Re: omap3-isp status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 10, 2011 at 8:18 PM, Javier Martinez Canillas
<martinez.javier@xxxxxxxxx> wrote:
> On Mon, Oct 10, 2011 at 7:09 PM, Enrico <ebutera@xxxxxxxxxxxxxxxx> wrote:
>> On Mon, Oct 10, 2011 at 6:53 PM, Javier Martinez Canillas
>> <martinez.javier@xxxxxxxxx> wrote:
>>> On Mon, Oct 10, 2011 at 6:34 PM, Enrico <ebutera@xxxxxxxxxxxxxxxx> wrote:
>>>> Ok, i made it work. It was missing just the config_outlineoffset i
>>>> wrote before and a missing FLDMODE in SYNC registers.
>>>>
>>>
>>> Great, do you get the ghosting effect or do you have a clean video?
>>
>>
>> Unfortunately i always get the ghosting effect. But this is something
>> we will try to fix later.
>>
>>
>
> Agree, we should try to get some code upstream to add interlaced video
> and bt.656 support and fix the artifact later.
>
>>>> Moreover it seems to me that the software-maintained field id
>>>> (interlaced_cnt in Javier patches, fldstat in Deepthy patches) is
>>>> useless, i've tried to only use the FLDSTAT bit from isp register
>>>> (fid) in vd0_isr:
>>>>
>>>> if (fid == 0) {
>>>>     restart = ccdc_isr_buffer(ccdc);
>>>>     goto done;
>>>> }
>>>>
>>>> and it works. I've not tested very long frame sequences, only up to 16
>>>> frames. The only issue is that the first frame could be half-green
>>>> because a field is missing.
>>>>
>>>
>>> Yes, when I tried Deepthy patches I realized that the fldstat was not
>>> in sync with the frames, but probably I made something wrong.
>>
>>
>> I had noticed the same thing, but now i tested it and it is ok, maybe
>> my fault too.
>>
>>
>>> We had the same problem with the hal-green frame. Our solution was to
>>> synchronize the CCDC with the first even field looking at fdstat on
>>> the VD1 interrupt handler and forcing to start processing from an ODD
>>> sub-frame.
>>
>> Thinking more about it, it's ugly to have that half-green video frame
>> even if it's just one. It's better to keep your or Deepthy solution.
>>
>> Enrico
>>
>
> Well, that is something that can be fixed later also. Can you send to
> the list your patches? So, Laurent, Sakari and others than know more
> about the ISP can review it. I hope they can find the cause for the
> artifact.

I'm attaching some fixes (taken from Deepthy patches) to be applied on
top of your v2 patches, with those i can grab frames but i only get
garbage.

I think the problem is that it always hits this in ccdc_isr_buffer:

if (ccdc_sbl_wait_idle(ccdc, 1000)) {
                dev_info(isp->dev, "CCDC won't become idle!\n");
                goto done;
}

so the video buffer never gets updated.

At this point i think it is better to go on with my port of Deepthy
patches and try to solve the ghosting issues, maybe with your fixes
about buffer decoupling.

Laurent, what do you suggest to do?

Enrico
From 078f2843ba94cfbc150f6c01cc614c0ed3a35fd4 Mon Sep 17 00:00:00 2001
From: Enrico Butera <ebutera@xxxxxxxxxxxxxxxx>
Date: Tue, 11 Oct 2011 11:51:38 +0200
Subject: [PATCH] omap3isp: some fixes for Javier v2 patches

Signed-off-by: Enrico Butera <ebutera@xxxxxxxxxxxxxxxx>
---
 drivers/media/video/omap3isp/ispccdc.c |   41 +++++++++++++++++++++++--------
 1 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c
index f1da49c..0cb4e36 100644
--- a/drivers/media/video/omap3isp/ispccdc.c
+++ b/drivers/media/video/omap3isp/ispccdc.c
@@ -43,6 +43,7 @@ __ccdc_get_format(struct isp_ccdc_device *ccdc, struct v4l2_subdev_fh *fh,
 		  unsigned int pad, enum v4l2_subdev_format_whence which);
 static bool ccdc_input_is_bt656(struct isp_ccdc_device *ccdc);
 static bool ccdc_input_is_fldmode(struct isp_ccdc_device *ccdc);
+static int __ccdc_handle_stopping(struct isp_ccdc_device *ccdc, u32 event);
 
 static const unsigned int ccdc_fmts[] = {
 	V4L2_MBUS_FMT_Y8_1X8,
@@ -795,11 +796,17 @@ static void ccdc_apply_controls(struct isp_ccdc_device *ccdc)
 void omap3isp_ccdc_restore_context(struct isp_device *isp)
 {
 	struct isp_ccdc_device *ccdc = &isp->isp_ccdc;
+	struct v4l2_mbus_framefmt *format;
 
 	isp_reg_set(isp, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_CFG, ISPCCDC_CFG_VDLC);
 
-	ccdc->update = OMAP3ISP_CCDC_ALAW | OMAP3ISP_CCDC_LPF
-		     | OMAP3ISP_CCDC_BLCLAMP | OMAP3ISP_CCDC_BCOMP;
+	/* CCDC_PAD_SINK */
+	format = &ccdc->formats[CCDC_PAD_SINK];
+	if ((format->code != V4L2_MBUS_FMT_UYVY8_2X8) &&
+			(format->code != V4L2_MBUS_FMT_UYVY8_2X8))
+		ccdc->update = OMAP3ISP_CCDC_ALAW | OMAP3ISP_CCDC_LPF
+				| OMAP3ISP_CCDC_BLCLAMP | OMAP3ISP_CCDC_BCOMP;
+
 	ccdc_apply_controls(ccdc);
 	ccdc_configure_fpc(ccdc);
 }
@@ -1021,10 +1028,10 @@ static void ccdc_config_sync_if(struct isp_ccdc_device *ccdc,
 
 	if (pdata && pdata->bt656)
 		isp_reg_set(isp, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_REC656IF,
-			    ISPCCDC_REC656IF_R656ON);
+			    ISPCCDC_REC656IF_R656ON | ISPCCDC_REC656IF_ECCFVH);
 	else
 		isp_reg_clr(isp, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_REC656IF,
-			    ISPCCDC_REC656IF_R656ON);
+			    ISPCCDC_REC656IF_R656ON | ISPCCDC_REC656IF_ECCFVH);
 }
 
 /* CCDC formats descriptions */
