summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/dri/common
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-04-06 18:55:40 +0800
committerChia-I Wu <[email protected]>2010-04-06 19:32:27 +0800
commit7915151f2d05e175d00e739e9a3fead922e60096 (patch)
treee66147a7201ffe5c65723ffc2031e562517b58d5 /src/gallium/state_trackers/dri/common
parent216c76c820339729a6c17237cf4d1478a1e9e2be (diff)
st/dri: Implement DRI image extension.
Diffstat (limited to 'src/gallium/state_trackers/dri/common')
-rw-r--r--src/gallium/state_trackers/dri/common/dri_st_api.c26
-rw-r--r--src/gallium/state_trackers/dri/common/dri_st_api.h9
2 files changed, 35 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 1a5259c68ba..561e6aa3b62 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();
}
diff --git a/src/gallium/state_trackers/dri/common/dri_st_api.h b/src/gallium/state_trackers/dri/common/dri_st_api.h
index 99a217bfa79..f41c1c6674c 100644
--- a/src/gallium/state_trackers/dri/common/dri_st_api.h
+++ b/src/gallium/state_trackers/dri/common/dri_st_api.h
@@ -33,6 +33,15 @@
struct dri_screen;
struct dri_drawable;
+struct __DRIimageRec {
+ struct pipe_texture *texture;
+ unsigned face;
+ unsigned level;
+ unsigned zslice;
+
+ void *loader_private;
+};
+
struct st_api *
dri_get_st_api(void);