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

vrfb-yuv-rotation.patch (5.92 KB)

From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
owner@vger.kernel.org] On Behalf Of Gregoire Gentil
Sent: Tuesday, April 07, 2009 10:00 AM
To: tomi.valkeinen@nokia.com
Cc: linux-omap@vger.kernel.org; beagleboard@googlegroups.com; plasm@roo.me.uk
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.

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.

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

Thanks in advance,

Grégoire Gentil

[Shah, Hardik] Hi,

0002-DSS2-OMAPFB-Changed-to-support-YUV-VRFB-rotation.patch (5.88 KB)

0001-DSS2-Added-support-for-the-YUV-VRFB-rotation.patch (5.71 KB)

Hi Hardik / Tomi,

[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.

[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

0002-Change-FIFO-settings-as-suggested-by-Hardik.patch (1.06 KB)

0001-DSS2-Add-YUV-VRFB-rotation-support.patch (13 KB)

Hi,

From: plasmaroo@gmail.com [mailto:plasmaroo@gmail.com] On Behalf Of Tim Yamin
Sent: Wednesday, April 08, 2009 12:31 AM
To: Shah, Hardik
Cc: gregoire@gentil.com; tomi.valkeinen@nokia.com; linux-omap@vger.kernel.org;
beagleboard@googlegroups.com
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,

> [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

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.

0002-DSS2-OMAPFB-Added-support-for-the-YUV-VRFB-rotatio.patch (7.58 KB)

0001-DSS2-VRFB-rotation-and-mirroring-implemented.patch (8.75 KB)

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

0001-DSS2-OMAPFB-Set-line_length-correctly-for-YUV-with.patch (1.87 KB)

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

Thanks and Regards,
Haardik

From: plasmaroo@gmail.com [mailto:plasmaroo@gmail.com] On Behalf Of Tim Yamin
Sent: Tuesday, April 14, 2009 2:30 AM
To: Shah, Hardik
Cc: gregoire@gentil.com; tomi.valkeinen@nokia.com; linux-omap@vger.kernel.org;
beagleboard@googlegroups.com
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?

[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

Hi Hardik,

[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

Tim Yamin wrote:

Hi Hardik,

[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.

I have not played much with rotation, but I have played quite a bit with
scaling. I can do full scaling (both vertical and horizontal) at 800x600
with a x6 clock multiplier, but at 1024x768, I found that that I can do
limited horizontal scaling and no vertical scaling. As you say, it looks
like the FCLK cannot be made to run fast enough to do much work
per-pixel at that resolution.

Brett

Hi Hardik and Tim,

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

Tomi