summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-08-11 17:09:39 +0800
committerBrian Paul <brianp@vmware.com>2009-08-18 08:44:34 -0600
commit2f2cf461c57974abd89e4917945cc8ae6a67a72e (patch)
tree0548e5d4fc90f8603bfe019783cd041f5f8adb94 /src/gallium
parent521dea21d46b4012653a4998d92ac0f6c0d1a8d4 (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 <olvaffe@gmail.com>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/egl/egl_context.c24
-rw-r--r--src/gallium/state_trackers/egl/egl_surface.c49
-rw-r--r--src/gallium/state_trackers/egl/egl_tracker.c7
-rw-r--r--src/gallium/state_trackers/egl/egl_tracker.h33
-rw-r--r--src/gallium/winsys/egl_xlib/egl_xlib.c154
5 files changed, 102 insertions, 165 deletions
diff --git a/src/gallium/state_trackers/egl/egl_context.c b/src/gallium/state_trackers/egl/egl_context.c
index 2c8f51cf38..52b6453d29 100644
--- a/src/gallium/state_trackers/egl/egl_context.c
+++ b/src/gallium/state_trackers/egl/egl_context.c
@@ -83,23 +83,16 @@ const struct dri_extension card_extensions[] = {
{NULL, NULL}
};
-EGLContext
-drm_create_context(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list)
+_EGLContext *
+drm_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, _EGLContext *share_list, const EGLint *attrib_list)
{
struct drm_device *dev = (struct drm_device *)drv;
struct drm_context *ctx;
struct drm_context *share = NULL;
struct st_context *st_share = NULL;
- _EGLConfig *conf;
int i;
__GLcontextModes *visual;
- conf = _eglLookupConfig(drv, dpy, config);
- if (!conf) {
- _eglError(EGL_BAD_CONFIG, "eglCreateContext");
- return EGL_NO_CONTEXT;
- }
-
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
switch (attrib_list[i]) {
/* no attribs defined for now */
@@ -129,25 +122,20 @@ drm_create_context(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext
if (!ctx->st)
goto err_gl;
- /* link to display */
- _eglLinkContext(&ctx->base, _eglLookupDisplay(dpy));
- assert(_eglGetContextHandle(&ctx->base));
-
- return _eglGetContextHandle(&ctx->base);
+ return &ctx->base;
err_gl:
ctx->pipe->destroy(ctx->pipe);
err_pipe:
free(ctx);
err_c:
- return EGL_NO_CONTEXT;
+ return NULL;
}
EGLBoolean
-drm_destroy_context(_EGLDriver *drv, EGLDisplay dpy, EGLContext context)
+drm_destroy_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *context)
{
struct drm_context *c = lookup_drm_context(context);
- _eglUnlinkContext(&c->base);
if (!_eglIsContextBound(&c->base)) {
st_destroy_context(c->st);
c->pipe->destroy(c->pipe);
@@ -157,7 +145,7 @@ drm_destroy_context(_EGLDriver *drv, EGLDisplay dpy, EGLContext context)
}
EGLBoolean
-drm_make_current(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext context)
+drm_make_current(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *context)
{
struct drm_surface *readSurf = lookup_drm_surface(read);
struct drm_surface *drawSurf = lookup_drm_surface(draw);
diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c
index d4cd2d3c74..c66c48f848 100644
--- a/src/gallium/state_trackers/egl/egl_surface.c
+++ b/src/gallium/state_trackers/egl/egl_surface.c
@@ -178,22 +178,22 @@ drm_takedown_shown_screen(_EGLDriver *drv, struct drm_screen *screen)
screen->shown = 0;
}
-EGLSurface
-drm_create_window_surface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list)
+_EGLSurface *
+drm_create_window_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativeWindowType window, const EGLint *attrib_list)
{
- return EGL_NO_SURFACE;
+ return NULL;
}
-EGLSurface
-drm_create_pixmap_surface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list)
+_EGLSurface *
+drm_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativePixmapType pixmap, const EGLint *attrib_list)
{
- return EGL_NO_SURFACE;
+ return NULL;
}
-EGLSurface
-drm_create_pbuffer_surface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
+_EGLSurface *
+drm_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
const EGLint *attrib_list)
{
int i;
@@ -201,13 +201,6 @@ drm_create_pbuffer_surface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
int height = -1;
struct drm_surface *surf = NULL;
__GLcontextModes *visual;
- _EGLConfig *conf;
-
- conf = _eglLookupConfig(drv, dpy, config);
- if (!conf) {
- _eglError(EGL_BAD_CONFIG, "eglCreatePbufferSurface");
- return EGL_NO_CONTEXT;
- }
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
switch (attrib_list[i]) {
@@ -225,7 +218,7 @@ drm_create_pbuffer_surface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
if (width < 1 || height < 1) {
_eglError(EGL_BAD_ATTRIBUTE, "eglCreatePbufferSurface");
- return EGL_NO_SURFACE;
+ return NULL;
}
surf = (struct drm_surface *) calloc(1, sizeof(struct drm_surface));
@@ -245,17 +238,16 @@ drm_create_pbuffer_surface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
(void*)surf);
drm_visual_modes_destroy(visual);
- _eglLinkSurface(&surf->base, _eglLookupDisplay(dpy));
- return surf->base.Handle;
+ return &surf->base;
err_surf:
free(surf);
err:
- return EGL_NO_SURFACE;
+ return NULL;
}
-EGLSurface
-drm_create_screen_surface_mesa(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg,
+_EGLSurface *
+drm_create_screen_surface_mesa(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *cfg,
const EGLint *attrib_list)
{
EGLSurface surf = drm_create_pbuffer_surface(drv, dpy, cfg, attrib_list);
@@ -264,14 +256,13 @@ drm_create_screen_surface_mesa(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg,
}
EGLBoolean
-drm_show_screen_surface_mesa(_EGLDriver *drv, EGLDisplay dpy,
- EGLScreenMESA screen,
- EGLSurface surface, EGLModeMESA m)
+drm_show_screen_surface_mesa(_EGLDriver *drv, _EGLDisplay *dpy,
+ _EGLScreen *screen,
+ _EGLSurface *surface, _EGLMode *mode)
{
struct drm_device *dev = (struct drm_device *)drv;
struct drm_surface *surf = lookup_drm_surface(surface);
- struct drm_screen *scrn = lookup_drm_screen(dpy, screen);
- _EGLMode *mode = _eglLookupMode(dpy, m);
+ struct drm_screen *scrn = lookup_drm_screen(screen);
int ret;
unsigned int i, k;
@@ -361,11 +352,9 @@ err_bo:
}
EGLBoolean
-drm_destroy_surface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
+drm_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface)
{
struct drm_surface *surf = lookup_drm_surface(surface);
- _eglUnlinkSurface(&surf->base);
-
if (!_eglIsSurfaceBound(&surf->base)) {
if (surf->screen)
drm_takedown_shown_screen(drv, surf->screen);
@@ -376,7 +365,7 @@ drm_destroy_surface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
}
EGLBoolean
-drm_swap_buffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
+drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw)
{
struct drm_surface *surf = lookup_drm_surface(draw);
struct pipe_surface *back_surf;
diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c
index 521c91d895..107f45cbcb 100644
--- a/src/gallium/state_trackers/egl/egl_tracker.c
+++ b/src/gallium/state_trackers/egl/egl_tracker.c
@@ -129,9 +129,8 @@ drm_find_dpms(struct drm_device *dev, struct drm_screen *screen)
}
EGLBoolean
-drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
+drm_initialize(_EGLDriver *drv, _EGLDisplay *disp, EGLint *major, EGLint *minor)
{
- _EGLDisplay *disp = _eglLookupDisplay(dpy);
struct drm_device *dev = (struct drm_device *)drv;
struct drm_screen *screen = NULL;
drmModeConnectorPtr connector = NULL;
@@ -214,7 +213,7 @@ err_fd:
}
EGLBoolean
-drm_terminate(_EGLDriver *drv, EGLDisplay dpy)
+drm_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
{
struct drm_device *dev = (struct drm_device *)drv;
struct drm_screen *screen;
@@ -240,7 +239,7 @@ drm_terminate(_EGLDriver *drv, EGLDisplay dpy)
drmClose(dev->drmFD);
- _eglCleanupDisplay(_eglLookupDisplay(dpy));
+ _eglCleanupDisplay(dpy);
free(dev);
return EGL_TRUE;
diff --git a/src/gallium/state_trackers/egl/egl_tracker.h b/src/gallium/state_trackers/egl/egl_tracker.h
index 3b8836720d..25f70d885e 100644
--- a/src/gallium/state_trackers/egl/egl_tracker.h
+++ b/src/gallium/state_trackers/egl/egl_tracker.h
@@ -137,24 +137,21 @@ struct drm_screen
static INLINE struct drm_context *
-lookup_drm_context(EGLContext context)
+lookup_drm_context(_EGLContext *c)
{
- _EGLContext *c = _eglLookupContext(context);
return (struct drm_context *) c;
}
static INLINE struct drm_surface *
-lookup_drm_surface(EGLSurface surface)
+lookup_drm_surface(_EGLSurface *s)
{
- _EGLSurface *s = _eglLookupSurface(surface);
return (struct drm_surface *) s;
}
static INLINE struct drm_screen *
-lookup_drm_screen(EGLDisplay dpy, EGLScreenMESA screen)
+lookup_drm_screen(_EGLScreen *s)
{
- _EGLScreen *s = _eglLookupScreen(dpy, screen);
return (struct drm_screen *) s;
}
@@ -178,18 +175,18 @@ void drm_takedown_shown_screen(_EGLDriver *drv, struct drm_screen *screen);
* All function exported to the egl side.
*/
/*@{*/
-EGLBoolean drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor);
-EGLBoolean drm_terminate(_EGLDriver *drv, EGLDisplay dpy);
-EGLContext drm_create_context(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list);
-EGLBoolean drm_destroy_context(_EGLDriver *drv, EGLDisplay dpy, EGLContext context);
-EGLSurface drm_create_window_surface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list);
-EGLSurface drm_create_pixmap_surface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list);
-EGLSurface drm_create_pbuffer_surface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-EGLSurface drm_create_screen_surface_mesa(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg, const EGLint *attrib_list);
-EGLBoolean drm_show_screen_surface_mesa(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA m);
-EGLBoolean drm_destroy_surface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface);
-EGLBoolean drm_make_current(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext context);
-EGLBoolean drm_swap_buffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw);
+EGLBoolean drm_initialize(_EGLDriver *drv, _EGLDisplay *dpy, EGLint *major, EGLint *minor);
+EGLBoolean drm_terminate(_EGLDriver *drv, _EGLDisplay *dpy);
+_EGLContext *drm_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, _EGLContext *share_list, const EGLint *attrib_list);
+EGLBoolean drm_destroy_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *context);
+_EGLSurface *drm_create_window_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativeWindowType window, const EGLint *attrib_list);
+_EGLSurface *drm_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativePixmapType pixmap, const EGLint *attrib_list);
+_EGLSurface *drm_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, const EGLint *attrib_list);
+_EGLSurface *drm_create_screen_surface_mesa(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, const EGLint *attrib_list);
+EGLBoolean drm_show_screen_surface_mesa(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, _EGLSurface *surface, _EGLMode *mode);
+EGLBoolean drm_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface);
+EGLBoolean drm_make_current(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *context);
+EGLBoolean drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw);
/*@}*/
#endif
diff --git a/src/gallium/winsys/egl_xlib/egl_xlib.c b/src/gallium/winsys/egl_xlib/egl_xlib.c
index f409a3fd6b..ed7eab50dd 100644
--- a/src/gallium/winsys/egl_xlib/egl_xlib.c
+++ b/src/gallium/winsys/egl_xlib/egl_xlib.c
@@ -103,18 +103,16 @@ xlib_egl_driver(_EGLDriver *drv)
static INLINE struct xlib_egl_surface *
-lookup_surface(EGLSurface surf)
+lookup_surface(_EGLSurface *surf)
{
- _EGLSurface *surface = _eglLookupSurface(surf);
- return (struct xlib_egl_surface *) surface;
+ return (struct xlib_egl_surface *) surf;
}
static INLINE struct xlib_egl_context *
-lookup_context(EGLContext ctx)
+lookup_context(_EGLContext *ctx)
{
- _EGLContext *context = _eglLookupContext(ctx);
- return (struct xlib_egl_context *) context;
+ return (struct xlib_egl_context *) ctx;
}
@@ -133,13 +131,12 @@ bitcount(unsigned int n)
* Create the EGLConfigs. (one per X visual)
*/
static void
-create_configs(_EGLDriver *drv, EGLDisplay dpy)
+create_configs(_EGLDriver *drv, _EGLDisplay *disp)
{
static const EGLint all_apis = (EGL_OPENGL_ES_BIT |
EGL_OPENGL_ES2_BIT |
EGL_OPENVG_BIT |
EGL_OPENGL_BIT);
- _EGLDisplay *disp = _eglLookupDisplay(dpy);
XVisualInfo *visInfo, visTemplate;
int num_visuals, i;
@@ -194,7 +191,7 @@ create_configs(_EGLDriver *drv, EGLDisplay dpy)
* Called via eglInitialize(), drv->API.Initialize().
*/
static EGLBoolean
-xlib_eglInitialize(_EGLDriver *drv, EGLDisplay dpy,
+xlib_eglInitialize(_EGLDriver *drv, _EGLDisplay *dpy,
EGLint *minor, EGLint *major)
{
create_configs(drv, dpy);
@@ -213,7 +210,7 @@ xlib_eglInitialize(_EGLDriver *drv, EGLDisplay dpy,
* Called via eglTerminate(), drv->API.Terminate().
*/
static EGLBoolean
-xlib_eglTerminate(_EGLDriver *drv, EGLDisplay dpy)
+xlib_eglTerminate(_EGLDriver *drv, _EGLDisplay *dpy)
{
return EGL_TRUE;
}
@@ -342,24 +339,23 @@ flush_frontbuffer(struct pipe_winsys *pws,
/**
* Called via eglCreateContext(), drv->API.CreateContext().
*/
-static EGLContext
-xlib_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
- EGLContext share_list, const EGLint *attrib_list)
+static _EGLContext *
+xlib_eglCreateContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
+ _EGLContext *share_list, const EGLint *attrib_list)
{
struct xlib_egl_driver *xdrv = xlib_egl_driver(drv);
- _EGLConfig *conf = _eglLookupConfig(drv, dpy, config);
struct xlib_egl_context *ctx;
struct st_context *share_ctx = NULL; /* XXX fix */
__GLcontextModes visual;
ctx = CALLOC_STRUCT(xlib_egl_context);
if (!ctx)
- return EGL_NO_CONTEXT;
+ return NULL;
/* let EGL lib init the common stuff */
if (!_eglInitContext(drv, &ctx->Base, conf, attrib_list)) {
free(ctx);
- return EGL_NO_CONTEXT;
+ return NULL;
}
/* API-dependent context creation */
@@ -379,41 +375,33 @@ xlib_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
default:
_eglError(EGL_BAD_MATCH, "eglCreateContext(unsupported API)");
free(ctx);
- return EGL_NO_CONTEXT;
+ return NULL;
}
- _eglLinkContext(&ctx->Base, _eglLookupDisplay(dpy));
-
- return _eglGetContextHandle(&ctx->Base);
+ return &ctx->Base;
}
static EGLBoolean
-xlib_eglDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx)
+xlib_eglDestroyContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
{
struct xlib_egl_context *context = lookup_context(ctx);
- if (context) {
- _eglUnlinkContext(&context->Base);
- if (!_eglIsContextBound(&context->Base)) {
- /* API-dependent clean-up */
- switch (context->Base.ClientAPI) {
- case EGL_OPENGL_ES_API:
- case EGL_OPENVG_API:
- /* fall-through */
- case EGL_OPENGL_API:
- st_destroy_context(context->Context);
- break;
- default:
- assert(0);
- }
- free(context);
+
+ if (!_eglIsContextBound(&context->Base)) {
+ /* API-dependent clean-up */
+ switch (context->Base.ClientAPI) {
+ case EGL_OPENGL_ES_API:
+ case EGL_OPENVG_API:
+ /* fall-through */
+ case EGL_OPENGL_API:
+ st_destroy_context(context->Context);
+ break;
+ default:
+ assert(0);
}
- return EGL_TRUE;
- }
- else {
- _eglError(EGL_BAD_CONTEXT, "eglDestroyContext");
- return EGL_TRUE;
+ free(context);
}
+ return EGL_TRUE;
}
@@ -421,15 +409,15 @@ xlib_eglDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx)
* Called via eglMakeCurrent(), drv->API.MakeCurrent().
*/
static EGLBoolean
-xlib_eglMakeCurrent(_EGLDriver *drv, EGLDisplay dpy,
- EGLSurface draw, EGLSurface read, EGLContext ctx)
+xlib_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy,
+ _EGLSurface *draw, _EGLSurface *read, _EGLContext *ctx)
{
struct xlib_egl_context *context = lookup_context(ctx);
struct xlib_egl_surface *draw_surf = lookup_surface(draw);
struct xlib_egl_surface *read_surf = lookup_surface(read);
struct st_context *oldctx = st_get_current();
- if (!_eglMakeCurrent(drv, dpy, draw, read, context))
+ if (!_eglMakeCurrent(drv, dpy, draw, read, ctx))
return EGL_FALSE;
/* Flush before switching context. Check client API? */
@@ -488,31 +476,26 @@ choose_stencil_format(const __GLcontextModes *visual)
/**
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
*/
-static EGLSurface
-xlib_eglCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
+static _EGLSurface *
+xlib_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
NativeWindowType window, const EGLint *attrib_list)
{
struct xlib_egl_driver *xdrv = xlib_egl_driver(drv);
- _EGLDisplay *disp = _eglLookupDisplay(dpy);
- _EGLConfig *conf = _eglLookupConfig(drv, dpy, config);
-
struct xlib_egl_surface *surf;
__GLcontextModes visual;
uint width, height;
surf = CALLOC_STRUCT(xlib_egl_surface);
if (!surf)
- return EGL_NO_SURFACE;
+ return NULL;
/* Let EGL lib init the common stuff */
if (!_eglInitSurface(drv, &surf->Base, EGL_WINDOW_BIT,
conf, attrib_list)) {
free(surf);
- return EGL_NO_SURFACE;
+ return NULL;
}
- _eglLinkSurface(&surf->Base, disp);
-
/*
* Now init the Xlib and gallium stuff
*/
@@ -539,46 +522,35 @@ xlib_eglCreateWindowSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
st_resize_framebuffer(surf->Framebuffer, width, height);
- return _eglGetSurfaceHandle(&surf->Base);
+ return &surf->Base;
}
-static EGLSurface
-xlib_eglCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
+static _EGLSurface *
+xlib_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
const EGLint *attrib_list)
{
struct xlib_egl_driver *xdrv = xlib_egl_driver(drv);
- _EGLDisplay *disp = _eglLookupDisplay(dpy);
- _EGLConfig *conf = _eglLookupConfig(drv, dpy, config);
struct xlib_egl_surface *surf;
__GLcontextModes visual;
uint width, height;
EGLBoolean bind_texture;
- if (!disp) {
- _eglError(EGL_BAD_DISPLAY, "eglCreatePbufferSurface");
- return EGL_NO_SURFACE;
- }
- if (!conf) {
- _eglError(EGL_BAD_CONFIG, "eglCreatePbufferSurface");
- return EGL_NO_SURFACE;
- }
-
surf = CALLOC_STRUCT(xlib_egl_surface);
if (!surf) {
_eglError(EGL_BAD_ALLOC, "eglCreatePbufferSurface");
- return EGL_NO_SURFACE;
+ return NULL;
}
if (!_eglInitSurface(drv, &surf->Base, EGL_PBUFFER_BIT,
conf, attrib_list)) {
free(surf);
- return EGL_NO_SURFACE;
+ return NULL;
}
if (surf->Base.Width < 0 || surf->Base.Height < 0) {
_eglError(EGL_BAD_PARAMETER, "eglCreatePbufferSurface");
free(surf);
- return EGL_NO_SURFACE;
+ return NULL;
}
bind_texture = (surf->Base.TextureFormat != EGL_NO_TEXTURE);
@@ -588,19 +560,19 @@ xlib_eglCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
(surf->Base.TextureTarget != EGL_NO_TEXTURE && !bind_texture)) {
_eglError(EGL_BAD_MATCH, "eglCreatePbufferSurface");
free(surf);
- return EGL_NO_SURFACE;
+ return NULL;
}
/* a framebuffer of zero width or height confuses st */
if (width == 0 || height == 0) {
_eglError(EGL_BAD_MATCH, "eglCreatePbufferSurface");
free(surf);
- return EGL_NO_SURFACE;
+ return NULL;
}
/* no mipmap generation */
if (surf->Base.MipmapTexture) {
_eglError(EGL_BAD_MATCH, "eglCreatePbufferSurface");
free(surf);
- return EGL_NO_SURFACE;
+ return NULL;
}
surf->winsys = xdrv->winsys;
@@ -616,34 +588,27 @@ xlib_eglCreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
(void *) surf);
st_resize_framebuffer(surf->Framebuffer, width, height);
- return _eglLinkSurface(&surf->Base, disp);
+ return &surf->Base;
}
static EGLBoolean
-xlib_eglDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
+xlib_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface)
{
struct xlib_egl_surface *surf = lookup_surface(surface);
- if (surf) {
- _eglUnlinkSurface(&surf->Base);
- if (!_eglIsSurfaceBound(&surf->Base)) {
- if (surf->Base.Type != EGL_PBUFFER_BIT)
- XFreeGC(surf->Dpy, surf->Gc);
- st_unreference_framebuffer(surf->Framebuffer);
- free(surf);
- }
- return EGL_TRUE;
- }
- else {
- _eglError(EGL_BAD_SURFACE, "eglDestroySurface");
- return EGL_FALSE;
+ if (!_eglIsSurfaceBound(&surf->Base)) {
+ if (surf->Base.Type != EGL_PBUFFER_BIT)
+ XFreeGC(surf->Dpy, surf->Gc);
+ st_unreference_framebuffer(surf->Framebuffer);
+ free(surf);
}
+ return EGL_TRUE;
}
static EGLBoolean
-xlib_eglBindTexImage(_EGLDriver *drv, EGLDisplay dpy,
- EGLSurface surface, EGLint buffer)
+xlib_eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy,
+ _EGLSurface *surface, EGLint buffer)
{
struct xlib_egl_surface *xsurf = lookup_surface(surface);
struct xlib_egl_context *xctx;
@@ -680,12 +645,12 @@ xlib_eglBindTexImage(_EGLDriver *drv, EGLDisplay dpy,
/* flush properly */
if (eglGetCurrentSurface(EGL_DRAW) == surface) {
- xctx = lookup_context(eglGetCurrentContext());
+ xctx = lookup_context(_eglGetCurrentContext());
st_flush(xctx->Context, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME,
NULL);
}
else if (_eglIsSurfaceBound(&xsurf->Base)) {
- xctx = lookup_context(_eglGetContextHandle(xsurf->Base.Binding));
+ xctx = lookup_context(xsurf->Base.Binding);
if (xctx)
st_finish(xctx->Context);
}
@@ -700,7 +665,7 @@ xlib_eglBindTexImage(_EGLDriver *drv, EGLDisplay dpy,
static EGLBoolean
-xlib_eglReleaseTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface,
+xlib_eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
EGLint buffer)
{
struct xlib_egl_surface *xsurf = lookup_surface(surface);
@@ -722,7 +687,7 @@ xlib_eglReleaseTexImage(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface,
static EGLBoolean
-xlib_eglSwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
+xlib_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw)
{
/* error checking step: */
if (!_eglSwapBuffers(drv, dpy, draw))
@@ -831,4 +796,3 @@ _eglMain(_EGLDisplay *dpy, const char *args)
return &xdrv->Base;
}
-