mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 17:48:10 +02:00
egl/x11: Honor the EGL_PLATFORM_X11_SCREEN_EXT attribute
Introduce _egl_display::Options::Platforms for private storage. For X11 platforms we can use it for the screen number as set by EGL_PLATFORM_X11_SCREEN_EXT. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
939b015736
commit
ddb99127a6
3 changed files with 14 additions and 8 deletions
|
|
@ -1191,7 +1191,7 @@ dri2_get_xcb_connection(_EGLDriver *drv, _EGLDisplay *disp,
|
||||||
struct dri2_egl_display *dri2_dpy)
|
struct dri2_egl_display *dri2_dpy)
|
||||||
{
|
{
|
||||||
xcb_screen_iterator_t s;
|
xcb_screen_iterator_t s;
|
||||||
int screen = 0;
|
int screen = (uintptr_t)disp->Options.Platform;
|
||||||
const char *msg;
|
const char *msg;
|
||||||
|
|
||||||
disp->DriverData = (void *) dri2_dpy;
|
disp->DriverData = (void *) dri2_dpy;
|
||||||
|
|
|
||||||
|
|
@ -472,7 +472,7 @@ _eglUnlinkResource(_EGLResource *res, _EGLResourceType type)
|
||||||
|
|
||||||
#ifdef HAVE_X11_PLATFORM
|
#ifdef HAVE_X11_PLATFORM
|
||||||
static EGLBoolean
|
static EGLBoolean
|
||||||
_eglParseX11DisplayAttribList(const EGLint *attrib_list)
|
_eglParseX11DisplayAttribList(_EGLDisplay *display, const EGLint *attrib_list)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -486,11 +486,10 @@ _eglParseX11DisplayAttribList(const EGLint *attrib_list)
|
||||||
|
|
||||||
/* EGL_EXT_platform_x11 recognizes exactly one attribute,
|
/* EGL_EXT_platform_x11 recognizes exactly one attribute,
|
||||||
* EGL_PLATFORM_X11_SCREEN_EXT, which is optional.
|
* EGL_PLATFORM_X11_SCREEN_EXT, which is optional.
|
||||||
*
|
|
||||||
* Mesa supports connecting to only the default screen, so we reject
|
|
||||||
* screen != 0.
|
|
||||||
*/
|
*/
|
||||||
if (attrib != EGL_PLATFORM_X11_SCREEN_EXT || value != 0) {
|
if (attrib == EGL_PLATFORM_X11_SCREEN_EXT) {
|
||||||
|
display->Options.Platform = (void *)value;
|
||||||
|
} else {
|
||||||
_eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
|
_eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
|
||||||
return EGL_FALSE;
|
return EGL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -503,11 +502,17 @@ _EGLDisplay*
|
||||||
_eglGetX11Display(Display *native_display,
|
_eglGetX11Display(Display *native_display,
|
||||||
const EGLint *attrib_list)
|
const EGLint *attrib_list)
|
||||||
{
|
{
|
||||||
if (!_eglParseX11DisplayAttribList(attrib_list)) {
|
_EGLDisplay *display = _eglFindDisplay(_EGL_PLATFORM_X11,
|
||||||
|
native_display);
|
||||||
|
|
||||||
|
if (!display)
|
||||||
|
_eglError(EGL_BAD_ALLOC, "eglGetPlatformDisplay");
|
||||||
|
|
||||||
|
if (!_eglParseX11DisplayAttribList(display, attrib_list)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _eglFindDisplay(_EGL_PLATFORM_X11, native_display);
|
return display;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_X11_PLATFORM */
|
#endif /* HAVE_X11_PLATFORM */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -151,6 +151,7 @@ struct _egl_display
|
||||||
struct {
|
struct {
|
||||||
EGLBoolean TestOnly; /**< Driver should not set fields when true */
|
EGLBoolean TestOnly; /**< Driver should not set fields when true */
|
||||||
EGLBoolean UseFallback; /**< Use fallback driver (sw or less features) */
|
EGLBoolean UseFallback; /**< Use fallback driver (sw or less features) */
|
||||||
|
void *Platform; /**< Platform-specific options */
|
||||||
} Options;
|
} Options;
|
||||||
|
|
||||||
/* these fields are set by the driver during init */
|
/* these fields are set by the driver during init */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue