dri: Pass the __DRIscreen and the __DRIscreen private back to image lookup
authorKristian Høgsberg <krh@bitplanet.net>
Thu, 23 Sep 2010 02:01:17 +0000 (22:01 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 23 Sep 2010 02:02:05 +0000 (22:02 -0400)
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.

include/GL/internal/dri_interface.h
src/egl/drivers/dri2/egl_dri2.c
src/gallium/include/state_tracker/st_api.h
src/gallium/state_trackers/dri/common/dri_context.h
src/gallium/state_trackers/dri/common/dri_screen.c
src/gallium/state_trackers/dri/common/dri_screen.h
src/gallium/state_trackers/dri/drm/dri2.c
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/dri_util.h
src/mesa/drivers/dri/intel/intel_fbo.c
src/mesa/drivers/dri/intel/intel_tex_image.c

index 5351a2ba4ab9744448dda749ecd4c6302659f805..9ee039bd90b17ce7b623444c7db93096544f23b0 100644 (file)
@@ -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);
 };
 
index 083f796f430104dbe6caa38d0d447236286a4bad..9c4ff560b1480aef79f7560b704ec89774d6e54e 100644 (file)
@@ -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");
index 8ea1554568971b923a33fcae66e56d8e9acd05aa..21e2165ed9e3bfe75299e670f4a2492f4f44bf49 100644 (file)
@@ -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);
 
index ffe9eba13c80295b03888e5ddbd3e89d281446ea..beb59c6f6846fdfa99c1174358ad16e2d48bddfd 100644 (file)
@@ -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 *
index 475a96d196716dba502362ff6703d25ddd589744..7e4b11d83f7e7b2d24e92f9b2ffb1d31bb668c83 100644 (file)
@@ -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)
index 849f399b2f8198674794ad3a5af9e95b25b919c3..d4eb8f454f0bcd75c19cc02305a3424090cfd766 100644 (file)
@@ -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 */
index 135f66c61da13f11b81182c47ba6d843c289519c..116afccb194e1b4b8056c99a02ae828759e3931b 100644 (file)
@@ -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;
 }
 
index f07c3da4bb62649708bd3b1adebf8456aeacdd18..d46f622d57322f63a60b3e5fcc880770784ced16 100644 (file)
@@ -880,6 +880,7 @@ dri2CreateNewScreen(int scrn, int fd,
     }
 
     psp->DriverAPI = driDriverAPI;
+    psp->loaderPrivate = data;
 
     driParseOptionInfo(&psp->optionInfo, __dri2ConfigOptions,
                       __dri2NConfigOptions);
index 5096d22cad386045d03b7b3ee908981d46875a7e..785beacd817e73b8bc0aa79ddc53e0e2e74f30aa 100644 (file)
@@ -539,6 +539,7 @@ struct __DRIscreenRec {
     driOptionCache optionInfo;
     driOptionCache optionCache;
    unsigned int api_mask;
+   void *loaderPrivate;
 };
 
 extern void
index 2693b5fa72e5ec9eb1cbe406dcd4761b7497c492..363a5c024257f64a0162c042fb19a0c2e461f086 100644 (file)
@@ -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;
 
index 7d33df35998e245d8c97967c81949352413828b6..b1ed7ee5e73b83c8ede927b98042529afd9ea31e 100644 (file)
@@ -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;