From: Alan Cox <alan@linux.jf.intel.com>
To: greg@kroah.com, linux-kernel@vger.kernel.org
Subject: [PATCH 4/9] gma500: Add a test ioctl for issuing 2D accel ops via user space
Date: Fri, 01 Apr 2011 18:41:30 +0100 [thread overview]
Message-ID: <20110401174128.18112.72945.stgit@localhost.localdomain> (raw)
In-Reply-To: <20110401173554.18112.67483.stgit@localhost.localdomain>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
drivers/staging/gma500/psb_2d.c | 2 +-
drivers/staging/gma500/psb_drv.h | 3 +++
drivers/staging/gma500/psb_fb.c | 26 ++++++++++++++++++++++++++
3 files changed, 30 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/gma500/psb_2d.c b/drivers/staging/gma500/psb_2d.c
index 9a0691f..94bce5c 100644
--- a/drivers/staging/gma500/psb_2d.c
+++ b/drivers/staging/gma500/psb_2d.c
@@ -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;
diff --git a/drivers/staging/gma500/psb_drv.h b/drivers/staging/gma500/psb_drv.h
index 7361fbf..8c1eceb 100644
--- a/drivers/staging/gma500/psb_drv.h
+++ b/drivers/staging/gma500/psb_drv.h
@@ -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
*/
diff --git a/drivers/staging/gma500/psb_fb.c b/drivers/staging/gma500/psb_fb.c
index 6c75df5..6499f28 100644
--- a/drivers/staging/gma500/psb_fb.c
+++ b/drivers/staging/gma500/psb_fb.c
@@ -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
next prev parent reply other threads:[~2011-04-01 18:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-01 17:37 [PATCH 0/9] psb: further clean up and some more fixes Alan Cox
2011-04-01 17:41 ` [PATCH 1/9] gma500: Another file we don't need Alan Cox
2011-04-01 17:41 ` [PATCH 2/9] gma500: kill some more #if 0 bits Alan Cox
2011-04-01 17:41 ` [PATCH 3/9] gma500: Fix some set up bugs found by comparing driver versions Alan Cox
2011-04-01 17:41 ` Alan Cox [this message]
2011-04-05 18:35 ` [PATCH 4/9] staging: gma500: Add a test ioctl for issuing 2D accel ops via user space Greg KH
2011-04-01 17:41 ` [PATCH 5/9] gma500: prune more unused fields Alan Cox
2011-04-01 17:42 ` [PATCH 6/9] gma500: begin tidying up the power management Alan Cox
2011-04-01 17:42 ` [PATCH 7/9] gma500: cleanup the SDVO messages Alan Cox
2011-04-01 17:42 ` [PATCH 8/9] gma500: Set the TWOD base Alan Cox
2011-04-01 17:44 ` [PATCH 9/9] gma500: psb_reset actually holds lid functions Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110401174128.18112.72945.stgit@localhost.localdomain \
--to=alan@linux.jf.intel.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox