summaryrefslogtreecommitdiffstats
path: root/src/glx/dri_glx.c
diff options
context:
space:
mode:
authorKristian Høgsberg <[email protected]>2010-07-22 21:24:14 -0400
committerKristian Høgsberg <[email protected]>2010-07-22 22:16:32 -0400
commit31819830b66a49f1b62e09090cc65aefc657aeb8 (patch)
tree4f818e5a2151cb673b73f901454b1d126227eb64 /src/glx/dri_glx.c
parentab434f6b7641a64d30725a9ac24929240362d466 (diff)
glx: Allocate the __GLXcontext in the DRI drivers
Diffstat (limited to 'src/glx/dri_glx.c')
-rw-r--r--src/glx/dri_glx.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index 369d07a27fe..959fc7425a4 100644
--- a/src/glx/dri_glx.c
+++ b/src/glx/dri_glx.c
@@ -78,7 +78,8 @@ struct dri_screen
struct dri_context
{
- __GLXDRIcontext base;
+ __GLXcontext base;
+ __GLXDRIcontext dri_vtable;
__DRIcontext *driContext;
XID hwContextID;
__GLXscreenConfigs *psc;
@@ -91,6 +92,11 @@ struct dri_drawable
__DRIdrawable *driDrawable;
};
+static const struct glx_context_vtable dri_context_vtable = {
+ NULL,
+ NULL,
+};
+
/*
* Given a display pointer and screen number, determine the name of
* the DRI driver for the screen. (I.e. "r128", "tdfx", etc).
@@ -497,11 +503,10 @@ CallCreateNewScreen(Display *dpy, int scrn, struct dri_screen *psc,
}
static void
-driDestroyContext(__GLXDRIcontext * context,
- __GLXscreenConfigs *base, Display * dpy)
+driDestroyContext(__GLXcontext * context)
{
struct dri_context *pcp = (struct dri_context *) context;
- struct dri_screen *psc = (struct dri_screen *) base;
+ struct dri_screen *psc = (struct dri_screen *) context->psc;
(*psc->core->destroyContext) (pcp->driContext);
@@ -510,7 +515,7 @@ driDestroyContext(__GLXDRIcontext * context,
}
static Bool
-driBindContext(__GLXDRIcontext *context,
+driBindContext(__GLXcontext *context,
__GLXDRIdrawable *draw, __GLXDRIdrawable *read)
{
struct dri_context *pcp = (struct dri_context *) context;
@@ -523,7 +528,7 @@ driBindContext(__GLXDRIcontext *context,
}
static void
-driUnbindContext(__GLXDRIcontext * context)
+driUnbindContext(__GLXcontext * context)
{
struct dri_context *pcp = (struct dri_context *) context;
struct dri_screen *psc = (struct dri_screen *) pcp->psc;
@@ -531,10 +536,10 @@ driUnbindContext(__GLXDRIcontext * context)
(*psc->core->unbindContext) (pcp->driContext);
}
-static __GLXDRIcontext *
+static __GLXcontext *
driCreateContext(__GLXscreenConfigs *base,
const __GLcontextModes * mode,
- GLXContext gc, GLXContext shareList, int renderType)
+ GLXContext shareList, int renderType)
{
struct dri_context *pcp, *pcp_shared;
struct dri_screen *psc = (struct dri_screen *) base;
@@ -554,7 +559,12 @@ driCreateContext(__GLXscreenConfigs *base,
if (pcp == NULL)
return NULL;
- pcp->psc = &psc->base;
+ memset(pcp, 0, sizeof *pcp);
+ if (!glx_context_init(&pcp->base, &psc->base, mode)) {
+ Xfree(pcp);
+ return NULL;
+ }
+
if (!XF86DRICreateContextWithConfig(psc->base.dpy, psc->base.scr,
mode->visualID,
&pcp->hwContextID, &hwContext)) {
@@ -572,9 +582,11 @@ driCreateContext(__GLXscreenConfigs *base,
return NULL;
}
- pcp->base.destroyContext = driDestroyContext;
- pcp->base.bindContext = driBindContext;
- pcp->base.unbindContext = driUnbindContext;
+ pcp->base.vtable = &dri_context_vtable;
+ pcp->base.driContext = &pcp->dri_vtable;
+ pcp->dri_vtable.destroyContext = driDestroyContext;
+ pcp->dri_vtable.bindContext = driBindContext;
+ pcp->dri_vtable.unbindContext = driUnbindContext;
return &pcp->base;
}
@@ -673,11 +685,6 @@ driDestroyScreen(__GLXscreenConfigs *base)
dlclose(psc->driver);
}
-static const struct glx_context_vtable dri_context_vtable = {
- NULL,
- NULL,
-};
-
#ifdef __DRI_SWAP_BUFFER_COUNTER
static int
@@ -884,8 +891,6 @@ driCreateScreen(int screen, __GLXdisplayPrivate *priv)
psp->setSwapInterval = driSetSwapInterval;
psp->getSwapInterval = driGetSwapInterval;
- psc->base.direct_context_vtable = &dri_context_vtable;
-
return &psc->base;
}