summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/egl/main/eglscreen.c101
-rw-r--r--src/egl/main/eglscreen.h34
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c4
3 files changed, 49 insertions, 90 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 */
diff --git a/src/egl/main/eglscreen.h b/src/egl/main/eglscreen.h
index e564793e511..44fe20da3be 100644
--- a/src/egl/main/eglscreen.h
+++ b/src/egl/main/eglscreen.h
@@ -19,6 +19,8 @@
*/
struct _egl_screen
{
+ _EGLDisplay *Display;
+
EGLScreenMESA Handle; /* The public/opaque handle which names this object */
_EGLMode *CurrentMode;
@@ -33,15 +35,25 @@ struct _egl_screen
PUBLIC void
-_eglInitScreen(_EGLScreen *screen);
+_eglInitScreen(_EGLScreen *screen, _EGLDisplay *dpy);
+
+
+PUBLIC EGLScreenMESA
+_eglLinkScreen(_EGLScreen *screen);
extern _EGLScreen *
_eglLookupScreen(EGLScreenMESA screen, _EGLDisplay *dpy);
-PUBLIC void
-_eglAddScreen(_EGLDisplay *display, _EGLScreen *screen);
+/**
+ * Return the handle of a linked screen.
+ */
+static INLINE EGLScreenMESA
+_eglGetScreenHandle(_EGLScreen *screen)
+{
+ return (screen) ? screen->Handle : (EGLScreenMESA) 0;
+}
extern EGLBoolean
@@ -49,18 +61,10 @@ _eglGetScreensMESA(_EGLDriver *drv, _EGLDisplay *dpy, EGLScreenMESA *screens, EG
extern EGLBoolean
-_eglScreenModeMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, _EGLMode *m);
-
-
-extern EGLBoolean
_eglScreenPositionMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, EGLint x, EGLint y);
extern EGLBoolean
-_eglQueryDisplayMESA(_EGLDriver *drv, _EGLDisplay *dpy, EGLint attribute, EGLint *value);
-
-
-extern EGLBoolean
_eglQueryScreenSurfaceMESA(_EGLDriver *drv, _EGLDisplay *dpy,
_EGLScreen *scrn, _EGLSurface **surface);
@@ -73,14 +77,6 @@ extern EGLBoolean
_eglQueryScreenMESA(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *scrn, EGLint attribute, EGLint *value);
-extern void
-_eglDestroyScreenModes(_EGLScreen *scrn);
-
-
-PUBLIC void
-_eglDestroyScreen(_EGLScreen *scrn);
-
-
#endif /* EGL_MESA_screen_surface */
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 8999b86e9b9..772c65daf50 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -126,7 +126,7 @@ egl_g3d_add_screens(_EGLDriver *drv, _EGLDisplay *dpy)
continue;
}
- _eglInitScreen(&gscr->base);
+ _eglInitScreen(&gscr->base, dpy);
for (j = 0; j < num_modes; j++) {
const struct native_mode *nmode = native_modes[j];
@@ -143,7 +143,7 @@ egl_g3d_add_screens(_EGLDriver *drv, _EGLDisplay *dpy)
gscr->native = nconn;
gscr->native_modes = native_modes;
- _eglAddScreen(dpy, &gscr->base);
+ _eglLinkScreen(&gscr->base);
}
FREE(native_connectors);