Skip to contentSkip to conversation

media: davinci: vpbe: fix layer availability for NV12 format

PATCH Superseded Prabhakar Lad 2 participants 2 messages May 3, 2013 Media (V4L/DVB)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: davinci: vpbe: fix layer availability for NV12 format

From: Lad, Prabhakar <[email protected]>

For NV12 format, even if display data is single image, both VIDWIN0 and VIDWIN1 parameters must be used. The start address of Y data plane and C data plane is configured in VIDEOWIN0ADH/L and VIDEOWIN1ADH/L respectively. cuurently only one layer was requested, which is suffice for yuv422, but for yuv420(NV12) two layers are required and fix the same by requesting for other layer if pix fmt is NV12 during set_fmt.

---
 drivers/media/platform/davinci/vpbe_display.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
drivers/media/platform/davinci/vpbe_display.c +16 -0
index 0341dcc..f2ee07b 100644
@@ -922,6 +922,22 @@ static int vpbe_display_s_fmt(struct file *file, void *priv,
 	other video window */
 
 	layer->pix_fmt = *pixfmt;
+	if (pixfmt->pixelformat == V4L2_PIX_FMT_NV12 &&
+	    cpu_is_davinci_dm365()) {
+		struct vpbe_layer *otherlayer;
+
+		otherlayer = _vpbe_display_get_other_win_layer(disp_dev, layer);
+		/* if other layer is available, only
+		* claim it, do not configure it
+		*/
+		ret = osd_device->ops.request_layer(osd_device,
+						    otherlayer->layer_info.id);
+		if (ret < 0) {
+			v4l2_err(&vpbe_dev->v4l2_dev,
+				 "Display Manager failed to allocate layer\n");
+			return -EBUSY;
+		}
+	}
 
 	/* Get osd layer config */
 	osd_device->ops.get_layer_config(osd_device,
Signature · 1 line
1.7.4.1
#1 lore raw

Hello.

Quoted 21 lines · Prabhakar Lad

From: Lad, Prabhakar <[email protected]>

For NV12 format, even if display data is single image, both VIDWIN0 and VIDWIN1 parameters must be used. The start address of Y data plane and C data plane is configured in VIDEOWIN0ADH/L and VIDEOWIN1ADH/L respectively. cuurently only one layer was requested, which is suffice for yuv422, but for yuv420(NV12) two layers are required and fix the same by requesting for other layer if pix fmt is NV12 during set_fmt.

---
  drivers/media/platform/davinci/vpbe_display.c |   16 ++++++++++++++++
  1 files changed, 16 insertions(+), 0 deletions(-)
drivers/media/platform/davinci/vpbe_display.c +0 -0
index 0341dcc..f2ee07b 100644

drivers/media/platform/davinci/vpbe_display.c static int vpbe_display_s_fmt(struct file *file, void *priv, · line 926

Quoted 5 lines
drivers/media/platform/davinci/vpbe_display.c +2 -0
@@ -922,6 +922,22 @@ static int vpbe_display_s_fmt(struct file *file, void *priv,
  	other video window */
 
  	layer->pix_fmt = *pixfmt;
+	if (pixfmt->pixelformat == V4L2_PIX_FMT_NV12 &&
+	    cpu_is_davinci_dm365()) {

cpu_is_*() shouldn't be used in the drivers.

Quoted 4 lines
drivers/media/platform/davinci/vpbe_display.c +4 -0
+		struct vpbe_layer *otherlayer;
+
+		otherlayer = _vpbe_display_get_other_win_layer(disp_dev, layer);
+		/* if other layer is available, only

drivers/media/platform/davinci/vpbe_display.c static int vpbe_display_s_fmt(struct file *file, void *priv, · line 940

Quoted 10 lines
drivers/media/platform/davinci/vpbe_display.c +10 -0
+		* claim it, do not configure it
+		*/
+		ret = osd_device->ops.request_layer(osd_device,
+						    otherlayer->layer_info.id);
+		if (ret < 0) {
+			v4l2_err(&vpbe_dev->v4l2_dev,
+				 "Display Manager failed to allocate layer\n");
+			return -EBUSY;
+		}
+	}

WBR, Sergei