summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys/drm
diff options
context:
space:
mode:
authorCorbin Simpson <[email protected]>2009-07-05 11:55:47 -0700
committerCorbin Simpson <[email protected]>2009-07-05 11:55:47 -0700
commitc8e0d55ac6e7fcb778a8e884e27b84dba10fa5db (patch)
tree9ca8c206075dcb8f68705cb49a149bd35d898866 /src/gallium/winsys/drm
parentdf04e72d25cfcc5aaa574949b8634bc564df0644 (diff)
radeon-gallium: Use FLINK to do proper global buffers.
Diffstat (limited to 'src/gallium/winsys/drm')
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_buffer.c1
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_buffer.h5
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_drm.c22
3 files changed, 26 insertions, 2 deletions
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
index 93748e22567..263f684a8e0 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c
@@ -200,6 +200,7 @@ struct radeon_winsys* radeon_pipe_winsys(int fd)
return NULL;
}
+ radeon_ws->priv->fd = fd;
radeon_ws->priv->bom = radeon_bo_manager_gem_ctor(fd);
radeon_ws->base.flush_frontbuffer = radeon_flush_frontbuffer;
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h
index ca8bbb3c117..14c463d702c 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h
+++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h
@@ -48,11 +48,16 @@
struct radeon_pipe_buffer {
struct pipe_buffer base;
struct radeon_bo *bo;
+ boolean flinked;
+ uint32_t flink;
};
#define RADEON_MAX_BOS 24
struct radeon_winsys_priv {
+ /* DRM FD */
+ int fd;
+
/* Radeon BO manager. */
struct radeon_bo_manager* bom;
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
index 4cad96041f3..8561e124d0b 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
@@ -113,10 +113,28 @@ boolean radeon_global_handle_from_buffer(struct drm_api* api,
struct pipe_buffer* buffer,
unsigned* handle)
{
- /* XXX WTF is the difference here? global? */
+ int retval, fd;
+ struct drm_gem_flink flink;
struct radeon_pipe_buffer* radeon_buffer =
(struct radeon_pipe_buffer*)buffer;
- *handle = radeon_buffer->bo->handle;
+
+ if (!radeon_buffer->flinked) {
+ fd = ((struct radeon_winsys*)screen->winsys)->priv->fd;
+
+ flink.handle = radeon_buffer->bo->handle;
+
+ retval = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
+ if (retval) {
+ debug_printf("radeon: DRM_IOCTL_GEM_FLINK failed, error %d\n",
+ retval);
+ return FALSE;
+ }
+
+ radeon_buffer->flink = flink.name;
+ radeon_buffer->flinked = TRUE;
+ }
+
+ *handle = radeon_buffer->flink;
return TRUE;
}