#include <EGL/eglplatform.h>
-/* EGL_MESA_screen extension >>> PRELIMINARY <<< */
-#ifndef EGL_MESA_screen_surface
-#define EGL_MESA_screen_surface 1
-
-#define EGL_BAD_SCREEN_MESA 0x4000
-#define EGL_BAD_MODE_MESA 0x4001
-#define EGL_SCREEN_COUNT_MESA 0x4002
-#define EGL_SCREEN_POSITION_MESA 0x4003
-#define EGL_SCREEN_POSITION_GRANULARITY_MESA 0x4004
-#define EGL_MODE_ID_MESA 0x4005
-#define EGL_REFRESH_RATE_MESA 0x4006
-#define EGL_OPTIMAL_MESA 0x4007
-#define EGL_INTERLACED_MESA 0x4008
-#define EGL_SCREEN_BIT_MESA 0x08
-
-typedef khronos_uint32_t EGLScreenMESA;
-typedef khronos_uint32_t EGLModeMESA;
-
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
-EGLAPI EGLSurface EGLAPIENTRY eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
-EGLAPI EGLBoolean EGLAPIENTRY eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
-EGLAPI const char * EGLAPIENTRY eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode);
-#endif /* EGL_EGLEXT_PROTOTYPES */
-
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLCHOOSEMODEMESA) (EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETMODESMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGetModeATTRIBMESA) (EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSCRREENSMESA) (EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESCREENSURFACEMESA) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSHOWSCREENSURFACEMESA) (EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSCREENPOSIITONMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENSURFACEMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENMODEMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
-typedef const char * (EGLAPIENTRYP PFNEGLQUERYMODESTRINGMESA) (EGLDisplay dpy, EGLModeMESA mode);
-
-#endif /* EGL_MESA_screen_surface */
-
#ifndef EGL_MESA_copy_context
#define EGL_MESA_copy_context 1
eglimage.h \
egllog.c \
egllog.h \
- eglmode.c \
- eglmode.h \
- eglscreen.c \
- eglscreen.h \
eglstring.c \
eglstring.h \
eglsurface.c \
#include "egldriver.h"
#include "eglsurface.h"
#include "eglconfig.h"
-#include "eglscreen.h"
-#include "eglmode.h"
#include "eglimage.h"
#include "eglsync.h"
#include "eglstring.h"
#define _EGL_CHECK_CONFIG(disp, conf, ret, drv) \
_EGL_CHECK_OBJECT(disp, Config, conf, ret, drv)
-#define _EGL_CHECK_SCREEN(disp, scrn, ret, drv) \
- _EGL_CHECK_OBJECT(disp, Screen, scrn, ret, drv)
-
-#define _EGL_CHECK_MODE(disp, m, ret, drv) \
- _EGL_CHECK_OBJECT(disp, Mode, m, ret, drv)
-
#define _EGL_CHECK_SYNC(disp, s, ret, drv) \
_EGL_CHECK_OBJECT(disp, Sync, s, ret, drv)
}
-#ifdef EGL_MESA_screen_surface
-
-
-static inline _EGLDriver *
-_eglCheckScreen(_EGLDisplay *disp, _EGLScreen *scrn, const char *msg)
-{
- _EGLDriver *drv = _eglCheckDisplay(disp, msg);
- if (!drv)
- return NULL;
- if (!scrn) {
- _eglError(EGL_BAD_SCREEN_MESA, msg);
- return NULL;
- }
- return drv;
-}
-
-
-static inline _EGLDriver *
-_eglCheckMode(_EGLDisplay *disp, _EGLMode *m, const char *msg)
-{
- _EGLDriver *drv = _eglCheckDisplay(disp, msg);
- if (!drv)
- return NULL;
- if (!m) {
- _eglError(EGL_BAD_MODE_MESA, msg);
- return NULL;
- }
- return drv;
-}
-
-
-#endif /* EGL_MESA_screen_surface */
-
-
/**
* Lookup and lock a display.
*/
char *exts = dpy->ExtensionsString;
- _EGL_CHECK_EXTENSION(MESA_screen_surface);
_EGL_CHECK_EXTENSION(MESA_copy_context);
_EGL_CHECK_EXTENSION(MESA_drm_display);
_EGL_CHECK_EXTENSION(MESA_drm_image);
{ "eglWaitGL", (_EGLProc) eglWaitGL },
{ "eglWaitNative", (_EGLProc) eglWaitNative },
#endif /* _EGL_GET_CORE_ADDRESSES */
-#ifdef EGL_MESA_screen_surface
- { "eglChooseModeMESA", (_EGLProc) eglChooseModeMESA },
- { "eglGetModesMESA", (_EGLProc) eglGetModesMESA },
- { "eglGetModeAttribMESA", (_EGLProc) eglGetModeAttribMESA },
- { "eglCopyContextMESA", (_EGLProc) eglCopyContextMESA },
- { "eglGetScreensMESA", (_EGLProc) eglGetScreensMESA },
- { "eglCreateScreenSurfaceMESA", (_EGLProc) eglCreateScreenSurfaceMESA },
- { "eglShowScreenSurfaceMESA", (_EGLProc) eglShowScreenSurfaceMESA },
- { "eglScreenPositionMESA", (_EGLProc) eglScreenPositionMESA },
- { "eglQueryScreenMESA", (_EGLProc) eglQueryScreenMESA },
- { "eglQueryScreenSurfaceMESA", (_EGLProc) eglQueryScreenSurfaceMESA },
- { "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA },
- { "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA },
-#endif /* EGL_MESA_screen_surface */
#ifdef EGL_MESA_drm_display
{ "eglGetDRMDisplayMESA", (_EGLProc) eglGetDRMDisplayMESA },
#endif
}
-#ifdef EGL_MESA_screen_surface
-
-
-/*
- * EGL_MESA_screen extension
- */
-
-EGLBoolean EGLAPIENTRY
-eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen,
- const EGLint *attrib_list, EGLModeMESA *modes,
- EGLint modes_size, EGLint *num_modes)
-{
- _EGLDisplay *disp = _eglLockDisplay(dpy);
- _EGLScreen *scrn = _eglLookupScreen(screen, disp);
- _EGLDriver *drv;
- EGLBoolean ret;
-
- _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
- ret = drv->API.ChooseModeMESA(drv, disp, scrn, attrib_list,
- modes, modes_size, num_modes);
-
- RETURN_EGL_EVAL(disp, ret);
-}
-
-
-EGLBoolean EGLAPIENTRY
-eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes,
- EGLint mode_size, EGLint *num_mode)
-{
- _EGLDisplay *disp = _eglLockDisplay(dpy);
- _EGLScreen *scrn = _eglLookupScreen(screen, disp);
- _EGLDriver *drv;
- EGLBoolean ret;
-
- _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
- ret = drv->API.GetModesMESA(drv, disp, scrn, modes, mode_size, num_mode);
-
- RETURN_EGL_EVAL(disp, ret);
-}
-
-
-EGLBoolean EGLAPIENTRY
-eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode,
- EGLint attribute, EGLint *value)
-{
- _EGLDisplay *disp = _eglLockDisplay(dpy);
- _EGLMode *m = _eglLookupMode(mode, disp);
- _EGLDriver *drv;
- EGLBoolean ret;
-
- _EGL_CHECK_MODE(disp, m, EGL_FALSE, drv);
- ret = drv->API.GetModeAttribMESA(drv, disp, m, attribute, value);
-
- RETURN_EGL_EVAL(disp, ret);
-}
-
-
-EGLBoolean EGLAPIENTRY
-eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest,
- EGLint mask)
-{
- _EGLDisplay *disp = _eglLockDisplay(dpy);
- _EGLContext *source_context = _eglLookupContext(source, disp);
- _EGLContext *dest_context = _eglLookupContext(dest, disp);
- _EGLDriver *drv;
- EGLBoolean ret;
-
- _EGL_CHECK_CONTEXT(disp, source_context, EGL_FALSE, drv);
- if (!dest_context)
- RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_FALSE);
-
- ret = drv->API.CopyContextMESA(drv, disp,
- source_context, dest_context, mask);
-
- RETURN_EGL_EVAL(disp, ret);
-}
-
-
-EGLBoolean EGLAPIENTRY
-eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens,
- EGLint max_screens, EGLint *num_screens)
-{
- _EGLDisplay *disp = _eglLockDisplay(dpy);
- _EGLDriver *drv;
- EGLBoolean ret;
-
- _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv);
- ret = drv->API.GetScreensMESA(drv, disp, screens, max_screens, num_screens);
-
- RETURN_EGL_EVAL(disp, ret);
-}
-
-
-EGLSurface EGLAPIENTRY
-eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list)
-{
- _EGLDisplay *disp = _eglLockDisplay(dpy);
- _EGLConfig *conf = _eglLookupConfig(config, disp);
- _EGLDriver *drv;
- _EGLSurface *surf;
- EGLSurface ret;
-
- _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv);
-
- surf = drv->API.CreateScreenSurfaceMESA(drv, disp, conf, attrib_list);
- ret = (surf) ? _eglLinkSurface(surf) : EGL_NO_SURFACE;
-
- RETURN_EGL_EVAL(disp, ret);
-}
-
-
-EGLBoolean EGLAPIENTRY
-eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen,
- EGLSurface surface, EGLModeMESA mode)
-{
- _EGLDisplay *disp = _eglLockDisplay(dpy);
- _EGLScreen *scrn = _eglLookupScreen((EGLScreenMESA) screen, disp);
- _EGLSurface *surf = _eglLookupSurface(surface, disp);
- _EGLMode *m = _eglLookupMode(mode, disp);
- _EGLDriver *drv;
- EGLBoolean ret;
-
- _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
- if (!surf && surface != EGL_NO_SURFACE)
- RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
- if (!m && mode != EGL_NO_MODE_MESA)
- RETURN_EGL_ERROR(disp, EGL_BAD_MODE_MESA, EGL_FALSE);
-
- ret = drv->API.ShowScreenSurfaceMESA(drv, disp, scrn, surf, m);
-
- RETURN_EGL_EVAL(disp, ret);
-}
-
-
-EGLBoolean EGLAPIENTRY
-eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y)
-{
- _EGLDisplay *disp = _eglLockDisplay(dpy);
- _EGLScreen *scrn = _eglLookupScreen(screen, disp);
- _EGLDriver *drv;
- EGLBoolean ret;
-
- _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
- ret = drv->API.ScreenPositionMESA(drv, disp, scrn, x, y);
-
- RETURN_EGL_EVAL(disp, ret);
-}
-
-
-EGLBoolean EGLAPIENTRY
-eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen,
- EGLint attribute, EGLint *value)
-{
- _EGLDisplay *disp = _eglLockDisplay(dpy);
- _EGLScreen *scrn = _eglLookupScreen(screen, disp);
- _EGLDriver *drv;
- EGLBoolean ret;
-
- _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
- ret = drv->API.QueryScreenMESA(drv, disp, scrn, attribute, value);
-
- RETURN_EGL_EVAL(disp, ret);
-}
-
-
-EGLBoolean EGLAPIENTRY
-eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen,
- EGLSurface *surface)
-{
- _EGLDisplay *disp = _eglLockDisplay(dpy);
- _EGLScreen *scrn = _eglLookupScreen((EGLScreenMESA) screen, disp);
- _EGLDriver *drv;
- _EGLSurface *surf;
- EGLBoolean ret;
-
- _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
- ret = drv->API.QueryScreenSurfaceMESA(drv, disp, scrn, &surf);
- if (ret && surface)
- *surface = _eglGetSurfaceHandle(surf);
-
- RETURN_EGL_EVAL(disp, ret);
-}
-
-
-EGLBoolean EGLAPIENTRY
-eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode)
-{
- _EGLDisplay *disp = _eglLockDisplay(dpy);
- _EGLScreen *scrn = _eglLookupScreen((EGLScreenMESA) screen, disp);
- _EGLDriver *drv;
- _EGLMode *m;
- EGLBoolean ret;
-
- _EGL_CHECK_SCREEN(disp, scrn, EGL_FALSE, drv);
- ret = drv->API.QueryScreenModeMESA(drv, disp, scrn, &m);
- if (ret && mode)
- *mode = m->Handle;
-
- RETURN_EGL_EVAL(disp, ret);
-}
-
-
-const char * EGLAPIENTRY
-eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
-{
- _EGLDisplay *disp = _eglLockDisplay(dpy);
- _EGLMode *m = _eglLookupMode(mode, disp);
- _EGLDriver *drv;
- const char *ret;
-
- _EGL_CHECK_MODE(disp, m, NULL, drv);
- ret = drv->API.QueryModeStringMESA(drv, disp, m);
-
- RETURN_EGL_EVAL(disp, ret);
-}
-
-
-#endif /* EGL_MESA_screen_surface */
-
-
#ifdef EGL_MESA_drm_display
EGLDisplay EGLAPIENTRY
-#ifdef EGL_MESA_screen_surface
-typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
-typedef EGLBoolean (*GetModesMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode);
-typedef EGLBoolean (*GetModeAttribMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *mode, EGLint attribute, EGLint *value);
-typedef EGLBoolean (*CopyContextMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *source, _EGLContext *dest, EGLint mask);
-typedef EGLBoolean (*GetScreensMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
-typedef _EGLSurface *(*CreateScreenSurfaceMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *config, const EGLint *attrib_list);
-typedef EGLBoolean (*ShowScreenSurfaceMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, _EGLSurface *surface, _EGLMode *mode);
-typedef EGLBoolean (*ScreenPositionMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, EGLint x, EGLint y);
-typedef EGLBoolean (*QueryScreenMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, EGLint attribute, EGLint *value);
-typedef EGLBoolean (*QueryScreenSurfaceMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, _EGLSurface **surface);
-typedef EGLBoolean (*QueryScreenModeMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, _EGLMode **mode);
-typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *mode);
-#endif /* EGL_MESA_screen_surface */
-
-
typedef _EGLSurface *(*CreatePbufferFromClientBuffer_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLenum buftype, EGLClientBuffer buffer, _EGLConfig *config, const EGLint *attrib_list);
WaitNative_t WaitNative;
GetProcAddress_t GetProcAddress;
-#ifdef EGL_MESA_screen_surface
- ChooseModeMESA_t ChooseModeMESA;
- GetModesMESA_t GetModesMESA;
- GetModeAttribMESA_t GetModeAttribMESA;
- CopyContextMESA_t CopyContextMESA;
- GetScreensMESA_t GetScreensMESA;
- CreateScreenSurfaceMESA_t CreateScreenSurfaceMESA;
- ShowScreenSurfaceMESA_t ShowScreenSurfaceMESA;
- ScreenPositionMESA_t ScreenPositionMESA;
- QueryScreenMESA_t QueryScreenMESA;
- QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
- QueryScreenModeMESA_t QueryScreenModeMESA;
- QueryModeStringMESA_t QueryModeStringMESA;
-#endif /* EGL_MESA_screen_surface */
-
CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer;
CreateImageKHR_t CreateImageKHR;
EGL_VG_ALPHA_FORMAT_PRE_BIT |
EGL_MULTISAMPLE_RESOLVE_BOX_BIT |
EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
-#ifdef EGL_MESA_screen_surface
- if (conf->Display->Extensions.MESA_screen_surface)
- mask |= EGL_SCREEN_BIT_MESA;
-#endif
break;
case EGL_RENDERABLE_TYPE:
case EGL_CONFORMANT:
case EGL_NOT_INITIALIZED:
s = "EGL_NOT_INITIALIZED";
break;
-#ifdef EGL_MESA_screen_surface
- case EGL_BAD_SCREEN_MESA:
- s = "EGL_BAD_SCREEN_MESA";
- break;
- case EGL_BAD_MODE_MESA:
- s = "EGL_BAD_MODE_MESA";
- break;
-#endif
default:
s = "other EGL error";
}
*/
struct _egl_extensions
{
- EGLBoolean MESA_screen_surface;
EGLBoolean MESA_copy_context;
EGLBoolean MESA_drm_display;
EGLBoolean MESA_drm_image;
#include "eglconfig.h"
#include "eglcontext.h"
#include "eglsurface.h"
-#include "eglscreen.h"
-#include "eglmode.h"
#include "eglsync.h"
drv->API.WaitNative = (WaitNative_t) _eglReturnFalse;
drv->API.GetProcAddress = (GetProcAddress_t) _eglReturnFalse;
-#ifdef EGL_MESA_screen_surface
- drv->API.CopyContextMESA = (CopyContextMESA_t) _eglReturnFalse;
- drv->API.CreateScreenSurfaceMESA =
- (CreateScreenSurfaceMESA_t) _eglReturnFalse;
- drv->API.ShowScreenSurfaceMESA = (ShowScreenSurfaceMESA_t) _eglReturnFalse;
- drv->API.ChooseModeMESA = _eglChooseModeMESA;
- drv->API.GetModesMESA = _eglGetModesMESA;
- drv->API.GetModeAttribMESA = _eglGetModeAttribMESA;
- drv->API.GetScreensMESA = _eglGetScreensMESA;
- drv->API.ScreenPositionMESA = _eglScreenPositionMESA;
- drv->API.QueryScreenMESA = _eglQueryScreenMESA;
- drv->API.QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA;
- drv->API.QueryScreenModeMESA = _eglQueryScreenModeMESA;
- drv->API.QueryModeStringMESA = _eglQueryModeStringMESA;
-#endif /* EGL_MESA_screen_surface */
-
drv->API.CreateImageKHR = NULL;
drv->API.DestroyImageKHR = NULL;
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2008 VMware, Inc.
- * Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
- * Copyright 2010 LunarG, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "egldisplay.h"
-#include "eglmode.h"
-#include "eglcurrent.h"
-#include "eglscreen.h"
-
-
-#ifdef EGL_MESA_screen_surface
-
-
-#define MIN2(A, B) (((A) < (B)) ? (A) : (B))
-
-
-/**
- * Given an EGLModeMESA handle, return the corresponding _EGLMode object
- * or null if non-existant.
- */
-_EGLMode *
-_eglLookupMode(EGLModeMESA mode, _EGLDisplay *disp)
-{
- EGLint scrnum;
-
- if (!disp || !disp->Screens)
- return NULL;
-
- /* loop over all screens on the display */
- for (scrnum = 0; scrnum < disp->Screens->Size; scrnum++) {
- const _EGLScreen *scrn = disp->Screens->Elements[scrnum];
- EGLint idx;
-
- /*
- * the mode ids of a screen ranges from scrn->Handle to scrn->Handle +
- * scrn->NumModes
- */
- if (mode >= scrn->Handle &&
- mode < scrn->Handle + _EGL_SCREEN_MAX_MODES) {
- idx = mode - scrn->Handle;
-
- assert(idx < scrn->NumModes && scrn->Modes[idx].Handle == mode);
-
- return &scrn->Modes[idx];
- }
- }
-
- return NULL;
-}
-
-
-/**
- * Parse the attrib_list to fill in the fields of the given _eglMode
- * Return EGL_FALSE if any errors, EGL_TRUE otherwise.
- */
-static EGLBoolean
-_eglParseModeAttribs(_EGLMode *mode, const EGLint *attrib_list)
-{
- EGLint i;
-
- /* init all attribs to EGL_DONT_CARE */
- mode->Handle = EGL_DONT_CARE;
- mode->Width = EGL_DONT_CARE;
- mode->Height = EGL_DONT_CARE;
- mode->RefreshRate = EGL_DONT_CARE;
- mode->Optimal = EGL_DONT_CARE;
- mode->Interlaced = EGL_DONT_CARE;
- mode->Name = NULL;
-
- for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
- switch (attrib_list[i]) {
- case EGL_MODE_ID_MESA:
- mode->Handle = attrib_list[++i];
- if (mode->Handle <= 0) {
- _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(handle)");
- return EGL_FALSE;
- }
- break;
- case EGL_WIDTH:
- mode->Width = attrib_list[++i];
- if (mode->Width <= 0) {
- _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(width)");
- return EGL_FALSE;
- }
- break;
- case EGL_HEIGHT:
- mode->Height = attrib_list[++i];
- if (mode->Height <= 0) {
- _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(height)");
- return EGL_FALSE;
- }
- break;
- case EGL_REFRESH_RATE_MESA:
- mode->RefreshRate = attrib_list[++i];
- if (mode->RefreshRate <= 0) {
- _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(refresh rate)");
- return EGL_FALSE;
- }
- break;
- case EGL_INTERLACED_MESA:
- mode->Interlaced = attrib_list[++i];
- if (mode->Interlaced != EGL_TRUE && mode->Interlaced != EGL_FALSE) {
- _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(interlaced)");
- return EGL_FALSE;
- }
- break;
- case EGL_OPTIMAL_MESA:
- mode->Optimal = attrib_list[++i];
- if (mode->Optimal != EGL_TRUE && mode->Optimal != EGL_FALSE) {
- _eglError(EGL_BAD_PARAMETER, "eglChooseModeMESA(optimal)");
- return EGL_FALSE;
- }
- break;
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglChooseModeMESA");
- return EGL_FALSE;
- }
- }
- return EGL_TRUE;
-}
-
-
-/**
- * Determine if the candidate mode's attributes are at least as good
- * as the minimal mode's.
- * \return EGL_TRUE if qualifies, EGL_FALSE otherwise
- */
-static EGLBoolean
-_eglModeQualifies(const _EGLMode *c, const _EGLMode *min)
-{
- if (min->Handle != EGL_DONT_CARE && c->Handle != min->Handle)
- return EGL_FALSE;
- if (min->Width != EGL_DONT_CARE && c->Width < min->Width)
- return EGL_FALSE;
- if (min->Height != EGL_DONT_CARE && c->Height < min->Height)
- return EGL_FALSE;
- if (min->RefreshRate != EGL_DONT_CARE && c->RefreshRate < min->RefreshRate)
- return EGL_FALSE;
- if (min->Optimal != EGL_DONT_CARE && c->Optimal != min->Optimal)
- return EGL_FALSE;
- if (min->Interlaced != EGL_DONT_CARE && c->Interlaced != min->Interlaced)
- return EGL_FALSE;
-
- return EGL_TRUE;
-}
-
-
-/**
- * Return value of given mode attribute, or -1 if bad attrib.
- */
-static EGLint
-getModeAttrib(const _EGLMode *m, EGLint attrib)
-{
- switch (attrib) {
- case EGL_MODE_ID_MESA:
- return m->Handle;
- case EGL_WIDTH:
- return m->Width;
- case EGL_HEIGHT:
- return m->Height;
- case EGL_REFRESH_RATE_MESA:
- return m->RefreshRate;
- case EGL_OPTIMAL_MESA:
- return m->Optimal;
- case EGL_INTERLACED_MESA:
- return m->Interlaced;
- default:
- return -1;
- }
-}
-
-
-#define SMALLER 1
-#define LARGER 2
-
-struct sort_info {
- EGLint Attrib;
- EGLint Order; /* SMALLER or LARGER */
-};
-
-/* the order of these entries is the priority */
-static struct sort_info SortInfo[] = {
- { EGL_OPTIMAL_MESA, LARGER },
- { EGL_INTERLACED_MESA, SMALLER },
- { EGL_WIDTH, LARGER },
- { EGL_HEIGHT, LARGER },
- { EGL_REFRESH_RATE_MESA, LARGER },
- { EGL_MODE_ID_MESA, SMALLER },
- { 0, 0 }
-};
-
-
-/**
- * Compare modes 'a' and 'b' and return -1 if a belongs before b, or 1 if a
- * belongs after b, or 0 if they're equal.
- * Used by qsort().
- */
-static int
-_eglCompareModes(const void *a, const void *b)
-{
- const _EGLMode *aMode = *((const _EGLMode **) a);
- const _EGLMode *bMode = *((const _EGLMode **) b);
- EGLint i;
-
- for (i = 0; SortInfo[i].Attrib; i++) {
- const EGLint aVal = getModeAttrib(aMode, SortInfo[i].Attrib);
- const EGLint bVal = getModeAttrib(bMode, SortInfo[i].Attrib);
- if (aVal == bVal) {
- /* a tie */
- continue;
- }
- else if (SortInfo[i].Order == SMALLER) {
- return (aVal < bVal) ? -1 : 1;
- }
- else if (SortInfo[i].Order == LARGER) {
- return (aVal > bVal) ? -1 : 1;
- }
- }
-
- /* all attributes identical */
- return 0;
-}
-
-
-/**
- * Search for EGLModes which match the given attribute list.
- * Called via eglChooseModeMESA API function.
- */
-EGLBoolean
-_eglChooseModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn,
- const EGLint *attrib_list, EGLModeMESA *modes,
- EGLint modes_size, EGLint *num_modes)
-{
- _EGLMode **modeList, min;
- EGLint i, count;
-
- if (!_eglParseModeAttribs(&min, attrib_list)) {
- /* error code will have been recorded */
- return EGL_FALSE;
- }
-
- /* allocate array of mode pointers */
- modeList = malloc(modes_size * sizeof(_EGLMode *));
- if (!modeList) {
- _eglError(EGL_BAD_MODE_MESA, "eglChooseModeMESA(out of memory)");
- return EGL_FALSE;
- }
-
- /* make array of pointers to qualifying modes */
- for (i = count = 0; i < scrn->NumModes && count < modes_size; i++) {
- if (_eglModeQualifies(scrn->Modes + i, &min)) {
- modeList[count++] = scrn->Modes + i;
- }
- }
-
- /* sort array of pointers */
- qsort(modeList, count, sizeof(_EGLMode *), _eglCompareModes);
-
- /* copy mode handles to output array */
- for (i = 0; i < count; i++) {
- modes[i] = modeList[i]->Handle;
- }
-
- free(modeList);
-
- *num_modes = count;
-
- return EGL_TRUE;
-}
-
-
-
-/**
- * Return all possible modes for the given screen. No sorting of results.
- * Called via eglGetModesMESA() API function.
- */
-EGLBoolean
-_eglGetModesMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn,
- EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes)
-{
- if (modes) {
- EGLint i;
- *num_modes = MIN2(scrn->NumModes, modes_size);
- for (i = 0; i < *num_modes; i++) {
- modes[i] = scrn->Modes[i].Handle;
- }
- }
- else {
- /* just return total number of supported modes */
- *num_modes = scrn->NumModes;
- }
-
- return EGL_TRUE;
-}
-
-
-/**
- * Query an attribute of a mode.
- */
-EGLBoolean
-_eglGetModeAttribMESA(_EGLDriver *drv, _EGLDisplay *dpy,
- _EGLMode *m, EGLint attribute, EGLint *value)
-{
- EGLint v;
-
- v = getModeAttrib(m, attribute);
- if (v < 0) {
- _eglError(EGL_BAD_ATTRIBUTE, "eglGetModeAttribMESA");
- return EGL_FALSE;
- }
- *value = v;
- return EGL_TRUE;
-}
-
-
-/**
- * Return human-readable string for given mode.
- * This is the default function called by eglQueryModeStringMESA().
- */
-const char *
-_eglQueryModeStringMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *m)
-{
- return m->Name;
-}
-
-
-#endif /* EGL_MESA_screen_surface */
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2008 VMware, Inc.
- * Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
- * Copyright 2010 LunarG, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#ifndef EGLMODE_INCLUDED
-#define EGLMODE_INCLUDED
-
-#include "egltypedefs.h"
-
-
-#ifdef EGL_MESA_screen_surface
-
-
-#define EGL_NO_MODE_MESA 0
-
-
-/**
- * Data structure which corresponds to an EGLModeMESA.
- */
-struct _egl_mode
-{
- EGLModeMESA Handle; /* the public/opaque handle which names this mode */
- EGLint Width, Height; /* size in pixels */
- EGLint RefreshRate; /* rate * 1000.0 */
- EGLint Optimal;
- EGLint Interlaced;
- const char *Name;
-
- /* Other possible attributes */
- /* interlaced */
- /* external sync */
-};
-
-
-extern _EGLMode *
-_eglLookupMode(EGLModeMESA mode, _EGLDisplay *dpy);
-
-
-extern EGLBoolean
-_eglChooseModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn,
- const EGLint *attrib_list, EGLModeMESA *modes,
- EGLint modes_size, EGLint *num_modes);
-
-
-extern EGLBoolean
-_eglGetModesMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn,
- EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
-
-
-extern EGLBoolean
-_eglGetModeAttribMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *m,
- EGLint attribute, EGLint *value);
-
-
-extern const char *
-_eglQueryModeStringMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *m);
-
-
-#endif /* EGL_MESA_screen_surface */
-
-
-#endif /* EGLMODE_INCLUDED */
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2008 VMware, Inc.
- * Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
- * Copyright 2010 LunarG, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-/*
- * Ideas for screen management extension to EGL.
- *
- * Each EGLDisplay has one or more screens (CRTs, Flat Panels, etc).
- * The screens' handles can be obtained with eglGetScreensMESA().
- *
- * A new kind of EGLSurface is possible- one which can be directly scanned
- * out on a screen. Such a surface is created with eglCreateScreenSurface().
- *
- * To actually display a screen surface on a screen, the eglShowSurface()
- * function is called.
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include "c11/threads.h"
-
-#include "egldisplay.h"
-#include "eglcurrent.h"
-#include "eglmode.h"
-#include "eglsurface.h"
-#include "eglscreen.h"
-
-
-#ifdef EGL_MESA_screen_surface
-
-
-/* ugh, no atomic op? */
-static mtx_t _eglNextScreenHandleMutex = _MTX_INITIALIZER_NP;
-static EGLScreenMESA _eglNextScreenHandle = 1;
-
-
-/**
- * Return a new screen handle/ID.
- * NOTE: we never reuse these!
- */
-static EGLScreenMESA
-_eglAllocScreenHandle(void)
-{
- EGLScreenMESA s;
-
- mtx_lock(&_eglNextScreenHandleMutex);
- s = _eglNextScreenHandle;
- _eglNextScreenHandle += _EGL_SCREEN_MAX_MODES;
- mtx_unlock(&_eglNextScreenHandleMutex);
-
- return s;
-}
-
-
-/**
- * Initialize an _EGLScreen object to default values.
- */
-void
-_eglInitScreen(_EGLScreen *screen, _EGLDisplay *dpy, EGLint num_modes)
-{
- memset(screen, 0, sizeof(_EGLScreen));
-
- screen->Display = dpy;
- screen->NumModes = num_modes;
- screen->StepX = 1;
- screen->StepY = 1;
-
- if (num_modes > _EGL_SCREEN_MAX_MODES)
- num_modes = _EGL_SCREEN_MAX_MODES;
- screen->Modes = calloc(num_modes, sizeof(*screen->Modes));
- screen->NumModes = (screen->Modes) ? num_modes : 0;
-}
-
-
-/**
- * Link a screen to its display and return the handle of the link.
- * The handle can be passed to client directly.
- */
-EGLScreenMESA
-_eglLinkScreen(_EGLScreen *screen)
-{
- _EGLDisplay *display;
- EGLint i;
-
- assert(screen && screen->Display);
- display = screen->Display;
-
- if (!display->Screens) {
- display->Screens = _eglCreateArray("Screen", 4);
- if (!display->Screens)
- return (EGLScreenMESA) 0;
- }
-
- screen->Handle = _eglAllocScreenHandle();
- for (i = 0; i < screen->NumModes; i++)
- screen->Modes[i].Handle = screen->Handle + i;
-
- _eglAppendArray(display->Screens, (void *) screen);
-
- return screen->Handle;
-}
-
-
-/**
- * Lookup a handle to find the linked config.
- * Return NULL if the handle has no corresponding linked config.
- */
-_EGLScreen *
-_eglLookupScreen(EGLScreenMESA screen, _EGLDisplay *display)
-{
- EGLint i;
-
- if (!display || !display->Screens)
- return NULL;
-
- for (i = 0; i < display->Screens->Size; i++) {
- _EGLScreen *scr = (_EGLScreen *) display->Screens->Elements[i];
- if (scr->Handle == screen) {
- assert(scr->Display == display);
- return scr;
- }
- }
- return NULL;
-}
-
-
-static EGLBoolean
-_eglFlattenScreen(void *elem, void *buffer)
-{
- _EGLScreen *scr = (_EGLScreen *) elem;
- EGLScreenMESA *handle = (EGLScreenMESA *) buffer;
- *handle = _eglGetScreenHandle(scr);
- return EGL_TRUE;
-}
-
-
-EGLBoolean
-_eglGetScreensMESA(_EGLDriver *drv, _EGLDisplay *display, EGLScreenMESA *screens,
- EGLint max_screens, EGLint *num_screens)
-{
- *num_screens = _eglFlattenArray(display->Screens, (void *) screens,
- sizeof(screens[0]), max_screens, _eglFlattenScreen);
-
- return EGL_TRUE;
-}
-
-
-/**
- * Set a screen's surface origin.
- */
-EGLBoolean
-_eglScreenPositionMESA(_EGLDriver *drv, _EGLDisplay *dpy,
- _EGLScreen *scrn, EGLint x, EGLint y)
-{
- scrn->OriginX = x;
- scrn->OriginY = y;
-
- return EGL_TRUE;
-}
-
-
-/**
- * Query a screen's current surface.
- */
-EGLBoolean
-_eglQueryScreenSurfaceMESA(_EGLDriver *drv, _EGLDisplay *dpy,
- _EGLScreen *scrn, _EGLSurface **surf)
-{
- *surf = scrn->CurrentSurface;
- return EGL_TRUE;
-}
-
-
-/**
- * Query a screen's current mode.
- */
-EGLBoolean
-_eglQueryScreenModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn,
- _EGLMode **m)
-{
- *m = scrn->CurrentMode;
- return EGL_TRUE;
-}
-
-
-EGLBoolean
-_eglQueryScreenMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn,
- EGLint attribute, EGLint *value)
-{
- switch (attribute) {
- case EGL_SCREEN_POSITION_MESA:
- value[0] = scrn->OriginX;
- value[1] = scrn->OriginY;
- break;
- case EGL_SCREEN_POSITION_GRANULARITY_MESA:
- value[0] = scrn->StepX;
- value[1] = scrn->StepY;
- break;
- default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglQueryScreenMESA");
- return EGL_FALSE;
- }
-
- return EGL_TRUE;
-}
-
-
-#endif /* EGL_MESA_screen_surface */
+++ /dev/null
-/**************************************************************************
- *
- * Copyright 2008 VMware, Inc.
- * Copyright 2009-2010 Chia-I Wu <olvaffe@gmail.com>
- * Copyright 2010 LunarG, Inc.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#ifndef EGLSCREEN_INCLUDED
-#define EGLSCREEN_INCLUDED
-
-#include "c99_compat.h"
-
-#include "egltypedefs.h"
-
-
-#ifdef EGL_MESA_screen_surface
-
-
-#define _EGL_SCREEN_MAX_MODES 16
-
-
-/**
- * Per-screen information.
- * Note that an EGL screen doesn't have a size. A screen may be set to
- * one of several display modes (width/height/scanrate). The screen
- * then displays a drawing surface. The drawing surface must be at least
- * as large as the display mode's resolution. If it's larger, the
- * OriginX and OriginY fields control what part of the surface is visible
- * on the screen.
- */
-struct _egl_screen
-{
- _EGLDisplay *Display;
-
- EGLScreenMESA Handle; /* The public/opaque handle which names this object */
-
- _EGLMode *CurrentMode;
- _EGLSurface *CurrentSurface;
-
- EGLint OriginX, OriginY; /**< Origin of scan-out region w.r.t. surface */
- EGLint StepX, StepY; /**< Screen position/origin granularity */
-
- EGLint NumModes;
- _EGLMode *Modes; /**< array [NumModes] */
-};
-
-
-extern void
-_eglInitScreen(_EGLScreen *screen, _EGLDisplay *dpy, EGLint num_modes);
-
-
-extern EGLScreenMESA
-_eglLinkScreen(_EGLScreen *screen);
-
-
-extern _EGLScreen *
-_eglLookupScreen(EGLScreenMESA screen, _EGLDisplay *dpy);
-
-
-/**
- * Return the handle of a linked screen.
- */
-static inline EGLScreenMESA
-_eglGetScreenHandle(_EGLScreen *screen)
-{
- return (screen) ? screen->Handle : (EGLScreenMESA) 0;
-}
-
-
-extern EGLBoolean
-_eglGetScreensMESA(_EGLDriver *drv, _EGLDisplay *dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
-
-
-extern EGLBoolean
-_eglScreenPositionMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, EGLint x, EGLint y);
-
-
-extern EGLBoolean
-_eglQueryScreenSurfaceMESA(_EGLDriver *drv, _EGLDisplay *dpy,
- _EGLScreen *scrn, _EGLSurface **surface);
-
-
-extern EGLBoolean
-_eglQueryScreenModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, _EGLMode **m);
-
-
-extern EGLBoolean
-_eglQueryScreenMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, EGLint attribute, EGLint *value);
-
-
-#endif /* EGL_MESA_screen_surface */
-
-
-#endif /* EGLSCREEN_INCLUDED */
}
-#ifdef EGL_MESA_screen_surface
-static EGLint
-_eglParseScreenSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
-{
- EGLint i, err = EGL_SUCCESS;
-
- if (!attrib_list)
- return EGL_SUCCESS;
-
- for (i = 0; attrib_list[i] != EGL_NONE; i++) {
- EGLint attr = attrib_list[i++];
- EGLint val = attrib_list[i];
-
- switch (attr) {
- case EGL_WIDTH:
- if (val < 0) {
- err = EGL_BAD_PARAMETER;
- break;
- }
- surf->Width = val;
- break;
- case EGL_HEIGHT:
- if (val < 0) {
- err = EGL_BAD_PARAMETER;
- break;
- }
- surf->Height = val;
- break;
- default:
- err = EGL_BAD_ATTRIBUTE;
- break;
- }
-
- if (err != EGL_SUCCESS) {
- _eglLog(_EGL_WARNING, "bad surface attribute 0x%04x", attr);
- break;
- }
- }
-
- return err;
-}
-#endif /* EGL_MESA_screen_surface */
-
-
/**
* Parse the list of surface attributes and return the proper error code.
*/
if (!attrib_list)
return EGL_SUCCESS;
-#ifdef EGL_MESA_screen_surface
- if (type == EGL_SCREEN_BIT_MESA)
- return _eglParseScreenSurfaceAttribList(surf, attrib_list);
-#endif
-
if (dpy->Extensions.NOK_texture_from_pixmap)
texture_type |= EGL_PIXMAP_BIT;
case EGL_PBUFFER_BIT:
func = "eglCreatePBufferSurface";
break;
-#ifdef EGL_MESA_screen_surface
- case EGL_SCREEN_BIT_MESA:
- func = "eglCreateScreenSurface";
- renderBuffer = EGL_SINGLE_BUFFER; /* XXX correct? */
- break;
-#endif
default:
_eglLog(_EGL_WARNING, "Bad type in _eglInitSurface");
return EGL_FALSE;