summaryrefslogtreecommitdiff
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2010-11-03 21:41:48 +0100
committerJerome Glisse <jglisse@redhat.com>2010-11-08 13:44:54 -0500
commit46c19700676e17bfaa0a88346d512449fbeede79 (patch)
tree68b51735e4fc4ade14fcb79e78a56c24e339bc2a /src/gallium/winsys
parent10b9e018ca4b37c66a6e0215d4551ed74b4981a6 (diff)
r600g: implement texture_get_handle (needed for eglExportDRMImageMESA)
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/r600/drm/r600_bo.c28
-rw-r--r--src/gallium/winsys/r600/drm/r600_priv.h3
-rw-r--r--src/gallium/winsys/r600/drm/radeon_bo.c16
3 files changed, 46 insertions, 1 deletions
diff --git a/src/gallium/winsys/r600/drm/r600_bo.c b/src/gallium/winsys/r600/drm/r600_bo.c
index 9b9aec5f64..251f009a6b 100644
--- a/src/gallium/winsys/r600/drm/r600_bo.c
+++ b/src/gallium/winsys/r600/drm/r600_bo.c
@@ -26,9 +26,10 @@
#include <pipe/p_compiler.h>
#include <pipe/p_screen.h>
#include <pipebuffer/pb_bufmgr.h>
-#include "radeon_drm.h"
+#include "state_tracker/drm_driver.h"
#include "r600_priv.h"
#include "r600d.h"
+#include "drm.h"
#include "radeon_drm.h"
struct r600_bo *r600_bo(struct radeon *radeon,
@@ -154,3 +155,28 @@ unsigned r600_bo_get_size(struct r600_bo *pb_bo)
return bo->size;
}
+
+boolean r600_bo_get_winsys_handle(struct radeon *radeon, struct r600_bo *pb_bo,
+ unsigned stride, struct winsys_handle *whandle)
+{
+ struct radeon_bo *bo;
+
+ bo = radeon_bo_pb_get_bo(pb_bo->pb);
+ if (!bo)
+ return FALSE;
+
+ whandle->stride = stride;
+ switch(whandle->type) {
+ case DRM_API_HANDLE_TYPE_KMS:
+ whandle->handle = r600_bo_get_handle(pb_bo);
+ break;
+ case DRM_API_HANDLE_TYPE_SHARED:
+ if (radeon_bo_get_name(radeon, bo, &whandle->handle))
+ return FALSE;
+ break;
+ default:
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h
index 97c582397a..9fd77b71c7 100644
--- a/src/gallium/winsys/r600/drm/r600_priv.h
+++ b/src/gallium/winsys/r600/drm/r600_priv.h
@@ -102,6 +102,9 @@ int radeon_bo_get_tiling_flags(struct radeon *radeon,
struct radeon_bo *bo,
uint32_t *tiling_flags,
uint32_t *pitch);
+int radeon_bo_get_name(struct radeon *radeon,
+ struct radeon_bo *bo,
+ uint32_t *name);
/* radeon_bo_pb.c */
struct radeon_bo *radeon_bo_pb_get_bo(struct pb_buffer *_buf);
diff --git a/src/gallium/winsys/r600/drm/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c
index dcee00de86..3054782838 100644
--- a/src/gallium/winsys/r600/drm/radeon_bo.c
+++ b/src/gallium/winsys/r600/drm/radeon_bo.c
@@ -216,3 +216,19 @@ int radeon_bo_get_tiling_flags(struct radeon *radeon,
*pitch = args.pitch;
return ret;
}
+
+int radeon_bo_get_name(struct radeon *radeon,
+ struct radeon_bo *bo,
+ uint32_t *name)
+{
+ struct drm_gem_flink flink;
+ int ret;
+
+ flink.handle = bo->handle;
+ ret = drmIoctl(radeon->fd, DRM_IOCTL_GEM_FLINK, &flink);
+ if (ret)
+ return ret;
+
+ *name = flink.name;
+ return ret;
+}