Skip to contentSkip to conversation

OMAP_VOUT: Allow omap_vout to build without VRFB

PATCH Superseded Archit Taneja 2 participants 9 messages May 27, 2011 – Jun 13, 2011 Media (V4L/DVB)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover OMAP_VOUT: Allow omap_vout to build without VRFB

Introduce omap_vout_vrfb.c and omap_vout_vrfb.h, for all VRFB related API's, making OMAP_VOUT driver independent from VRFB. This is required for OMAP4 DSS, since OMAP4 doesn't have VRFB block.

A new enum called vout_rotation_type is introduced to differentiate between no rotation and vrfb rotation. A member rotation_type is introduced in omapvideo_info, this allows to call vrfb specific functions only if the rotation type is VOUT_ROT_VRFB. When the rotation_type is set to VOUT_ROT_NONE, the S_CTRL ioctl prevents the user setting a non zero rotation or non zero mirror value.

Archit Taneja (2):
OMAP_VOUT: CLEANUP: Move some functions and macros from omap_vout
OMAP_VOUT: Create separate file for VRFB related API's

 drivers/media/video/omap/Kconfig          |    7 +-
 drivers/media/video/omap/Makefile         |    1 +
 drivers/media/video/omap/omap_vout.c      |  562 +++++------------------------
 drivers/media/video/omap/omap_vout_vrfb.c |  390 ++++++++++++++++++++
 drivers/media/video/omap/omap_vout_vrfb.h |   40 ++
 drivers/media/video/omap/omap_voutdef.h   |   78 ++++
 drivers/media/video/omap/omap_voutlib.c   |   44 +++
 drivers/media/video/omap/omap_voutlib.h   |    2 +
 8 files changed, 644 insertions(+), 480 deletions(-)
 create mode 100644 drivers/media/video/omap/omap_vout_vrfb.c
 create mode 100644 drivers/media/video/omap/omap_vout_vrfb.h
#1 lore raw

PATCH 1/2 OMAP_VOUT: CLEANUP: Move some functions and macros from omap_vout

Move some inline functions from omap_vout.c to omap_voutdef.h and independent functions like omap_vout_alloc_buffer/omap_vout_free_buffer to omap_voutlib.c.

---
 drivers/media/video/omap/omap_vout.c    |  109 -------------------------------
 drivers/media/video/omap/omap_voutdef.h |   62 +++++++++++++++++
 drivers/media/video/omap/omap_voutlib.c |   44 ++++++++++++
 drivers/media/video/omap/omap_voutlib.h |    2 +
 4 files changed, 108 insertions(+), 109 deletions(-)
drivers/media/video/omap/omap_vout.c +0 -109
index 4ada9be..6433e7b 100644
@@ -35,17 +35,14 @@
 #include <linux/sched.h>
 #include <linux/types.h>
 #include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
 #include <linux/irq.h>
 #include <linux/videodev2.h>
-#include <linux/slab.h>
 
 #include <media/videobuf-dma-contig.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-ioctl.h>
 
 #include <plat/dma.h>
-#include <plat/vram.h>
 #include <plat/vrfb.h>
 #include <video/omapdss.h>
 
@@ -56,7 +53,6 @@ MODULE_AUTHOR("Texas Instruments");
 MODULE_DESCRIPTION("OMAP Video for Linux Video out driver");
 MODULE_LICENSE("GPL");
 
-
 /* Driver Configuration macros */
 #define VOUT_NAME		"omap_vout"
 
@@ -65,31 +61,6 @@ enum omap_vout_channels {
 	OMAP_VIDEO2,
 };
 
-enum dma_channel_state {
-	DMA_CHAN_NOT_ALLOTED,
-	DMA_CHAN_ALLOTED,
-};
-
-#define QQVGA_WIDTH		160
-#define QQVGA_HEIGHT		120
-
-/* Max Resolution supported by the driver */
-#define VID_MAX_WIDTH		1280	/* Largest width */
-#define VID_MAX_HEIGHT		720	/* Largest height */
-
-/* Mimimum requirement is 2x2 for DSS */
-#define VID_MIN_WIDTH		2
-#define VID_MIN_HEIGHT		2
-
-/* 2048 x 2048 is max res supported by OMAP display controller */
-#define MAX_PIXELS_PER_LINE     2048
-
-#define VRFB_TX_TIMEOUT         1000
-#define VRFB_NUM_BUFS		4
-
-/* Max buffer size tobe allocated during init */
-#define OMAP_VOUT_MAX_BUF_SIZE (VID_MAX_WIDTH*VID_MAX_HEIGHT*4)
-
 static struct videobuf_queue_ops video_vbq_ops;
 /* Variables configurable through module params*/
 static u32 video1_numbuffers = 3;
