mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-02 03:45:58 +01:00
render: use DRM formats in wlr_texture_from_pixels
This commit is contained in:
parent
b54ef3372d
commit
27fba3df43
6 changed files with 10 additions and 12 deletions
|
@ -121,7 +121,7 @@ struct wlr_gles2_texture *gles2_get_texture(
|
||||||
struct wlr_texture *wlr_texture);
|
struct wlr_texture *wlr_texture);
|
||||||
|
|
||||||
struct wlr_texture *gles2_texture_from_pixels(struct wlr_renderer *wlr_renderer,
|
struct wlr_texture *gles2_texture_from_pixels(struct wlr_renderer *wlr_renderer,
|
||||||
enum wl_shm_format wl_fmt, uint32_t stride, uint32_t width, uint32_t height,
|
uint32_t fmt, uint32_t stride, uint32_t width, uint32_t height,
|
||||||
const void *data);
|
const void *data);
|
||||||
struct wlr_texture *gles2_texture_from_wl_drm(struct wlr_renderer *wlr_renderer,
|
struct wlr_texture *gles2_texture_from_wl_drm(struct wlr_renderer *wlr_renderer,
|
||||||
struct wl_resource *data);
|
struct wl_resource *data);
|
||||||
|
|
|
@ -48,8 +48,8 @@ struct wlr_renderer_impl {
|
||||||
uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,
|
uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,
|
||||||
void *data);
|
void *data);
|
||||||
struct wlr_texture *(*texture_from_pixels)(struct wlr_renderer *renderer,
|
struct wlr_texture *(*texture_from_pixels)(struct wlr_renderer *renderer,
|
||||||
enum wl_shm_format fmt, uint32_t stride, uint32_t width,
|
uint32_t fmt, uint32_t stride, uint32_t width, uint32_t height,
|
||||||
uint32_t height, const void *data);
|
const void *data);
|
||||||
struct wlr_texture *(*texture_from_wl_drm)(struct wlr_renderer *renderer,
|
struct wlr_texture *(*texture_from_wl_drm)(struct wlr_renderer *renderer,
|
||||||
struct wl_resource *data);
|
struct wl_resource *data);
|
||||||
struct wlr_texture *(*texture_from_dmabuf)(struct wlr_renderer *renderer,
|
struct wlr_texture *(*texture_from_dmabuf)(struct wlr_renderer *renderer,
|
||||||
|
|
|
@ -29,7 +29,7 @@ struct wlr_texture {
|
||||||
* between attaching a renderer to an output and committing it.
|
* between attaching a renderer to an output and committing it.
|
||||||
*/
|
*/
|
||||||
struct wlr_texture *wlr_texture_from_pixels(struct wlr_renderer *renderer,
|
struct wlr_texture *wlr_texture_from_pixels(struct wlr_renderer *renderer,
|
||||||
enum wl_shm_format wl_fmt, uint32_t stride, uint32_t width, uint32_t height,
|
uint32_t fmt, uint32_t stride, uint32_t width, uint32_t height,
|
||||||
const void *data);
|
const void *data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include <wlr/types/wlr_linux_dmabuf_v1.h>
|
#include <wlr/types/wlr_linux_dmabuf_v1.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "render/gles2.h"
|
#include "render/gles2.h"
|
||||||
#include "render/shm_format.h"
|
|
||||||
|
|
||||||
static const GLfloat verts[] = {
|
static const GLfloat verts[] = {
|
||||||
1, 0, // top right
|
1, 0, // top right
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include <wlr/types/wlr_matrix.h>
|
#include <wlr/types/wlr_matrix.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "render/gles2.h"
|
#include "render/gles2.h"
|
||||||
#include "render/shm_format.h"
|
|
||||||
#include "util/signal.h"
|
#include "util/signal.h"
|
||||||
|
|
||||||
static const struct wlr_texture_impl texture_impl;
|
static const struct wlr_texture_impl texture_impl;
|
||||||
|
@ -153,14 +152,14 @@ static const struct wlr_texture_impl texture_impl = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_texture *gles2_texture_from_pixels(struct wlr_renderer *wlr_renderer,
|
struct wlr_texture *gles2_texture_from_pixels(struct wlr_renderer *wlr_renderer,
|
||||||
enum wl_shm_format wl_fmt, uint32_t stride, uint32_t width,
|
uint32_t drm_format, uint32_t stride, uint32_t width,
|
||||||
uint32_t height, const void *data) {
|
uint32_t height, const void *data) {
|
||||||
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
|
struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer);
|
||||||
|
|
||||||
const struct wlr_gles2_pixel_format *fmt =
|
const struct wlr_gles2_pixel_format *fmt =
|
||||||
get_gles2_format_from_drm(convert_wl_shm_format_to_drm(wl_fmt));
|
get_gles2_format_from_drm(drm_format);
|
||||||
if (fmt == NULL) {
|
if (fmt == NULL) {
|
||||||
wlr_log(WLR_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
|
wlr_log(WLR_ERROR, "Unsupported pixel format 0x%"PRIX32, drm_format);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,9 @@ void wlr_texture_destroy(struct wlr_texture *texture) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_texture *wlr_texture_from_pixels(struct wlr_renderer *renderer,
|
struct wlr_texture *wlr_texture_from_pixels(struct wlr_renderer *renderer,
|
||||||
enum wl_shm_format wl_fmt, uint32_t stride, uint32_t width,
|
uint32_t fmt, uint32_t stride, uint32_t width, uint32_t height,
|
||||||
uint32_t height, const void *data) {
|
const void *data) {
|
||||||
return renderer->impl->texture_from_pixels(renderer, wl_fmt, stride, width,
|
return renderer->impl->texture_from_pixels(renderer, fmt, stride, width,
|
||||||
height, data);
|
height, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue