Skip to contentSkip to conversation

Hello Tomi Valkeinen, I have some questions about dss2 driver.

DISCUSSION InKi Dae 5 participants 12 messages Mar 11, 2009 – Apr 16, 2009

Subsystems (3)
lore
Share & tools
lore

InKi Dae

author
#0 lore raw

I am using your dss2 driver downloaded from your git server and tried to rotate an image(RGB24U and YUV2 format) using OMAPFB_ROT_DMA command.
but I can't see rotated image on screen. I added variables for rotating like below. as the result, LCD Panel is stoped.

omapfb.rotate=2
omapfb.vrfb=n

and then I tried again using OMAPFB_ROT_VRFB command like below.

omapfb.rotate=2
omapfb.vrfb=y

In this case, I can see rotated image(only RGB24U format) on screen. You asid "Rotation and mirroring currently only supports RGB565 and RGB8888 modes. VRFB does not support mirroring" through /Documentation/arm/OMAP/DSS file.

Doesn't your dss2 driver support DMA rotation?
I am trying to add rotation feature for YUV2 image using VRFB to your dss2 driver.

for this, I think that it have to change rot and mirror become 0 if rotation_type is OMAPFB_ROT_VRFB to be rot=ofbi->rotation and mirror = ofbi->mirror (in omapfb-main.c file) and
add codes for calculating offset0, offset1, pixel increment and row increment value for YUV2 format also pixel size becomes 4 in YUV2 case (in dispc.c fild).
omap_vrfb_setup function must be modifed also (in vrfb.c file)?

Do you have any idea?
I need your help and advice.

Thank you.
- InKi-

#1 lore raw

Hi Dae,
I am attaching one patch which adds the support of rotation on top of Tomi's DSS library. But this patch is created against the patches posted by tomi long back. You can have look at _dispc_calc_and_set_row_inc and _dispc_set_rotation_mirroring function for reference to add the YUV support. I have tested it with YUV, UYVY, RGB16 and RGB24u pixel format. Currently it supports pixel and row increment calculation only for rotation case.

Thanks and Regards,
Hardik Shah

Quoted 43 lines

-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of InKi Dae
Sent: Wednesday, March 11, 2009 10:28 AM
To: Tomi Valkeinen
Cc: [email protected]
Subject: Hello Tomi Valkeinen, I have some questions about dss2 driver.

I am using your dss2 driver downloaded from your git server and tried to rotate an image(RGB24U and YUV2 format) using OMAPFB_ROT_DMA command.
but I can't see rotated image on screen. I added variables for rotating like below. as the result, LCD Panel is stoped.

omapfb.rotate=2
omapfb.vrfb=n

and then I tried again using OMAPFB_ROT_VRFB command like below.

omapfb.rotate=2
omapfb.vrfb=y

In this case, I can see rotated image(only RGB24U format) on screen. You asid "Rotation and mirroring currently only supports RGB565 and RGB8888 modes. VRFB does not support mirroring" through /Documentation/arm/OMAP/DSS file.

Doesn't your dss2 driver support DMA rotation?
I am trying to add rotation feature for YUV2 image using VRFB to your dss2 driver.

for this, I think that it have to change rot and mirror become 0 if rotation_type is OMAPFB_ROT_VRFB to be rot=ofbi->rotation and mirror = ofbi->mirror (in omapfb-main.c file) and
add codes for calculating offset0, offset1, pixel increment and row increment value for YUV2 format also pixel size becomes 4 in YUV2 case (in dispc.c fild).
omap_vrfb_setup function must be modifed also (in vrfb.c file)?

Do you have any idea?
I need your help and advice.

Quoted 6 lines

Thank you.
- InKi-
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

From 26ef0074ac798b631f5d674d26306871da5a901f Mon Sep 17 00:00:00 2001
From: Hardik Shah <[email protected]>
Date: Mon, 12 Jan 2009 18:59:50 +0530
Subject: [PATCH 2/4] Changes Done to DSS Library

---
 arch/arm/plat-omap/dss/dispc.c            |  207 ++++++++++++++++++++++-------
 arch/arm/plat-omap/dss/display.c          |   19 ++-
 arch/arm/plat-omap/dss/dss.c              |    3 +
 arch/arm/plat-omap/dss/dss.h              |    6 +-
 arch/arm/plat-omap/include/mach/display.h |   11 +-
 5 files changed, 182 insertions(+), 64 deletions(-)
arch/arm/plat-omap/dss/dispc.c +156 -51
index 20caa48..7711767 100644
@@ -120,7 +120,6 @@ struct dispc_reg { u16 idx; };
 
 #define DISPC_VID_PRELOAD(n)		DISPC_REG(0x230 + (n)*0x04)
 
-
 #define DISPC_IRQ_MASK_ERROR            (DISPC_IRQ_GFX_FIFO_UNDERFLOW | \
 					 DISPC_IRQ_OCP_ERR | \
 					 DISPC_IRQ_VID1_FIFO_UNDERFLOW | \
@@ -521,7 +520,6 @@ static void _dispc_write_firhv_reg(enum omap_plane plane, int reg, u32 value)
 	dispc_write_reg(DISPC_VID_FIR_COEF_HV(plane-1, reg), value);
 }
 
-
 static void _dispc_set_scale_coef(enum omap_plane plane, int hscaleup,
 		int vscaleup)
 {
@@ -649,7 +647,6 @@ static void _dispc_setup_color_conv_coef(void)
 	REG_FLD_MOD(DISPC_VID_ATTRIBUTES(1), ct->full_range, 11, 11);
 }
 
