summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/dri/drm
diff options
context:
space:
mode:
authorGeorge Sapountzis <[email protected]>2010-07-18 18:23:36 +0300
committerGeorge Sapountzis <[email protected]>2010-07-30 23:43:26 +0300
commit873ddf547d5aeb68f37a172d73131c6bc51101f6 (patch)
treea8f9253527ccc3d1a4661438b8567ad290257995 /src/gallium/state_trackers/dri/drm
parenta30b966f8345cb99922a416fce2da6edb70f864c (diff)
st/dri: move backend hooks to appropriate object
Diffstat (limited to 'src/gallium/state_trackers/dri/drm')
-rw-r--r--src/gallium/state_trackers/dri/drm/dri2.c45
1 files changed, 38 insertions, 7 deletions
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index 9965d706c89..88ffa1e89d3 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -507,9 +507,6 @@ dri2_init_screen(__DRIscreen * sPriv)
screen->sPriv = sPriv;
screen->fd = sPriv->fd;
- screen->lookup_egl_image = dri2_lookup_egl_image;
- screen->allocate_textures = dri2_allocate_textures;
- screen->flush_frontbuffer = dri2_flush_frontbuffer;
sPriv->private = (void *)screen;
sPriv->extensions = dri_screen_extensions;
@@ -531,16 +528,52 @@ fail:
return NULL;
}
+static boolean
+dri2_create_context(gl_api api, const __GLcontextModes * visual,
+ __DRIcontext * cPriv, void *sharedContextPrivate)
+{
+ struct dri_context *ctx = NULL;
+
+ if (!dri_create_context(api, visual, cPriv, sharedContextPrivate))
+ return FALSE;
+
+ ctx = cPriv->driverPrivate;
+
+ ctx->lookup_egl_image = dri2_lookup_egl_image;
+
+ return TRUE;
+}
+
+static boolean
+dri2_create_buffer(__DRIscreen * sPriv,
+ __DRIdrawable * dPriv,
+ const __GLcontextModes * visual, boolean isPixmap)
+{
+ struct dri_drawable *drawable = NULL;
+
+ if (!dri_create_buffer(sPriv, dPriv, visual, isPixmap))
+ return FALSE;
+
+ drawable = dPriv->driverPrivate;
+
+ drawable->allocate_textures = dri2_allocate_textures;
+ drawable->flush_frontbuffer = dri2_flush_frontbuffer;
+
+ return TRUE;
+}
+
/**
* DRI driver virtual function table.
*
* DRI versions differ in their implementation of init_screen and swap_buffers.
*/
const struct __DriverAPIRec driDriverAPI = {
+ .InitScreen = NULL,
+ .InitScreen2 = dri2_init_screen,
.DestroyScreen = dri_destroy_screen,
- .CreateContext = dri_create_context,
+ .CreateContext = dri2_create_context,
.DestroyContext = dri_destroy_context,
- .CreateBuffer = dri_create_buffer,
+ .CreateBuffer = dri2_create_buffer,
.DestroyBuffer = dri_destroy_buffer,
.MakeCurrent = dri_make_current,
.UnbindContext = dri_unbind_context,
@@ -548,9 +581,7 @@ const struct __DriverAPIRec driDriverAPI = {
.GetSwapInfo = NULL,
.GetDrawableMSC = NULL,
.WaitForMSC = NULL,
- .InitScreen2 = dri2_init_screen,
- .InitScreen = NULL,
.SwapBuffers = NULL,
.CopySubBuffer = NULL,
};