Re: [PATCH] OMAP: DSS2: DMA optimization using scaler line buffers

2010-06-23 Thread Koen Kooi

Op 23 jun 2010, om 07:18 heeft Nagarajan, Rajkumar het volgende geschreven:

 
 --- a/drivers/video/omap2/omapfb/omapfb-main.c
 +++ b/drivers/video/omap2/omapfb/omapfb-main.c
 @@ -552,7 +552,7 @@ static int setup_vrfb_rotation(struct fb_info *fbi)
   omap_vrfb_setup(rg-vrfb, rg-paddr,
   var-xres_virtual,
   var-yres_virtual,
 - bytespp, yuv_mode);
 + bytespp, mode, 0);

Shouldn't that be 'color_mode' instead of 'mode'?

regards,

Koen
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] OMAP: DSS2: DMA optimization using scaler line buffers

2010-06-23 Thread Ville Syrjälä
On Wed, Jun 23, 2010 at 07:18:00AM +0200, ext Nagarajan, Rajkumar wrote:
 
 DISPC DMA optimization has been enabled and vrfb calls changed as required.
 Optimization reduces the memory traffic (DDR memory) when rotation is set
 to 90- and 270- degree and SMS-VRFB rotation engine is used.
 
 With this change,
 L3 interconnect traffic is reduced by a factor 2x for YUV422  UYVY
 DDR memory traffic is reduced by a factor 2x for YUV422  UYVY.
 
 Signed-off-by: Mukund Mittal mmit...@ti.com
 Signed-off-by: Kishore Y kishor...@ti.com
 Signed-off-by: Rajkumar N rajkumar.nagara...@ti.com
 ---
  arch/arm/plat-omap/include/plat/vrfb.h   |6 +++-
  drivers/media/video/omap/omap_vout.c |2 +-
  drivers/video/omap2/dss/dispc.c  |   39 
 +++---
  drivers/video/omap2/omapfb/omapfb-main.c |2 +-
  drivers/video/omap2/vrfb.c   |   18 ++---
  5 files changed, 50 insertions(+), 17 deletions(-)
 
 diff --git a/arch/arm/plat-omap/include/plat/vrfb.h 
 b/arch/arm/plat-omap/include/plat/vrfb.h
 index d8a03ce..fba9ecd 100644
 --- a/arch/arm/plat-omap/include/plat/vrfb.h
 +++ b/arch/arm/plat-omap/include/plat/vrfb.h
 @@ -23,6 +23,8 @@
  
  #define OMAP_VRFB_LINE_LEN 2048
  
 +#include plat/display.h
 +
  struct vrfb {
   u8 context;
   void __iomem *vaddr[4];
 @@ -42,8 +44,8 @@ extern void omap_vrfb_adjust_size(u16 *width, u16 *height,
  extern u32 omap_vrfb_min_phys_size(u16 width, u16 height, u8 bytespp);
  extern u16 omap_vrfb_max_height(u32 phys_size, u16 width, u8 bytespp);
  extern void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
 - u16 width, u16 height,
 - unsigned bytespp, bool yuv_mode);
 + u16 width, u16 height, unsigned bytespp,
 + enum omap_color_mode color_mode, int rotation);
  extern int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot);
  extern void omap_vrfb_restore_context(void);
  
 diff --git a/drivers/media/video/omap/omap_vout.c 
 b/drivers/media/video/omap/omap_vout.c
 index b74884b..b3f94ca 100644
 --- a/drivers/media/video/omap/omap_vout.c
 +++ b/drivers/media/video/omap/omap_vout.c
 @@ -465,7 +465,7 @@ static int omap_vout_vrfb_buffer_setup(struct 
 omap_vout_device *vout,
   for (i = 0; i  *count; i++)
   omap_vrfb_setup(vout-vrfb_context[i],
   vout-smsshado_phy_addr[i], vout-pix.width,
 - vout-pix.height, vout-bpp, yuv_mode);
 + vout-pix.height, vout-bpp, vout-dss_mode, 
 vout-rotation);
  
   return 0;
  }
 diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
 index e777e35..cb8eba4 100644
 --- a/drivers/video/omap2/dss/dispc.c
 +++ b/drivers/video/omap2/dss/dispc.c
 @@ -1059,12 +1059,16 @@ 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_vdma_attrs(enum omap_plane plane, bool enable)
 +{
 +   REG_FLD_MOD(dispc_reg_att[plane], enable ? 1 : 0, 20, 20);
 +}
  
  static void _dispc_set_scaling(enum omap_plane plane,
   u16 orig_width, u16 orig_height,
   u16 out_width, u16 out_height,
   bool ilace, bool five_taps,
 - bool fieldmode)
 + bool fieldmode, bool vdma)
  {
   int fir_hinc;
   int fir_vinc;
 @@ -1080,12 +1084,12 @@ static void _dispc_set_scaling(enum omap_plane plane,
  
   _dispc_set_scale_coef(plane, hscaleup, vscaleup, five_taps);
  
 - if (!orig_width || orig_width == out_width)
 + if (!orig_width || (!vdma  (orig_width == out_width)))
   fir_hinc = 0;
   else
   fir_hinc = 1024 * orig_width / out_width;
  
 - if (!orig_height || orig_height == out_height)
 + if (!orig_height || (!vdma  (orig_height == out_height)))
   fir_vinc = 0;
   else
   fir_vinc = 1024 * orig_height / out_height;
 @@ -1164,10 +1168,6 @@ static void _dispc_set_rotation_attrs(enum omap_plane 
 plane, u8 rotation,
  
   REG_FLD_MOD(dispc_reg_att[plane], vidrot, 13, 12);
  
 - if (rotation == OMAP_DSS_ROT_90 || rotation == OMAP_DSS_ROT_270)
 - REG_FLD_MOD(dispc_reg_att[plane], 0x1, 18, 18);
 - else
 - REG_FLD_MOD(dispc_reg_att[plane], 0x0, 18, 18);

So VIDROWREPEAT is supposed to be off when vid DMA optimization is on?
There's no mention of that in the TRM.

   } else {
   REG_FLD_MOD(dispc_reg_att[plane], 0, 13, 12);
   REG_FLD_MOD(dispc_reg_att[plane], 0, 18, 18);
 @@ -1504,6 +1504,17 @@ static unsigned long calc_fclk(u16 width, u16 height,
   return dispc_pclk_rate() * vf * hf;
  }
  
 +static int dispc_is_vdma_req(u8 rotation, enum omap_color_mode color_mode)
 +{
 +/* TODO: VDMA support for RGB16 mode */
 + if (cpu_is_omap3630())

Is video DMA optimization broken on 34xx? I tried to 

[PATCH] OMAP: DSS2: DMA optimization using scaler line buffers

2010-06-22 Thread Nagarajan, Rajkumar

DISPC DMA optimization has been enabled and vrfb calls changed as required.
Optimization reduces the memory traffic (DDR memory) when rotation is set
to 90- and 270- degree and SMS-VRFB rotation engine is used.

With this change,
L3 interconnect traffic is reduced by a factor 2x for YUV422  UYVY
DDR memory traffic is reduced by a factor 2x for YUV422  UYVY.

Signed-off-by: Mukund Mittal mmit...@ti.com
Signed-off-by: Kishore Y kishor...@ti.com
Signed-off-by: Rajkumar N rajkumar.nagara...@ti.com
---
 arch/arm/plat-omap/include/plat/vrfb.h   |6 +++-
 drivers/media/video/omap/omap_vout.c |2 +-
 drivers/video/omap2/dss/dispc.c  |   39 +++---
 drivers/video/omap2/omapfb/omapfb-main.c |2 +-
 drivers/video/omap2/vrfb.c   |   18 ++---
 5 files changed, 50 insertions(+), 17 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/vrfb.h 
b/arch/arm/plat-omap/include/plat/vrfb.h
index d8a03ce..fba9ecd 100644
--- a/arch/arm/plat-omap/include/plat/vrfb.h
+++ b/arch/arm/plat-omap/include/plat/vrfb.h
@@ -23,6 +23,8 @@
 
 #define OMAP_VRFB_LINE_LEN 2048
 
+#include plat/display.h
+
 struct vrfb {
u8 context;
void __iomem *vaddr[4];
@@ -42,8 +44,8 @@ extern void omap_vrfb_adjust_size(u16 *width, u16 *height,
 extern u32 omap_vrfb_min_phys_size(u16 width, u16 height, u8 bytespp);
 extern u16 omap_vrfb_max_height(u32 phys_size, u16 width, u8 bytespp);
 extern void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
-   u16 width, u16 height,
-   unsigned bytespp, bool yuv_mode);
+   u16 width, u16 height, unsigned bytespp,
+   enum omap_color_mode color_mode, int rotation);
 extern int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot);
 extern void omap_vrfb_restore_context(void);
 
diff --git a/drivers/media/video/omap/omap_vout.c 
b/drivers/media/video/omap/omap_vout.c
index b74884b..b3f94ca 100644
--- a/drivers/media/video/omap/omap_vout.c
+++ b/drivers/media/video/omap/omap_vout.c
@@ -465,7 +465,7 @@ static int omap_vout_vrfb_buffer_setup(struct 
omap_vout_device *vout,
for (i = 0; i  *count; i++)
omap_vrfb_setup(vout-vrfb_context[i],
vout-smsshado_phy_addr[i], vout-pix.width,
-   vout-pix.height, vout-bpp, yuv_mode);
+   vout-pix.height, vout-bpp, vout-dss_mode, 
vout-rotation);
 
return 0;
 }
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index e777e35..cb8eba4 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -1059,12 +1059,16 @@ 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_vdma_attrs(enum omap_plane plane, bool enable)
+{
+   REG_FLD_MOD(dispc_reg_att[plane], enable ? 1 : 0, 20, 20);
+}
 
 static void _dispc_set_scaling(enum omap_plane plane,
u16 orig_width, u16 orig_height,
u16 out_width, u16 out_height,
bool ilace, bool five_taps,
-   bool fieldmode)
+   bool fieldmode, bool vdma)
 {
int fir_hinc;
int fir_vinc;
@@ -1080,12 +1084,12 @@ static void _dispc_set_scaling(enum omap_plane plane,
 
_dispc_set_scale_coef(plane, hscaleup, vscaleup, five_taps);
 
-   if (!orig_width || orig_width == out_width)
+   if (!orig_width || (!vdma  (orig_width == out_width)))
fir_hinc = 0;
else
fir_hinc = 1024 * orig_width / out_width;
 
-   if (!orig_height || orig_height == out_height)
+   if (!orig_height || (!vdma  (orig_height == out_height)))
fir_vinc = 0;
else
fir_vinc = 1024 * orig_height / out_height;
@@ -1164,10 +1168,6 @@ static void _dispc_set_rotation_attrs(enum omap_plane 
plane, u8 rotation,
 
REG_FLD_MOD(dispc_reg_att[plane], vidrot, 13, 12);
 
-   if (rotation == OMAP_DSS_ROT_90 || rotation == OMAP_DSS_ROT_270)
-   REG_FLD_MOD(dispc_reg_att[plane], 0x1, 18, 18);
-   else
-   REG_FLD_MOD(dispc_reg_att[plane], 0x0, 18, 18);
} else {
REG_FLD_MOD(dispc_reg_att[plane], 0, 13, 12);
REG_FLD_MOD(dispc_reg_att[plane], 0, 18, 18);
@@ -1504,6 +1504,17 @@ static unsigned long calc_fclk(u16 width, u16 height,
return dispc_pclk_rate() * vf * hf;
 }
 
+static int dispc_is_vdma_req(u8 rotation, enum omap_color_mode color_mode)
+{
+/* TODO: VDMA support for RGB16 mode */
+   if (cpu_is_omap3630())
+   if ((color_mode == OMAP_DSS_COLOR_YUV2) ||
+   (color_mode == OMAP_DSS_COLOR_UYVY))
+   if ((rotation == 1) || (rotation == 3))
+   return true;
+   return false;
+}
+
 void