-
 static void _dispc_set_plane_ba0(enum omap_plane plane, u32 paddr)
 {
 	const struct dispc_reg ba0_reg[] = { DISPC_GFX_BA0,
@@ -926,7 +923,6 @@ static void _dispc_set_vid_accu1(enum omap_plane plane, int haccu, int vaccu)
 	dispc_write_reg(ac1_reg[plane-1], val);
 }
 
-
 static void _dispc_set_scaling(enum omap_plane plane,
 			       int orig_width, int orig_height,
 			       int out_width, int out_height,
@@ -956,7 +952,6 @@ static void _dispc_set_scaling(enum omap_plane plane,
 		fir_vinc = 0;
 	else
 		fir_vinc = 1024 * orig_height / out_height;
-
 	_dispc_set_fir(plane, fir_hinc, fir_vinc);
 
 	l = dispc_read_reg(dispc_reg_att[plane]);
@@ -988,19 +983,127 @@ static void _dispc_set_scaling(enum omap_plane plane,
 	_dispc_set_vid_accu1(plane, 0, accu1);
 }
 
+static int _dispc_set_rotation_mirroring(enum omap_plane plane,
+	int rotation, int mirroring, enum omap_color_mode color_mode)
+{
+	u32 attr_value;
+	if (rotation == -1)
+		return 0;
+	if (color_mode == OMAP_DSS_COLOR_YUV2 ||
+		color_mode == OMAP_DSS_COLOR_UYVY) {
+		if (mirroring == 1) {
+
+			if (rotation == 90)
+				REG_FLD_MOD(dispc_reg_att[plane], 0x3, 13, 12);
+			else if (rotation == 270)
+				REG_FLD_MOD(dispc_reg_att[plane], 0x1, 13, 12);
+			else if (rotation == 0)
+				REG_FLD_MOD(dispc_reg_att[plane], 0x2, 13, 12);
+			else if (rotation == 180)
+				REG_FLD_MOD(dispc_reg_att[plane], 0x0, 13, 12);
+		} else {
+			if (rotation == 90)
+				REG_FLD_MOD(dispc_reg_att[plane], 0x3, 13, 12);
+			else if (rotation == 270)
+				REG_FLD_MOD(dispc_reg_att[plane], 0x01, 13, 12);
+			else if (rotation == 180)
+				REG_FLD_MOD(dispc_reg_att[plane], 0x2, 13, 12);
+			else if (rotation == 0)
+				REG_FLD_MOD(dispc_reg_att[plane], 0x0, 13, 12);
+			}
+		}
+		if (rotation == 90 || rotation == 270)
+			REG_FLD_MOD(dispc_reg_att[plane], 0x1, 18, 18);
+		else
+			REG_FLD_MOD(dispc_reg_att[plane], 0x0, 18, 18);
+	attr_value = dispc_read_reg(DISPC_VID_ATTRIBUTES(0));
+	return 0;
+}
+
+#define MAX_PIXELS_PER_LINE     2048
+#define MAX_LINES               2048
+
+static void _dispc_calc_and_set_row_inc(enum omap_plane plane,
+	int screen_width, int cropwidth,
+	int cleft, enum omap_color_mode color_mode, int rotation, int mirror,
+	int fieldmode)
+{
+	int ps = 2, vr_ps = 1;
+	int row_inc_value = 0, pixel_inc_value = 0;
+	int temp;
+
+	switch (color_mode) {
+	case OMAP_DSS_COLOR_YUV2:
+	case OMAP_DSS_COLOR_UYVY:
+		if (mirror == 1 || rotation >= 0) {
+			/*
+			 * ps      - In VRFB space the pixel size for YUYV/UYVY
+			 * is 4 bytes
+			 * vr_ps - Actual pixel size for YUYV/UYVY  is 2 bytes
+			 */
+			ps = 4;
+			vr_ps = 2;
+		}
+		break;
+	case OMAP_DSS_COLOR_RGB24P:
+		ps = 3;		/* pixel size is 3 bytes */
+		break;
+
+	case OMAP_DSS_COLOR_RGB24U:
+		ps = 4;		/* pixel size is 4 bytes */
+		break;
+
+	case OMAP_DSS_COLOR_RGB16:
+	default:
+		ps = 2;		/* pixel size is 2 bytes */
+		break;
+	}
+	if (rotation == 90 || rotation == 270) {
+		row_inc_value = 1 + (MAX_PIXELS_PER_LINE - screen_width +
+			 (screen_width - cropwidth - cleft) + cleft) * ps;
+
+	} else if (rotation == 180 || rotation == 0) {
+		if (color_mode == OMAP_DSS_COLOR_YUV2
+			|| color_mode == OMAP_DSS_COLOR_UYVY) {
+			temp = MAX_PIXELS_PER_LINE - (screen_width / vr_ps);
+			temp += (screen_width - cropwidth - cleft) / vr_ps;
+			row_inc_value = ((temp + (cleft/vr_ps)) * ps);
+			row_inc_value++;
+
+		} else
+			row_inc_value = 1 + (MAX_PIXELS_PER_LINE -
+				screen_width + (screen_width - cropwidth -
+				cleft) + cleft) * ps;
+	} else {
+		row_inc_value = 1 + (screen_width * ps) - cropwidth * ps;
+	}
+	pixel_inc_value = 1;
+
+	if (fieldmode) {
+		if (rotation >= 0)
+			row_inc_value = row_inc_value +
+				MAX_PIXELS_PER_LINE * ps;
+		else
+			row_inc_value = row_inc_value + screen_width * ps;
+	}
+	_dispc_set_row_inc(plane, row_inc_value);
+
+}
+
 static int _dispc_setup_plane(enum omap_plane plane,
 		enum omap_channel channel_out,
-		u32 paddr, int screen_width,
+		u32 paddr, int tv_field1_offset, int screen_width,
 		int pos_x, int pos_y,
 		int width, int height,
 		int out_width, int out_height,
 		enum omap_color_mode color_mode,
-		int ilace)
+		int ilace, int rotation, int mirror)
 {
 	int fieldmode = 0;
 	int bpp;
 	int cconv;
 	int scaling = 0;
+	u32 attr_value;
 
 	if (plane == OMAP_DSS_GFX) {
 		if (width != out_width || height != out_height)
@@ -1009,7 +1112,6 @@ static int _dispc_setup_plane(enum omap_plane plane,
 		/* video plane */
 		if (width != out_width || height != out_height)
 			scaling = 1;
-
 		if (out_width < width/2 ||
 		   out_width > width*8)
 			return -EINVAL;
@@ -1019,7 +1121,6 @@ static int _dispc_setup_plane(enum omap_plane plane,
 			return -EINVAL;
 	}
 
-
 	switch (color_mode) {
 	case OMAP_DSS_COLOR_RGB16:
 		bpp = 16;
@@ -1066,6 +1167,13 @@ static int _dispc_setup_plane(enum omap_plane plane,
 
 	/* attributes */
 	_dispc_set_channel_out(plane, channel_out);
+
+	if (rotation >= 0) {
+		/* Set rotation and mirroring attributes */
+		_dispc_set_rotation_mirroring(plane, rotation,
+				mirror, color_mode);
+	}
+
 	_dispc_set_color_mode(plane, color_mode);
 	if (plane != OMAP_DSS_GFX)
 		_dispc_set_vid_color_conv(plane, cconv);
@@ -1075,11 +1183,11 @@ static int _dispc_setup_plane(enum omap_plane plane,
 	_dispc_set_plane_ba0(plane, paddr);
 
 	if (fieldmode)
-		_dispc_set_plane_ba1(plane, paddr + screen_width * bpp/8);
+		_dispc_set_plane_ba1(plane, paddr + tv_field1_offset);
+
 	else
 		_dispc_set_plane_ba1(plane, paddr);
 
-
 	_dispc_set_plane_pos(plane, pos_x, pos_y);
 
 	_dispc_set_pic_size(plane, width, height);
@@ -1087,11 +1195,10 @@ static int _dispc_setup_plane(enum omap_plane plane,
 	if (plane != OMAP_DSS_GFX)
 		_dispc_set_vid_size(plane, out_width, out_height);
 
-	_dispc_set_row_inc(plane,
-			   (screen_width - width) * bpp / 8 +
-			   (fieldmode ? screen_width * bpp / 8 : 0) +
-			   1);
+	_dispc_calc_and_set_row_inc(plane, screen_width, width, 0,
+			color_mode, rotation, mirror, fieldmode);
 
+	attr_value = dispc_read_reg(DISPC_VID_ATTRIBUTES(0));
 	return 0;
 }
 
@@ -1100,7 +1207,6 @@ static void _dispc_enable_plane(enum omap_plane plane, int enable)
 	REG_FLD_MOD(dispc_reg_att[plane], enable ? 1 : 0, 0, 0);
 }
 
-
 void dispc_enable_lcd_out(int enable)
 {
 	enable_clocks(1);
@@ -1143,7 +1249,6 @@ void dispc_enable_fifohandcheck(int enable)
 	enable_clocks(0);
 }
 
-
 void dispc_set_lcd_display_type(enum omap_lcd_display_type type)
 {
 	int mode;
@@ -1174,7 +1279,6 @@ void dispc_set_loadmode(enum omap_dss_load_mode mode)
 	enable_clocks(0);
 }
 
-
 void omap_dispc_set_default_color(enum omap_channel channel, u32 color)
 {
 	const struct dispc_reg def_reg[] = { DISPC_DEFAULT_COLOR0,
@@ -1613,7 +1717,7 @@ int dispc_set_clock_div(struct dispc_clock_info *cinfo)
 	return 0;
 }
 
-int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask)
+void *omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask)
 {
 	int i;
 	int ret = -EBUSY;
@@ -1621,16 +1725,11 @@ int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask)
 	u32 new_mask = 0;
 
 	if (isr == NULL)
-		return -EINVAL;
+		return NULL;
 
 	spin_lock_irqsave(&dispc.irq_lock, flags);
 
 	for (i = 0; i < DISPC_MAX_NR_ISRS; i++) {
-		if (registered_isr[i].isr == isr) {
-			ret = -EINVAL;
-			break;
-		}
-
 		if (registered_isr[i].isr != NULL)
 			continue;
 
@@ -1641,6 +1740,7 @@ int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask)
 		enable_clocks(1);
 		new_mask = dispc_read_reg(DISPC_IRQENABLE);
 		new_mask |= mask;
+		dispc_write_reg(DISPC_IRQSTATUS, mask);
 		dispc_write_reg(DISPC_IRQENABLE, new_mask);
 		enable_clocks(0);
 
@@ -1648,42 +1748,48 @@ int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask)
 		break;
 	}
 
-	spin_unlock_irqrestore(&dispc.irq_lock, flags);
+	if (!ret)
+		return (void *)&registered_isr[i];
+	else
+		return (void *)NULL;
 
-	return ret;
+	spin_unlock_irqrestore(&dispc.irq_lock, flags);
 }
 EXPORT_SYMBOL(omap_dispc_register_isr);
 
-int omap_dispc_unregister_isr(omap_dispc_isr_t isr)
+int omap_dispc_unregister_isr(void *handle)
 {
 	int i, j;
 	unsigned long flags;
 	u32 new_mask = DISPC_IRQ_MASK_ERROR;
 	int ret = -EINVAL;
+	struct registered_isr *isr;
 
 	spin_lock_irqsave(&dispc.irq_lock, flags);
 
-	for (i = 0; i < DISPC_MAX_NR_ISRS; i++) {
-		if (registered_isr[i].isr != isr)
-			continue;
+	isr = (struct registered_isr *)handle;
 
-		registered_isr[i].isr = NULL;
-		registered_isr[i].arg = NULL;
-		registered_isr[i].mask = 0;
+	if (isr == NULL)
+		return -EINVAL;
 
-		for (j = 0; j < DISPC_MAX_NR_ISRS; j++)
-			new_mask |= registered_isr[j].mask;
+	for (i = 0; i < DISPC_MAX_NR_ISRS; i++) {
+		if (isr == (struct registered_isr *)&(registered_isr[i].isr)) {
 
-		enable_clocks(1);
-		dispc_write_reg(DISPC_IRQENABLE, new_mask);
-		enable_clocks(0);
+			registered_isr[i].isr = NULL;
+			registered_isr[i].arg = NULL;
+			registered_isr[i].mask = 0;
 
-		ret = 0;
-		break;
-	}
+			for (j = 0; j < DISPC_MAX_NR_ISRS; j++)
+				new_mask |= registered_isr[j].mask;
 
+			enable_clocks(1);
+			dispc_write_reg(DISPC_IRQENABLE, new_mask);
+			enable_clocks(0);
+			ret = 0;
+			break;
+		}
+	}
 	spin_unlock_irqrestore(&dispc.irq_lock, flags);
-
 	return ret;
 }
 EXPORT_SYMBOL(omap_dispc_unregister_isr);
@@ -1736,6 +1842,7 @@ void dispc_irq_handler(void)
 		if (registered_isr[i].mask & irqstatus) {
 			registered_isr[i].isr(registered_isr[i].arg,
 					      irqstatus);
+
 			handledirqs |= registered_isr[i].mask;
 		}
 	}
@@ -1865,12 +1972,12 @@ int dispc_enable_plane(enum omap_plane plane, int enable)
 }
 
 int dispc_setup_plane(enum omap_plane plane, enum omap_channel channel_out,
-		       u32 paddr, int screen_width,
+		       u32 paddr, int tv_field1_offset, int screen_width,
 		       int pos_x, int pos_y,
 		       int width, int height,
 		       int out_width, int out_height,
 		       enum omap_color_mode color_mode,
-		       int ilace)
+		       int ilace, int rotation, int mirror)
 {
 	int r = 0;
 
@@ -1880,15 +1987,14 @@ int dispc_setup_plane(enum omap_plane plane, enum omap_channel channel_out,
 	       width, height,
 	       out_width, out_height,
 	       ilace);
-
 	enable_clocks(1);
 
 	r = _dispc_setup_plane(plane, channel_out,
-			   paddr, screen_width,
+			   paddr, tv_field1_offset, screen_width,
 			   pos_x, pos_y,
 			   width, height,
 			   out_width, out_height,
-			   color_mode, ilace);
+			   color_mode, ilace, rotation, mirror);
 
 	enable_clocks(0);
 
