Merge branch 'gles2-nv12-render-target' into 'master'

render: gles2: NV12 render buffers

See merge request wlroots/wlroots!5344
This commit is contained in:
Andri Yngvason 2026-06-03 09:15:17 +00:00
commit d3d2d0f668
13 changed files with 394 additions and 63 deletions

View file

@ -108,4 +108,7 @@ void wlr_color_primaries_to_xyz(const struct wlr_color_primaries *primaries, flo
void wlr_color_transfer_function_get_default_luminance(enum wlr_color_transfer_function tf,
struct wlr_color_luminances *lum);
void wlr_color_rgb_to_ycbcr_matrix(enum wlr_color_encoding encoding,
enum wlr_color_range range, float matrix[static 16]);
#endif

View file

@ -28,12 +28,21 @@ struct wlr_gles2_pixel_format {
GLint gl_format, gl_type;
};
struct wlr_gles2_quad_shader {
GLuint program;
GLint proj;
GLint color;
GLint color_matrix;
GLint pos_attrib;
};
struct wlr_gles2_tex_shader {
GLuint program;
GLint proj;
GLint tex_proj;
GLint tex;
GLint alpha;
GLint color_matrix;
GLint pos_attrib;
};
@ -44,6 +53,7 @@ struct wlr_gles2_renderer {
int drm_fd;
struct wlr_drm_format_set shm_texture_formats;
struct wlr_drm_format_set dmabuf_render_formats;
const char *exts_str;
struct {
@ -74,12 +84,7 @@ struct wlr_gles2_renderer {
} procs;
struct {
struct {
GLuint program;
GLint proj;
GLint color;
GLint pos_attrib;
} quad;
struct wlr_gles2_quad_shader quad;
struct wlr_gles2_tex_shader tex_rgba;
struct wlr_gles2_tex_shader tex_rgbx;
struct wlr_gles2_tex_shader tex_ext;
@ -104,9 +109,11 @@ struct wlr_gles2_buffer {
struct wl_list link; // wlr_gles2_renderer.buffers
bool external_only;
EGLImageKHR image;
GLuint rbo;
GLuint fbo;
int n_images;
EGLImageKHR image[4];
GLuint rbo[4];
GLuint fbo[4];
GLuint tex;
struct wlr_addon addon;
@ -139,6 +146,8 @@ struct wlr_gles2_render_pass {
struct wlr_gles2_render_timer *timer;
struct wlr_drm_syncobj_timeline *signal_timeline;
uint64_t signal_point;
float color_matrix[16];
float color_matrix_nv12_chroma[16];
};
bool is_gles2_pixel_format_supported(const struct wlr_gles2_renderer *renderer,
@ -149,7 +158,7 @@ const struct wlr_gles2_pixel_format *get_gles2_format_from_gl(
void get_gles2_shm_formats(const struct wlr_gles2_renderer *renderer,
struct wlr_drm_format_set *out);
GLuint gles2_buffer_get_fbo(struct wlr_gles2_buffer *buffer);
GLuint gles2_buffer_get_fbo(struct wlr_gles2_buffer *buffer, int index);
struct wlr_gles2_renderer *gles2_get_renderer(
struct wlr_renderer *wlr_renderer);
@ -171,6 +180,7 @@ void pop_gles2_debug(struct wlr_gles2_renderer *renderer);
struct wlr_gles2_render_pass *begin_gles2_buffer_pass(struct wlr_gles2_buffer *buffer,
struct wlr_egl_context *prev_ctx, struct wlr_gles2_render_timer *timer,
struct wlr_drm_syncobj_timeline *signal_timeline, uint64_t signal_point);
struct wlr_drm_syncobj_timeline *signal_timeline, uint64_t signal_point,
enum wlr_color_encoding color_encoding, enum wlr_color_range color_range);
#endif

View file

@ -36,6 +36,11 @@ struct wlr_buffer_pass_options {
* sRGB monitors) */
struct wlr_color_transform *color_transform;
/* Color encoding of the destination buffer for RGB to YCbCr conversion */
enum wlr_color_encoding color_encoding;
/* Color range of the destination buffer */
enum wlr_color_range color_range;
/* Signal a timeline synchronization point when the render pass completes.
*
* When a compositor provides a signal timeline, the renderer may skip