From patchwork Wed Jun 23 05:18:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nagarajan, Rajkumar" X-Patchwork-Id: 107547 X-Patchwork-Delegate: tomi.valkeinen@nokia.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o5N5IKwt009093 for ; Wed, 23 Jun 2010 05:18:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750998Ab0FWFSL (ORCPT ); Wed, 23 Jun 2010 01:18:11 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:41600 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750809Ab0FWFSK convert rfc822-to-8bit (ORCPT ); Wed, 23 Jun 2010 01:18:10 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id o5N5I3nc010966 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 23 Jun 2010 00:18:06 -0500 Received: from dbde70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id o5N5I2u1009453; Wed, 23 Jun 2010 10:48:02 +0530 (IST) Received: from dbde02.ent.ti.com ([172.24.170.145]) by dbde70.ent.ti.com ([172.24.170.148]) with mapi; Wed, 23 Jun 2010 10:48:01 +0530 From: "Nagarajan, Rajkumar" To: "linux-omap@vger.kernel.org" CC: "tomi.valkeinen@nokia.com" , "linux-fbdev@vger.kernel.org" Date: Wed, 23 Jun 2010 10:48:00 +0530 Subject: [PATCH] OMAP: DSS2: DMA optimization using scaler line buffers Thread-Topic: [PATCH] OMAP: DSS2: DMA optimization using scaler line buffers Thread-Index: AcsSlG+E0vVRA4cRSz2MRAaRQbRsCw== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 23 Jun 2010 05:18:20 +0000 (UTC) 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 + 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 dispc_set_channel_out(enum omap_plane plane, enum omap_channel channel_out) { enable_clocks(1); @@ -1623,6 +1634,8 @@ static int _dispc_setup_plane(enum omap_plane plane, if (cpu_is_omap34xx() && height > out_height && fclk > dispc_fclk_rate()) five_taps = true; + if (dispc_is_vdma_req(rotation, color_mode)) + five_taps = true; } if (width > (2048 >> five_taps)) { @@ -1694,9 +1707,17 @@ static int _dispc_setup_plane(enum omap_plane plane, _dispc_set_pic_size(plane, width, height); if (plane != OMAP_DSS_GFX) { - _dispc_set_scaling(plane, width, height, + if (dispc_is_vdma_req(rotation, color_mode)) { + _dispc_set_scaling(plane, width, height, out_width, out_height, - ilace, five_taps, fieldmode); + ilace, five_taps, fieldmode, 1); + _dispc_set_vdma_attrs(plane, 1); + } else { + _dispc_set_scaling(plane, width, height, + out_width, out_height, + ilace, five_taps, fieldmode, 0); + _dispc_set_vdma_attrs(plane, 0); + } _dispc_set_vid_size(plane, out_width, out_height); _dispc_set_vid_color_conv(plane, cconv); } diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c index 73ecc9f..33fd427 100644 --- 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); /* Now one can ioremap the 0 angle view */ r = omap_vrfb_map_angle(vrfb, var->yres_virtual, 0); diff --git a/drivers/video/omap2/vrfb.c b/drivers/video/omap2/vrfb.c index fd22716..38d03d1 100644 --- a/drivers/video/omap2/vrfb.c +++ b/drivers/video/omap2/vrfb.c @@ -157,7 +157,7 @@ EXPORT_SYMBOL(omap_vrfb_max_height); void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr, u16 width, u16 height, - unsigned bytespp, bool yuv_mode) + unsigned bytespp, enum omap_color_mode color_mode, int rotation) { unsigned pixel_size_exp; u16 vrfb_width; @@ -167,11 +167,12 @@ void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr, u32 control; DBG("omapfb_set_vrfb(%d, %lx, %dx%d, %d, %d)\n", ctx, paddr, - width, height, bytespp, yuv_mode); + width, height, bytespp, color_mode); /* For YUV2 and UYVY modes VRFB needs to handle pixels a bit * differently. See TRM. */ - if (yuv_mode) { + if (color_mode == OMAP_DSS_COLOR_YUV2 || + color_mode == OMAP_DSS_COLOR_UYVY) { bytespp *= 2; width /= 2; } @@ -183,6 +184,13 @@ void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr, else BUG(); + /* for vdma */ + /* TODO: VDMA support for RGB16 mode */ + if (cpu_is_omap3630()) + if (color_mode == OMAP_DSS_COLOR_YUV2) + if ((rotation == 1) || (rotation == 3)) + pixel_size_exp = 2; + vrfb_width = ALIGN(width * bytespp, VRFB_PAGE_WIDTH) / bytespp; vrfb_height = ALIGN(height, VRFB_PAGE_HEIGHT); @@ -211,7 +219,9 @@ void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr, vrfb->xoffset = vrfb_width - width; vrfb->yoffset = vrfb_height - height; vrfb->bytespp = bytespp; - vrfb->yuv_mode = yuv_mode; + if (color_mode == OMAP_DSS_COLOR_YUV2 || + color_mode == OMAP_DSS_COLOR_UYVY) + vrfb->yuv_mode = true; } EXPORT_SYMBOL(omap_vrfb_setup);