[Mesa-dev] [PATCH 2/2] egl/dri2: enable EGL_KHR_gl_colorspace for swrast

Boyan Ding boyan.j.ding at gmail.com
Tue Sep 15 07:58:51 PDT 2015


2015-09-15 1:35 GMT+08:00 Emil Velikov <emil.l.velikov at gmail.com>:
> No driver changes needed for softpipe/llvmpipe - things just work.
>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>  docs/relnotes/11.1.0.html               |  1 +
>  src/egl/drivers/dri2/platform_drm.c     | 12 ++++++------
>  src/egl/drivers/dri2/platform_wayland.c |  9 ++++++---
>  src/egl/drivers/dri2/platform_x11.c     | 12 ++++++------
>  4 files changed, 19 insertions(+), 15 deletions(-)
>
> diff --git a/docs/relnotes/11.1.0.html b/docs/relnotes/11.1.0.html
> index 528905f..02ffd45 100644
> --- a/docs/relnotes/11.1.0.html
> +++ b/docs/relnotes/11.1.0.html
> @@ -47,6 +47,7 @@ Note: some of the new features are only available with certain drivers.
>  <li>GL_ARB_shader_texture_image_samples on i965</li>
>  <li>GL_ARB_texture_query_lod on softpipe</li>
>  <li>GL_ARB_gpu_shader_fp64 on r600 for Cypress/Cayman/Aruba chips</li>
> +<li>EGL_KHR_gl_colorspace on softpipe, llvmpipe</li>
>  </ul>
>
>  <h2>Bug fixes</h2>
> diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
> index eda5087..547a65a 100644
> --- a/src/egl/drivers/dri2/platform_drm.c
> +++ b/src/egl/drivers/dri2/platform_drm.c
> @@ -101,6 +101,7 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
>     struct dri2_egl_surface *dri2_surf;
>     struct gbm_surface *window = native_window;
>     struct gbm_dri_surface *surf;
> +   const __DRIconfig *config;
>
>     (void) drv;
>
> @@ -130,21 +131,20 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
>        goto cleanup_surf;
>     }
>
> -   if (dri2_dpy->dri2) {
> -      const __DRIconfig *config =
> -         dri2_get_dri_config(dri2_conf, EGL_WINDOW_BIT,
> +   config = dri2_get_dri_config(dri2_conf, EGL_WINDOW_BIT,
>                               dri2_surf->base.GLColorspace);
                                ^^^
Please reindent this line.

>
> +   if (dri2_dpy->dri2) {
>        dri2_surf->dri_drawable =
>           (*dri2_dpy->dri2->createNewDrawable)(dri2_dpy->dri_screen, config,
>                                                dri2_surf->gbm_surf);
>
>     } else {
>        assert(dri2_dpy->swrast != NULL);
> +
>        dri2_surf->dri_drawable =
> -         (*dri2_dpy->swrast->createNewDrawable) (dri2_dpy->dri_screen,
> -                                                 dri2_conf->dri_double_config,
> -                                                 dri2_surf->gbm_surf);
> +         (*dri2_dpy->swrast->createNewDrawable)(dri2_dpy->dri_screen, config,
> +                                                dri2_surf->gbm_surf);
>
>     }
>     if (dri2_surf->dri_drawable == NULL) {
> diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
> index dbc64ba..32840bb 100644
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -1645,6 +1645,7 @@ dri2_wl_swrast_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
>     struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
>     struct wl_egl_window *window = native_window;
>     struct dri2_egl_surface *dri2_surf;
> +   const __DRIconfig *config;
>
>     (void) drv;
>
> @@ -1669,10 +1670,12 @@ dri2_wl_swrast_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
>     dri2_surf->base.Width = -1;
>     dri2_surf->base.Height = -1;
>
> +   config = dri2_get_dri_config(dri2_conf, EGL_WINDOW_BIT,
> +                                dri2_surf->base.GLColorspace);
> +
>     dri2_surf->dri_drawable =
> -      (*dri2_dpy->swrast->createNewDrawable) (dri2_dpy->dri_screen,
> -                                              dri2_conf->dri_double_config,
> -                                              dri2_surf);
> +      (*dri2_dpy->swrast->createNewDrawable)(dri2_dpy->dri_screen,
> +                                             config, dri2_surf);
>     if (dri2_surf->dri_drawable == NULL) {
>        _eglError(EGL_BAD_ALLOC, "swrast->createNewDrawable");
>        goto cleanup_dri_drawable;
> diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
> index bf7d2be..166cf75 100644
> --- a/src/egl/drivers/dri2/platform_x11.c
> +++ b/src/egl/drivers/dri2/platform_x11.c
> @@ -206,6 +206,7 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
>     xcb_generic_error_t *error;
>     xcb_drawable_t drawable;
>     xcb_screen_t *screen;
> +   const __DRIconfig *config;
>
>     STATIC_ASSERT(sizeof(uintptr_t) == sizeof(native_surface));
>     drawable = (uintptr_t) native_surface;
> @@ -245,19 +246,18 @@ dri2_x11_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
>        dri2_surf->drawable = drawable;
>     }
>
> -   if (dri2_dpy->dri2) {
> -      const __DRIconfig *config =
> -         dri2_get_dri_config(dri2_conf, type, dri2_surf->base.GLColorspace);
> +   config = dri2_get_dri_config(dri2_conf, type,
> +                                dri2_surf->base.GLColorspace);
>
> +   if (dri2_dpy->dri2) {
>        dri2_surf->dri_drawable =
>          (*dri2_dpy->dri2->createNewDrawable)(dri2_dpy->dri_screen, config,
>                                               dri2_surf);
>     } else {
>        assert(dri2_dpy->swrast);
>        dri2_surf->dri_drawable =
> -        (*dri2_dpy->swrast->createNewDrawable) (dri2_dpy->dri_screen,
> -                                                dri2_conf->dri_double_config,
> -                                                dri2_surf);
> +        (*dri2_dpy->swrast->createNewDrawable)(dri2_dpy->dri_screen, config,
> +                                               dri2_surf);

Use spaces here. The original lines here are wrongly using tabs.

Despite the whitespace issues, this patch looks okay to me, so with those
fixed, it is
Reviewed-by: Boyan Ding <boyan.j.ding at gmail.com>

>     }
>
>     if (dri2_surf->dri_drawable == NULL) {
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list