virgl,egl: add check for EGL_KHR_gl_colorspace

This is needed to properly support EXT_sRGB_write_control

v2: Make return value of virgl_has_egl_khr_gl_colorspace
    a bool (Gurchetan)

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
macos/master
Gert Wollny 6 years ago committed by Jakob Bornecrantz
parent ea97380ec8
commit fb4f7577f7
  1. 1
      src/virgl_egl.h
  2. 9
      src/virgl_egl_context.c
  3. 7
      src/virglrenderer.c
  4. 2
      src/vrend_renderer.h

@ -35,6 +35,7 @@ void virgl_egl_destroy_context(struct virgl_egl *ve, virgl_renderer_gl_context v
int virgl_egl_make_context_current(struct virgl_egl *ve, virgl_renderer_gl_context virglctx);
virgl_renderer_gl_context virgl_egl_get_current_context(struct virgl_egl *ve);
bool virgl_has_egl_khr_gl_colorspace(struct virgl_egl *ve);
int virgl_egl_get_fourcc_for_texture(struct virgl_egl *ve, uint32_t tex_id, uint32_t format, int *fourcc);
int virgl_egl_get_fd_for_texture(struct virgl_egl *ve, uint32_t tex_id, int *fd);
int virgl_egl_get_fd_for_texture2(struct virgl_egl *ve, uint32_t tex_id, int *fd, int *stride, int *offset);

@ -54,6 +54,7 @@ struct virgl_egl {
EGLContext egl_ctx;
bool have_mesa_drm_image;
bool have_mesa_dma_buf_img_export;
bool have_egl_khr_gl_colorspace;
};
static int egl_rendernode_open(void)
@ -240,6 +241,9 @@ struct virgl_egl *virgl_egl_init(int fd, bool surfaceless, bool gles)
goto fail;
}
d->have_egl_khr_gl_colorspace =
virgl_egl_has_extension_in_string(extension_list, "EGL_KHR_gl_colorspace");
if (gles)
api = EGL_OPENGL_ES_API;
else
@ -417,6 +421,11 @@ int virgl_egl_get_fd_for_texture(struct virgl_egl *ve, uint32_t tex_id, int *fd)
return ret;
}
bool virgl_has_egl_khr_gl_colorspace(struct virgl_egl *ve)
{
return ve->have_egl_khr_gl_colorspace;
}
uint32_t virgl_egl_get_gbm_format(uint32_t format)
{
switch (format) {

@ -201,6 +201,13 @@ int virgl_renderer_resource_get_info(int res_handle,
return ret;
}
int virgl_has_gl_colorspace(void)
{
return use_context == CONTEXT_GLX ||
(use_context == CONTEXT_EGL &&
virgl_has_egl_khr_gl_colorspace(egl_info));
}
void virgl_renderer_get_cap_set(uint32_t cap_set, uint32_t *max_ver,
uint32_t *max_size)
{

@ -418,6 +418,8 @@ unsigned vrend_context_has_debug_flag(struct vrend_context *ctx,
unsigned vrend_renderer_query_multisample_caps(unsigned max_samples,
struct virgl_caps_v2 *caps);
int virgl_has_gl_colorspace(void);
struct gl_version {
uint32_t major;
uint32_t minor;

Loading…
Cancel
Save