@@ -1941,7 +2047,6 @@ void dispc_setup_partial_planes(struct omap_display *display,
 	DSSDBG("dispc_setup_partial_planes %d,%d %dx%d\n",
 		*xi, *yi, *wi, *hi);
 
-
 	mgr = display->manager;
 
 	if (!mgr) {
@@ -2095,11 +2200,11 @@ void dispc_setup_partial_planes(struct omap_display *display,
 				ovl->id, pa, psw, px, py, pw, ph, pow, poh);
 
 		dispc_setup_plane(ovl->id, mgr->id,
-				pa, psw,
+				pa, pi->tv_field1_offset, psw,
 				px, py,
 				pw, ph,
 				pow, poh,
-				pi->color_mode, 0);
+				pi->color_mode, 0, 0, 0);
 
 		dispc_enable_plane(ovl->id, 1);
 	}
arch/arm/plat-omap/dss/display.c +13 -6
index e3ff778..c312cb2 100644
@@ -245,9 +245,9 @@ static int omap_dss_unset_display(struct omap_overlay_manager *mgr)
 }
 
 static int omap_dss_setup_overlay_input(struct omap_overlay *ovl,
-		u32 paddr, void *vaddr, int screen_width,
+		u32 paddr, void *vaddr, int tv_field1_offset, int screen_width,
 		int width, int height,
-		enum omap_color_mode color_mode)
+		enum omap_color_mode color_mode, int rotation, int mirror)
 {
 	int r;
 	struct omap_overlay_info old_info;
@@ -262,7 +262,9 @@ static int omap_dss_setup_overlay_input(struct omap_overlay *ovl,
 	ovl->info.paddr = paddr;
 	ovl->info.vaddr = vaddr;
 	ovl->info.screen_width = screen_width;
-
+	ovl->info.rotation = rotation;
+	ovl->info.mirror = mirror;
+	ovl->info.tv_field1_offset = tv_field1_offset;
 	ovl->info.width = width;
 	ovl->info.height = height;
 	ovl->info.color_mode = color_mode;
@@ -381,6 +383,7 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 
 		r = dispc_setup_plane(ovl->id, ovl->manager->id,
 				ovl->info.paddr,
+				ovl->info.tv_field1_offset,
 				ovl->info.screen_width,
 				ovl->info.pos_x,
 				ovl->info.pos_y,
@@ -389,13 +392,14 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 				outw,
 				outh,
 				ovl->info.color_mode,
-				ilace);
+				ilace,
+				ovl->info.rotation,
+				ovl->info.mirror);
 
 		if (r) {
 			DSSERR("dispc_setup_plane failed\n");
 			goto exit;
 		}
-
 		dispc_enable_plane(ovl->id, 1);
 	}
 
@@ -599,7 +603,10 @@ void initialize_overlays(const char *def_disp_name)
 		for (i = 0; i < 3; i++) {
 			struct omap_overlay *ovl;
 			ovl = omap_dss_get_overlay(i);
-			omap_dss_set_manager(ovl, def_mgr);
+			if (i == 1)
+				omap_dss_set_manager(ovl, lcd_mgr);
+			else
+				omap_dss_set_manager(ovl, tv_mgr);
 		}
 	}
 
arch/arm/plat-omap/dss/dss.c +3 -0
index b9f35d8..bf4175f 100644
@@ -480,6 +480,9 @@ static irqreturn_t dss_irq_handler_omap3(int irq, void *arg)
 		dsi_irq_handler();
 #endif
 
+	/* Workaround suggested by Tony  for spurious interrupt warning */
+	irqstatus = dss_read_reg(DSS_IRQSTATUS);
+
 	return IRQ_HANDLED;
 }
 
arch/arm/plat-omap/dss/dss.h +2 -4
index da628a7..c77412b 100644
@@ -161,7 +161,6 @@ int sdi_init(void);
 void sdi_exit(void);
 void sdi_init_display(struct omap_display *display);
 
-
 /* DSI */
 int dsi_init(void);
 void dsi_exit(void);
@@ -213,12 +212,12 @@ void dispc_set_plane_size(enum omap_plane plane, int width, int height);
 void dispc_set_row_inc(enum omap_plane plane, int inc);
 
 int dispc_setup_plane(enum omap_plane plane, enum omap_channel channel_out,
-		      u32 paddr, int screen_width,
+		      u32 paddr, int tv_field1_offset, int screen_width,
 		      int pos_x, int pos_y,
 		      int width, int height,
 		      int out_width, int out_height,
 		      enum omap_color_mode color_mode,
-		      int ilace);
+		      int ilace, int rotation, int mirror);
 
 void dispc_go(enum omap_channel channel);
 void dispc_enable_lcd_out(int enable);
@@ -251,7 +250,6 @@ void dispc_setup_partial_planes(struct omap_display *display,
 				int *x, int *y, int *w, int *h);
 void dispc_draw_partial_planes(struct omap_display *display);
 
-
 ssize_t dispc_print_clocks(char *buf, ssize_t size);
 
 /* VENC */
