summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2010-09-22 22:01:17 -0400
committerKristian Høgsberg <krh@bitplanet.net>2010-09-22 22:02:05 -0400
commit17eace581d25a626a7d75d9d1205d012cbb14a6e (patch)
tree743e51cafdb23f5a59cec7813642296c5bcd04ed
parent1c2423999e35576bebd7962a907507a81eb79b07 (diff)
dri: Pass the __DRIscreen and the __DRIscreen private back to image lookup
We will typically have a current context when we need to lookup the image, but the lookup implementation don't need it so drop it.
-rw-r--r--include/GL/internal/dri_interface.h2
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c7
-rw-r--r--src/gallium/include/state_tracker/st_api.h1
-rw-r--r--src/gallium/state_trackers/dri/common/dri_context.h3
-rw-r--r--src/gallium/state_trackers/dri/common/dri_screen.c8
-rw-r--r--src/gallium/state_trackers/dri/common/dri_screen.h3
-rw-r--r--src/gallium/state_trackers/dri/drm/dri2.c10
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c1
-rw-r--r--src/mesa/drivers/dri/common/dri_util.h1
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_image.c4
11 files changed, 21 insertions, 23 deletions
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 5351a2ba4a..9ee039bd90 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -841,7 +841,7 @@ typedef struct __DRIimageLookupExtensionRec __DRIimageLookupExtension;
struct __DRIimageLookupExtensionRec {
__DRIextension base;
- __DRIimage *(*lookupEGLImage)(__DRIcontext *context, void *image,
+ __DRIimage *(*lookupEGLImage)(__DRIscreen *screen, void *image,
void *loaderPrivate);
};
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 083f796f43..9c4ff560b1 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -370,10 +370,9 @@ dri2_flush_front_buffer(__DRIdrawable * driDrawable, void *loaderPrivate)
}
static __DRIimage *
-dri2_lookup_egl_image(__DRIcontext *context, void *image, void *data)
+dri2_lookup_egl_image(__DRIscreen *screen, void *image, void *data)
{
- struct dri2_egl_context *dri2_ctx = data;
- _EGLDisplay *disp = dri2_ctx->base.Resource.Display;
+ _EGLDisplay *disp = data;
struct dri2_egl_image *dri2_img;
_EGLImage *img;
@@ -728,7 +727,7 @@ dri2_create_screen(_EGLDisplay *disp)
dri2_dpy = disp->DriverData;
dri2_dpy->dri_screen =
dri2_dpy->dri2->createNewScreen(0, dri2_dpy->fd, dri2_dpy->extensions,
- &dri2_dpy->driver_configs, dri2_dpy);
+ &dri2_dpy->driver_configs, disp);
if (dri2_dpy->dri_screen == NULL) {
_eglLog(_EGL_WARNING, "DRI2: failed to create dri screen");
diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
index 8ea1554568..21e2165ed9 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -384,7 +384,6 @@ struct st_manager
* This function is optional.
*/
boolean (*get_egl_image)(struct st_manager *smapi,
- struct st_context_iface *stctx,
void *egl_image,
struct st_egl_image *out);
diff --git a/src/gallium/state_trackers/dri/common/dri_context.h b/src/gallium/state_trackers/dri/common/dri_context.h
index ffe9eba13c..beb59c6f68 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.h
+++ b/src/gallium/state_trackers/dri/common/dri_context.h
@@ -61,9 +61,6 @@ struct dri_context
/* gallium */
struct st_api *stapi;
struct st_context_iface *st;
-
- /* hooks filled in by dri2 & drisw */
- __DRIimage * (*lookup_egl_image)(struct dri_context *ctx, void *handle);
};
static INLINE struct dri_context *
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
index 475a96d196..7e4b11d83f 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -287,16 +287,14 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
static boolean
dri_get_egl_image(struct st_manager *smapi,
- struct st_context_iface *stctxi,
void *egl_image,
struct st_egl_image *stimg)
{
- struct dri_context *ctx =
- (struct dri_context *)stctxi->st_manager_private;
+ struct dri_screen *screen = (struct dri_screen *)smapi;
__DRIimage *img = NULL;
- if (ctx->lookup_egl_image) {
- img = ctx->lookup_egl_image(ctx, egl_image);
+ if (screen->lookup_egl_image) {
+ img = screen->lookup_egl_image(screen, egl_image);
}
if (!img)
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h b/src/gallium/state_trackers/dri/common/dri_screen.h
index 849f399b2f..d4eb8f454f 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.h
+++ b/src/gallium/state_trackers/dri/common/dri_screen.h
@@ -69,6 +69,9 @@ struct dri_screen
boolean sd_depth_bits_last;
boolean auto_fake_front;
enum pipe_texture_target target;
+
+ /* hooks filled in by dri2 & drisw */
+ __DRIimage * (*lookup_egl_image)(struct dri_screen *ctx, void *handle);
};
/** cast wrapper */
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index 135f66c61d..116afccb19 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -291,15 +291,16 @@ dri2_flush_frontbuffer(struct dri_drawable *drawable,
}
static __DRIimage *
-dri2_lookup_egl_image(struct dri_context *ctx, void *handle)
+dri2_lookup_egl_image(struct dri_screen *screen, void *handle)
{
- __DRIimageLookupExtension *loader = ctx->sPriv->dri2.image;
+ __DRIimageLookupExtension *loader = screen->sPriv->dri2.image;
__DRIimage *img;
if (!loader->lookupEGLImage)
return NULL;
- img = loader->lookupEGLImage(ctx->cPriv, handle, ctx->cPriv->loaderPrivate);
+ img = loader->lookupEGLImage(screen->sPriv,
+ handle, screen->sPriv->loaderPrivate);
return img;
}
@@ -537,6 +538,7 @@ dri2_init_screen(__DRIscreen * sPriv)
screen->auto_fake_front = dri_with_format(sPriv);
screen->broken_invalidate = !sPriv->dri2.useInvalidate;
+ screen->lookup_egl_image = dri2_lookup_egl_image;
return configs;
fail:
@@ -556,8 +558,6 @@ dri2_create_context(gl_api api, const __GLcontextModes * visual,
ctx = cPriv->driverPrivate;
- ctx->lookup_egl_image = dri2_lookup_egl_image;
-
return TRUE;
}
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index f07c3da4bb..d46f622d57 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -880,6 +880,7 @@ dri2CreateNewScreen(int scrn, int fd,
}
psp->DriverAPI = driDriverAPI;
+ psp->loaderPrivate = data;
driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions,
__dri2NConfigOptions);
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index 5096d22cad..785beacd81 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -539,6 +539,7 @@ struct __DRIscreenRec {
driOptionCache optionInfo;
driOptionCache optionCache;
unsigned int api_mask;
+ void *loaderPrivate;
};
extern void
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index 2693b5fa72..363a5c0242 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -202,8 +202,8 @@ intel_image_target_renderbuffer_storage(GLcontext *ctx,
__DRIimage *image;
screen = intel->intelScreen->driScrnPriv;
- image = screen->dri2.image->lookupEGLImage(intel->driContext, image_handle,
- intel->driContext->loaderPrivate);
+ image = screen->dri2.image->lookupEGLImage(screen, image_handle,
+ screen->loaderPrivate);
if (image == NULL)
return;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 7d33df3599..b1ed7ee5e7 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -805,8 +805,8 @@ intel_image_target_texture_2d(GLcontext *ctx, GLenum target,
__DRIimage *image;
screen = intel->intelScreen->driScrnPriv;
- image = screen->dri2.image->lookupEGLImage(intel->driContext, image_handle,
- intel->driContext->loaderPrivate);
+ image = screen->dri2.image->lookupEGLImage(screen, image_handle,
+ screen->loaderPrivate);
if (image == NULL)
return;