[Mesa-dev] [PATCH v6] egl/dri2: implement platform_surfaceless
Chad Versace
chad.versace at intel.com
Fri Jun 12 10:29:21 PDT 2015
On Fri 12 Jun 2015, 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)
> v6: use O_CLOEXEC for drm fd
>
> Signed-off-by: Haixia Shi <hshi at chromium.org>
> Signed-off-by: Zach Reizner <zachr at google.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 | 171 ++++++++++++++++++++++++++++
> src/egl/main/Makefile.am | 4 +
> src/egl/main/egldisplay.c | 3 +-
> src/egl/main/egldisplay.h | 1 +
> 8 files changed, 199 insertions(+), 1 deletion(-)
> create mode 100644 src/egl/drivers/dri2/platform_surfaceless.c
> +#ifdef O_CLOEXEC
> + dri2_dpy->fd = open(card_path, O_RDWR | O_CLOEXEC);
> + if (dri2_dpy->fd < 0 && errno == EINVAL)
> +#endif
> + {
> + dri2_dpy->fd = open(card_path, O_RDWR);
> + if (dri2_dpy->fd >= 0)
> + fcntl(dri2_dpy->fd, F_SETFD, fcntl(dri2_dpy->fd, F_GETFD) |
> + FD_CLOEXEC);
> + }
The #ifdef and fallback path here look strange to me because Linux has
supported O_CLOEXEC for a loooong time. After grepping for O_CLOEXEC,
though, I discovered that this pattern is common throughout Mesa. So...
ok.
I was initially worried that dri2_terminate() might not properly tear
down the display, but I convinced myself the code is correct.
Reviewed-by: Chad Versace <chad.versace at intel.com>
If no one objects, I'll commit this Monday afternoon.
More information about the mesa-dev
mailing list