arch/arm/plat-omap/include/mach/display.h +8 -3
index 49ab00a..1a8fee7 100644
@@ -320,6 +320,7 @@ struct omap_overlay_info {
 	int enabled;
 	u32 paddr;
 	void *vaddr;
+	int tv_field1_offset;
 	int screen_width;
 	int pos_x;
 	int pos_y;
@@ -327,6 +328,8 @@ struct omap_overlay_info {
 	int height;
 	int out_width;	/* if 0, out_width == width */
 	int out_height;	/* if 0, out_height == height */
+	int rotation;
+	int mirror;
 	enum omap_color_mode color_mode;
 };
 
@@ -349,9 +352,11 @@ struct omap_overlay {
 
 	int (*setup_input)(struct omap_overlay *ovl,
 			u32 paddr, void *vaddr,
+			int tv_field1_offset,
 			int screen_width,
 			int width, int height,
-			enum omap_color_mode color_mode);
+			enum omap_color_mode color_mode, int rotation,
+			int mirror);
 	int (*setup_output)(struct omap_overlay *ovl,
 			int pos_x, int pos_y,
 			int out_width, int out_height);
@@ -456,7 +461,7 @@ int omap_dss_get_num_overlays(void);
 struct omap_overlay *omap_dss_get_overlay(int num);
 
 typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
-int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
-int omap_dispc_unregister_isr(omap_dispc_isr_t isr);
+void *omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
+int omap_dispc_unregister_isr(void *handle);
 
 #endif
Signature · 1 line
1.5.6
#2 lore raw
In reply to InKi Dae

Hi,

Quoted 15 lines · ext InKi Dae

I am using your dss2 driver downloaded from your git server and tried to rotate an image(RGB24U and YUV2 format) using OMAPFB_ROT_DMA command.
but I can't see rotated image on screen. I added variables for rotating like below. as the result, LCD Panel is stoped.

omapfb.rotate=2
omapfb.vrfb=n

and then I tried again using OMAPFB_ROT_VRFB command like below.

omapfb.rotate=2
omapfb.vrfb=y

Quoted 6 lines

In this case, I can see rotated image(only RGB24U format) on screen. You asid "Rotation and mirroring currently only supports RGB565 and RGB8888 modes. VRFB does not support mirroring" through /Documentation/arm/OMAP/DSS file.

Doesn't your dss2 driver support DMA rotation?

It does. However, you should use DMA rotation only with OMAP2 when the framebuffer is in SRAM. It seems to work somewhat on OMAP3 and SDRAM, but I've noticed it doesn't always work. I don't know if lowering pixel clock, increasing dss fck or fiddling with fifo sizes could affect it.

Quoted 11 lines

I am trying to add rotation feature for YUV2 image using VRFB to your dss2 driver.

for this, I think that it have to change rot and mirror become 0 if rotation_type is OMAPFB_ROT_VRFB to be rot=ofbi->rotation and mirror = ofbi->mirror (in omapfb-main.c file) and
add codes for calculating offset0, offset1, pixel increment and row increment value for YUV2 format also pixel size becomes 4 in YUV2 case (in dispc.c fild).
omap_vrfb_setup function must be modifed also (in vrfb.c file)?

Quoted 1 line

Do you have any idea?

No, I haven't really looked at YUV rotations.

Tomi

Quoted 4 lines

I need your help and advice.

Thank you.
- InKi-

#3 lore raw

YUV rotation support for DSS2 - 2.6.29 [WAS Re: Hello Tomi Valkeinen, I have some questions about dss2 driver.]

Tomi,

Tim has patched your latest DSS2 2.6.29 git (master branch) to add support for YUV rotation. It has been successfully tested on the coming Touch Book, as well as the Beagleboard Rev B6 with the exception of the bug mentioned below. You may want to review this patch and perhaps integrate once we have fixed the problem below.

A couple of questions and comments:

1. dss.c has no way of knowing whether VRFB is being used or not -- this is a problem because you need to decide whether to call calc_rotation_offset_vrfb(...) or calc_rotation_offset(...). Any suggestions on how the rotation mode should be passed between dss.c and omapfb-main.c?

2. If I try to rotate both plane 0 and plane 1 to either 90 degrees or 270 (doesn't matter which is which), as soon as you try to play a video you get VID1_FIFO_UNDERFLOW error messages, so it seems that the hardware seems to be struggling a little when you have two sets of 90/270 degree rotations. If one of the planes is 0/180 and the other is 90/270, then everything is fine. Would changing the FIFO settings somehow improve this or do you have any ideas about what else might make it work better?

Thanks in advance,

Grégoire Gentil

arch/arm/plat-omap/vrfb.c +3 -1
index 7e0f8fc..77aa9a7 100644
@@ -61,8 +61,10 @@ void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
 			width, height, bytespp);
 
 	if (bytespp == 4)
+	{
 		pixel_size_exp = 2;
-	else if (bytespp == 2)
+		width >>= 1;
+	} else if (bytespp == 2)
 		pixel_size_exp = 1;
 	else
 		BUG();
drivers/video/omap2/dss/dispc.c +94 -9

145 lines not on this page · raw message

drivers/video/omap2/omapfb/omapfb-main.c +9 -8
index afe40a9..02d308a 100644
@@ -420,10 +420,14 @@ void set_fb_fix(struct fb_info *fbi)
 	fix->ypanstep = 1;
 
 	if (rg->size) {
-		if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
+		if (ofbi->rotation_type == OMAPFB_ROT_VRFB && ofbi->id == 0)
 			omap_vrfb_setup(&rg->vrfb, rg->paddr,
 					var->xres_virtual, var->yres_virtual,
 					var->bits_per_pixel >> 3);
+		else if (ofbi->rotation_type == OMAPFB_ROT_VRFB && ofbi->id != 0)
+			omap_vrfb_setup(&rg->vrfb, rg->paddr,
+					var->xres_virtual, var->yres_virtual,
+					var->bits_per_pixel >> 2);
 	}
 }
 
@@ -487,6 +491,8 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var)
 	yres_max = 2048;
 
 	bytespp = var->bits_per_pixel >> 3;
+	if(mode == OMAP_DSS_COLOR_YUV2 || mode == OMAP_DSS_COLOR_UYVY)
+		bytespp <<= 1;
 
 	/* XXX: some applications seem to set virtual res to 0. */
 	if (var->xres_virtual == 0)
@@ -696,13 +702,8 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
 
 	ovl->get_overlay_info(ovl, &info);
 
-	if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
-		rot = 0;
-		mirror = 0;
-	} else {
-		rot = ofbi->rotation;
-		mirror = ofbi->mirror;
-	}
+	rot = ofbi->rotation;
+	mirror = ofbi->mirror;
 
 	info.paddr = data_start_p;
 	info.vaddr = data_start_v;
#4 lore raw

RE: YUV rotation support for DSS2 - 2.6.29 [WAS Re: Hello Tomi Valkeinen, I have some questions about dss2 driver.]

Quoted 19 lines

-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Gregoire Gentil
Sent: Tuesday, April 07, 2009 10:00 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: YUV rotation support for DSS2 - 2.6.29 [WAS Re: Hello Tomi Valkeinen, I have some questions about dss2 driver.]

Tomi,

Tim has patched your latest DSS2 2.6.29 git (master branch) to add support for YUV rotation. It has been successfully tested on the coming Touch Book, as well as the Beagleboard Rev B6 with the exception of the bug mentioned below. You may want to review this patch and perhaps integrate once we have fixed the problem below.

Quoted 8 lines

A couple of questions and comments:

1. dss.c has no way of knowing whether VRFB is being used or not -- this is a problem because you need to decide whether to call calc_rotation_offset_vrfb(...) or calc_rotation_offset(...). Any suggestions on how the rotation mode should be passed between dss.c and omapfb-main.c?

[Shah, Hardik] I have also patched the DSS to support the DSS YUV rotation. Here the rotation type is passed to know the type of rotation required by driver. I have also modified the FBDEV driver to use this patch. Please find the both patches. I have tested it on the old master of tomi. Commit id is 4261fafc4fdc0730b3d4dd83c036d8be09ec8575. I am planning to rebase it on the latest master soon. I have tested the FBDEV driver with different rotation and resolution settings.

Quoted 8 lines

