aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2009-08-22 17:25:31 +0100
committerThomas White <taw@bitwiz.org.uk>2009-08-22 17:25:31 +0100
commitc2c4dbb6513bd938f5009e7b6293782dea37887d (patch)
treea5664e699b19983852b8fcfc45f841e74fa6a371 /drivers
parentb7629bbd863a3de9c7d8c2e699437d517bbd6f1d (diff)
Zero VRAM before passing to userspace
Signed-off-by: Thomas White <taw@bitwiz.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mfd/glamo/glamo-buffer.c4
-rw-r--r--drivers/mfd/glamo/glamo-cmdq.c18
-rw-r--r--drivers/mfd/glamo/glamo-cmdq.h2
3 files changed, 24 insertions, 0 deletions
diff --git a/drivers/mfd/glamo/glamo-buffer.c b/drivers/mfd/glamo/glamo-buffer.c
index abf867530aa..6529e5f51ac 100644
--- a/drivers/mfd/glamo/glamo-buffer.c
+++ b/drivers/mfd/glamo/glamo-buffer.c
@@ -50,6 +50,7 @@
#include <drm/glamo_drm.h>
#include "glamo-drm-private.h"
+#include "glamo-cmdq.h" /* For glamo_cmdq_blank() */
struct drm_gem_object *glamo_gem_object_alloc(struct drm_device *dev, int size,
@@ -79,6 +80,9 @@ struct drm_gem_object *glamo_gem_object_alloc(struct drm_device *dev, int size,
goto fail;
}
+ /* Arrange for the contents to be set to zero */
+ glamo_cmdq_blank(gdrm, obj);
+
return obj;
fail:
diff --git a/drivers/mfd/glamo/glamo-cmdq.c b/drivers/mfd/glamo/glamo-cmdq.c
index 6f14244af11..a96adc3cbd2 100644
--- a/drivers/mfd/glamo/glamo-cmdq.c
+++ b/drivers/mfd/glamo/glamo-cmdq.c
@@ -440,3 +440,21 @@ void glamo_cmdq_resume(struct glamodrm_handle *gdrm)
{
glamo_cmdq_init(gdrm);
}
+
+
+/* Initialise an object's contents to zero.
+ * This is in glamo-cmdq.c in the hope that we can accelerate it later. */
+void glamo_cmdq_blank(struct glamodrm_handle *gdrm, struct drm_gem_object *obj)
+{
+ char __iomem *cookie;
+ struct drm_glamo_gem_object *gobj;
+ int i;
+
+ gobj = obj->driver_private;
+
+ cookie = ioremap(gdrm->vram->start + gobj->block->start, obj->size);
+ for ( i=0; i<obj->size; i+=2 ) {
+ iowrite16(0, cookie+i);
+ }
+ iounmap(cookie);
+}
diff --git a/drivers/mfd/glamo/glamo-cmdq.h b/drivers/mfd/glamo/glamo-cmdq.h
index 8a518288eb4..4c003c61181 100644
--- a/drivers/mfd/glamo/glamo-cmdq.h
+++ b/drivers/mfd/glamo/glamo-cmdq.h
@@ -35,6 +35,8 @@ extern int glamo_ioctl_cmdbuf(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int glamo_ioctl_gem_wait_rendering(struct drm_device *dev, void *data,
struct drm_file *file_priv);
+extern void glamo_cmdq_blank(struct glamodrm_handle *gdrm,
+ struct drm_gem_object *obj);
extern int glamo_cmdq_init(struct glamodrm_handle *gdrm);
extern int glamo_cmdq_shutdown(struct glamodrm_handle *gdrm);