aboutsummaryrefslogtreecommitdiff
path: root/drivers/mfd/glamo/glamo-cmdq.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2009-06-11 16:28:49 +0100
committerThomas White <taw@bitwiz.org.uk>2009-06-11 16:28:49 +0100
commitd8e4b9ff4dc8bf57e53fa174f977c8fb00ec4e90 (patch)
treebc79de4a44ba183014c75f430c180e514e7b40e9 /drivers/mfd/glamo/glamo-cmdq.c
parent3a83621f0e6a52eff7402702b0774092cc7b0187 (diff)
Front buffer kludge
This makes the GEM "info" ioctl produce an object handle which can be used to refer to the front buffer (i.e. screen pixmap) in Xorg or otherwise. This is unfortunately necessary since this memory is allocated in the kernel by the framebuffer driver, and is not available to DRM until we move to KMS. Signed-off-by: Thomas White <taw@bitwiz.org.uk>
Diffstat (limited to 'drivers/mfd/glamo/glamo-cmdq.c')
-rw-r--r--drivers/mfd/glamo/glamo-cmdq.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/mfd/glamo/glamo-cmdq.c b/drivers/mfd/glamo/glamo-cmdq.c
index 32fad98be8a..3c410f828da 100644
--- a/drivers/mfd/glamo/glamo-cmdq.c
+++ b/drivers/mfd/glamo/glamo-cmdq.c
@@ -243,6 +243,7 @@ static int glamo_do_relocation(struct glamodrm_handle *gdrm,
struct drm_file *file_priv)
{
u32 *handles;
+ u32 front_handle;
int *offsets;
int nobjs = cbuf->nobjs;
int i;
@@ -259,6 +260,8 @@ static int glamo_do_relocation(struct glamodrm_handle *gdrm,
if ( copy_from_user(offsets, cbuf->obj_pos, nobjs*sizeof(int)) )
return -1;
+ front_handle = gdrm->front_buffer_handle;
+
for ( i=0; i<nobjs; i++ ) {
u32 handle = handles[i];
@@ -277,22 +280,29 @@ static int glamo_do_relocation(struct glamodrm_handle *gdrm,
goto fail;
}
- obj = drm_gem_object_lookup(dev, file_priv, handle);
- if ( obj == NULL ) return -1;
+ if ( handle == front_handle ) {
- /* Unref the object now, or it'll never get freed.
- * This should really happen after the GPU has finished
- * the commands which are about to be submitted. */
- drm_gem_object_unreference(obj);
+ addr = GLAMO_OFFSET_FRAMEBUFFER;
- gobj = obj->driver_private;
- if ( gobj == NULL ) {
- printk(KERN_WARNING "[glamo-drm] This object has no "
- "private data!\n");
- goto fail;
+ } else {
+ obj = drm_gem_object_lookup(dev, file_priv, handle);
+ if ( obj == NULL ) return -1;
+
+ /* Unref the object now, or it'll never get freed.
+ * This should really happen after the GPU has finished
+ * the commands which are about to be submitted. */
+ drm_gem_object_unreference(obj);
+
+ gobj = obj->driver_private;
+ if ( gobj == NULL ) {
+ printk(KERN_WARNING "[glamo-drm] This object "
+ "has no private data!\n");
+ goto fail;
+ }
+
+ addr = GLAMO_OFFSET_WORK + gobj->block->start;
}
- addr = GLAMO_OFFSET_WORK + gobj->block->start;
addr_low = addr & 0xffff;
addr_high = (addr >> 16) & 0x7f;
printk(KERN_INFO "Addr low 0x%x, high 0x%x\n",