From fbc4a50eafe5d5023ef1c0a32d362c2166946164 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Wed, 24 Jun 2009 14:56:29 +0300 Subject: [PATCH 126/146] DSS2: OMAPFB: implement OMAPFB_GET_VRAM_INFO ioctl This ioctl can be used to guess how big buffers it is possible to reserve. Signed-off-by: Tomi Valkeinen --- drivers/video/omap2/omapfb/omapfb-ioctl.c | 18 ++++++++++++++++++ include/linux/omapfb.h | 8 ++++++++ 2 files changed, 26 insertions(+), 0 deletions(-) diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c index 257f7cb..70fb64e 100644 --- a/drivers/video/omap2/omapfb/omapfb-ioctl.c +++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c @@ -30,6 +30,7 @@ #include #include +#include #include "omapfb.h" @@ -475,6 +476,7 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg) enum omapfb_update_mode update_mode; int test_num; struct omapfb_memory_read memory_read; + struct omapfb_vram_info vram_info; } p; int r = 0; @@ -695,6 +697,22 @@ int omapfb_ioctl(struct fb_info *fbi, unsigned int cmd, unsigned long arg) break; + case OMAPFB_GET_VRAM_INFO: { + unsigned long vram, free, largest; + + DBG("ioctl GET_VRAM_INFO\n"); + + omap_vram_get_info(&vram, &free, &largest); + p.vram_info.total = vram; + p.vram_info.free = free; + p.vram_info.largest_free_block = largest; + + if (copy_to_user((void __user *)arg, &p.vram_info, + sizeof(p.vram_info))) + r = -EFAULT; + break; + } + default: dev_err(fbdev->dev, "Unknown ioctl 0x%x\n", cmd); r = -EINVAL; diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h index 5014d2e..0df0df9 100644 --- a/include/linux/omapfb.h +++ b/include/linux/omapfb.h @@ -56,6 +56,7 @@ #define OMAPFB_MEMORY_READ OMAP_IOR(58, struct omapfb_memory_read) #define OMAPFB_GET_OVERLAY_COLORMODE OMAP_IOR(59, struct omapfb_ovl_colormode) #define OMAPFB_WAITFORGO OMAP_IO(60) +#define OMAPFB_GET_VRAM_INFO OMAP_IOR(61, struct omapfb_vram_info) #define OMAPFB_CAPS_GENERIC_MASK 0x00000fff #define OMAPFB_CAPS_LCDC_MASK 0x00fff000 @@ -194,6 +195,13 @@ struct omapfb_ovl_colormode { struct fb_bitfield transp; }; +struct omapfb_vram_info { + __u32 total; + __u32 free; + __u32 largest_free_block; + __u32 reserved[5]; +}; + #ifdef __KERNEL__ #include -- 1.6.2.4