2. If I try to rotate both plane 0 and plane 1 to either 90 degrees or 270 (doesn't matter which is which), as soon as you try to play a video you get VID1_FIFO_UNDERFLOW error messages, so it seems that the hardware seems to be struggling a little when you have two sets of 90/270 degree rotations. If one of the planes is 0/180 and the other is 90/270, then everything is fine. Would changing the FIFO settings somehow improve this or do you have any ideas about what else might make it work better?

[Shah, Hardik] In past I saw setting the FIFO size eliminates this problem. I have some FIFO setting can you please try this out and let me know the result. FIFO_HIGH_THRES = 0x3FC and GFX_FIFO_LOW_THRES = 0x3BC. This I tried in on OMAP3.

Regards,
Hardik Shah

Quoted 5 lines

Thanks in advance,

Grégoire Gentil

[Shah, Hardik] Hi,

From 7cb8ed8d13145ec031a7aa8771956b2f4a3c8978 Mon Sep 17 00:00:00 2001
From: Hardik Shah <[email protected]>
Date: Thu, 2 Apr 2009 17:03:34 +0530
Subject: [PATCH 1/1] DSS2: OMAPFB: Changed to support YUV VRFB rotation.

DSS2 requires the rotation_type to be passed by driver

---
 drivers/video/omap2/omapfb/omapfb-main.c |   31 +++++++++++++++--------------
 drivers/video/omap2/omapfb/omapfb.h      |    7 +-----
 2 files changed, 17 insertions(+), 21 deletions(-)
drivers/video/omap2/omapfb/omapfb-main.c +16 -15
index ad2f0e3..e3fc71f 100644
@@ -176,7 +176,7 @@ static unsigned omapfb_get_vrfb_offset(struct omapfb_info *ofbi, int rot)
 
 static u32 omapfb_get_region_rot_paddr(struct omapfb_info *ofbi)
 {
-	if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
+	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
 		unsigned offset;
 		int rot;
 
@@ -192,7 +192,7 @@ static u32 omapfb_get_region_rot_paddr(struct omapfb_info *ofbi)
 
 u32 omapfb_get_region_paddr(struct omapfb_info *ofbi)
 {
-	if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
+	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
 		return ofbi->region.vrfb.paddr[0];
 	else
 		return ofbi->region.paddr;
@@ -200,7 +200,7 @@ u32 omapfb_get_region_paddr(struct omapfb_info *ofbi)
 
 void __iomem *omapfb_get_region_vaddr(struct omapfb_info *ofbi)
 {
-	if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
+	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
 		return ofbi->region.vrfb.vaddr[0];
 	else
 		return ofbi->region.vaddr;
@@ -383,7 +383,7 @@ void set_fb_fix(struct fb_info *fbi)
 	fbi->screen_base = (char __iomem *)omapfb_get_region_vaddr(ofbi);
 
 	/* used by mmap in fbmem.c */
-	if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
+	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
 		fix->line_length =
 			(OMAP_VRFB_LINE_LEN * var->bits_per_pixel) >> 3;
 	else
@@ -420,7 +420,7 @@ void set_fb_fix(struct fb_info *fbi)
 	fix->ypanstep = 1;
 
 	if (rg->size) {
-		if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
+		if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
 			omap_vrfb_setup(&rg->vrfb, rg->paddr,
 					var->xres_virtual, var->yres_virtual,
 					var->bits_per_pixel >> 3);
@@ -512,7 +512,7 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var)
 	if (var->yres > var->yres_virtual)
 		var->yres = var->yres_virtual;
 
-	if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
+	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
 		line_size = OMAP_VRFB_LINE_LEN * bytespp;
 	else
 		line_size = var->xres_virtual * bytespp;
@@ -534,7 +534,7 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var)
 
 	if (line_size * var->yres_virtual > max_frame_size) {
 		DBG("can't fit FB into memory, reducing x\n");
-		if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
+		if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
 			return -EINVAL;
 
 		var->xres_virtual = max_frame_size / var->yres_virtual /
@@ -673,7 +673,7 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
 	offset = ((var->yoffset * var->xres_virtual +
 				var->xoffset) * var->bits_per_pixel) >> 3;
 
-	if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
+	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
 		data_start_p = omapfb_get_region_rot_paddr(ofbi);
 		data_start_v = NULL;
 	} else {
@@ -695,8 +695,8 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
 
 	ovl->get_overlay_info(ovl, &info);
 
-	if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
-		rot = 0;
+	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
+		rot = ofbi->rotation;
 		mirror = 0;
 	} else {
 		rot = ofbi->rotation;
@@ -709,6 +709,7 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
 	info.width = xres;
 	info.height = yres;
 	info.color_mode = mode;
+	info.rotation_type = ofbi->rotation_type;
 	info.rotation = rot;
 	info.mirror = mirror;
 
@@ -1106,7 +1107,7 @@ static void omapfb_free_fbmem(struct fb_info *fbi)
 	if (rg->vaddr)
 		iounmap(rg->vaddr);
 
-	if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
+	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
 		/* unmap the 0 angle rotation */
 		if (rg->vrfb.vaddr[0]) {
 			iounmap(rg->vrfb.vaddr[0]);
@@ -1166,7 +1167,7 @@ static int omapfb_alloc_fbmem(struct fb_info *fbi, unsigned long size,
 		return -ENOMEM;
 	}
 
-	if (ofbi->rotation_type != OMAPFB_ROT_VRFB) {
+	if (ofbi->rotation_type != OMAP_DSS_ROT_VRFB) {
 		vaddr = ioremap_wc(paddr, size);
 
 		if (!vaddr) {
@@ -1244,7 +1245,7 @@ static int omapfb_alloc_fbmem_display(struct fb_info *fbi, unsigned long size,
 
 		display->get_resolution(display, &w, &h);
 
-		if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
+		if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
 			int oldw = w, oldh = h;
 
 			omap_vrfb_adjust_size(&w, &h, bytespp);
@@ -1593,8 +1594,8 @@ static int omapfb_create_framebuffers(struct omapfb2_device *fbdev)
 		ofbi->id = i;
 
 		/* assign these early, so that fb alloc can use them */
-		ofbi->rotation_type = def_vrfb ? OMAPFB_ROT_VRFB :
-			OMAPFB_ROT_DMA;
+		ofbi->rotation_type = def_vrfb ? OMAP_DSS_ROT_VRFB :
+			OMAP_DSS_ROT_DMA;
 		ofbi->rotation = def_rotate;
 		ofbi->mirror = def_mirror;
 
drivers/video/omap2/omapfb/omapfb.h +1 -6
index 65e9e6e..88e7675 100644
@@ -51,11 +51,6 @@ struct omapfb2_mem_region {
 	bool		map;		/* kernel mapped by the driver */
 };
 
-enum omapfb_rotation_type {
-	OMAPFB_ROT_DMA = 0,
-	OMAPFB_ROT_VRFB = 1,
-};
-
 /* appended to fb_info */
 struct omapfb_info {
 	int id;
@@ -64,7 +59,7 @@ struct omapfb_info {
 	int num_overlays;
 	struct omap_overlay *overlays[OMAPFB_MAX_OVL_PER_FB];
 	struct omapfb2_device *fbdev;
-	enum omapfb_rotation_type rotation_type;
+	enum omap_dss_rotation_type rotation_type;
 	u8 rotation;
 	bool mirror;
 };
Signature · 1 line
1.6.0.3

From e67fafadde2b908ee5c4309fc3bd3cd5a110b0e0 Mon Sep 17 00:00:00 2001
From: Hardik Shah <[email protected]>
Date: Thu, 2 Apr 2009 16:58:39 +0530
Subject: [PATCH 1/1] DSS2: Added support for the YUV VRFB rotation.

Modified disc_setup_plane to get the rotation_type from driver and set the row_inc value accordingly.

---
 arch/arm/plat-omap/include/mach/display.h |    6 ++
 drivers/video/omap2/dss/dispc.c           |   77 ++++++++++++++++++++++++++++-
 drivers/video/omap2/dss/dss.h             |    1 +
 drivers/video/omap2/dss/manager.c         |    2 +
 4 files changed, 84 insertions(+), 2 deletions(-)
arch/arm/plat-omap/include/mach/display.h +6 -0
index eaacf3e..d48b5d2 100644
@@ -338,6 +338,11 @@ enum omap_dss_overlay_managers {
 
 struct omap_overlay_manager;
 
+enum omap_dss_rotation_type {
+	OMAP_DSS_ROT_DMA = 0,
+	OMAP_DSS_ROT_VRFB = 1,
+};
+
 struct omap_overlay_info {
 	bool enabled;
 
@@ -348,6 +353,7 @@ struct omap_overlay_info {
 	u16 height;
 	enum omap_color_mode color_mode;
 	u8 rotation;
+	enum omap_dss_rotation_type rotation_type;
 	bool mirror;
 
 	u16 pos_x;
drivers/video/omap2/dss/dispc.c +75 -2

113 lines not on this page · raw message

drivers/video/omap2/dss/dss.h +1 -0
index 4576821..53ccac2 100644
@@ -268,6 +268,7 @@ int dispc_setup_plane(enum omap_plane plane, enum omap_channel channel_out,
 		      u16 out_width, u16 out_height,
 		      enum omap_color_mode color_mode,
 		      bool ilace,
+		      enum omap_dss_rotation_type rotation_type,
 		      u8 rotation, bool mirror,
 		      u8 global_alpha);
 
drivers/video/omap2/dss/manager.c +2 -0
index e829156..ff29bc5 100644
@@ -195,6 +195,7 @@ static ssize_t manager_color_key_enabled_store(struct omap_overlay_manager *mgr,
 	return size;
 }
 
+
 struct manager_attribute {
 	struct attribute attr;
 	ssize_t (*show)(struct omap_overlay_manager *, char *);
@@ -397,6 +398,7 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 				outh,
 				ovl->info.color_mode,
 				ilace,
+				ovl->info.rotation_type,
 				ovl->info.rotation,
 				ovl->info.mirror,
 				ovl->info.global_alpha);
Signature · 1 line
1.6.0.3
#5 lore raw

Re: YUV rotation support for DSS2 - 2.6.29 [WAS Re: Hello Tomi Valkeinen, I have some questions about dss2 driver.]

Hi Hardik / Tomi,

Quoted 1 line

[Shah, Hardik] I have also patched the DSS to support the DSS YUV rotation.  Here the rotation type is passed to know the type of rotation required by driver.  I have also modified the FBDEV driver to use this patch.  Please find the both patches.  I have tested it on the old master of tomi. Commit id is 4261fafc4fdc0730b3d4dd83c036d8be09ec8575.  I am planning to rebase it on the latest master soon. I have tested the FBDEV driver with different rotation and resolution settings.

I've merged my changes with your patches and rebased against master, please find the new patch attached.

Quoted 2 lines

[Shah, Hardik] In past I saw setting the FIFO size eliminates this problem.  I have some FIFO setting can you please try this out and let me know the result. FIFO_HIGH_THRES = 0x3FC and GFX_FIFO_LOW_THRES = 0x3BC.  This I tried in on OMAP3.

Tried this (see attached patch) but does not help -- still getting these errors as soon as I try to play a video:

omapdss DISPC error: VID1_FIFO_UNDERFLOW, disabling VID1 omapdss DISPC error: SYNC_LOST, disabling LCD

The FIFOs are configured as follows:

omapdss DISPC: fifo(0) size 1024, low/high old 3008/3071, new 956/1020 omapdss DISPC: fifo(1) size 1024, low/high old 956/1020, new 956/1020

Cheers,

Tim

From 5c575fd5226164c75e0bc98a5ead80ee6900fdc1 Mon Sep 17 00:00:00 2001
From: Tim Yamin <[email protected]>
Date: Tue, 7 Apr 2009 11:27:54 -0700
Subject: [PATCH] Change FIFO settings as suggested by Hardik.

---
 drivers/video/omap2/dss/dispc.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/video/omap2/dss/dispc.c +8 -0
index 550a2a0..61785e3 100644
@@ -960,6 +960,12 @@ void dispc_setup_plane_fifo(enum omap_plane plane, u32 low, u32 high)
 
 	BUG_ON(low > size || high > size);
 
+	if(size == 1024)
+	{
+		high = 0x3FC;
+		low = 0x3BC;
+	}
+
 	DSSDBG("fifo(%d) size %d, low/high old %u/%u, new %u/%u\n",
 			plane, size,
 			REG_GET(ftrs_reg[plane], 11, 0),
@@ -1463,6 +1469,8 @@ static int _dispc_setup_plane(enum omap_plane plane,
 			out_width, out_height);
 
 	_dispc_set_plane_pos(plane, pos_x, pos_y);
+	if (plane != OMAP_DSS_GFX)
+		_dispc_set_plane_pos(plane, 5, 5);
 
 	_dispc_set_pic_size(plane, width, height);
 
Signature · 1 line
1.5.6.3

From 826edf9b2b9af7b9bc32f4363724af174911175c Mon Sep 17 00:00:00 2001
From: Tim Yamin <[email protected]>
Date: Tue, 7 Apr 2009 11:52:35 -0700
Subject: [PATCH] DSS2: Add YUV VRFB rotation support

This is a rebased version of Hardik Shah's patch with a few additional tweaks from me.

---
 arch/arm/plat-omap/include/mach/display.h |    6 ++
 arch/arm/plat-omap/vrfb.c                 |    4 +-
 drivers/video/omap2/dss/dispc.c           |   87 ++++++++++++++++++++++++++--
 drivers/video/omap2/dss/dss.h             |    1 +
 drivers/video/omap2/dss/manager.c         |    1 +
 drivers/video/omap2/omapfb/omapfb-main.c  |   66 +++++++++++-----------
 drivers/video/omap2/omapfb/omapfb.h       |    7 +--
 7 files changed, 126 insertions(+), 46 deletions(-)
arch/arm/plat-omap/include/mach/display.h +6 -0
index 6b702c7..b0a6272 100644
@@ -341,6 +341,11 @@ enum omap_dss_overlay_managers {
 
 struct omap_overlay_manager;
 
+enum omap_dss_rotation_type {
+	OMAP_DSS_ROT_DMA = 0,
+	OMAP_DSS_ROT_VRFB = 1,
+};
+
 struct omap_overlay_info {
 	bool enabled;
 
@@ -351,6 +356,7 @@ struct omap_overlay_info {
 	u16 height;
 	enum omap_color_mode color_mode;
 	u8 rotation;
+	enum omap_dss_rotation_type rotation_type;
 	bool mirror;
 
 	u16 pos_x;
arch/arm/plat-omap/vrfb.c +3 -1
index 7e0f8fc..77aa9a7 100644
@@ -61,8 +61,10 @@ void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
 			width, height, bytespp);
 
 	if (bytespp == 4)
+	{
 		pixel_size_exp = 2;
-	else if (bytespp == 2)
+		width >>= 1;
+	} else if (bytespp == 2)
 		pixel_size_exp = 1;
 	else
 		BUG();
drivers/video/omap2/dss/dispc.c +80 -7

129 lines not on this page · raw message

drivers/video/omap2/dss/dss.h +1 -0
index 0be42b6..c722eee 100644
@@ -269,6 +269,7 @@ int dispc_setup_plane(enum omap_plane plane, enum omap_channel channel_out,
 		      u16 out_width, u16 out_height,
 		      enum omap_color_mode color_mode,
 		      bool ilace,
+		      enum omap_dss_rotation_type rotation_type,
 		      u8 rotation, bool mirror);
 
 void dispc_go(enum omap_channel channel);
drivers/video/omap2/dss/manager.c +1 -0
index b0fee80..8ca0bbb 100644
@@ -395,6 +395,7 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 				outh,
 				ovl->info.color_mode,
 				ilace,
+				ovl->info.rotation_type,
 				ovl->info.rotation,
 				ovl->info.mirror);
 
drivers/video/omap2/omapfb/omapfb-main.c +34 -32

158 lines not on this page · raw message

drivers/video/omap2/omapfb/omapfb.h +1 -6
index 65e9e6e..88e7675 100644
@@ -51,11 +51,6 @@ struct omapfb2_mem_region {
 	bool		map;		/* kernel mapped by the driver */
 };
 
-enum omapfb_rotation_type {
-	OMAPFB_ROT_DMA = 0,
-	OMAPFB_ROT_VRFB = 1,
-};
-
 /* appended to fb_info */
 struct omapfb_info {
 	int id;
@@ -64,7 +59,7 @@ struct omapfb_info {
 	int num_overlays;
 	struct omap_overlay *overlays[OMAPFB_MAX_OVL_PER_FB];
 	struct omapfb2_device *fbdev;
-	enum omapfb_rotation_type rotation_type;
+	enum omap_dss_rotation_type rotation_type;
 	u8 rotation;
 	bool mirror;
 };
Signature · 1 line
1.5.6.3
#6 lore raw

RE: YUV rotation support for DSS2 - 2.6.29 [WAS Re: Hello Tomi Valkeinen, I have some questions about dss2 driver.]

Hi,

Quoted 11 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Tim Yamin
Sent: Wednesday, April 08, 2009 12:31 AM
To: Shah, Hardik
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: YUV rotation support for DSS2 - 2.6.29 [WAS Re: Hello Tomi Valkeinen, I have some questions about dss2 driver.]

Hi Hardik / Tomi,

Quoted 7 lines
Quoted 1 line

[Shah, Hardik] I have also patched the DSS to support the DSS YUV rotation.

 Here the rotation type is passed to know the type of rotation required by driver.  I have also modified the FBDEV driver to use this patch.  Please find the both patches.  I have tested it on the old master of tomi. Commit id is 4261fafc4fdc0730b3d4dd83c036d8be09ec8575.  I am planning to rebase it on the latest master soon. I have tested the FBDEV driver with different rotation and resolution settings.

Hi Tim,
I have done few changes to your patch.

- else if (bytespp == 2)
+ width >>= 1;
Will not work for 32 bit formats like ARGB or RGB24u.

Secondly I have fixed lot many check patch warnings/errors in your patch. So please do that before providing patches.

Third I have implemented VRFB mirroring also.

I have tested YUV, UYVY, RGB24u, RGB16, and ARGB on V4L2 driver with rotation and mirroring with different resolutions on LCD and its working fine.

Tim,

Will you please test the YUV rotation with frame buffer driver with the attached patch and let us know the result. I have tested RGB rotation and its working fine.

Hi Tomi,
If YUV rotation with frame buffer passes can you please review the patch and merge it to your latest.

Regards,
Hardik

Quoted 3 lines

I've merged my changes with your patches and rebased against master, please find the new patch attached.

[Shah, Hardik] Hi Tim,
I have modified your DSS2 rotation patch to make it more generic to support YUV as well as ARGB32 and RGB24u formats.

Quoted 13 lines
Quoted 2 lines

[Shah, Hardik] In past I saw setting the FIFO size eliminates this problem.

 I have some FIFO setting can you please try this out and let me know the result.

Quoted 1 line

FIFO_HIGH_THRES = 0x3FC and GFX_FIFO_LOW_THRES = 0x3BC.  This I tried in on

OMAP3.

Tried this (see attached patch) but does not help -- still getting these errors as soon as I try to play a video:

omapdss DISPC error: VID1_FIFO_UNDERFLOW, disabling VID1 omapdss DISPC error: SYNC_LOST, disabling LCD

Quoted 8 lines

The FIFOs are configured as follows:

omapdss DISPC: fifo(0) size 1024, low/high old 3008/3071, new 956/1020 omapdss DISPC: fifo(1) size 1024, low/high old 956/1020, new 956/1020

Cheers,

Tim

From c40d8f7f94fd5294393753445f31922bcd274a6a Mon Sep 17 00:00:00 2001
From: Hardik Shah <[email protected]>
Date: Thu, 9 Apr 2009 12:13:07 +0530
Subject: [PATCH 2/2] DSS2: OMAPFB: Added support for the YUV VRFB rotation and mirroring.

DSS2 now requires roatation_type to be specified by driver. Added support for that.
DSS2 OMAPFB: Modified to pass the dss mode to omap_vrfb_setup function.

VRFB size register requires the width to be halved when the
mode is YUV or UYVY. So VRFB is modifed to pass the mode to omap_vrfb_setup function.

Few changes done by Tim Yamin

---
 arch/arm/plat-omap/vrfb.c                |    4 +-
 drivers/video/omap2/omapfb/omapfb-main.c |   59 ++++++++++++++----------------
 drivers/video/omap2/omapfb/omapfb.h      |    7 +---
 3 files changed, 30 insertions(+), 40 deletions(-)
arch/arm/plat-omap/vrfb.c +2 -2
index e0036f7..5610539 100644
@@ -88,9 +88,9 @@ void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
 			color_mode == OMAP_DSS_COLOR_UYVY)
 		width >>= 1;
 
-	if (bytespp == 4) {
+	if (bytespp == 4)
 		pixel_size_exp = 2;
-	} else if (bytespp == 2)
+	else if (bytespp == 2)
 		pixel_size_exp = 1;
 	else
 		BUG();
drivers/video/omap2/omapfb/omapfb-main.c +27 -32

151 lines not on this page · raw message

drivers/video/omap2/omapfb/omapfb.h +1 -6
index 65e9e6e..88e7675 100644
@@ -51,11 +51,6 @@ struct omapfb2_mem_region {
 	bool		map;		/* kernel mapped by the driver */
 };
 
-enum omapfb_rotation_type {
-	OMAPFB_ROT_DMA = 0,
-	OMAPFB_ROT_VRFB = 1,
-};
-
 /* appended to fb_info */
 struct omapfb_info {
 	int id;
@@ -64,7 +59,7 @@ struct omapfb_info {
 	int num_overlays;
 	struct omap_overlay *overlays[OMAPFB_MAX_OVL_PER_FB];
 	struct omapfb2_device *fbdev;
-	enum omapfb_rotation_type rotation_type;
+	enum omap_dss_rotation_type rotation_type;
 	u8 rotation;
 	bool mirror;
 };
Signature · 1 line
1.6.0.3

From 6fbfc5fc2291a421e1f748dfd81a7bf643e77e72 Mon Sep 17 00:00:00 2001
From: Hardik Shah <[email protected]>
Date: Thu, 9 Apr 2009 12:09:44 +0530
Subject: [PATCH 1/2] DSS2: VRFB rotation and mirroring implemented.

DSS2 modified to accept the rotation_type input
to get the dma or VRFB rotation.

DSS2: VRFB: Changed to pass DSS mode to vrfb_setup instead of Bpp.

VRFB size registers requires the width to be halved when the mode is YUV or UYVY. So modifed to pass the mode to omap_vrfb_setup function.

Code added by Tim Yamin for few bug fixes

---
 arch/arm/plat-omap/include/mach/display.h |    6 ++
 arch/arm/plat-omap/include/mach/vrfb.h    |    3 +-
 arch/arm/plat-omap/vrfb.c                 |   36 +++++++++-
 drivers/video/omap2/dss/dispc.c           |  109 +++++++++++++++++++++++++++--
 drivers/video/omap2/dss/dss.h             |    1 +
 drivers/video/omap2/dss/manager.c         |    1 +
 6 files changed, 144 insertions(+), 12 deletions(-)
arch/arm/plat-omap/include/mach/display.h +6 -0
index 6b702c7..b0a6272 100644
@@ -341,6 +341,11 @@ enum omap_dss_overlay_managers {
 
 struct omap_overlay_manager;
 
+enum omap_dss_rotation_type {
+	OMAP_DSS_ROT_DMA = 0,
+	OMAP_DSS_ROT_VRFB = 1,
+};
+
 struct omap_overlay_info {
 	bool enabled;
 
@@ -351,6 +356,7 @@ struct omap_overlay_info {
 	u16 height;
 	enum omap_color_mode color_mode;
 	u8 rotation;
+	enum omap_dss_rotation_type rotation_type;
 	bool mirror;
 
 	u16 pos_x;
arch/arm/plat-omap/include/mach/vrfb.h +2 -1
index 2047862..12c7fab 100644
@@ -24,6 +24,7 @@
 #ifndef __VRFB_H
 #define __VRFB_H
 
+#include <mach/display.h>
 #define OMAP_VRFB_LINE_LEN 2048
 
 struct vrfb
@@ -42,6 +43,6 @@ extern void omap_vrfb_adjust_size(u16 *width, u16 *height,
 		u8 bytespp);
 extern void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
 		u16 width, u16 height,
-		u8 bytespp);
+		enum omap_color_mode color_mode);
 
 #endif /* __VRFB_H */
arch/arm/plat-omap/vrfb.c +32 -4
index 7e0f8fc..e0036f7 100644
@@ -5,7 +5,6 @@
 
 #include <mach/io.h>
 #include <mach/vrfb.h>
-
 /*#define DEBUG*/
 
 #ifdef DEBUG
@@ -50,19 +49,48 @@ EXPORT_SYMBOL(omap_vrfb_adjust_size);
 
 void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
 		u16 width, u16 height,
-		u8 bytespp)
+		enum omap_color_mode color_mode)
 {
 	unsigned pixel_size_exp;
 	u16 vrfb_width;
 	u16 vrfb_height;
 	u8 ctx = vrfb->context;
+	u8 bytespp;
 
 	DBG("omapfb_set_vrfb(%d, %lx, %dx%d, %d)\n", ctx, paddr,
 			width, height, bytespp);
 
-	if (bytespp == 4)
+	switch (color_mode) {
+	case OMAP_DSS_COLOR_RGB16:
+	case OMAP_DSS_COLOR_ARGB16:
+		bytespp = 2;
+		break;
+
+	case OMAP_DSS_COLOR_RGB24P:
+		bytespp = 3;
+		break;
+
+	case OMAP_DSS_COLOR_RGB24U:
+	case OMAP_DSS_COLOR_ARGB32:
+	case OMAP_DSS_COLOR_RGBA32:
+	case OMAP_DSS_COLOR_RGBX32:
+	case OMAP_DSS_COLOR_YUV2:
+	case OMAP_DSS_COLOR_UYVY:
+		bytespp = 4;
+		break;
+
+	default:
+		BUG();
+		return;
+	}
+
+	if (color_mode == OMAP_DSS_COLOR_YUV2 ||
+			color_mode == OMAP_DSS_COLOR_UYVY)
+		width >>= 1;
+
+	if (bytespp == 4) {
 		pixel_size_exp = 2;
-	else if (bytespp == 2)
+	} else if (bytespp == 2)
 		pixel_size_exp = 1;
 	else
 		BUG();
drivers/video/omap2/dss/dispc.c +102 -7

151 lines not on this page · raw message

drivers/video/omap2/dss/dss.h +1 -0
index 0be42b6..c722eee 100644
@@ -269,6 +269,7 @@ int dispc_setup_plane(enum omap_plane plane, enum omap_channel channel_out,
 		      u16 out_width, u16 out_height,
 		      enum omap_color_mode color_mode,
 		      bool ilace,
+		      enum omap_dss_rotation_type rotation_type,
 		      u8 rotation, bool mirror);
 
 void dispc_go(enum omap_channel channel);
drivers/video/omap2/dss/manager.c +1 -0
index b0fee80..8ca0bbb 100644
@@ -395,6 +395,7 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 				outh,
 				ovl->info.color_mode,
 				ilace,
+				ovl->info.rotation_type,
 				ovl->info.rotation,
 				ovl->info.mirror);
 
Signature · 1 line
1.6.0.3
#7 lore raw

Re: YUV rotation support for DSS2 - 2.6.29 [WAS Re: Hello Tomi Valkeinen, I have some questions about dss2 driver.]

Hi Hardik,

Thanks for fixing up the patch. I can confirm that YUV rotation is fine and patches are ready to be merged -- although the attached fix is needed as well for the userspace layer to know the correct row strides when writing YUV to the framebuffer.

I'm still having VID1_FIFO_UNDERFLOW errors when I try to play rotated video on plane 1 and plane 0 is rotated as well. Do you have any ideas how to debug this further?

Thanks,

Tim

Quoted 5 lines

Hi Tomi,
If YUV rotation with frame buffer passes can you please review the patch and merge it to your latest.

Regards,
Hardik

From 4ba3f8b1d2feef00ac6c8de827262d255cebb185 Mon Sep 17 00:00:00 2001
From: Tim Yamin <[email protected]>
Date: Mon, 13 Apr 2009 13:57:42 -0700
Subject: [PATCH] DSS2: OMAPFB: Set line_length correctly for YUV with VRFB.

---
 drivers/video/omap2/omapfb/omapfb-main.c |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)
drivers/video/omap2/omapfb/omapfb-main.c +25 -5
index 9043265..675a7c9 100644
@@ -377,10 +377,19 @@ void set_fb_fix(struct fb_info *fbi)
 	fbi->screen_base = (char __iomem *)omapfb_get_region_vaddr(ofbi);
 
 	/* used by mmap in fbmem.c */
-	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
-		fix->line_length =
-			(OMAP_VRFB_LINE_LEN * var->bits_per_pixel) >> 3;
-	else
+	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
+		switch (var->nonstd) {
+		case OMAPFB_COLOR_YUV422:
+		case OMAPFB_COLOR_YUY422:
+			fix->line_length =
+				(OMAP_VRFB_LINE_LEN * var->bits_per_pixel) >> 2;
+			break;
+		default:
+			fix->line_length =
+				(OMAP_VRFB_LINE_LEN * var->bits_per_pixel) >> 3;
+			break;
+		}
+	} else
 		fix->line_length =
 			(var->xres_virtual * var->bits_per_pixel) >> 3;
 	fix->smem_start = omapfb_get_region_paddr(ofbi);
@@ -689,7 +698,18 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
 		goto err;
 	}
 
-	screen_width = fix->line_length / (var->bits_per_pixel >> 3);
+	switch (var->nonstd) {
+	case OMAPFB_COLOR_YUV422:
+	case OMAPFB_COLOR_YUY422:
+		if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
+			screen_width = fix->line_length
+				/ (var->bits_per_pixel >> 2);
+			break;
+		}
+	default:
+		screen_width = fix->line_length / (var->bits_per_pixel >> 3);
+		break;
+	}
 
 	ovl->get_overlay_info(ovl, &info);
 
Signature · 1 line
1.5.6.3
#8 lore raw

RE: YUV rotation support for DSS2 - 2.6.29 [WAS Re: Hello Tomi Valkeinen, I have some questions about dss2 driver.]

Hi Tomi,
Can you please merge the YUV rotation patches with your latest?

Thanks and Regards,
Haardik

Quoted 30 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Tim Yamin
Sent: Tuesday, April 14, 2009 2:30 AM
To: Shah, Hardik
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: YUV rotation support for DSS2 - 2.6.29 [WAS Re: Hello Tomi Valkeinen, I have some questions about dss2 driver.]

Hi Hardik,

Thanks for fixing up the patch. I can confirm that YUV rotation is fine and patches are ready to be merged -- although the attached fix is needed as well for the userspace layer to know the correct row strides when writing YUV to the framebuffer.

I'm still having VID1_FIFO_UNDERFLOW errors when I try to play rotated video on plane 1 and plane 0 is rotated as well. Do you have any ideas how to debug this further?

Thanks,

Tim

Quoted 2 lines

Hi Tomi,
If YUV rotation with frame buffer passes can you please review the patch and

merge it to your latest.

Quoted 3 lines

Regards,
Hardik

#10 lore raw

RE: YUV rotation support for DSS2 - 2.6.29 [WAS Re: Hello Tomi Valkeinen, I have some questions about dss2 driver.]

In reply to Tim Yamin
Quoted 13 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Tim Yamin
Sent: Tuesday, April 14, 2009 2:30 AM
To: Shah, Hardik
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: YUV rotation support for DSS2 - 2.6.29 [WAS Re: Hello Tomi Valkeinen, I have some questions about dss2 driver.]

Hi Hardik,

Quoted 8 lines

Thanks for fixing up the patch. I can confirm that YUV rotation is fine and patches are ready to be merged -- although the attached fix is needed as well for the userspace layer to know the correct row strides when writing YUV to the framebuffer.

I'm still having VID1_FIFO_UNDERFLOW errors when I try to play rotated video on plane 1 and plane 0 is rotated as well. Do you have any ideas how to debug this further?

[Shah, Hardik] Hi Tim,
Try to increase the pixel clock to functional clock ratio to 6 or 8. This may help as you are getting under run errors.

Thanks,
Hardik

Quoted 11 lines

Thanks,

Tim

Quoted 2 lines

Hi Tomi,
If YUV rotation with frame buffer passes can you please review the patch and

merge it to your latest.

Quoted 3 lines

Regards,
Hardik

#11 lore raw

Re: YUV rotation support for DSS2 - 2.6.29 [WAS Re: Hello Tomi Valkeinen, I have some questions about dss2 driver.]

Hi Hardik,

2009/4/15 Shah, Hardik <[email protected]>:

Quoted 2 lines

[Shah, Hardik] Hi Tim,
Try to increase the pixel clock to functional clock ratio to 6 or 8.  This may help as you are getting under run errors.

Thanks for the help -- so it seems that it's a clock issue. At 800x600 rotation of both planes simultaneously by 90 degrees is working just fine. At 1024x768 it seems that it's not possible because of the
clocking: the pixel clock is 56MHz so the maximum OMAP2_DSS_MIN_FCK_PER_PCK constant is 3, which does not seem to be sufficient.

Cheers,

Tim
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

RE: YUV rotation support for DSS2 - 2.6.29 [WAS Re: Hello Tomi Valkeinen, I have some questions about dss2 driver.]

In reply to Shah, Hardik

Hi Hardik and Tim,

Thanks for the patches. They look fine to me, and are applied to my tree.

Tomi

Quoted 36 lines · Hardik

Hi Tomi,
Can you please merge the YUV rotation patches with your latest?

Thanks and Regards,
Haardik

Quoted 30 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Tim Yamin
Sent: Tuesday, April 14, 2009 2:30 AM
To: Shah, Hardik
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: YUV rotation support for DSS2 - 2.6.29 [WAS Re: Hello Tomi Valkeinen, I have some questions about dss2 driver.]

Hi Hardik,

Thanks for fixing up the patch. I can confirm that YUV rotation is fine and patches are ready to be merged -- although the attached fix is needed as well for the userspace layer to know the correct row strides when writing YUV to the framebuffer.

I'm still having VID1_FIFO_UNDERFLOW errors when I try to play rotated video on plane 1 and plane 0 is rotated as well. Do you have any ideas how to debug this further?

Thanks,

Tim

Quoted 2 lines

Hi Tomi,
If YUV rotation with frame buffer passes can you please review the patch and

merge it to your latest.

Quoted 3 lines

Regards,
Hardik