st_api: Give get_egl_image arguments directly to the function
authorJakob Borncrantz <jakob@vmware.com>
Fri, 21 May 2010 22:25:45 +0000 (23:25 +0100)
committerJakob Bornecrantz <jakob@vmware.com>
Fri, 21 May 2010 22:29:05 +0000 (23:29 +0100)
src/gallium/include/state_tracker/st_api.h
src/gallium/state_trackers/dri/common/dri_screen.c
src/gallium/state_trackers/egl/common/egl_g3d_st.c
src/mesa/state_tracker/st_manager.c

index e7efbf065f0a38bf128e0b3ec83d3e757365e98a..621bdae5c8528933c97ebe563dcc95b9c8255464 100644 (file)
@@ -146,10 +146,6 @@ struct st_context_resource
  */
 struct st_egl_image
 {
-   /* these fields are filled by the caller */
-   struct st_context_iface *stctxi;
-   void *egl_image;
-
    /* this is owned by the caller */
    struct pipe_resource *texture;
 
@@ -329,10 +325,22 @@ struct st_manager
    /**
     * Look up and return the info of an EGLImage.
     *
+    * This is used to implement for example EGLImageTargetTexture2DOES.
+    * The GLeglImageOES agrument of that call is passed directly to this
+    * function call and the information needed to access this is returned
+    * in the given struct out.
+    *
+    * @smapi: manager owning the caller context
+    * @stctx: caller context
+    * @egl_image: EGLImage that caller recived
+    * @out: return struct filled out with access information.
+    *
     * This function is optional.
     */
    boolean (*get_egl_image)(struct st_manager *smapi,
-                            struct st_egl_image *stimg);
+                            struct st_context_iface *stctx,
+                            void *egl_image,
+                            struct st_egl_image *out);
 
    /**
     * Query an manager param.
index 5decdb23b15b9d1f66885dacaecaf6349482d891..fa1a35deb329dc182c04c19e1b031dcbe6c1556e 100644 (file)
@@ -314,15 +314,17 @@ dri_get_swap_info(__DRIdrawable * dPriv, __DRIswapInfo * sInfo)
 
 static boolean
 dri_get_egl_image(struct st_manager *smapi,
-                             struct st_egl_image *stimg)
+                  struct st_context_iface *stctxi,
+                  void *egl_image,
+                  struct st_egl_image *stimg)
 {
    struct dri_context *ctx =
-      (struct dri_context *)stimg->stctxi->st_manager_private;
+      (struct dri_context *)stctxi->st_manager_private;
    struct dri_screen *screen = dri_screen(ctx->sPriv);
    __DRIimage *img = NULL;
 
    if (screen->lookup_egl_image) {
-      img = screen->lookup_egl_image(ctx, stimg->egl_image);
+      img = screen->lookup_egl_image(ctx, egl_image);
    }
 
    if (!img)
index 2d459d5a6c9b7e99d06fea97f37f4e179e6c9cff..cdf13140cb008cdb8adcf2dc5e81d52eb182db02 100644 (file)
@@ -206,10 +206,11 @@ egl_g3d_destroy_st_apis(void)
 
 static boolean
 egl_g3d_st_manager_get_egl_image(struct st_manager *smapi,
-                                 struct st_egl_image *stimg)
+                                 void *egl_image,
+                                 struct st_egl_image *out)
 {
    struct egl_g3d_st_manager *gsmapi = egl_g3d_st_manager(smapi);
-   EGLImageKHR handle = (EGLImageKHR) stimg->egl_image;
+   EGLImageKHR handle = (EGLImageKHR) egl_image;
    _EGLImage *img;
    struct egl_g3d_image *gimg;
 
@@ -224,11 +225,11 @@ egl_g3d_st_manager_get_egl_image(struct st_manager *smapi,
 
    gimg = egl_g3d_image(img);
 
-   stimg->texture = NULL;
-   pipe_resource_reference(&stimg->texture, gimg->texture);
-   stimg->face = gimg->face;
-   stimg->level = gimg->level;
-   stimg->zslice = gimg->zslice;
+   out->texture = NULL;
+   pipe_resource_reference(&out->texture, gimg->texture);
+   out->face = gimg->face;
+   out->level = gimg->level;
+   out->zslice = gimg->zslice;
 
    _eglUnlockMutex(&gsmapi->display->Mutex);
 
index d7523e4941e1a542497bac39511324354e3d6ac9..8c3dfb3f71f46308d1f774836bfc53b479775d7b 100644 (file)
@@ -756,9 +756,7 @@ st_manager_get_egl_image_surface(struct st_context *st,
       return NULL;
 
    memset(&stimg, 0, sizeof(stimg));
-   stimg.stctxi = &st->iface;
-   stimg.egl_image = eglimg;
-   if (!smapi->get_egl_image(smapi, &stimg))
+   if (!smapi->get_egl_image(smapi, &st->iface, eglimg, &stimg))
       return NULL;
 
    ps = smapi->screen->get_tex_surface(smapi->screen,