mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-27 17:18:59 +00:00
bb39b8d99a
Update our copies of the brcm2708 patches to the latest rpi-3.10-y rebased against linux-3.10.y stable (3.10.32). This should hopefully make it easier for us in the future to leverage the raspberry/rpi-* branches. Signed-off-by: Florian Fainelli <florian@openwrt.org> SVN-Revision: 39770
92 lines
2.7 KiB
Diff
92 lines
2.7 KiB
Diff
From bae48dcebc8f847977f6077910afb93f754708d6 Mon Sep 17 00:00:00 2001
|
|
From: Siarhei Siamashka <siarhei.siamashka@gmail.com>
|
|
Date: Mon, 17 Jun 2013 13:32:11 +0300
|
|
Subject: [PATCH 069/174] fbdev: add FBIOCOPYAREA ioctl
|
|
|
|
Based on the patch authored by Ali Gholami Rudi at
|
|
https://lkml.org/lkml/2009/7/13/153
|
|
|
|
Provide an ioctl for userspace applications, but only if this operation
|
|
is hardware accelerated (otherwide it does not make any sense).
|
|
|
|
Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
|
|
---
|
|
drivers/video/fbmem.c | 30 ++++++++++++++++++++++++++++++
|
|
include/uapi/linux/fb.h | 5 +++++
|
|
2 files changed, 35 insertions(+)
|
|
|
|
--- a/drivers/video/fbmem.c
|
|
+++ b/drivers/video/fbmem.c
|
|
@@ -1074,6 +1074,25 @@ fb_blank(struct fb_info *info, int blank
|
|
return ret;
|
|
}
|
|
|
|
+static int fb_copyarea_user(struct fb_info *info,
|
|
+ struct fb_copyarea *copy)
|
|
+{
|
|
+ int ret = 0;
|
|
+ if (!lock_fb_info(info))
|
|
+ return -ENODEV;
|
|
+ if (copy->dx + copy->width > info->var.xres ||
|
|
+ copy->sx + copy->width > info->var.xres ||
|
|
+ copy->dy + copy->height > info->var.yres ||
|
|
+ copy->sy + copy->height > info->var.yres) {
|
|
+ ret = -EINVAL;
|
|
+ goto out;
|
|
+ }
|
|
+ info->fbops->fb_copyarea(info, copy);
|
|
+out:
|
|
+ unlock_fb_info(info);
|
|
+ return ret;
|
|
+}
|
|
+
|
|
static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
|
|
unsigned long arg)
|
|
{
|
|
@@ -1084,6 +1103,7 @@ static long do_fb_ioctl(struct fb_info *
|
|
struct fb_cmap cmap_from;
|
|
struct fb_cmap_user cmap;
|
|
struct fb_event event;
|
|
+ struct fb_copyarea copy;
|
|
void __user *argp = (void __user *)arg;
|
|
long ret = 0;
|
|
|
|
@@ -1193,6 +1213,15 @@ static long do_fb_ioctl(struct fb_info *
|
|
console_unlock();
|
|
unlock_fb_info(info);
|
|
break;
|
|
+ case FBIOCOPYAREA:
|
|
+ if (info->flags & FBINFO_HWACCEL_COPYAREA) {
|
|
+ /* only provide this ioctl if it is accelerated */
|
|
+ if (copy_from_user(©, argp, sizeof(copy)))
|
|
+ return -EFAULT;
|
|
+ ret = fb_copyarea_user(info, ©);
|
|
+ break;
|
|
+ }
|
|
+ /* fall through */
|
|
default:
|
|
if (!lock_fb_info(info))
|
|
return -ENODEV;
|
|
@@ -1345,6 +1374,7 @@ static long fb_compat_ioctl(struct file
|
|
case FBIOPAN_DISPLAY:
|
|
case FBIOGET_CON2FBMAP:
|
|
case FBIOPUT_CON2FBMAP:
|
|
+ case FBIOCOPYAREA:
|
|
arg = (unsigned long) compat_ptr(arg);
|
|
case FBIOBLANK:
|
|
ret = do_fb_ioctl(info, cmd, arg);
|
|
--- a/include/uapi/linux/fb.h
|
|
+++ b/include/uapi/linux/fb.h
|
|
@@ -34,6 +34,11 @@
|
|
#define FBIOPUT_MODEINFO 0x4617
|
|
#define FBIOGET_DISPINFO 0x4618
|
|
#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
|
|
+/*
|
|
+ * HACK: use 'z' in order not to clash with any other ioctl numbers which might
|
|
+ * be concurrently added to the mainline kernel
|
|
+ */
|
|
+#define FBIOCOPYAREA _IOW('z', 0x21, struct fb_copyarea)
|
|
|
|
#define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
|
|
#define FB_TYPE_PLANES 1 /* Non interleaved planes */
|