diff options
author | Chia-I Wu <[email protected]> | 2009-08-11 17:09:39 +0800 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-08-18 08:44:34 -0600 |
commit | 2f2cf461c57974abd89e4917945cc8ae6a67a72e (patch) | |
tree | 0548e5d4fc90f8603bfe019783cd041f5f8adb94 /src/egl/main/eglmode.c | |
parent | 521dea21d46b4012653a4998d92ac0f6c0d1a8d4 (diff) |
egl: Overhaul driver API.
The motivation is so that drivers do not need to look up and check for
bad display, context, and etc. It also becomes unnecessary for drivers
to call the link functions.
This commit makes eglapi.[ch] do the lookup and check. As a result, the
driver API is overhauled, and almost all sources and drivers need
update. The updates are mainly find and replace with human brains.
Signed-off-by: Chia-I Wu <[email protected]>
Diffstat (limited to 'src/egl/main/eglmode.c')
-rw-r--r-- | src/egl/main/eglmode.c | 37 |
1 files changed, 6 insertions, 31 deletions
diff --git a/src/egl/main/eglmode.c b/src/egl/main/eglmode.c index 786432234bb..0f3ba6e5c08 100644 --- a/src/egl/main/eglmode.c +++ b/src/egl/main/eglmode.c @@ -34,9 +34,8 @@ my_strdup(const char *s) * or null if non-existant. */ _EGLMode * -_eglLookupMode(EGLDisplay dpy, EGLModeMESA mode) +_eglLookupMode(EGLModeMESA mode, _EGLDisplay *disp) { - const _EGLDisplay *disp = _eglLookupDisplay(dpy); EGLint scrnum; /* loop over all screens on the display */ @@ -272,19 +271,13 @@ _eglCompareModes(const void *a, const void *b) * Called via eglChooseModeMESA API function. */ EGLBoolean -_eglChooseModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, +_eglChooseModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes) { - const _EGLScreen *scrn = _eglLookupScreen(dpy, screen); _EGLMode **modeList, min; EGLint i, count; - if (!scrn) { - _eglError(EGL_BAD_SCREEN_MESA, "eglChooseModeMESA"); - return EGL_FALSE; - } - if (!_eglParseModeAttribs(&min, attrib_list)) { /* error code will have been recorded */ return EGL_FALSE; @@ -326,16 +319,9 @@ _eglChooseModeMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, * Called via eglGetModesMESA() API function. */ EGLBoolean -_eglGetModesMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, +_eglGetModesMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes) { - _EGLScreen *scrn = _eglLookupScreen(dpy, screen); - - if (!scrn) { - _eglError(EGL_BAD_SCREEN_MESA, "eglGetModesMESA"); - return EGL_FALSE; - } - if (modes) { EGLint i; *num_modes = MIN2(scrn->NumModes, modes_size); @@ -356,17 +342,11 @@ _eglGetModesMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, * Query an attribute of a mode. */ EGLBoolean -_eglGetModeAttribMESA(_EGLDriver *drv, EGLDisplay dpy, - EGLModeMESA mode, EGLint attribute, EGLint *value) +_eglGetModeAttribMESA(_EGLDriver *drv, _EGLDisplay *dpy, + _EGLMode *m, EGLint attribute, EGLint *value) { - _EGLMode *m = _eglLookupMode(dpy, mode); EGLint v; - if (!m) { - _eglError(EGL_BAD_MODE_MESA, "eglGetModeAttribMESA"); - return EGL_FALSE; - } - v = getModeAttrib(m, attribute); if (v < 0) { _eglError(EGL_BAD_ATTRIBUTE, "eglGetModeAttribMESA"); @@ -382,13 +362,8 @@ _eglGetModeAttribMESA(_EGLDriver *drv, EGLDisplay dpy, * This is the default function called by eglQueryModeStringMESA(). */ const char * -_eglQueryModeStringMESA(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode) +_eglQueryModeStringMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLMode *m) { - _EGLMode *m = _eglLookupMode(dpy, mode); - if (!m) { - _eglError(EGL_BAD_MODE_MESA, "eglQueryModeStringMESA"); - return NULL; - } return m->Name; } |