]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: gma500: Add a test ioctl for issuing 2D accel ops via user space
authorAlan Cox <alan@linux.jf.intel.com>
Fri, 1 Apr 2011 17:41:30 +0000 (18:41 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 5 Apr 2011 18:36:25 +0000 (11:36 -0700)
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/gma500/psb_2d.c
drivers/staging/gma500/psb_drv.h
drivers/staging/gma500/psb_fb.c

index 9a0691f75d15b2e66f64922fe094660e0854d657..94bce5c0648eea03decdec44d777cf598738f6ae 100644 (file)
@@ -84,7 +84,7 @@ static int psb_2d_wait_available(struct drm_psb_private *dev_priv,
 /* FIXME: Remember if we expose the 2D engine to the DRM we need to serialize
    it with console use */
 
-static int psbfb_2d_submit(struct drm_psb_private *dev_priv, uint32_t *cmdbuf,
+int psbfb_2d_submit(struct drm_psb_private *dev_priv, uint32_t *cmdbuf,
                           unsigned size)
 {
        int ret = 0;
index 7361fbfc0682b297dc8024ba2b303847800029f5..8c1ecebf69f1970396500811b5977fee9fc590de 100644 (file)
@@ -709,6 +709,9 @@ extern int psbfb_sync(struct fb_info *info);
 
 extern void psb_spank(struct drm_psb_private *dev_priv);
 
+extern int psbfb_2d_submit(struct drm_psb_private *dev_priv, uint32_t *cmdbuf,
+                          unsigned size);
+
 /*
  *psb_reset.c
  */
index 6c75df504c504bafb79af36ec04eafb3349935ff..6499f28cb2af7258e6adf571fab64bb314113f37 100644 (file)
@@ -270,6 +270,31 @@ static int psbfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
        return 0;
 }
 
+static int psbfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
+{
+       struct psb_fbdev *fbdev = info->par;
+       struct psb_framebuffer *psbfb = fbdev->pfb;
+       struct drm_device *dev = psbfb->base.dev;
+       struct drm_psb_private *dev_priv = dev->dev_private;
+       u32 __user *p = (u32 __user *)arg;
+       u32 l;
+       u32 buf[32];
+       switch (cmd) {
+       case 0x12345678:
+               if (!capable(CAP_SYS_RAWIO))
+                       return -EPERM;
+               if (get_user(l, p))
+                       return -EFAULT;
+               if (l > 32)
+                       return -EMSGSIZE;
+               if (copy_from_user(buf, p + 1, l))
+                       return -EFAULT;
+               psbfb_2d_submit(dev_priv, buf, l);
+               return 0;
+       default:
+               return -ENOTTY;
+       }
+}
 
 static struct fb_ops psbfb_ops = {
        .owner = THIS_MODULE,
@@ -282,6 +307,7 @@ static struct fb_ops psbfb_ops = {
        .fb_imageblit = psbfb_imageblit,
        .fb_mmap = psbfb_mmap,
        .fb_sync = psbfb_sync,
+       .fb_ioctl = psbfb_ioctl,
 };
 
 static struct drm_framebuffer *psb_framebuffer_create