@@ -172,49 +143,6 @@ const static struct v4l2_fmtdesc omap_formats[] = {
 #define NUM_OUTPUT_FORMATS (ARRAY_SIZE(omap_formats))
 
 /*
- * Allocate buffers
- */
-static unsigned long omap_vout_alloc_buffer(u32 buf_size, u32 *phys_addr)
-{
-	u32 order, size;
-	unsigned long virt_addr, addr;
-
-	size = PAGE_ALIGN(buf_size);
-	order = get_order(size);
-	virt_addr = __get_free_pages(GFP_KERNEL | GFP_DMA, order);
-	addr = virt_addr;
-
-	if (virt_addr) {
-		while (size > 0) {
-			SetPageReserved(virt_to_page(addr));
-			addr += PAGE_SIZE;
-			size -= PAGE_SIZE;
-		}
-	}
-	*phys_addr = (u32) virt_to_phys((void *) virt_addr);
-	return virt_addr;
-}
-
-/*
- * Free buffers
- */
-static void omap_vout_free_buffer(unsigned long virtaddr, u32 buf_size)
-{
-	u32 order, size;
-	unsigned long addr = virtaddr;
-
-	size = PAGE_ALIGN(buf_size);
-	order = get_order(size);
-
-	while (size > 0) {
-		ClearPageReserved(virt_to_page(addr));
-		addr += PAGE_SIZE;
-		size -= PAGE_SIZE;
-	}
-	free_pages((unsigned long) virtaddr, order);
-}
-
-/*
  * Function for allocating video buffers
  */
 static int omap_vout_allocate_vrfb_buffers(struct omap_vout_device *vout,
@@ -369,43 +297,6 @@ static void omap_vout_release_vrfb(struct omap_vout_device *vout)
 }
 
 /*
- * Return true if rotation is 90 or 270
- */
-static inline int rotate_90_or_270(const struct omap_vout_device *vout)
-{
-	return (vout->rotation == dss_rotation_90_degree ||
-			vout->rotation == dss_rotation_270_degree);
-}
-
-/*
- * Return true if rotation is enabled
- */
-static inline int rotation_enabled(const struct omap_vout_device *vout)
-{
-	return vout->rotation || vout->mirror;
-}
-
-/*
- * Reverse the rotation degree if mirroring is enabled
- */
-static inline int calc_rotation(const struct omap_vout_device *vout)
-{
-	if (!vout->mirror)
-		return vout->rotation;
-
-	switch (vout->rotation) {
-	case dss_rotation_90_degree:
-		return dss_rotation_270_degree;
-	case dss_rotation_270_degree:
-		return dss_rotation_90_degree;
-	case dss_rotation_180_degree:
-		return dss_rotation_0_degree;
-	default:
-		return dss_rotation_180_degree;
-	}
-}
-
-/*
  * Free the V4L2 buffers
  */
 static void omap_vout_free_buffers(struct omap_vout_device *vout)
drivers/media/video/omap/omap_voutdef.h +62 -0

72 lines not on this page · raw message

drivers/media/video/omap/omap_voutlib.c +44 -0

53 lines not on this page · raw message

drivers/media/video/omap/omap_voutlib.h +2 -0
index a60b16e..1d722be 100644
@@ -30,5 +30,7 @@ extern int omap_vout_new_window(struct v4l2_rect *crop,
 extern void omap_vout_new_format(struct v4l2_pix_format *pix,
 		struct v4l2_framebuffer *fbuf, struct v4l2_rect *crop,
 		struct v4l2_window *win);
+extern unsigned long omap_vout_alloc_buffer(u32 buf_size, u32 *phys_addr);
+extern void omap_vout_free_buffer(unsigned long virtaddr, u32 buf_size);
 #endif	/* #ifndef OMAP_VOUTLIB_H */
 
Signature · 1 line
1.7.1
#4 lore raw

PATCH 2/2 OMAP_VOUT: Create separate file for VRFB related API's

In reply to Archit Taneja

Introduce omap_vout_vrfb.c and omap_vout_vrfb.h, for all VRFB related API's, making OMAP_VOUT driver independent from VRFB. This is required for OMAP4 DSS, since OMAP4 doesn't have VRFB block.

Added new enum vout_rotation_type and "rotation_type" member to omapvideo_info, this is initialized based on the arch type in omap_vout_probe. The rotation_type var is now used to choose between vrfb and non-vrfb calls.

---
 drivers/media/video/omap/Kconfig          |    7 +-
 drivers/media/video/omap/Makefile         |    1 +
 drivers/media/video/omap/omap_vout.c      |  453 ++++++-----------------------
 drivers/media/video/omap/omap_vout_vrfb.c |  390 +++++++++++++++++++++++++
 drivers/media/video/omap/omap_vout_vrfb.h |   40 +++
 drivers/media/video/omap/omap_voutdef.h   |   16 +
 6 files changed, 536 insertions(+), 371 deletions(-)
 create mode 100644 drivers/media/video/omap/omap_vout_vrfb.c
 create mode 100644 drivers/media/video/omap/omap_vout_vrfb.h
drivers/media/video/omap/Kconfig +5 -2
index e63233f..390ab09 100644
@@ -1,11 +1,14 @@
+config VIDEO_OMAP2_VOUT_VRFB
+	bool
+
 config VIDEO_OMAP2_VOUT
 	tristate "OMAP2/OMAP3 V4L2-Display driver"
 	depends on ARCH_OMAP2 || ARCH_OMAP3
 	select VIDEOBUF_GEN
 	select VIDEOBUF_DMA_CONTIG
 	select OMAP2_DSS
-	select OMAP2_VRAM
-	select OMAP2_VRFB
+	select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3
+	select VIDEO_OMAP2_VOUT_VRFB if VIDEO_OMAP2_VOUT && OMAP2_VRFB
 	default n
 	---help---
 	  V4L2 Display driver support for OMAP2/3 based boards.
drivers/media/video/omap/Makefile +1 -0
index b287880..fc410b4 100644
@@ -4,4 +4,5 @@
 
 # OMAP2/3 Display driver
 omap-vout-y := omap_vout.o omap_voutlib.o
+omap-vout-$(CONFIG_VIDEO_OMAP2_VOUT_VRFB) += omap_vout_vrfb.o
 obj-$(CONFIG_VIDEO_OMAP2_VOUT) += omap-vout.o
drivers/media/video/omap/omap_vout.c +85 -370

635 lines not on this page · raw message

drivers/media/video/omap/omap_vout_vrfb.c new file +390 -0

390 lines not on this page · raw message

drivers/media/video/omap/omap_vout_vrfb.h new file +40 -0
new file mode 100644
index 0000000..ffde741
@@ -0,0 +1,40 @@
+/*
+ * omap_vout_vrfb.h
+ *
+ * Copyright (C) 2010 Texas Instruments.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ *
+ */
+
+#ifndef OMAP_VOUT_VRFB_H
+#define OMAP_VOUT_VRFB_H
+
+#ifdef CONFIG_VIDEO_OMAP2_VOUT_VRFB
+void omap_vout_free_vrfb_buffers(struct omap_vout_device *vout);
+int omap_vout_setup_vrfb_bufs(struct platform_device *pdev, int vid_num,
+			u32 static_vrfb_allocation);
+void omap_vout_release_vrfb(struct omap_vout_device *vout);
+int omap_vout_vrfb_buffer_setup(struct omap_vout_device *vout,
+			unsigned int *count, unsigned int startindex);
+int omap_vout_prepare_vrfb(struct omap_vout_device *vout,
+			struct videobuf_buffer *vb);
+void omap_vout_calculate_vrfb_offset(struct omap_vout_device *vout);
+#else
+void omap_vout_free_vrfb_buffers(struct omap_vout_device *vout) { }
+int omap_vout_setup_vrfb_bufs(struct platform_device *pdev, int vid_num,
+			u32 static_vrfb_allocation)
+		{ return 0; }
+void omap_vout_release_vrfb(struct omap_vout_device *vout) { }
+int omap_vout_vrfb_buffer_setup(struct omap_vout_device *vout,
+			unsigned int *count, unsigned int startindex)
+		{ return 0; }
+int omap_vout_prepare_vrfb(struct omap_vout_device *vout,
+			struct videobuf_buffer *vb)
+		{ return 0; }
+void omap_vout_calculate_vrfb_offset(struct omap_vout_device *vout) { }
+#endif
+
+#endif
drivers/media/video/omap/omap_voutdef.h +16 -0
index 31e6261..26e2b63 100644
@@ -12,6 +12,7 @@
 #define OMAP_VOUTDEF_H
 
 #include <video/omapdss.h>
+#include <plat/vrfb.h>
 
 #define YUYV_BPP        2
 #define RGB565_BPP      2
@@ -62,6 +63,18 @@ enum dss_rotation {
 	dss_rotation_180_degree	= 2,
 	dss_rotation_270_degree = 3,
 };
+
+/* Enum for choosing rotation type for vout
+ * DSS2 doesn't understand no rotation as an
+ * option while V4L2 driver doesn't support
+ * rotation in the case where VRFB is not built in
+ * the kernel
+ */
+enum vout_rotaion_type {
+	VOUT_ROT_NONE	= 0,
+	VOUT_ROT_VRFB	= 1,
+};
+
 /*
  * This structure is used to store the DMA transfer parameters
  * for VRFB hidden buffer
@@ -78,6 +91,7 @@ struct omapvideo_info {
 	int id;
 	int num_overlays;
 	struct omap_overlay *overlays[MAX_OVLS];
+	enum vout_rotaion_type rotation_type;
 };
 
 struct omap2video_device {
@@ -206,4 +220,6 @@ static inline int calc_rotation(const struct omap_vout_device *vout)
 		return dss_rotation_180_degree;
 	}
 }
+
+void omap_vout_free_buffers(struct omap_vout_device *vout);
 #endif	/* ifndef OMAP_VOUTDEF_H */
Signature · 1 line
1.7.1
#2 lore raw

RE: [PATCH 1/2] OMAP_VOUT: CLEANUP: Move some functions and macros from omap_vout

In reply to Archit Taneja
Quoted 8 lines

-----Original Message-----
From: Taneja, Archit
Sent: Friday, May 27, 2011 12:31 PM
To: [email protected]
Cc: Hiremath, Vaibhav; Taneja, Archit
Subject: [PATCH 1/2] OMAP_VOUT: CLEANUP: Move some functions and macros from omap_vout

[Hiremath, Vaibhav] You may want to give patch revision here. Cosmetic comment -

Consider changing the subject line to something -

OMAP_VOUT: CLEANUP: Move generic functions and macros to common files

Quoted 5 lines

Move some inline functions from omap_vout.c to omap_voutdef.h and independent
functions like omap_vout_alloc_buffer/omap_vout_free_buffer to omap_voutlib.c.

[Hiremath, Vaibhav] Ditto here, word "some" doesn't convey anything.

Quoted 133 lines
---
 drivers/media/video/omap/omap_vout.c    |  109 --------------------------
-----
 drivers/media/video/omap/omap_voutdef.h |   62 +++++++++++++++++
 drivers/media/video/omap/omap_voutlib.c |   44 ++++++++++++
 drivers/media/video/omap/omap_voutlib.h |    2 +
 4 files changed, 108 insertions(+), 109 deletions(-)
drivers/media/video/omap/omap_vout.c +0 -78
index 4ada9be..6433e7b 100644
@@ -35,17 +35,14 @@
 #include <linux/sched.h>
 #include <linux/types.h>
 #include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
 #include <linux/irq.h>
 #include <linux/videodev2.h>
-#include <linux/slab.h>
 
 #include <media/videobuf-dma-contig.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-ioctl.h>
 
 #include <plat/dma.h>
-#include <plat/vram.h>
 #include <plat/vrfb.h>
 #include <video/omapdss.h>
 
@@ -56,7 +53,6 @@ MODULE_AUTHOR("Texas Instruments");
 MODULE_DESCRIPTION("OMAP Video for Linux Video out driver");
 MODULE_LICENSE("GPL");
 
-
 /* Driver Configuration macros */
 #define VOUT_NAME		"omap_vout"
 
@@ -65,31 +61,6 @@ enum omap_vout_channels {
 	OMAP_VIDEO2,
 };
 
-enum dma_channel_state {
-	DMA_CHAN_NOT_ALLOTED,
-	DMA_CHAN_ALLOTED,
-};
-
-#define QQVGA_WIDTH		160
-#define QQVGA_HEIGHT		120
-
-/* Max Resolution supported by the driver */
-#define VID_MAX_WIDTH		1280	/* Largest width */
-#define VID_MAX_HEIGHT		720	/* Largest height */
-
-/* Mimimum requirement is 2x2 for DSS */
-#define VID_MIN_WIDTH		2
-#define VID_MIN_HEIGHT		2
-
-/* 2048 x 2048 is max res supported by OMAP display controller */
-#define MAX_PIXELS_PER_LINE     2048
-
-#define VRFB_TX_TIMEOUT         1000
-#define VRFB_NUM_BUFS		4
-
-/* Max buffer size tobe allocated during init */
-#define OMAP_VOUT_MAX_BUF_SIZE (VID_MAX_WIDTH*VID_MAX_HEIGHT*4)
-
 static struct videobuf_queue_ops video_vbq_ops;
 /* Variables configurable through module params*/
 static u32 video1_numbuffers = 3;
@@ -172,49 +143,6 @@ const static struct v4l2_fmtdesc omap_formats[] = {
 #define NUM_OUTPUT_FORMATS (ARRAY_SIZE(omap_formats))
 
 /*
- * Allocate buffers
- */
-static unsigned long omap_vout_alloc_buffer(u32 buf_size, u32 *phys_addr)
-{
-	u32 order, size;
-	unsigned long virt_addr, addr;
-
-	size = PAGE_ALIGN(buf_size);
-	order = get_order(size);
-	virt_addr = __get_free_pages(GFP_KERNEL | GFP_DMA, order);
-	addr = virt_addr;
-
-	if (virt_addr) {
-		while (size > 0) {
-			SetPageReserved(virt_to_page(addr));
-			addr += PAGE_SIZE;
-			size -= PAGE_SIZE;
-		}
-	}
-	*phys_addr = (u32) virt_to_phys((void *) virt_addr);
-	return virt_addr;
-}
-
-/*
- * Free buffers
- */
-static void omap_vout_free_buffer(unsigned long virtaddr, u32 buf_size)
-{
-	u32 order, size;
-	unsigned long addr = virtaddr;
-
-	size = PAGE_ALIGN(buf_size);
-	order = get_order(size);
-
-	while (size > 0) {
-		ClearPageReserved(virt_to_page(addr));
-		addr += PAGE_SIZE;
-		size -= PAGE_SIZE;
-	}
-	free_pages((unsigned long) virtaddr, order);
-}
-
-/*
  * Function for allocating video buffers
  */
 static int omap_vout_allocate_vrfb_buffers(struct omap_vout_device *vout,
@@ -369,43 +297,6 @@ static void omap_vout_release_vrfb(struct
 omap_vout_device *vout)
 }
 
 /*
- * Return true if rotation is 90 or 270
- */
-static inline int rotate_90_or_270(const struct omap_vout_device *vout)
-{
-	return (vout->rotation == dss_rotation_90_degree ||
-			vout->rotation == dss_rotation_270_degree);

drivers/media/video/omap/omap_vout.c static void omap_vout_release_vrfb(struct · line 388

Quoted 10 lines
drivers/media/video/omap/omap_vout.c +0 -10
-}
-
-/*
- * Return true if rotation is enabled
- */
-static inline int rotation_enabled(const struct omap_vout_device *vout)
-{
-	return vout->rotation || vout->mirror;
-}
-

[Hiremath, Vaibhav] As part of this cleanup I would suggest to rename these API's to self descriptive, something like -

rotation_enabled => is_rotation_enabled
rotate_90_or_270 => is_rotation_90_or_270

Quoted 171 lines
drivers/media/video/omap/omap_vout.c +0 -21
-/*
- * Reverse the rotation degree if mirroring is enabled
- */
-static inline int calc_rotation(const struct omap_vout_device *vout)
-{
-	if (!vout->mirror)
-		return vout->rotation;
-
-	switch (vout->rotation) {
-	case dss_rotation_90_degree:
-		return dss_rotation_270_degree;
-	case dss_rotation_270_degree:
-		return dss_rotation_90_degree;
-	case dss_rotation_180_degree:
-		return dss_rotation_0_degree;
-	default:
-		return dss_rotation_180_degree;
-	}
-}
-
-/*
  * Free the V4L2 buffers
  */

static void omap_vout_free_buffers(struct omap_vout_device *vout)

drivers/media/video/omap/omap_voutdef.h +62 -0
index 659497b..31e6261 100644
@@ -27,6 +27,31 @@
 #define MAX_DISPLAYS	3
 #define MAX_MANAGERS	3
 
+#define QQVGA_WIDTH		160
+#define QQVGA_HEIGHT		120
+
+/* Max Resolution supported by the driver */
+#define VID_MAX_WIDTH		1280	/* Largest width */
+#define VID_MAX_HEIGHT		720	/* Largest height */
+
+/* Mimimum requirement is 2x2 for DSS */
+#define VID_MIN_WIDTH		2
+#define VID_MIN_HEIGHT		2
+
+/* 2048 x 2048 is max res supported by OMAP display controller */
+#define MAX_PIXELS_PER_LINE     2048
+
+#define VRFB_TX_TIMEOUT         1000
+#define VRFB_NUM_BUFS		4
+
+/* Max buffer size tobe allocated during init */
+#define OMAP_VOUT_MAX_BUF_SIZE (VID_MAX_WIDTH*VID_MAX_HEIGHT*4)
+
+enum dma_channel_state {
+	DMA_CHAN_NOT_ALLOTED,
+	DMA_CHAN_ALLOTED,
+};
+
 /* Enum for Rotation
  * DSS understands rotation in 0, 1, 2, 3 context
  * while V4L2 driver understands it as 0, 90, 180, 270
@@ -144,4 +169,41 @@ struct omap_vout_device {
 	int io_allowed;
 
 };
+
+/*
+ * Return true if rotation is 90 or 270
+ */
+static inline int rotate_90_or_270(const struct omap_vout_device *vout)
+{
+	return (vout->rotation == dss_rotation_90_degree ||
+			vout->rotation == dss_rotation_270_degree);
+}
+
+/*
+ * Return true if rotation is enabled
+ */
+static inline int rotation_enabled(const struct omap_vout_device *vout)
+{
+	return vout->rotation || vout->mirror;
+}
+
+/*
+ * Reverse the rotation degree if mirroring is enabled
+ */
+static inline int calc_rotation(const struct omap_vout_device *vout)
+{
+	if (!vout->mirror)
+		return vout->rotation;
+
+	switch (vout->rotation) {
+	case dss_rotation_90_degree:
+		return dss_rotation_270_degree;
+	case dss_rotation_270_degree:
+		return dss_rotation_90_degree;
+	case dss_rotation_180_degree:
+		return dss_rotation_0_degree;
+	default:
+		return dss_rotation_180_degree;
+	}
+}
 #endif	/* ifndef OMAP_VOUTDEF_H */
drivers/media/video/omap/omap_voutlib.c +44 -0
index 2aa6a76..c28ef05 100644
@@ -24,6 +24,8 @@
 #include <linux/types.h>
 #include <linux/videodev2.h>
 
+#include <linux/dma-mapping.h>
+
 #include <plat/cpu.h>
 
 MODULE_AUTHOR("Texas Instruments");
@@ -291,3 +293,45 @@ void omap_vout_new_format(struct v4l2_pix_format
 *pix,
 }
 EXPORT_SYMBOL_GPL(omap_vout_new_format);
 
+/*
+ * Allocate buffers
+ */
+unsigned long omap_vout_alloc_buffer(u32 buf_size, u32 *phys_addr)
+{
+	u32 order, size;
+	unsigned long virt_addr, addr;
+
+	size = PAGE_ALIGN(buf_size);
+	order = get_order(size);
+	virt_addr = __get_free_pages(GFP_KERNEL | GFP_DMA, order);
+	addr = virt_addr;
+
+	if (virt_addr) {
+		while (size > 0) {
+			SetPageReserved(virt_to_page(addr));
+			addr += PAGE_SIZE;
+			size -= PAGE_SIZE;
+		}
+	}
+	*phys_addr = (u32) virt_to_phys((void *) virt_addr);
+	return virt_addr;
+}
+
+/*
+ * Free buffers
+ */
+void omap_vout_free_buffer(unsigned long virtaddr, u32 buf_size)
+{
+	u32 order, size;
+	unsigned long addr = virtaddr;
+
+	size = PAGE_ALIGN(buf_size);
+	order = get_order(size);
+
+	while (size > 0) {
+		ClearPageReserved(virt_to_page(addr));
+		addr += PAGE_SIZE;
+		size -= PAGE_SIZE;
+	}
+	free_pages((unsigned long) virtaddr, order);
+}
drivers/media/video/omap/omap_voutlib.h +0 -0
index a60b16e..1d722be 100644

drivers/media/video/omap/omap_voutlib.h extern int omap_vout_new_window(struct v4l2_rect *crop, · line 36

Quoted 7 lines
drivers/media/video/omap/omap_voutlib.h +2 -0
@@ -30,5 +30,7 @@ extern int omap_vout_new_window(struct v4l2_rect *crop,
 extern void omap_vout_new_format(struct v4l2_pix_format *pix,
 		struct v4l2_framebuffer *fbuf, struct v4l2_rect *crop,
 		struct v4l2_window *win);
+extern unsigned long omap_vout_alloc_buffer(u32 buf_size, u32
 *phys_addr);
+extern void omap_vout_free_buffer(unsigned long virtaddr, u32 buf_size);
 #endif	/* #ifndef OMAP_VOUTLIB_H */

[Hiremath, Vaibhav] We do not need to use externs here; this should be another cleanup candidate which can be done with this patch series.

Thanks,
Vaibhav

Quoted 2 lines

--
1.7.1

#3 lore raw

Re: [PATCH 1/2] OMAP_VOUT: CLEANUP: Move some functions and macros from omap_vout

Hi,

Quoted 9 lines · Vaibhav
Quoted 8 lines

-----Original Message-----
From: Taneja, Archit
Sent: Friday, May 27, 2011 12:31 PM
To: [email protected]
Cc: Hiremath, Vaibhav; Taneja, Archit
Subject: [PATCH 1/2] OMAP_VOUT: CLEANUP: Move some functions and macros from omap_vout

[Hiremath, Vaibhav] You may want to give patch revision here.

I don't think it makes sense to give the old revisions anymore, this patch set had been dormant since last year. I'll add revisions for the later versions of this set.

Quoted 7 lines

Cosmetic comment -

Consider changing the subject line to something -

OMAP_VOUT: CLEANUP: Move generic functions and macros to common files

Quoted 6 lines
Quoted 5 lines

Move some inline functions from omap_vout.c to omap_voutdef.h and independent
functions like omap_vout_alloc_buffer/omap_vout_free_buffer to omap_voutlib.c.

[Hiremath, Vaibhav] Ditto here, word "some" doesn't convey anything.

Okay.

Quoted 1 line

<snip>

Quoted 20 lines
Quoted 8 lines

/*
- * Return true if rotation is 90 or 270
- */

drivers/media/video/omap/omap_vout.c +0 -4
-static inline int rotate_90_or_270(const struct omap_vout_device *vout)
-{
-	return (vout->rotation == dss_rotation_90_degree ||
-			vout->rotation == dss_rotation_270_degree);

drivers/media/video/omap/omap_vout.c static void omap_vout_release_vrfb(struct omap_vout_device *vout) · line 387

Quoted 10 lines
drivers/media/video/omap/omap_vout.c +0 -10
-}
-
-/*
- * Return true if rotation is enabled
- */
-static inline int rotation_enabled(const struct omap_vout_device *vout)
-{
-	return vout->rotation || vout->mirror;
-}
-

[Hiremath, Vaibhav] As part of this cleanup I would suggest to rename these API's to self descriptive, something like -

Quoted 2 lines

rotation_enabled => is_rotation_enabled
rotate_90_or_270 => is_rotation_90_or_270

This patch just moves these functions. Moving it to another file and then changing the names in the same patch will make things messy. I'll do this in a separate patch in the same patch set.

Quoted 3 lines
Quoted 3 lines

-/*

<snip>

Quoted 7 lines
Quoted 7 lines
drivers/media/video/omap/omap_voutlib.h +0 -0
index a60b16e..1d722be 100644
@@ -30,5 +30,7 @@ extern int omap_vout_new_window(struct v4l2_rect *crop,
  extern void omap_vout_new_format(struct v4l2_pix_format *pix,
Quoted 8 lines

drivers/media/video/omap/omap_voutlib.h extern int omap_vout_new_window(struct v4l2_rect *crop, · line 35

Quoted 7 lines
drivers/media/video/omap/omap_voutlib.h +2 -0
  		struct v4l2_framebuffer *fbuf, struct v4l2_rect *crop,
  		struct v4l2_window *win);
+extern unsigned long omap_vout_alloc_buffer(u32 buf_size, u32
 *phys_addr);
+extern void omap_vout_free_buffer(unsigned long virtaddr, u32 buf_size);
  #endif	/* #ifndef OMAP_VOUTLIB_H */

[Hiremath, Vaibhav] We do not need to use externs here; this should be another cleanup candidate which can be done with this patch series.

Will fix this.

Archit

#5 lore raw

Re: [PATCH 2/2] OMAP_VOUT: Create separate file for VRFB related API's

In reply to Archit Taneja

Hi Vaibhav,

Quoted 7 lines · Archit

Introduce omap_vout_vrfb.c and omap_vout_vrfb.h, for all VRFB related API's, making OMAP_VOUT driver independent from VRFB. This is required for OMAP4 DSS, since OMAP4 doesn't have VRFB block.

Added new enum vout_rotation_type and "rotation_type" member to omapvideo_info, this is initialized based on the arch type in omap_vout_probe. The rotation_type var is now used to choose between vrfb and non-vrfb calls.

Any comments on this patch?

<snip>

Thanks,
Archit

#6 lore raw

RE: [PATCH 2/2] OMAP_VOUT: Create separate file for VRFB related API's

Quoted 18 lines

-----Original Message-----
From: Taneja, Archit
Sent: Monday, June 13, 2011 10:17 AM
To: Hiremath, Vaibhav
Cc: [email protected]
Subject: Re: [PATCH 2/2] OMAP_VOUT: Create separate file for VRFB related API's

Hi Vaibhav,

Quoted 1 line · Archit

Introduce omap_vout_vrfb.c and omap_vout_vrfb.h, for all VRFB related

API's,

Quoted 1 line

making OMAP_VOUT driver independent from VRFB. This is required for

OMAP4 DSS,

Quoted 2 lines

since OMAP4 doesn't have VRFB block.

Quoted 8 lines
Quoted 1 line

Added new enum vout_rotation_type and "rotation_type" member to

omapvideo_info,

Quoted 1 line

this is initialized based on the arch type in omap_vout_probe. The

rotation_type

Quoted 1 line

var is now used to choose between vrfb and non-vrfb calls.

Any comments on this patch?

Archit,

Last week I had to park this due to some high priority issue, today I am going to validate these patches and will respond you. Code implementation point of view, this patch looks ok. And I believe you will incorporate my comments on first patch.

Thanks,
Vaibhav

Quoted 4 lines

<snip>

Thanks,
Archit

#7 lore raw

Re: [PATCH 2/2] OMAP_VOUT: Create separate file for VRFB related API's

Quoted 22 lines · Vaibhav
Quoted 22 lines

-----Original Message-----
From: Taneja, Archit
Sent: Monday, June 13, 2011 10:17 AM
To: Hiremath, Vaibhav
Cc: [email protected]
Subject: Re: [PATCH 2/2] OMAP_VOUT: Create separate file for VRFB related API's

Hi Vaibhav,

Quoted 1 line · Archit

Introduce omap_vout_vrfb.c and omap_vout_vrfb.h, for all VRFB related

API's,

Quoted 1 line

making OMAP_VOUT driver independent from VRFB. This is required for

OMAP4 DSS,

Quoted 3 lines

since OMAP4 doesn't have VRFB block.

Added new enum vout_rotation_type and "rotation_type" member to

omapvideo_info,

Quoted 1 line

this is initialized based on the arch type in omap_vout_probe. The

rotation_type

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

var is now used to choose between vrfb and non-vrfb calls.

Any comments on this patch?

Archit,

Last week I had to park this due to some high priority issue, today I am going to validate these patches and will respond you. Code implementation point of view, this patch looks ok. And I believe you will incorporate my comments on first patch.

Oh okay, great.

Thanks,
Archit

#8 lore raw

RE: [PATCH 2/2] OMAP_VOUT: Create separate file for VRFB related API's

Quoted 36 lines

-----Original Message-----
From: Taneja, Archit
Sent: Monday, June 13, 2011 12:21 PM
To: Hiremath, Vaibhav
Cc: [email protected]
Subject: Re: [PATCH 2/2] OMAP_VOUT: Create separate file for VRFB related API's

Quoted 7 lines · Vaibhav
Quoted 7 lines

-----Original Message-----
From: Taneja, Archit
Sent: Monday, June 13, 2011 10:17 AM
To: Hiremath, Vaibhav
Cc: [email protected]
Subject: Re: [PATCH 2/2] OMAP_VOUT: Create separate file for VRFB

related

Quoted 19 lines
Quoted 19 lines

API's

Hi Vaibhav,

Quoted 1 line · Archit

Introduce omap_vout_vrfb.c and omap_vout_vrfb.h, for all VRFB related

API's,

Quoted 1 line

making OMAP_VOUT driver independent from VRFB. This is required for

OMAP4 DSS,

Quoted 3 lines

since OMAP4 doesn't have VRFB block.

Added new enum vout_rotation_type and "rotation_type" member to

omapvideo_info,

Quoted 1 line

this is initialized based on the arch type in omap_vout_probe. The

rotation_type

Quoted 1 line

var is now used to choose between vrfb and non-vrfb calls.

Any comments on this patch?

Quoted 9 lines
Quoted 3 lines

Archit,

Last week I had to park this due to some high priority issue, today I am

going to validate these patches and will respond you.

Quoted 1 line

Code implementation point of view, this patch looks ok. And I believe

you will incorporate my comments on first patch.

Oh okay, great.

[Hiremath, Vaibhav] Archit,

I tested it and seems to be ok to me. Also please note that, there is dependency of your patch with Amber's GFP_DMA patch, so make sure that you create next version against that.

Once you post it to list, I will apply to my repo and give pull request for the same.

Thanks,
Vaibhav

Quoted 2 lines

Thanks,
Archit