@@ -1187,7 +1194,9 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc)
 		ccdc_pattern = ccdc_sgrbg_pattern;
 		break;
 	}
-	ccdc_config_imgattr(ccdc, ccdc_pattern);
+	if ((format->code != V4L2_MBUS_FMT_YUYV8_2X8) &&
+			(format->code != V4L2_MBUS_FMT_UYVY8_2X8))
+		ccdc_config_imgattr(ccdc, ccdc_pattern);
 
 	/* In BT.656 a pixel is representd using two bytes */
 	if (pdata->bt656)
@@ -1219,7 +1228,7 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc)
 		       OMAP3_ISP_IOMEM_CCDC, ISPCCDC_HORZ_INFO);
 	isp_reg_writel(isp, 0 << ISPCCDC_VERT_START_SLV0_SHIFT,
 		       OMAP3_ISP_IOMEM_CCDC, ISPCCDC_VERT_START);
-	isp_reg_writel(isp, nlv << ISPCCDC_VERT_LINES_NLV_SHIFT,
+	isp_reg_writel(isp, (((format->height >> 1) - 1) /*nlv*/ << ISPCCDC_VERT_LINES_NLV_SHIFT),
 		       OMAP3_ISP_IOMEM_CCDC, ISPCCDC_VERT_LINES);
 	isp_reg_writel(isp, 0 << ISPCCDC_VERT_START_SLV1_SHIFT,
 		       OMAP3_ISP_IOMEM_CCDC, ISPCCDC_VERT_START);
@@ -1278,6 +1287,11 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc)
 unlock:
 	spin_unlock_irqrestore(&ccdc->lsc.req_lock, flags);
 
+	if (pdata->bt656)
+		ccdc->update = OMAP3ISP_CCDC_BLCLAMP;
+	else
+		ccdc->update = 0;
+
 	ccdc_apply_controls(ccdc);
 }
 
@@ -1299,6 +1313,11 @@ static int ccdc_disable(struct isp_ccdc_device *ccdc)
 		ccdc->stopping = CCDC_STOP_REQUEST;
 	spin_unlock_irqrestore(&ccdc->lock, flags);
 
+	__ccdc_lsc_enable(ccdc, 0);
+	__ccdc_enable(ccdc, 0);
+	ccdc->stopping = CCDC_STOP_EXECUTED;
+	__ccdc_handle_stopping(ccdc, CCDC_STOP_FINISHED);
+
 	ret = wait_event_timeout(ccdc->wait,
 				 ccdc->stopping == CCDC_STOP_FINISHED,
 				 msecs_to_jiffies(2000));
@@ -1522,7 +1541,7 @@ static int ccdc_isr_buffer(struct isp_ccdc_device *ccdc)
 	/* In interlaced mode a frame is composed of two subframes so we don't have
 	 * to change the CCDC output memory on every end of frame.
 	 */
-	if (!ccdc_input_is_fldmode(ccdc)) {
+	if (ccdc_input_is_fldmode(ccdc)) {
 		if (!ccdc->interlaced_cnt) {
 			ccdc->interlaced_cnt = 1;
 			restart = 1;
@@ -1656,7 +1675,7 @@ int omap3isp_ccdc_isr(struct isp_ccdc_device *ccdc, u32 events)
 	if (ccdc->state == ISP_PIPELINE_STREAM_STOPPED)
 		return 0;
 
-	if (events & IRQ0STATUS_CCDC_VD1_IRQ)
+	if ((events & IRQ0STATUS_CCDC_VD1_IRQ) && !ccdc_input_is_bt656(ccdc))
 		ccdc_vd1_isr(ccdc);
 
 	ccdc_lsc_isr(ccdc, events);
@@ -1664,7 +1683,7 @@ int omap3isp_ccdc_isr(struct isp_ccdc_device *ccdc, u32 events)
 	if (events & IRQ0STATUS_CCDC_VD0_IRQ)
 		ccdc_vd0_isr(ccdc);
 
-	if (events & IRQ0STATUS_HS_VS_IRQ)
+	if ((events & IRQ0STATUS_HS_VS_IRQ) && !ccdc_input_is_bt656(ccdc))
 		ccdc_hs_vs_isr(ccdc);
 
 	return 0;
@@ -1774,7 +1793,7 @@ static int ccdc_set_stream(struct v4l2_subdev *sd, int enable)
 		 * links are inactive.
 		 */
 		ccdc_config_vp(ccdc);
-		ccdc_enable_vp(ccdc, 1);
+		ccdc_enable_vp(ccdc, 0);
 		ccdc->error = 0;
 		ccdc_print_status(ccdc);
 	}
@@ -2344,7 +2363,7 @@ int omap3isp_ccdc_init(struct isp_device *isp)
 
 	ccdc->vpcfg.pixelclk = 0;
 
-	ccdc->update = OMAP3ISP_CCDC_BLCLAMP;
+	ccdc->update = 0;
 	ccdc_apply_controls(ccdc);
 
 	ret = ccdc_init_entities(ccdc);
-- 
1.7.4.1


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux