On Fri 12 Jun 2015, Zach Reizner wrote: > From: Haixia Shi <h...@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 <h...@chromium.org> > Signed-off-by: Zach Reizner <za...@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.vers...@intel.com> If no one objects, I'll commit this Monday afternoon. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev