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

Emil Velikov emil.l.velikov at gmail.com
Fri Jun 12 15:40:18 PDT 2015


On 12/06/15 17:29, Chad Versace wrote:
> 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.
> 
On the Linux side, the minimum requirement (kernel 2.6.23 and glibc 2.7)
were released in 2007. I'm finding it hard to believe that anyone uses
older kernel/glibc than that, although I don't know AMD/Intel's POV on
supporting such setups.

Whereas for other platforms - *BSD, Solaris, Haiku, Darwin/MacOS,
Cygwin... we can check/confirm as we fold the duplication.

-Emil


More information about the mesa-dev mailing list