summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglscreen.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-10-23 02:11:21 +0800
committerChia-I Wu <[email protected]>2010-10-23 11:20:41 +0800
commit37213ceacc2d7b309de7641da501282f8f24c8c2 (patch)
treeacc58a71199726a4c0457c5e9bc842efe54c37cb /src/egl/main/eglscreen.c
parent8a6bdf3979c2dda0efc6771308bf9e5c32bbdab4 (diff)
egl: Minor changes to the _EGLScreen interface.
Make _eglInitScreen take a display and rename _eglAddScreen to _eglLinkScreen. Remove unused functions.
Diffstat (limited to 'src/egl/main/eglscreen.c')
-rw-r--r--src/egl/main/eglscreen.c101
1 files changed, 32 insertions, 69 deletions
diff --git a/src/egl/main/eglscreen.c b/src/egl/main/eglscreen.c
index 2ae403494e2..0bbead84769 100644
--- a/src/egl/main/eglscreen.c
+++ b/src/egl/main/eglscreen.c
@@ -53,16 +53,42 @@ _eglAllocScreenHandle(void)
* Initialize an _EGLScreen object to default values.
*/
void
-_eglInitScreen(_EGLScreen *screen)
+_eglInitScreen(_EGLScreen *screen, _EGLDisplay *dpy)
{
memset(screen, 0, sizeof(_EGLScreen));
+ screen->Display = dpy;
screen->StepX = 1;
screen->StepY = 1;
}
/**
- * Given a public screen handle, return the internal _EGLScreen object.
+ * 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;
+
+ assert(screen && screen->Display);
+ display = screen->Display;
+
+ if (!display->Screens) {
+ display->Screens = _eglCreateArray("Screen", 4);
+ if (!display->Screens)
+ return (EGLScreenMESA) 0;
+ }
+ screen->Handle = _eglAllocScreenHandle();
+ _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)
@@ -74,39 +100,21 @@ _eglLookupScreen(EGLScreenMESA screen, _EGLDisplay *display)
for (i = 0; i < display->Screens->Size; i++) {
_EGLScreen *scr = (_EGLScreen *) display->Screens->Elements[i];
- if (scr->Handle == screen)
+ if (scr->Handle == screen) {
+ assert(scr->Display == display);
return scr;
+ }
}
return NULL;
}
-/**
- * Add the given _EGLScreen to the display's list of screens.
- */
-void
-_eglAddScreen(_EGLDisplay *display, _EGLScreen *screen)
-{
- assert(display);
- assert(screen);
-
- if (!display->Screens) {
- display->Screens = _eglCreateArray("Screen", 4);
- if (!display->Screens)
- return;
- }
- screen->Handle = _eglAllocScreenHandle();
- _eglAppendArray(display->Screens, (void *) screen);
-}
-
-
-
static EGLBoolean
_eglFlattenScreen(void *elem, void *buffer)
{
_EGLScreen *scr = (_EGLScreen *) elem;
EGLScreenMESA *handle = (EGLScreenMESA *) buffer;
- *handle = scr->Handle;
+ *handle = _eglGetScreenHandle(scr);
return EGL_TRUE;
}
@@ -123,22 +131,6 @@ _eglGetScreensMESA(_EGLDriver *drv, _EGLDisplay *display, EGLScreenMESA *screens
/**
- * Set a screen's current display mode.
- * Note: mode = EGL_NO_MODE is valid (turns off the screen)
- *
- * This is just a placeholder function; drivers will always override
- * this with code that _really_ sets the mode.
- */
-EGLBoolean
-_eglScreenModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn,
- _EGLMode *m)
-{
- scrn->CurrentMode = m;
- return EGL_TRUE;
-}
-
-
-/**
* Set a screen's surface origin.
*/
EGLBoolean
@@ -198,33 +190,4 @@ _eglQueryScreenMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn,
}
-/**
- * Delete the modes associated with given screen.
- */
-void
-_eglDestroyScreenModes(_EGLScreen *scrn)
-{
- EGLint i;
- for (i = 0; i < scrn->NumModes; i++) {
- if (scrn->Modes[i].Name)
- free((char *) scrn->Modes[i].Name); /* cast away const */
- }
- if (scrn->Modes)
- free(scrn->Modes);
- scrn->Modes = NULL;
- scrn->NumModes = 0;
-}
-
-
-/**
- * Default fallback routine - drivers should usually override this.
- */
-void
-_eglDestroyScreen(_EGLScreen *scrn)
-{
- _eglDestroyScreenModes(scrn);
- free(scrn);
-}
-
-
#endif /* EGL_MESA_screen_surface */