[Mesa-dev] EGL: Add pbuffer support for drm platform

Liu, Ying2 ying2.liu at intel.com
Thu Jun 11 23:42:04 PDT 2015


Marek,

Thank you so much for your review. I have updated my patch.

Ying

-----Original Message-----
From: Marek Olšák [mailto:maraeo at gmail.com] 
Sent: Thursday, June 11, 2015 4:34 AM
To: Liu, Ying2
Cc: mesa-dev at lists.freedesktop.org
Subject: Re: [Mesa-dev] EGL: Add pbuffer support for drm platform

On Thu, Jun 11, 2015 at 1:05 AM, Ying Liu <ying2.liu at intel.com> wrote:
> Add pbuffer support for drm platform, because some customers are still using this feature.
>
> Signed-off-by: Ying Liu <ying2.liu at intel.com>
> ---
>  src/egl/drivers/dri2/egl_dri2.c     |  3 +++
>  src/egl/drivers/dri2/platform_drm.c | 30 
> +++++++++++++++++++++++-------
>  2 files changed, 26 insertions(+), 7 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/egl_dri2.c 
> b/src/egl/drivers/dri2/egl_dri2.c index 44a6c96..d56795e 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -909,6 +909,9 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
>         */
>        if (conf->SurfaceType & EGL_WINDOW_BIT)
>           dri2_ctx->base.WindowRenderBuffer = EGL_BACK_BUFFER;
> +
> +      if (conf->SurfaceType & EGL_PBUFFER_BIT)
> +         dri2_ctx->base.WindowRenderBuffer = EGL_BACK_BUFFER;

You can merge both ifs together and do:
if (conf->SurfaceType & (EGL_WINDOW_BIT | EGL_PBUFFER_BIT))


>     }
>     else
>        dri_config = NULL;
> diff --git a/src/egl/drivers/dri2/platform_drm.c 
> b/src/egl/drivers/dri2/platform_drm.c
> index 3391afc..c8b7e92 100644
> --- a/src/egl/drivers/dri2/platform_drm.c
> +++ b/src/egl/drivers/dri2/platform_drm.c
> @@ -123,16 +123,23 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
>        dri2_surf->base.Height = surf->base.height;
>        surf->dri_private = dri2_surf;
>        break;
> +   case EGL_PBUFFER_BIT:
> +      break;
>     default:
>        goto cleanup_surf;
>     }
>
>     if (dri2_dpy->dri2) {
> -      dri2_surf->dri_drawable =
> -         (*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen,
> -                                               dri2_conf->dri_double_config,
> -                                               dri2_surf->gbm_surf);
> -
> +      if (type == EGL_PBUFFER_BIT)
> +         dri2_surf->dri_drawable =
> +            (*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen,
> +                                                  dri2_conf->dri_double_config,
> +                                                  dri2_surf);
> +      else
> +        dri2_surf->dri_drawable =
> +            (*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen,
> +                                                  dri2_conf->dri_double_config,
> +                                                  
> + dri2_surf->gbm_surf);

Instead of the conditional, you can just update the last parameter:
type == EGL_PBUFFER_BIT ? dri2_surf : dri2_surf->gbm_surf

With those 2 fixed, this is:

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek


More information about the mesa-dev mailing list