[Mesa-dev] [PATCH] Introduce platform displays internally

Kristian Høgsberg krh at bitplanet.net
Tue Jun 22 08:17:37 PDT 2010


2010/6/18 Chia-I Wu <olvaffe at gmail.com>:
> Hi Krisitian,
>
> While working on the multiple EGL libraries idea, it turns out there is one
> internal change that is beneficial for all approaches on the table.  You can
> find the change as a patch in the attachment.
>
> The patch is basically a rewrite of the internal change you did for
> EGL_MESA_typed_display.  It introduces a new notion: platform displays.  A
> platform display is exactly a typed display in EGL_MESA_typed_display, except
> that it is entirely internal.  In the patch, a driver is updated to always deal
> with a platform display.  A native display, whose type is EGLNativeDisplayType,
> is now treated as a platform display whose platform is determined at compile
> time.  When eglCreateWindowSurface is called with a non-native platform
> display, EGL_NO_SURFACE is returned and EGL_BAD_NATIVE_WINDOW is set.
>
> The patch does not add any new public functions or tokens to specify a
> non-native platform display.  However, it makes EGL ready to support
> EGL_MESA_typed_display or the more specific eglGetDRMDisplay.  It also allows
> me to support multiple EGL libraries without going into Makefile hell.  As a
> result, I've created two branches
>
>  http://cgit.freedesktop.org/~olv/mesa/log/?h=egl-drm-display
>  (for eglGetDRMDisplay)
>
>  http://cgit.freedesktop.org/~olv/mesa/log/?h=multi-egl
>  (for multiple EGL libraries)
>
> The interesting commit in multi-egl branch is the last one
>
>  "egl: Build one library for each platform."
>
> It installs multiple libEGL.so's and .pc files.  The .pc files for non-X11
> platform defines macros so that apps pick the correct platform (correct native
> types, no Xlib headers) from eglplatform.h.
>
> Both approaches look fine to me.  I seriously do not have a preference here.
> But I would like to know if it is fine to land the patch first, or to rebase
> your work on it.  The patch allows me to do some cleanups to st/egl.  What do
> you think?

I think the egl-drm-display branch looks good.  The platform display
patch is definitely good to commit, and I don't see a problem in
merging the entire egl-drm-display branch either.  As I said before, I
was practically sold on the multi-egl idea, until I realized that the
libEGL-drm.so dependency is pulled into higher level libraries that
use EGL in a platform-independent way.  What you implemented in
egl-drm-display is exactly what I would've done myself.

I'm still on the fence about -DMESA_EGL_NO_X11_HEADERS vs #include
<egldrm.h>, that is, I think adding a new egldrm.h header file that
defines the eglGetDRMDirsplayMESA() (and potentially DRM specific
surface create functions) is a pretty clean approach as well.  In
fact, I think that would make sense for X11 and the other existing
platforms too.  Ideally, including egl.h wouldn't  define any native
types or display/surface create functions.

But for now, egl-drm-display gets us what we want.  Thanks for taking this on.

Kristian


More information about the mesa-dev mailing list