[Mesa-dev] [PATCH 09/10] egl/drm: Add support for native gbm backends

Emil Velikov emil.l.velikov at gmail.com
Fri Apr 4 04:28:31 PDT 2014


On 04/04/14 09:36, Ander Conselvan de Oliveira wrote:
> From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
> 
> ---
>  src/egl/drivers/dri2/egl_dri2.c     |   9 +-
>  src/egl/drivers/dri2/egl_dri2.h     |   3 +-
>  src/egl/drivers/dri2/platform_drm.c | 217 ++++++++++++++++++++++++++++++------
>  src/gbm/main/common_drm.h           |   6 +
>  4 files changed, 200 insertions(+), 35 deletions(-)
> 
[snip]
> diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
> index 0c3ffd2..d7c3f3f 100644
> --- a/src/egl/drivers/dri2/platform_drm.c
> +++ b/src/egl/drivers/dri2/platform_drm.c
[snip]
> +static EGLBoolean
> +dri2_initialize_gbm_native(_EGLDisplay *disp)
> +{
> +   struct dri2_egl_display *dri2_dpy = disp->DriverData;
> +
> +   _eglLog(_EGL_DEBUG, "DRM: GBM is using native backend");
> +
> +   if (!dri2_dpy->gbm_drm->bufmgr)
> +      return EGL_FALSE;
> +
> +   dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd, 0);
> +   if (!dri2_dpy->driver_name)
> +      return EGL_FALSE;
> +
> +   if (!dri2_load_driver(disp))
> +      goto cleanup_driver_name;
> +
> +   dri2_dpy->shared_bufmgr_extension.base.name = __DRI_SHARED_BUFMGR;
> +   dri2_dpy->shared_bufmgr_extension.base.version = 1;
> +   dri2_dpy->shared_bufmgr_extension.bufmgr = dri2_dpy->gbm_drm->bufmgr;
You might want to create a static const instance of the extension and use it here.

> +   dri2_dpy->extensions[0] = &image_loader_extension.base;
> +   dri2_dpy->extensions[1] = &image_lookup_extension.base;
> +   dri2_dpy->extensions[2] = &use_invalidate.base;
> +   dri2_dpy->extensions[3] = &dri2_dpy->shared_bufmgr_extension.base;
> +   dri2_dpy->extensions[4] = NULL;
> +
Use a static const array and point extensions to it, rather than going through
the list at runtime ?

-Emil



More information about the mesa-dev mailing list