[Mesa-dev] [RFC] New EGL extension: EGL_EXT_platform_display
Chad Versace
chad.versace at linux.intel.com
Tue Feb 19 08:20:51 PST 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm seeking feedback on an EGL extension that I'm drafting. The ideas have
already been discussed at Khronos meetings to a good reception, but I want
feedback from Mesa developers too.
Summary
- -------
The extension, tentatively named EGL_EXT_platform_display, enables EGL clients
to specify to which platform (X11, Wayland, gbm, etc) an EGL resource
(EGLDisplay, EGLSurface, etc) belongs when the resource is derived from
a platform-native type. As a corollary, the extension enables the creation of
EGL resources from different platforms within a single process.
Feedback
- --------
I'd like to hear feeback about the details below. Do you see any potential
problems? Is it lacking a feature that you believe should be present?
Details
- -------
The draft extension defines the following new functions:
// This is the extenion's key function.
//
EGLDisplay
eglGetPlatformDisplayEXT(EGLenum platform, void *native_display);
// The two eglCreate functions below differ from their core counterparts
// only in their signature. The EGLNative types are replaced with void*.
// This makes the signature agnostic to which platform the native resource
// belongs.
EGLSurface
eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy,
EGLConfig config,
void *native_window,
const EGLint *attrib_list);
EGLSurface
eglCreatePlatformPixmapSurface(EGLDisplay dpy,
EGLConfig config,
void *native_pixmap,
const EGLint *attrib_list);
Valid values for `platform` are defined by layered extensions. For
example, EGL_EXT_platform_x11 defines EGL_PLATFORM_X11, and
EGL_EXT_platform_wayland defines EGL_PLATFORM_WAYLAND.
Also, the layered extensions specify which native types should be passed as
the native parameters. For example, EGL_EXT_platform_wayland specifies that,
when calling eglCreatePlatformWindowSurfaceEXT with a display that was derived
from a Wayland display, then the native_window parameter must be `struct
wl_egl_window*`. Analogously, EGL_EXT_platform_x11 specifies that
native_window must be `Window*`.
Example Code for X11
- --------------------
// The internal representation of the egl_dpy, created below, remembers that
// it was derived from an Xlib display.
Display *xlib_dpy = XOpenDisplay(NULL);
EGLDisplay *egl_dpy = eglGetPlatformDisplayEXT(EGL_PLATFORM_X11, xlib_dpy);
EGLConfig config;
eglChooseConfig(egl_dpy, &config, ...);
// Since egl_dpy remembers that it was derived from an Xlib display, when
// creating the EGLSurface below libEGL internally casts the
// `(void*) &xlib_win` to `Window*`.
Window xlib_win = XCreateWindow(xlib_dpy, ...);
EGLSurface egl_surface = eglCreatePlatformWindowSurfaceEXT(egl_dpy, config,
(void*) &xlib_win,
NULL);
Example Code for Wayland
- ------------------------
// The internal representation of the egl_dpy, created below, remembers that
// it was derived from a Wayland display.
struct wl_display *wl_dpy = wl_display_connect(NULL);
EGLDisplay *egl_dpy = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND, wl_dpy);
EGLConfig config;
eglChooseConfig(egl_dpy, &config, ...);
// Since egl_dpy remembers that it was derived from an Wayland display, when
// creating the EGLSurface below libEGL internally casts the
// `(void*) wl_win` to `struct wl_egl_window*`.
struct wl_egl_window *wl_win = wl_egl_window_create(...);
EGLSurface egl_surface = eglCreateWindowSurface(egl_dpy, config,
(void*) wl_win, NULL);
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJRI6ZfAAoJEAIvNt057x8iIiEP/0ikLSoTa7sy7bAi5lRasFUZ
/fKhktZbf062K6PNETS+kS5xiKcEnaJ7FnEjnga/ao2Lbp+7+7ArI0v8vKEpekS0
Ln9oQs7fXzp9dD5+YZT0ICpB7oanZsVy7VDBEq5GcH5zuHGVL1PwiPNKT4OEUi5R
7+j2UZ0kCWVGQS0vB0onoLHeSwud6mVURSvvOghhza3f32QgUDuw3XsEdrmpx0Bw
WMROUDgcpYFBJ8lQ5GO+yFkPPnWytwspECveMQXUg/M63s+UADfWFvEuOE92yddb
SMviKzlKzbG+ZZffvOBy4lt99NCO1oZ+FeR0Uc5m9wT3dpF0GDILR+sH+eemAbxn
JicvhPycgd9mfjtsG47+Y1atkdkh7nBIbk5qrkCq4eMxVVSeQLQ8PdBUJUQA1JI+
YIM4/+E4iFi8ynCIcWKXccnFnV+POHizIDPwxQHp7cbuOXvI8tQhxf0H83Qm3Gl+
amfRgJWj1nUGtz4UQK5DEq6KfxRIy84/OvrWd9fw610sFAALXiSZC2b0wmz0Alv4
bkQ3LxIJtN9Nyabcm2B1eXtl1SYFRwx24P0T+2IL4INCvUFPJVtzfORo8pWLIMYm
kA8p+0DSgrEkBE0D6bgluGhTjsWejyHoqoNG95YIcEGPnNJf12cS36oJSOttvnz2
BXfyGn39yyRGUIrRgpUR
=MP7i
-----END PGP SIGNATURE-----
More information about the mesa-dev
mailing list