[Mesa-dev] [PATCH 7/9] egl: implement EGL_KHR_gl_colorspace

Marek Olšák maraeo at gmail.com
Wed Jun 10 09:51:28 PDT 2015


On Wed, Jun 10, 2015 at 6:47 PM, Matt Turner <mattst88 at gmail.com> wrote:
> On Wed, Jun 10, 2015 at 9:27 AM, Marek Olšák <maraeo at gmail.com> wrote:
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> ---
>>  src/egl/drivers/dri2/egl_dri2.c         | 40 ++++++++++++++++++++++++++-------
>>  src/egl/drivers/dri2/egl_dri2.h         |  6 +++++
>>  src/egl/drivers/dri2/platform_android.c |  4 ++++
>>  src/egl/drivers/dri2/platform_drm.c     |  9 +++++---
>>  src/egl/drivers/dri2/platform_wayland.c |  9 +++++---
>>  src/egl/drivers/dri2/platform_x11.c     | 12 +++++-----
>>  src/egl/main/eglconfig.c                |  3 ++-
>>  src/egl/main/eglsurface.c               | 24 ++++++++++++++++++++
>>  src/egl/main/eglsurface.h               |  1 +
>>  9 files changed, 87 insertions(+), 21 deletions(-)
>>
>> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
>> index eacb36c..84f0afb 100644
>> --- a/src/egl/drivers/dri2/egl_dri2.c
>> +++ b/src/egl/drivers/dri2/egl_dri2.c
>> @@ -28,6 +28,7 @@
>>  #define WL_HIDE_DEPRECATED
>>
>>  #include <stdint.h>
>> +#include <stdbool.h>
>>  #include <stdlib.h>
>>  #include <string.h>
>>  #include <stdio.h>
>> @@ -109,6 +110,18 @@ EGLint dri2_to_egl_attribute_map[] = {
>>     0,                          /* __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE */
>>  };
>>
>> +const __DRIconfig *
>> +dri2_get_dri_config(struct dri2_egl_config *conf, EGLint surface_type,
>> +                    EGLenum colorspace)
>> +{
>> +   if (colorspace == EGL_GL_COLORSPACE_SRGB_KHR)
>> +      return surface_type == EGL_WINDOW_BIT ? conf->dri_srgb_double_config :
>> +                                              conf->dri_srgb_single_config;
>> +   else
>> +      return surface_type == EGL_WINDOW_BIT ? conf->dri_double_config :
>> +                                              conf->dri_single_config;
>> +}
>> +
>>  static EGLBoolean
>>  dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
>>  {
>> @@ -130,6 +143,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
>>     struct dri2_egl_display *dri2_dpy;
>>     _EGLConfig base;
>>     unsigned int attrib, value, double_buffer;
>> +   bool srgb = false;
>>     EGLint key, bind_to_texture_rgb, bind_to_texture_rgba;
>>     unsigned int dri_masks[4] = { 0, 0, 0, 0 };
>>     _EGLConfig *matching_config;
>> @@ -202,6 +216,9 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
>>           /* Don't expose visuals with the accumulation buffer. */
>>           if (value > 0)
>>              return NULL;
>> +
>
> Please mark this with a /* fallthrough */ comment so that static
> analysis tools don't think there's a missing break.

The missing "break" is actually a bug. Thanks.

Marek


More information about the mesa-dev mailing list