[Mesa-dev] [PATCH v5] egl/dri2: implement platform_surfaceless

Emil Velikov emil.l.velikov at gmail.com
Fri Jun 12 07:43:57 PDT 2015


On 11/06/15 17:43, Zach Reizner wrote:
> From: Haixia Shi <hshi at chromium.org>
> 
> The surfaceless platform is for off-screen rendering only. Render node support
> is required.
> 
> Only consider the render nodes. Do not use normal nodes as they require
> auth hooks.
> 
> v3: change platform_null to platform_surfaceless
> v4: make libdrm required for surfaceless
> v5: remove modified include guards with defined(HAVE_SURFACELESS_PLATFORM)
> 
> Signed-off-by: Haixia Shi <hshi at chromium.org>
> Signed-off-by: Zach Reizner <zachr at google.com>
Thanks it looks great. There is a minor comment about a follow-up/future
work, although feel free to add, fwiw

Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>

> ---
>  configure.ac                                |   6 ++
>  src/egl/drivers/dri2/Makefile.am            |   5 +
>  src/egl/drivers/dri2/egl_dri2.c             |   7 ++
>  src/egl/drivers/dri2/egl_dri2.h             |   3 +
>  src/egl/drivers/dri2/platform_surfaceless.c | 161 ++++++++++++++++++++++++++++
>  src/egl/main/Makefile.am                    |   4 +
>  src/egl/main/egldisplay.c                   |   3 +-
>  src/egl/main/egldisplay.h                   |   1 +
>  8 files changed, 189 insertions(+), 1 deletion(-)
>  create mode 100644 src/egl/drivers/dri2/platform_surfaceless.c
> 

> --- /dev/null
> +++ b/src/egl/drivers/dri2/platform_surfaceless.c

> +EGLBoolean
> +dri2_initialize_surfaceless(_EGLDriver *drv, _EGLDisplay *disp)
> +{
> +   struct dri2_egl_display *dri2_dpy;
> +   const char* err;
> +   int i;
> +   int driver_loaded = 0;
> +
> +   loader_set_logger(_eglLog);
> +
> +   dri2_dpy = calloc(1, sizeof *dri2_dpy);
> +   if (!dri2_dpy)
> +      return _eglError(EGL_BAD_ALLOC, "eglInitialize");
> +
> +   disp->DriverData = (void *) dri2_dpy;
> +
> +   const int limit = 64;
> +   const int base = 128;
> +   for (i = 0; i < limit; ++i) {
> +      char *card_path;
> +      if (asprintf(&card_path, DRM_RENDER_DEV_NAME, DRM_DIR_NAME, base + i) < 0)
> +         continue;
> +
> +      dri2_dpy->fd = open(card_path, O_RDWR);
Pretty sure that we'd want some O_CLOEXEC/fcntl() magic but that can be
done as a separate patch.

Cheers
Emil



More information about the mesa-dev mailing list