summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/dri/common/dri_st_api.c
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2010-04-06 18:55:40 +0800
committerChia-I Wu <olv@lunarg.com>2010-04-06 19:32:27 +0800
commit7915151f2d05e175d00e739e9a3fead922e60096 (patch)
treee66147a7201ffe5c65723ffc2031e562517b58d5 /src/gallium/state_trackers/dri/common/dri_st_api.c
parent216c76c820339729a6c17237cf4d1478a1e9e2be (diff)
st/dri: Implement DRI image extension.
Diffstat (limited to 'src/gallium/state_trackers/dri/common/dri_st_api.c')
-rw-r--r--src/gallium/state_trackers/dri/common/dri_st_api.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri_st_api.c b/src/gallium/state_trackers/dri/common/dri_st_api.c
index 1a5259c68b..561e6aa3b6 100644
--- a/src/gallium/state_trackers/dri/common/dri_st_api.c
+++ b/src/gallium/state_trackers/dri/common/dri_st_api.c
@@ -224,6 +224,31 @@ _dri_put_st_api(void)
}
}
+static boolean
+dri_st_manager_get_egl_image(struct st_manager *smapi,
+ struct st_egl_image *stimg)
+{
+ __DRIimage *img = NULL;
+
+#ifndef __NOT_HAVE_DRM_H
+ if (!__dri1_api_hooks) {
+ struct dri_context *ctx = (struct dri_context *)
+ stimg->stctxi->st_manager_private;
+ img = dri2_lookup_egl_image(ctx, stimg->egl_image);
+ }
+#endif
+ if (!img)
+ return FALSE;
+
+ stimg->texture = NULL;
+ pipe_texture_reference(&stimg->texture, img->texture);
+ stimg->face = img->face;
+ stimg->level = img->level;
+ stimg->zslice = img->zslice;
+
+ return TRUE;
+}
+
/**
* Create a state tracker manager from the given screen.
*/
@@ -235,6 +260,7 @@ dri_create_st_manager(struct dri_screen *screen)
smapi = CALLOC_STRUCT(st_manager);
if (smapi) {
smapi->screen = screen->pipe_screen;
+ smapi->get_egl_image = dri_st_manager_get_egl_image;
_dri_get_st_api();
}