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

Marek Olšák maraeo at gmail.com
Fri Jun 12 02:20:48 PDT 2015


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

Marek

On Fri, Jun 12, 2015 at 1:37 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     |  2 +-
>  src/egl/drivers/dri2/platform_drm.c | 18 ++++++++++++++----
>  2 files changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index 44a6c96..e5fd04d 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -907,7 +907,7 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
>        /* EGL_WINDOW_BIT is set only when there is a dri_double_config.  This
>         * makes sure the back buffer will always be used.
>         */
> -      if (conf->SurfaceType & EGL_WINDOW_BIT)
> +      if (conf->SurfaceType & (EGL_WINDOW_BIT | EGL_PBUFFER_BIT))
>           dri2_ctx->base.WindowRenderBuffer = EGL_BACK_BUFFER;
>     }
>     else
> diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
> index 3391afc..2ef9ec8 100644
> --- a/src/egl/drivers/dri2/platform_drm.c
> +++ b/src/egl/drivers/dri2/platform_drm.c
> @@ -123,6 +123,8 @@ 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;
>     }
> @@ -131,8 +133,7 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
>        dri2_surf->dri_drawable =
>           (*dri2_dpy->dri2->createNewDrawable) (dri2_dpy->dri_screen,
>                                                 dri2_conf->dri_double_config,
> -                                               dri2_surf->gbm_surf);
> -
> +                                               type == EGL_PBUFFER_BIT ? dri2_surf : dri2_surf->gbm_surf);
>     } else {
>        assert(dri2_dpy->swrast != NULL);
>        dri2_surf->dri_drawable =
> @@ -155,6 +156,15 @@ dri2_drm_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
>  }
>
>  static _EGLSurface *
> +dri2_drm_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp,
> +                                _EGLConfig *conf,
> +                                const EGLint *attrib_list)
> +{
> +   return dri2_drm_create_surface(drv, disp, EGL_PBUFFER_BIT, conf,
> +                                  NULL, attrib_list);
> +}
> +
> +static _EGLSurface *
>  dri2_drm_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
>                                 _EGLConfig *conf, void *native_window,
>                                 const EGLint *attrib_list)
> @@ -576,7 +586,7 @@ static struct dri2_egl_display_vtbl dri2_drm_display_vtbl = {
>     .authenticate = dri2_drm_authenticate,
>     .create_window_surface = dri2_drm_create_window_surface,
>     .create_pixmap_surface = dri2_drm_create_pixmap_surface,
> -   .create_pbuffer_surface = dri2_fallback_create_pbuffer_surface,
> +   .create_pbuffer_surface = dri2_drm_create_pbuffer_surface,
>     .destroy_surface = dri2_drm_destroy_surface,
>     .create_image = dri2_drm_create_image_khr,
>     .swap_interval = dri2_fallback_swap_interval,
> @@ -693,7 +703,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
>        attr_list[2] = EGL_NONE;
>
>        dri2_add_config(disp, dri2_dpy->driver_configs[i],
> -                      i + 1, EGL_WINDOW_BIT, attr_list, NULL);
> +                      i + 1, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, attr_list, NULL);
>     }
>
>     disp->Extensions.KHR_image_pixmap = EGL_TRUE;
> --
> 2.1.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