video: msm: Adding Support for MDP3.1
cover video: msm: Adding Support for MDP3.1
These patches continue to update the MSM display drivers to support newer MDP versions and display modes (while also providing a base for future display development). The original source of these patches is one patch (squashing together 22 other patches) on the Google Android kernel tree.
Brian Swetland (1):
video: msm: Fix typo 'mpd'->'mdp'
Carl Vanderlip (19):
video: msm: add spinlock to mdp_info struct
video: msm: add locked_enable_mdp_irq function
video: msm: Move clk to mdp_info struct
video: msm: Setup framework for multiple output interfaces
video: msm: Simplify mdp_blit function
video: msm: Allow users to request a larger x and y virtual fb
video: msm: Refactor mdp_regs
video: msm: Split out MDP2.2 HW specific code.
video: msm: Separate more MDP HW specific code
video: msm: Add MDP FB DMA configuration
video: msm: Add IRQ callback for MDP interface
video: msm: Debugging for send_blit
video: msm: Write IRQ mask to MDP registers
video: msm: convert printk to pr_*
video: msm: Set the EBI1 clock to 128MHz when performing blits
video: msm: Prevent framebuffer glitch during initialization
video: msm: Prevent DMA lockups when switching bit depths
video: msm: Separate calculation of base and offset
video: msm: Add support for MDP 3.1 (qsd8k)
arch/arm/mach-msm/Kconfig | 8 +
arch/arm/mach-msm/include/mach/msm_fb.h | 11 +-
drivers/video/msm/Makefile | 5 +-
drivers/video/msm/mdp.c | 589 +++++++++++++-----
drivers/video/msm/mdp_csc_table.h | 163 ++++--
drivers/video/msm/mdp_hw.h | 205 +++++--
drivers/video/msm/mdp_ppp.c | 639 ++++++++------------
drivers/video/msm/mdp_ppp.h | 82 +++
.../video/msm/{mdp_scale_tables.c => mdp_ppp22.c} | 333 ++++++++++-
drivers/video/msm/mdp_ppp31.c | 335 ++++++++++
drivers/video/msm/mdp_scale_tables.h | 38 --
drivers/video/msm/msm_fb.c | 69 ++-
12 files changed, 1775 insertions(+), 702 deletions(-)
create mode 100644 drivers/video/msm/mdp_ppp.h
rename drivers/video/msm/{mdp_scale_tables.c => mdp_ppp22.c} (69%)
create mode 100644 drivers/video/msm/mdp_ppp31.c
delete mode 100644 drivers/video/msm/mdp_scale_tables.hSignature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 1/20 video: msm: Fix typo 'mpd'->'mdp'
From: Brian Swetland <[email protected]>
Trivial fix
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- arch/arm/mach-msm/include/mach/msm_fb.h | 2 +- drivers/video/msm/mdp.c | 8 ++++---- drivers/video/msm/mdp_ppp.c | 10 +++++----- drivers/video/msm/msm_fb.c | 1 - 4 files changed, 10 insertions(+), 11 deletions(-)
arch/arm/mach-msm/include/mach/msm_fb.h +1 -1
@@ -114,7 +114,7 @@ struct mdp_blit_req;struct fb_info ;struct mdp_device {struct device dev; -void (*dma)(struct mdp_device *mpd,uint32_t addr, +void (*dma)(struct mdp_device *mdp,uint32_t addr,uint32_t stride,uint32_t w,uint32_t h,uint32_t x,uint32_t y,struct msmfb_callback *callback,int interface);void (*dma_wait)(struct mdp_device *mdp);
drivers/video/msm/mdp.c +4 -4
@@ -2,7 +2,7 @@* * MSM MDP Interface (used by framebuffer core) * -* Copyright (C) 2007 QUALCOMM Incorporated +* Copyright (C) 2007, 2011 Code Aurora Forum. All rights reserved. * Copyright (C) 2007 Google Incorporated * * This software is licensed under the terms of the GNU General Public
@@ -288,7 +288,7 @@ int mdp_blit(struct mdp_device *mdp_dev, struct fb_info *fb,/* WORKAROUND FOR HARDWARE BUG IN BG TILE FETCH */ if (unlikely (req->src_rect.h ==0 || req->src_rect.w ==0 )) { -printk (KERN_ERR "mpd_ppp: src img of zero size!\n" ); +printk (KERN_ERR "mdp_ppp: src img of zero size!\n" );return -EINVAL ; } if (unlikely(req->dst_rect.h == 0 ||
@@ -298,13 +298,13 @@ int mdp_blit(struct mdp_device *mdp_dev, struct fb_info *fb,/* do this first so that if this fails, the caller can always * safely call put_img */ if (unlikely (get_img (&req->src, fb, &src_start, &src_len, &src_file))) { -printk (KERN_ERR "mpd_ppp: could not retrieve src image from " +printk (KERN_ERR "mdp_ppp: could not retrieve src image from " "memory\n" );return -EINVAL ; }if (unlikely (get_img (&req->dst, fb, &dst_start, &dst_len, &dst_file))) { -printk (KERN_ERR "mpd_ppp: could not retrieve dst image from " +printk (KERN_ERR "mdp_ppp: could not retrieve dst image from " "memory\n" );return -EINVAL ; }
drivers/video/msm/mdp_ppp.c +5 -5
@@ -1,6 +1,6 @@/* drivers/video/msm/mdp_ppp.c * -* Copyright (C) 2007 QUALCOMM Incorporated +* Copyright (C) 2007, 2011 Code Aurora Forum. All rights reserved. * Copyright (C) 2007 Google Incorporated * * This software is licensed under the terms of the GNU General Public
@@ -650,7 +650,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req,if (unlikely (req->src.format >=MDP_IMGTYPE_LIMIT || req->dst.format >=MDP_IMGTYPE_LIMIT )) { -printk (KERN_ERR "mpd_ppp: img is of wrong format\n" ); +printk (KERN_ERR "mdp_ppp: img is of wrong format\n" );return -EINVAL ; }
@@ -658,7 +658,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req, req->src_rect.y > req->src.height || req->dst_rect.x > req->dst.width || req->dst_rect.y > req->dst.height)) { -printk (KERN_ERR "mpd_ppp: img rect is outside of img!\n" ); +printk (KERN_ERR "mdp_ppp: img rect is outside of img!\n" );return -EINVAL ; }
@@ -694,7 +694,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req,if (!valid_src_dst (src_start, src_len, dst_start, dst_len, req, ®s)) { -printk (KERN_ERR "mpd_ppp: final src or dst location is " +printk (KERN_ERR "mdp_ppp: final src or dst location is " "invalid, are you trying to make an image too large " "or to place it outside the screen?\n" );return -EINVAL ;
@@ -708,7 +708,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req, regs.op |=PPP_OP_DITHER_EN ;blit_blend (req, ®s);if (blit_scale (mdp, req, ®s)) { -printk (KERN_ERR "mpd_ppp: error computing scale for img.\n" ); +printk (KERN_ERR "mdp_ppp: error computing scale for img.\n" );return -EINVAL ; }blit_blur (mdp, req, ®s);
drivers/video/msm/msm_fb.c +0 -1
@@ -321,7 +321,6 @@ error:mutex_unlock (&msmfb->panel_init_lock); } -static int msmfb_check_var (struct fb_var_screeninfo *var,struct fb_info *info) { if ((var->xres != info->var.xres) ||
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RE: [PATCH 01/20] video: msm: Fix typo 'mpd'->'mdp'
Quoted 12 lines
-----Original Message-----
From: linux-fbdev-owner at vger.kernel.org [mailto:linux-fbdev- owner at vger.kernel.org] On Behalf Of Carl Vanderlip
Sent: Saturday, March 19, 2011 3:22 AM
To: Russell King; David Brown; Daniel Walker; Bryan Huntsman
Cc: Brian Swetland; Dima Zavin; Rebecca Schultz Zavin; Colin Cross; linux- fbdev at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-arm- msm at vger.kernel.org; linux-kernel at vger.kernel.org; Carl Vanderlip
Subject: [PATCH 01/20] video: msm: Fix typo 'mpd'->'mdp'
Quoted 3 lines
From: Brian Swetland <[email protected]>
Trivial fix
The Subject line states that you are only changing a typo from mpd to mdp. The description doesn't state anything more.
But the patch is changing Copyright info also.
Quoted 34 lines
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>Signed-off-by Carl Vanderlip <[email protected]>--- arch/arm/mach-msm/include/mach/msm_fb.h | 2 +- drivers/video/msm/mdp.c | 8 ++++---- drivers/video/msm/mdp_ppp.c | 10 +++++----- drivers/video/msm/msm_fb.c | 1 - 4 files changed, 10 insertions(+), 11 deletions(-)arch/arm/mach- renamed from arch/arm/mach-msm/include/mach/msm_fb.h +0
-0
msm/include/mach/msm_fb.h
index 1f4fc81..da11719 100644arch/arm/mach-msm/include/mach/msm_fb.h +1
-1@@ -114,7 +114,7 @@ struct mdp_blit_req;struct fb_info ;struct mdp_device {struct device dev; -void (*dma)(struct mdp_device *mpd,uint32_t addr, +void (*dma)(struct mdp_device *mdp,uint32_t addr,uint32_t stride,uint32_t w,uint32_t h,uint32_t x,uint32_t y,struct msmfb_callback *callback,int interface);arch/arm/mach-msm/include/mach/msm_fb.h +0
-0void (*dma_wait)(struct mdp_device *mdp);drivers/video/msm/mdp.c +0
-0
drivers/video/msm/mdp.c line 5
Quoted 5 lines
drivers/video/msm/mdp.c +1
-1@@ -2,7 +2,7 @@* * MSM MDP Interface (used by framebuffer core) * -* Copyright (C) 2007 QUALCOMM Incorporated +* Copyright (C) 2007, 2011 Code Aurora Forum. All rights reserved.
It is a change from 2007 to 2011 and the company name is being changed. I think it should be mentioned in the Subject/Description.
Quoted 37 lines
drivers/video/msm/mdp.c +1
-1* Copyright (C) 2007 Google Incorporated * * This software is licensed under the terms of the GNU General Public @@ -288,7 +288,7 @@ int mdp_blit(struct mdp_device *mdp_dev, struct fb_info *fb,/* WORKAROUND FOR HARDWARE BUG IN BG TILE FETCH */ if (unlikely(req->src_rect.h == 0 || req->src_rect.w == 0)) { -printk (KERN_ERR "mpd_ppp: src img of zero size!\n" ); +printk (KERN_ERR "mdp_ppp: src img of zero size!\n" );return -EINVAL ; }drivers/video/msm/mdp.c +2
-2if (unlikely(req->dst_rect.h == 0 ||@@ -298,13 +298,13 @@ int mdp_blit(struct mdp_device *mdp_dev, struct fb_info *fb,/* do this first so that if this fails, the caller can always * safely call put_img */ if (unlikely(get_img(&req->src, fb, &src_start, &src_len, &src_file))) { -printk (KERN_ERR "mpd_ppp: could not retrieve src image from " +printk (KERN_ERR "mdp_ppp: could not retrieve src image from " "memory\n" );return -EINVAL ; }if (unlikely (get_img (&req->dst, fb, &dst_start, &dst_len, &dst_file))) { - printk(KERN_ERR "mpd_ppp: could not retrieve dst image from " + printk(KERN_ERR "mdp_ppp: could not retrieve dst image from "drivers/video/msm/mdp.c +0
-0"memory\n");return -EINVAL ; }drivers/video/msm/mdp_ppp.c +0
-0
drivers/video/msm/mdp_ppp.c line 3
Quoted 4 lines
drivers/video/msm/mdp_ppp.c +1
-1@@ -1,6 +1,6 @@/* drivers/video/msm/mdp_ppp.c * -* Copyright (C) 2007 QUALCOMM Incorporated +* Copyright (C) 2007, 2011 Code Aurora Forum. All rights reserved.
Same here.
Quoted 64 lines
drivers/video/msm/mdp_ppp.c +3
-3* Copyright (C) 2007 Google Incorporated * * This software is licensed under the terms of the GNU General Public @@ -650,7 +650,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req, if (unlikely(req->src.format >= MDP_IMGTYPE_LIMIT || req->dst.format >= MDP_IMGTYPE_LIMIT)) { -printk (KERN_ERR "mpd_ppp: img is of wrong format\n" ); +printk (KERN_ERR "mdp_ppp: img is of wrong format\n" );return -EINVAL ; }@@ -658,7 +658,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req, req->src_rect.y > req->src.height || req->dst_rect.x > req->dst.width || req->dst_rect.y > req->dst.height)) { -printk (KERN_ERR "mpd_ppp: img rect is outside of img!\n" ); +printk (KERN_ERR "mdp_ppp: img rect is outside of img!\n" );return -EINVAL ; }@@ -694,7 +694,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req, if (!valid_src_dst(src_start, src_len, dst_start, dst_len, req, ®s)) { -printk (KERN_ERR "mpd_ppp: final src or dst location is " +printk (KERN_ERR "mdp_ppp: final src or dst location is " "invalid, are you trying to make an image too large " "or to place it outside the screen?\n" );drivers/video/msm/mdp_ppp.c +1
-1return -EINVAL ;@@ -708,7 +708,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req, regs.op |=PPP_OP_DITHER_EN ;blit_blend (req, ®s);if (blit_scale (mdp, req, ®s)) { -printk (KERN_ERR "mpd_ppp: error computing scale for img.\n" ); +printk (KERN_ERR "mdp_ppp: error computing scale for img.\n" );return -EINVAL ; }drivers/video/msm/mdp_ppp.c +0
-0blit_blur (mdp, req, ®s);drivers/video/msm/msm_fb.c +0
-1@@ -321,7 +321,6 @@ error:mutex_unlock (&msmfb->panel_init_lock); } -static int msmfb_check_var (struct fb_var_screeninfo *var,struct fb_info *info) {if ((
var->xres!=info->var.xres) ||
--
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 01/20] video: msm: Fix typo 'mpd'->'mdp'
Quoted 13 lines
Quoted 13 lines
-----Original Message-----
From: linux-fbdev-owner at vger.kernel.org [mailto:linux-fbdev- owner at vger.kernel.org] On Behalf Of Carl Vanderlip
Sent: Saturday, March 19, 2011 3:22 AM
To: Russell King; David Brown; Daniel Walker; Bryan Huntsman
Cc: Brian Swetland; Dima Zavin; Rebecca Schultz Zavin; Colin Cross; linux-
fbdev at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-arm- msm at vger.kernel.org; linux-kernel at vger.kernel.org; Carl Vanderlip
Subject: [PATCH 01/20] video: msm: Fix typo 'mpd'->'mdp'
Quoted 14 lines
Quoted 3 lines
From: Brian Swetland <[email protected]>
Trivial fix
The Subject line states that you are only changing a typo from mpd to mdp. The description doesn't state anything more.
But the patch is changing Copyright info also.Quoted 7 lines
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>Signed-off-by Carl Vanderlip <[email protected]>
It was my intention to update the files I was changing in this patchset with the correct copyright assignments. v2 commit text will mention this change.
-Carl V.
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 2/20 video: msm: add spinlock to mdp_info struct
In reply to Carl VanderlipMove the mdp_lock into the mdp_info struct for easier access.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- drivers/video/msm/mdp.c | 27 ++++++++++++++------------- drivers/video/msm/mdp_hw.h | 3 ++- 2 files changed, 16 insertions(+), 14 deletions(-)
drivers/video/msm/mdp.c +14 -13
@@ -45,7 +45,6 @@ static DECLARE_WAIT_QUEUE_HEAD(mdp_ppp_waitqueue);static struct msmfb_callback *dma_callback;static struct clk *clk;static unsigned int mdp_irq_mask; -static DEFINE_SPINLOCK (mdp_lock);DEFINE_MUTEX (mdp_mutex);static int enable_mdp_irq (struct mdp_info *mdp,uint32_t mask)
@@ -55,7 +54,7 @@ static int enable_mdp_irq(struct mdp_info *mdp, uint32_t mask)BUG_ON (!mask); -spin_lock_irqsave (&mdp_lock, irq_flags); +spin_lock_irqsave (&mdp->lock, irq_flags);/* if the mask bits are already set return an error, this interrupt * is already enabled */ if (mdp_irq_mask & mask) {
@@ -73,7 +72,7 @@ static int enable_mdp_irq(struct mdp_info *mdp, uint32_t mask)/* update the irq mask to reflect the fact that the interrupt is * enabled */ mdp_irq_mask |= mask; -spin_unlock_irqrestore (&mdp_lock, irq_flags); +spin_unlock_irqrestore (&mdp->lock, irq_flags);return ret; }
@@ -102,9 +101,9 @@ static int disable_mdp_irq(struct mdp_info *mdp, uint32_t mask)unsigned long irq_flags;int ret; -spin_lock_irqsave (&mdp_lock, irq_flags); +spin_lock_irqsave (&mdp->lock, irq_flags); ret =locked_disable_mdp_irq (mdp, mask); -spin_unlock_irqrestore (&mdp_lock, irq_flags); +spin_unlock_irqrestore (&mdp->lock, irq_flags);return ret; }
@@ -114,7 +113,7 @@ static irqreturn_t mdp_isr(int irq, void *data)unsigned long irq_flags;struct mdp_info *mdp = data; -spin_lock_irqsave (&mdp_lock, irq_flags); +spin_lock_irqsave (&mdp->lock, irq_flags); status =mdp_readl (mdp,MDP_INTR_STATUS );mdp_writel (mdp, status,MDP_INTR_CLEAR );
@@ -134,18 +133,18 @@ static irqreturn_t mdp_isr(int irq, void *data)if (status)locked_disable_mdp_irq (mdp, status); -spin_unlock_irqrestore (&mdp_lock, irq_flags); +spin_unlock_irqrestore (&mdp->lock, irq_flags);return IRQ_HANDLED ; } -static uint32_t mdp_check_mask (uint32_t mask) +static uint32_t mdp_check_mask (struct mdp_info *mdp,uint32_t mask) {uint32_t ret;unsigned long irq_flags; -spin_lock_irqsave (&mdp_lock, irq_flags); +spin_lock_irqsave (&mdp->lock, irq_flags); ret = mdp_irq_mask & mask; -spin_unlock_irqrestore (&mdp_lock, irq_flags); +spin_unlock_irqrestore (&mdp->lock, irq_flags);return ret; }
@@ -154,16 +153,16 @@ static int mdp_wait(struct mdp_info *mdp, uint32_t mask, wait_queue_head_t *wq)int ret =0 ;unsigned long irq_flags; -wait_event_timeout (*wq, !mdp_check_mask (mask),HZ ); +wait_event_timeout (*wq, !mdp_check_mask (mdp, mask),HZ ); -spin_lock_irqsave (&mdp_lock, irq_flags); +spin_lock_irqsave (&mdp->lock, irq_flags);if (mdp_irq_mask & mask) {locked_disable_mdp_irq (mdp, mask);printk (KERN_WARNING "timeout waiting for mdp to complete %x\n" , mask); ret = -ETIMEDOUT ; } -spin_unlock_irqrestore (&mdp_lock, irq_flags); +spin_unlock_irqrestore (&mdp->lock, irq_flags);return ret; }
@@ -399,6 +398,8 @@ int mdp_probe(struct platform_device *pdev)if (!mdp)return -ENOMEM ; +spin_lock_init (&mdp->lock); + mdp->irq =platform_get_irq (pdev,0 );if (mdp->irq <0 ) {pr_err ("mdp: can not get mdp irq\n" );
drivers/video/msm/mdp_hw.h +2 -1
@@ -1,6 +1,6 @@/* drivers/video/msm_fb/mdp_hw.h * -* Copyright (C) 2007 QUALCOMM Incorporated +* Copyright (C) 2007, 2011 Code Aurora Forum. All rights reserved. * Copyright (C) 2007 Google Incorporated * * This software is licensed under the terms of the GNU General Public
@@ -19,6 +19,7 @@#include <mach/msm_fb.h> struct mdp_info { +spinlock_t lock;struct mdp_device mdp_dev;char *__iomem base;int irq;
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 3/20 video: msm: add locked_enable_mdp_irq function
In reply to Carl VanderlipAdd a version of this fuction to be called in a locked context.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- drivers/video/msm/mdp.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-)
drivers/video/msm/mdp.c +12 -4
@@ -47,14 +47,12 @@ static struct clk *clk;static unsigned int mdp_irq_mask;DEFINE_MUTEX (mdp_mutex); -static int enable_mdp_irq (struct mdp_info *mdp,uint32_t mask) +static int locked_enable_mdp_irq (struct mdp_info *mdp,uint32_t mask) { -unsigned long irq_flags;int ret =0 ;BUG_ON (!mask); -spin_lock_irqsave (&mdp->lock, irq_flags);/* if the mask bits are already set return an error, this interrupt * is already enabled */ if (mdp_irq_mask & mask) {
@@ -72,7 +70,17 @@ static int enable_mdp_irq(struct mdp_info *mdp, uint32_t mask)/* update the irq mask to reflect the fact that the interrupt is * enabled */ mdp_irq_mask |= mask; -spin_unlock_irqrestore (&mdp->lock, irq_flags); +return 0 ; +} + +static int enable_mdp_irq (struct mdp_info *mdp,uint32_t mask) +{ +unsigned long flags; +int ret; + +spin_lock_irqsave (&mdp->lock, flags); + ret =locked_enable_mdp_irq (mdp, mask); +spin_unlock_irqrestore (&mdp->lock, flags);return ret; }
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 4/20 video: msm: Move clk to mdp_info struct
In reply to Carl VanderlipMove local clock variable into mdp_info struct for easier access.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- drivers/video/msm/mdp.c | 17 +++++++++-------- drivers/video/msm/mdp_hw.h | 1 + 2 files changed, 10 insertions(+), 8 deletions(-)
drivers/video/msm/mdp.c +9 -8
@@ -43,7 +43,6 @@ static uint16_t mdp_default_ccs[] = {static DECLARE_WAIT_QUEUE_HEAD (mdp_dma2_waitqueue);static DECLARE_WAIT_QUEUE_HEAD (mdp_ppp_waitqueue);static struct msmfb_callback *dma_callback; -static struct clk *clk;static unsigned int mdp_irq_mask;DEFINE_MUTEX (mdp_mutex);
@@ -62,8 +61,7 @@ static int locked_enable_mdp_irq(struct mdp_info *mdp, uint32_t mask) }/* if the mdp irq is not already enabled enable it */ if (!mdp_irq_mask) { -if (clk) -clk_enable (clk); +clk_enable (mdp->clk);enable_irq (mdp->irq); }
@@ -98,8 +96,8 @@ static int locked_disable_mdp_irq(struct mdp_info *mdp, uint32_t mask)/* if no one is waiting on the interrupt, disable it */ if (!mdp_irq_mask) {disable_irq_nosync (mdp->irq); -if (clk) -clk_disable (clk); +if (mdp->clk) +clk_disable (mdp->clk); }return 0 ; }
@@ -428,10 +426,11 @@ int mdp_probe(struct platform_device *pdev) mdp->mdp_dev.blit = mdp_blit; mdp->mdp_dev.set_grp_disp = mdp_set_grp_disp; - clk =clk_get (&pdev->dev,"mdp_clk" ); -if (IS_ERR (clk)) { + mdp->clk =clk_get (&pdev->dev,"mdp_clk" ); +if (IS_ERR (mdp->clk)) {printk (KERN_INFO "mdp: failed to get mdp clk" ); -return PTR_ERR (clk); + ret =PTR_ERR (mdp->clk); + goto error_get_mdp_clk; } ret =request_irq (mdp->irq, mdp_isr,IRQF_DISABLED ,"msm_mdp" , mdp);
@@ -467,6 +466,7 @@ int mdp_probe(struct platform_device *pdev)mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0174 );mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x017c ); +clk_enable (mdp->clk);/* comp.plane 2 & 3 */ mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0114 );mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0118 );
@@ -505,6 +505,7 @@ int mdp_probe(struct platform_device *pdev) error_device_register:free_irq (mdp->irq, mdp); error_request_irq: +error_get_mdp_clk:iounmap (mdp->base); error_get_irq: error_ioremap:
drivers/video/msm/mdp_hw.h +1 -0
@@ -23,6 +23,7 @@ struct mdp_info {struct mdp_device mdp_dev;char *__iomem base;int irq; +struct clk *clk; };struct mdp_blit_req ;struct mdp_device ;
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 5/20 video: msm: Setup framework for multiple output interfaces
In reply to Carl VanderlipMoving the dma waitqueue into a struct that is uniquely configurable for each output interface allows for multiple displays using different callback and irq masks.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- arch/arm/mach-msm/include/mach/msm_fb.h | 6 +- drivers/video/msm/mdp.c | 111 +++++++++++++++++++++++++------ drivers/video/msm/mdp_hw.h | 24 +++++++ 3 files changed, 117 insertions(+), 24 deletions(-)
arch/arm/mach-msm/include/mach/msm_fb.h +4 -2
@@ -34,9 +34,11 @@ struct msmfb_callback { };enum { -MSM_MDDI_PMDH_INTERFACE , +MSM_MDDI_PMDH_INTERFACE =0 ,MSM_MDDI_EMDH_INTERFACE ,MSM_EBI2_INTERFACE , + +MSM_MDP_NUM_INTERFACES =MSM_EBI2_INTERFACE +1 , };#define MSMFB_CAP_PARTIAL_UPDATES (1 << 0)
@@ -117,7 +119,7 @@ struct mdp_device {void (*dma)(struct mdp_device *mdp,uint32_t addr,uint32_t stride,uint32_t w,uint32_t h,uint32_t x,uint32_t y,struct msmfb_callback *callback,int interface); -void (*dma_wait)(struct mdp_device *mdp); +void (*dma_wait)(struct mdp_device *mdp,int interface);int (*blit)(struct mdp_device *mdp,struct fb_info *fb,struct mdp_blit_req *req);void (*set_grp_disp)(struct mdp_device *mdp,uint32_t disp_id);
drivers/video/msm/mdp.c +89 -22
178 lines not on this page · raw message
drivers/video/msm/mdp_hw.h +24 -0
@@ -15,16 +15,38 @@#ifndef _MDP_HW_H_#define _MDP_HW_H_ +#include <linux/wait.h> #include <mach/msm_iomap.h> #include <mach/msm_fb.h> +typedef void (*mdp_dma_start_func_t )(void *private_data,uint32_t addr, +uint32_t stride,uint32_t width, +uint32_t height,uint32_t x,uint32_t y); + +struct mdp_out_interface { +uint32_t registered:1 ; +void *priv; + +/* If the interface client wants to get DMA_DONE events */ +uint32_t dma_mask; +mdp_dma_start_func_t dma_start; + +struct msmfb_callback *dma_cb; +wait_queue_head_t dma_waitqueue; +}; +struct mdp_info {spinlock_t lock;struct mdp_device mdp_dev;char *__iomem base;int irq;struct clk *clk; +struct mdp_out_interface out_if[MSM_MDP_NUM_INTERFACES ]; }; + +extern int mdp_out_if_register (struct mdp_device *mdp_dev,int interface, +void *private_data,uint32_t dma_mask, +mdp_dma_start_func_t dma_start);struct mdp_blit_req ;struct mdp_device ; int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req,
@@ -210,6 +232,8 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req, DL1_FETCH_DONE| \ TV_ENC_UNDERRUN) +#define MDP_DMA_P_DONE (1 << 2) +#define MDP_TOP_LUMA 16#define MDP_TOP_CHROMA 0#define MDP_BOTTOM_LUMA 19
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 6/20 video: msm: Simplify mdp_blit function
In reply to Carl VanderlipMove the enabling of mdp interrupt, blitting and waiting for blit to complete to a separate function to simplify the actions completed by mdp_blit.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- drivers/video/msm/mdp.c | 53 ++++++++++++++++++++++++++-------------------- 1 files changed, 30 insertions(+), 23 deletions(-)
drivers/video/msm/mdp.c +30 -23
@@ -308,6 +308,29 @@ void put_img(struct file *src_file, struct file *dst_file) { } +int mdp_blit_and_wait (struct mdp_info *mdp,struct mdp_blit_req *req, +struct file *src_file,unsigned long src_start, +unsigned long src_len,struct file *dst_file, +unsigned long dst_start,unsigned long dst_len) +{ +int ret; +enable_mdp_irq (mdp,DL0_ROI_DONE ); + ret =mdp_ppp_blit (mdp, req, + src_file, src_start, src_len, + dst_file, dst_start, dst_len); +if (unlikely (ret)) { +disable_mdp_irq (mdp,DL0_ROI_DONE ); +return ret; + } + ret =mdp_ppp_wait (mdp); +if (unlikely (ret)) { +printk (KERN_ERR "%s: failed!\n" , __func__); +BUG (); +return ret; + } +return 0 ; +} +int mdp_blit (struct mdp_device *mdp_dev,struct fb_info *fb,struct mdp_blit_req *req) {
@@ -354,15 +377,11 @@ int mdp_blit(struct mdp_device *mdp_dev, struct fb_info *fb, req->src_rect.w =16 *req->src_rect.w / req->dst_rect.h; req->dst_rect.h =16 ;for (i =0 ; i < tiles; i++) { -enable_mdp_irq (mdp,DL0_ROI_DONE ); - ret =mdp_ppp_blit (mdp, req, src_file, src_start, - src_len, dst_file, dst_start, - dst_len); -if (ret) - goto err_bad_blit; - ret =mdp_ppp_wait (mdp); + ret =mdp_blit_and_wait (mdp, req, + src_file, src_start, src_len, + dst_file, dst_start, dst_len);if (ret) - goto err_wait_failed; + goto end; req->dst_rect.y +=16 ; req->src_rect.x += req->src_rect.w; }
@@ -371,24 +390,12 @@ int mdp_blit(struct mdp_device *mdp_dev, struct fb_info *fb, req->src_rect.w = remainder*req->src_rect.w / req->dst_rect.h; req->dst_rect.h = remainder; } -enable_mdp_irq (mdp,DL0_ROI_DONE ); - ret =mdp_ppp_blit (mdp, req, src_file, src_start, src_len, dst_file, - dst_start, - dst_len); -if (ret) - goto err_bad_blit; - ret =mdp_ppp_wait (mdp); -if (ret) - goto err_wait_failed; + ret =mdp_blit_and_wait (mdp, req, + src_file, src_start, src_len, + dst_file, dst_start, dst_len); end:put_img (src_file, dst_file);mutex_unlock (&mdp_mutex); -return 0 ; -err_bad_blit: -disable_mdp_irq (mdp,DL0_ROI_DONE ); -err_wait_failed: -put_img (src_file, dst_file); -mutex_unlock (&mdp_mutex);return ret; }
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 7/20 video: msm: Allow users to request a larger x and y virtual fb
In reply to Carl VanderlipAs long as the total size fits inside the memory allocated to the framebuffer users can request a larger size. This change allows users to request a triple buffered fb.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- drivers/video/msm/msm_fb.c | 63 ++++++++++++++++++++++++++++++++++--------- 1 files changed, 50 insertions(+), 13 deletions(-)
drivers/video/msm/msm_fb.c +50 -13
@@ -53,6 +53,9 @@ do { \ printk(KERN_INFO "msmfb: "fmt, ##args); \ } while (0) +#define BITS_PER_PIXEL (info) (info->fb->var.bits_per_pixel) +#define BYTES_PER_PIXEL (info) (info->fb->var.bits_per_pixel >> 3) +static int msmfb_debug_mask;module_param_named (msmfb_debug_mask, msmfb_debug_mask, int,S_IRUGO |S_IWUSR |S_IWGRP );
@@ -161,9 +164,10 @@ static int msmfb_start_dma(struct msmfb_info *msmfb) }spin_unlock_irqrestore (&msmfb->update_lock, irq_flags); - addr = ((msmfb->xres * (yoffset + y) + x) *2 ); + addr = ((msmfb->xres * (yoffset + y) + x) *BYTES_PER_PIXEL (msmfb)); mdp->dma (mdp, addr + msmfb->fb->fix.smem_start, - msmfb->xres *2 , w, h, x, y, &msmfb->dma_callback, + msmfb->xres *BYTES_PER_PIXEL (msmfb), w, h, x, y, + &msmfb->dma_callback, panel->interface_type);return 0 ; error:
@@ -323,14 +327,46 @@ error:static int msmfb_check_var (struct fb_var_screeninfo *var,struct fb_info *info) { +u32 size; +if ((var->xres != info->var.xres) || (var->yres != info->var.yres) || - (var->xres_virtual != info->var.xres_virtual) || - (var->yres_virtual != info->var.yres_virtual) || (var->xoffset != info->var.xoffset) || (var->bits_per_pixel != info->var.bits_per_pixel) || (var->grayscale != info->var.grayscale))return -EINVAL ; + + size = var->xres_virtual * var->yres_virtual * + (var->bits_per_pixel >>3 ); +if (size > info->fix.smem_len) +return -EINVAL ; +return 0 ; +} + +static int msmfb_set_par (struct fb_info *info) +{ +struct fb_var_screeninfo *var = &info->var; +struct fb_fix_screeninfo *fix = &info->fix; + +/* we only support RGB ordering for now */ +if (var->bits_per_pixel ==32 || var->bits_per_pixel ==24 ) { + var->red.offset =0 ; + var->red.length =8 ; + var->green.offset =8 ; + var->green.length =8 ; + var->blue.offset =16 ; + var->blue.length =8 ; + }else if (var->bits_per_pixel ==16 ) { + var->red.offset =11 ; + var->red.length =5 ; + var->green.offset =5 ; + var->green.length =6 ; + var->blue.offset =0 ; + var->blue.length =5 ; + }else +return -1 ; + fix->line_length = var->xres * var->bits_per_pixel /8 ; +return 0 ; }
@@ -427,6 +463,7 @@ static struct fb_ops msmfb_ops = { .fb_open = msmfb_open, .fb_release = msmfb_release, .fb_check_var = msmfb_check_var, + .fb_set_par = msmfb_set_par, .fb_pan_display = msmfb_pan_display, .fb_fillrect = msmfb_fillrect, .fb_copyarea = msmfb_copyarea,
@@ -438,8 +475,6 @@ static unsigned PP[16]; -#define BITS_PER_PIXEL 16 -static void setup_fb_info (struct msmfb_info *msmfb) {struct fb_info *fb_info = msmfb->fb;
@@ -462,7 +497,7 @@ static void setup_fb_info(struct msmfb_info *msmfb) fb_info->var.height = msmfb->panel->fb_data->height; fb_info->var.xres_virtual = msmfb->xres; fb_info->var.yres_virtual = msmfb->yres *2 ; - fb_info->var.bits_per_pixel =BITS_PER_PIXEL ; + fb_info->var.bits_per_pixel =16 ; fb_info->var.accel_flags =0 ; fb_info->var.yoffset =0 ;
@@ -497,28 +532,30 @@ static int setup_fbmem(struct msmfb_info *msmfb, struct platform_device *pdev)struct fb_info *fb = msmfb->fb;struct resource *resource;unsigned long size = msmfb->xres * msmfb->yres * - (BITS_PER_PIXEL >>3 ) *2 ; +BYTES_PER_PIXEL (msmfb) *2 ; +unsigned long resource_size;unsigned char *fbram;/* board file might have attached a resource describing an fb */ resource =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!resource)return -EINVAL ; + resource_size = resource->end - resource->start +1 ;/* check the resource is large enough to fit the fb */ -if (resource->end - resource->start < size) { -printk (KERN_ERR "allocated resource is too small for " +if (resource_size < size) { +printk (KERN_ERR "msmfb: allocated resource is too small for " "fb\n" );return -ENOMEM ; } fb->fix.smem_start = resource->start; - fb->fix.smem_len = resource->end - resource->start; - fbram =ioremap (resource->start, - resource->end - resource->start); + fb->fix.smem_len = resource_size; + fbram =ioremap (resource->start, resource_size);if (fbram ==0 ) {printk (KERN_ERR "msmfb: cannot allocate fbram!\n" );return -ENOMEM ; } + fb->screen_base = fbram;return 0 ; }
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RE: [PATCH 07/20] video: msm: Allow users to request a larger x and y virtual fb
Quoted 66 lines
-----Original Message-----
From: linux-fbdev-owner at vger.kernel.org [mailto:linux-fbdev- owner at vger.kernel.org] On Behalf Of Carl Vanderlip
Sent: Saturday, March 19, 2011 3:26 AM
To: David Brown; Daniel Walker; Bryan Huntsman
Cc: Brian Swetland; Dima Zavin; Rebecca Schultz Zavin; Colin Cross; linux- fbdev at vger.kernel.org; Carl Vanderlip; linux-arm-
kernel at lists.infradead.org; linux-arm-msm at vger.kernel.org; linux- kernel at vger.kernel.org
Subject: [PATCH 07/20] video: msm: Allow users to request a larger x and y virtual fbAs long as the total size fits inside the memory allocated to the framebuffer
users can request a larger size. This change allows users to request a triple
buffered fb.Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>Signed-off-by Carl Vanderlip <[email protected]>--- drivers/video/msm/msm_fb.c | 63 ++++++++++++++++++++++++++++++++++----- ---- 1 files changed, 50 insertions(+), 13 deletions(-)drivers/video/msm/msm_fb.c +8
-2@@ -53,6 +53,9 @@ do { \ printk(KERN_INFO "msmfb: "fmt, ##args); \ } while (0) +#define BITS_PER_PIXEL (info) (info->fb->var.bits_per_pixel) +#define BYTES_PER_PIXEL (info) (info->fb->var.bits_per_pixel >> 3) +static int msmfb_debug_mask;module_param_named (msmfb_debug_mask, msmfb_debug_mask, int,S_IRUGO |S_IWUSR |S_IWGRP );@@ -161,9 +164,10 @@ static int msmfb_start_dma(struct msmfb_info *msmfb) }spin_unlock_irqrestore (&msmfb->update_lock, irq_flags); - addr = ((msmfb->xres * (yoffset + y) + x) *2 ); + addr = ((msmfb->xres * (yoffset + y) + x) *BYTES_PER_PIXEL (msmfb)); mdp->dma (mdp, addr + msmfb->fb->fix.smem_start, - msmfb->xres *2 , w, h, x, y, &msmfb->dma_callback, + msmfb->xres *BYTES_PER_PIXEL (msmfb), w, h, x, y, + &msmfb->dma_callback, panel->interface_type);return 0 ; error:@@ -323,14 +327,46 @@ error:static int msmfb_check_var (struct fb_var_screeninfo *var,struct fb_info *info) { +u32 size; + if ((var->xres != info->var.xres) ||
drivers/video/msm/msm_fb.c error: · line 341
Quoted 10 lines
drivers/video/msm/msm_fb.c +3
-2(var->yres != info->var.yres) || - (var->xres_virtual != info->var.xres_virtual) || - (var->yres_virtual != info->var.yres_virtual) || (var->xoffset != info->var.xoffset) || (var->bits_per_pixel != info->var.bits_per_pixel) || (var->grayscale != info->var.grayscale)) return -EINVAL; + + size = var->xres_virtual * var->yres_virtual * + (var->bits_per_pixel >>3 );
How about defining a new macro BYTES_PER_PIXEL_VAR for fb_var_screeninfo also? That would make code more readable.
Quoted 8 lines
drivers/video/msm/msm_fb.c +8
-0+if (size > info->fix.smem_len) +return -EINVAL ; +return 0 ; +} + +static int msmfb_set_par (struct fb_info *info) +{ +struct fb_var_screeninfo *var = &info->var;
drivers/video/msm/msm_fb.c error: · line 358
Quoted 10 lines
drivers/video/msm/msm_fb.c +10
-0+struct fb_fix_screeninfo *fix = &info->fix; + +/* we only support RGB ordering for now */ +if (var->bits_per_pixel ==32 || var->bits_per_pixel ==24 ) { + var->red.offset =0 ; + var->red.length =8 ; + var->green.offset =8 ; + var->green.length =8 ; + var->blue.offset =16 ; + var->blue.length =8 ;
var->red is a fb_bitfield variable.
It provides offset, length and msb_right.
struct fb_bitfield {
__u32 offset; /* beginning of bitfield */
__u32 length; /* length of bitfield */
__u32 msb_right; /* != 0 : Most significant bit is */
/* right */
}Please don't keep msb_right unassigned.
drivers/video/msm/msm_fb.c error: · line 367
Quoted 9 lines
drivers/video/msm/msm_fb.c +9
-0+ }else if (var->bits_per_pixel ==16 ) { + var->red.offset =11 ; + var->red.length =5 ; + var->green.offset =5 ; + var->green.length =6 ; + var->blue.offset =0 ; + var->blue.length =5 ; + }else +return -1 ;
Please use standard error code provided by Linux kernel -EINVAL (-22 Invalid argument)
drivers/video/msm/msm_fb.c error: · line 368
Quoted 1 line
drivers/video/msm/msm_fb.c +1
-0+ fix->line_length = var->xres * var->bits_per_pixel /8 ;
Why to divide by 8? Atleast use >>3, bitwise operations that would take less cpu cycles) As I stated earlier define a new macro for var also.
Quoted 76 lines
drivers/video/msm/msm_fb.c +11
-9+return 0 ; }@@ -427,6 +463,7 @@ static struct fb_ops msmfb_ops = { .fb_open = msmfb_open, .fb_release = msmfb_release, .fb_check_var = msmfb_check_var, + .fb_set_par = msmfb_set_par, .fb_pan_display = msmfb_pan_display, .fb_fillrect = msmfb_fillrect, .fb_copyarea = msmfb_copyarea,@@ -438,8 +475,6 @@ static unsigned PP[16]; -#define BITS_PER_PIXEL 16 -static void setup_fb_info (struct msmfb_info *msmfb) {struct fb_info *fb_info = msmfb->fb;@@ -462,7 +497,7 @@ static void setup_fb_info(struct msmfb_info *msmfb) fb_info->var.height = msmfb->panel->fb_data->height; fb_info->var.xres_virtual = msmfb->xres; fb_info->var.yres_virtual = msmfb->yres *2 ; - fb_info->var.bits_per_pixel =BITS_PER_PIXEL ; + fb_info->var.bits_per_pixel =16 ; fb_info->var.accel_flags =0 ; fb_info->var.yoffset =0 ;@@ -497,28 +532,30 @@ static int setup_fbmem(struct msmfb_info *msmfb, struct platform_device *pdev)struct fb_info *fb = msmfb->fb;struct resource *resource;unsigned long size = msmfb->xres * msmfb->yres * - (BITS_PER_PIXEL >>3 ) *2 ; +BYTES_PER_PIXEL (msmfb) *2 ; +unsigned long resource_size;unsigned char *fbram;/* board file might have attached a resource describing an fb */ resource =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!resource)return -EINVAL ; + resource_size = resource->end - resource->start +1 ;/* check the resource is large enough to fit the fb */ -if (resource->end - resource->start < size) { -printk (KERN_ERR "allocated resource is too small for " +if (resource_size < size) { +printk (KERN_ERR "msmfb: allocated resource is too small for " "fb\n" );return -ENOMEM ; } fb->fix.smem_start = resource->start; - fb->fix.smem_len = resource->end - resource->start; - fbram =ioremap (resource->start, - resource->end - resource->start); + fb->fix.smem_len = resource_size; + fbram =ioremap (resource->start, resource_size);if (fbram ==0 ) {printk (KERN_ERR "msmfb: cannot allocate fbram!\n" );return -ENOMEM ; } + fb->screen_base = fbram;return 0 ;}
--
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 07/20] video: msm: Allow users to request a larger x and y virtual fb
Quoted 4 lines · Mayuresh
drivers/video/msm/msm_fb.c error: · line 368
Quoted 1 line
drivers/video/msm/msm_fb.c +1
-0+ fix->line_length = var->xres * var->bits_per_pixel /8 ;Why to divide by 8? Atleast use >>3, bitwise operations that would take less cpu cycles)
As I stated earlier define a new macro for var also.
Modern compilers know about such things. >> 3 vs / 8 (probably) makes no difference to the generated code with the toolchains we use.
RE: [PATCH 07/20] video: msm: Allow users to request a larger x and y virtual fb
In reply to Janorkar, MayureshQuoted 28 lines
Quoted 14 lines
drivers/video/msm/msm_fb.c +0
-0@@ -323,14 +327,46 @@ error: static int msmfb_check_var(struct fb_var_screeninfo *var, struct
fb_info
*info)
{drivers/video/msm/msm_fb.c +2
-0+u32 size; + if ((var->xres != info->var.xres) ||drivers/video/msm/msm_fb.c error: · line 340
Quoted 10 lines
drivers/video/msm/msm_fb.c +3
-2(var->yres != info->var.yres) || - (var->xres_virtual != info->var.xres_virtual) || - (var->yres_virtual != info->var.yres_virtual) || (var->xoffset != info->var.xoffset) || (var->bits_per_pixel != info->var.bits_per_pixel) || (var->grayscale != info->var.grayscale)) return -EINVAL; + + size = var->xres_virtual * var->yres_virtual * + (var->bits_per_pixel >>3 );How about defining a new macro
BYTES_PER_PIXEL_VARforfb_var_screeninfoalso? That would make code more readable.
Quoted 4 lines
drivers/video/msm/msm_fb.c error: · line 344
Quoted 4 lines
drivers/video/msm/msm_fb.c +4
-0+if (size > info->fix.smem_len) +return -EINVAL ; +return 0 ; +}
Name might be a little easy to confuse with the other BYTES_PER_PIXEL, but overall readability would increase IMHO; Done.
Quoted 38 lines
drivers/video/msm/msm_fb.c error: · line 358
Quoted 13 lines
drivers/video/msm/msm_fb.c +13
-0+static int msmfb_set_par (struct fb_info *info) +{ +struct fb_var_screeninfo *var = &info->var; +struct fb_fix_screeninfo *fix = &info->fix; + +/* we only support RGB ordering for now */ +if (var->bits_per_pixel ==32 || var->bits_per_pixel ==24 ) { + var->red.offset =0 ; + var->red.length =8 ; + var->green.offset =8 ; + var->green.length =8 ; + var->blue.offset =16 ; + var->blue.length =8 ;
var->redis afb_bitfieldvariable.
It provides offset, length andmsb_right.struct
fb_bitfield{__u32 offset; /* beginning of bitfield */ __u32 length; /* length of bitfield */ __u32 msb_right; /* != 0 : Most significant bit is */ /* right */ }Please don't keep
msb_rightunassigned.drivers/video/msm/msm_fb.c error: · line 367
Quoted 9 lines
drivers/video/msm/msm_fb.c +9
-0+ }else if (var->bits_per_pixel ==16 ) { + var->red.offset =11 ; + var->red.length =5 ; + var->green.offset =5 ; + var->green.length =6 ; + var->blue.offset =0 ; + var->blue.length =5 ; + }else +return -1 ;Please use standard error code provided by Linux kernel
-EINVAL(-22 Invalid argument)
Quoted 8 lines
drivers/video/msm/msm_fb.c error: · line 368
Quoted 1 line
drivers/video/msm/msm_fb.c +1
-0+ fix->line_length = var->xres * var->bits_per_pixel /8 ;Why to divide by 8? Atleast use >>3, bitwise operations that would take less cpu cycles)
As I stated earlier define a new macro for var also.Quoted 3 lines
drivers/video/msm/msm_fb.c +1
-0+return 0 ; }
And Done. And done again... and while I'm at it, all the changes you suggested are being pulled into v2 (except for updating Google's copyright date (see: Brian Swetland's response)).
Thank you for reviewing my patches :)
-Carl V.
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 8/20 video: msm: Refactor mdp_regs
In reply to Carl VanderlipTo begin splitting hw specific PPP operations into different files, the mdp_regs struct will be moved into a new generic header file for PPP operations.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- drivers/video/msm/mdp_ppp.c | 49 +++++++++++++----------------------------- drivers/video/msm/mdp_ppp.h | 50 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 34 deletions(-) create mode 100644 drivers/video/msm/mdp_ppp.h
drivers/video/msm/mdp_ppp.c +15 -34
@@ -19,6 +19,7 @@#include <mach/msm_fb.h> #include "mdp_hw.h" +#include "mdp_ppp.h" #include "mdp_scale_tables.h" #define DLOG(x...) do {} while (0)
@@ -27,28 +28,6 @@static int downscale_y_table =MDP_DOWNSCALE_MAX ;static int downscale_x_table =MDP_DOWNSCALE_MAX ; -struct mdp_regs { -uint32_t src0; -uint32_t src1; -uint32_t dst0; -uint32_t dst1; -uint32_t src_cfg; -uint32_t dst_cfg; -uint32_t src_pack; -uint32_t dst_pack; -uint32_t src_rect; -uint32_t dst_rect; -uint32_t src_ystride; -uint32_t dst_ystride; -uint32_t op; -uint32_t src_bpp; -uint32_t dst_bpp; -uint32_t edge; -uint32_t phasex_init; -uint32_t phasey_init; -uint32_t phasex_step; -uint32_t phasey_step; -};static uint32_t pack_pattern[] = {PPP_ARRAY0 (PACK_PATTERN )
@@ -88,7 +67,8 @@ static uint32_t bg_op_chroma[] = { PPP_ARRAY1(CHROMA_SAMP, BG) }; -static void rotate_dst_addr_x (struct mdp_blit_req *req,struct mdp_regs *regs) +static void rotate_dst_addr_x (struct mdp_blit_req *req, +struct ppp_regs *regs) { regs->dst0 += (req->dst_rect.w -min ((uint32_t )16 , req->dst_rect.w)) * regs->dst_bpp;
@@ -96,7 +76,8 @@ static void rotate_dst_addr_x(struct mdp_blit_req *req, struct mdp_regs *regs) min((uint32_t)16, req->dst_rect.w)) * regs->dst_bpp; } -static void rotate_dst_addr_y (struct mdp_blit_req *req,struct mdp_regs *regs) +static void rotate_dst_addr_y (struct mdp_blit_req *req, +struct ppp_regs *regs) { regs->dst0 += (req->dst_rect.h - min((uint32_t)16, req->dst_rect.h)) *
@@ -107,7 +88,7 @@ static void rotate_dst_addr_y(struct mdp_blit_req *req, struct mdp_regs *regs) }static void blit_rotate (struct mdp_blit_req *req, -struct mdp_regs *regs) +struct ppp_regs *regs) {if (req->flags ==MDP_ROT_NOP )return ;
@@ -126,7 +107,7 @@ static void blit_rotate(struct mdp_blit_req *req, regs->op |=PPP_OP_FLIP_LR ; } -static void blit_convert (struct mdp_blit_req *req,struct mdp_regs *regs) +static void blit_convert (struct mdp_blit_req *req,struct ppp_regs *regs) {if (req->src.format == req->dst.format)return ;
@@ -165,7 +146,7 @@ static uint32_t transp_convert(struct mdp_blit_req *req) }#undef GET_BIT_RANGE -static void blit_blend (struct mdp_blit_req *req,struct mdp_regs *regs) +static void blit_blend (struct mdp_blit_req *req,struct ppp_regs *regs) {/* TRANSP BLEND */ if (req->transp_mask !=MDP_TRANSP_NOP ) {
@@ -332,7 +313,7 @@ static void get_edge_info(uint32_t src, uint32_t src_coord, uint32_t dst, *interp2 += src_coord; } -static int get_edge_cond (struct mdp_blit_req *req,struct mdp_regs *regs) +static int get_edge_cond (struct mdp_blit_req *req,struct ppp_regs *regs) {int32_t luma_interp[4 ];int32_t luma_repeat[4 ];
@@ -432,7 +413,7 @@ static int get_edge_cond(struct mdp_blit_req *req, struct mdp_regs *regs) }static int blit_scale (const struct mdp_info *mdp,struct mdp_blit_req *req, -struct mdp_regs *regs) +struct ppp_regs *regs) {uint32_t phase_init_x, phase_init_y, phase_step_x, phase_step_y;uint32_t scale_factor_x, scale_factor_y;
@@ -500,7 +481,7 @@ static int blit_scale(const struct mdp_info *mdp, struct mdp_blit_req *req, }static void blit_blur (const struct mdp_info *mdp,struct mdp_blit_req *req, -struct mdp_regs *regs) +struct ppp_regs *regs) {if (!(req->flags &MDP_BLUR ))return ;
@@ -534,7 +515,7 @@ static void get_len(struct mdp_img *img, struct mdp_rect *rect, uint32_t bpp,static int valid_src_dst (unsigned long src_start,unsigned long src_len,unsigned long dst_start,unsigned long dst_len, -struct mdp_blit_req *req,struct mdp_regs *regs) +struct mdp_blit_req *req,struct ppp_regs *regs) {unsigned long src_min_ok = src_start;unsigned long src_max_ok = src_start + src_len;
@@ -575,7 +556,7 @@ static int valid_src_dst(unsigned long src_start, unsigned long src_len, } -static void flush_imgs (struct mdp_blit_req *req,struct mdp_regs *regs, +static void flush_imgs (struct mdp_blit_req *req,struct ppp_regs *regs,struct file *src_file,struct file *dst_file) { }
@@ -601,7 +582,7 @@ static void get_chroma_addr(struct mdp_img *img, struct mdp_rect *rect, }static int send_blit (const struct mdp_info *mdp,struct mdp_blit_req *req, -struct mdp_regs *regs,struct file *src_file, +struct ppp_regs *regs,struct file *src_file,struct file *dst_file) {mdp_writel (mdp,1 ,0x060 );
@@ -646,7 +627,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req, struct file *src_file, unsigned long src_start, unsigned long src_len, struct file *dst_file, unsigned long dst_start, unsigned long dst_len) { - struct mdp_regs regs = {0}; + struct ppp_regs regs = {0};if (unlikely (req->src.format >=MDP_IMGTYPE_LIMIT || req->dst.format >=MDP_IMGTYPE_LIMIT )) {
drivers/video/msm/mdp_ppp.h new file +50 -0
50 lines not on this page · raw message
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RE: [PATCH 08/20] video: msm: Refactor mdp_regs
Quoted 205 lines
-----Original Message-----
From: linux-fbdev-owner at vger.kernel.org [mailto:linux-fbdev- owner at vger.kernel.org] On Behalf Of Carl Vanderlip
Sent: Saturday, March 19, 2011 3:27 AM
To: David Brown; Daniel Walker; Bryan Huntsman
Cc: Brian Swetland; Dima Zavin; Rebecca Schultz Zavin; Colin Cross; linux- fbdev at vger.kernel.org; Carl Vanderlip; linux-arm-
kernel at lists.infradead.org; linux-arm-msm at vger.kernel.org; linux- kernel at vger.kernel.org
Subject: [PATCH 08/20] video: msm: Refactormdp_regsTo begin splitting hw specific PPP operations into different files, the
mdp_regsstruct will be moved into a new generic header file for PPP operations.Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>Signed-off-by Carl Vanderlip <[email protected]>--- drivers/video/msm/mdp_ppp.c | 49 +++++++++++++------------------------- ---- drivers/video/msm/mdp_ppp.h | 50 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 34 deletions(-) create mode 100644 drivers/video/msm/mdp_ppp.hdrivers/video/msm/mdp_ppp.c +3
-23@@ -19,6 +19,7 @@#include <mach/msm_fb.h> #include "mdp_hw.h" +#include "mdp_ppp.h" #include "mdp_scale_tables.h" #define DLOG(x...) do {} while (0)@@ -27,28 +28,6 @@static int downscale_y_table =MDP_DOWNSCALE_MAX ;static int downscale_x_table =MDP_DOWNSCALE_MAX ; -struct mdp_regs { -uint32_t src0; -uint32_t src1; -uint32_t dst0; -uint32_t dst1; -uint32_t src_cfg; -uint32_t dst_cfg; -uint32_t src_pack; -uint32_t dst_pack; -uint32_t src_rect; -uint32_t dst_rect; -uint32_t src_ystride; -uint32_t dst_ystride; -uint32_t op; -uint32_t src_bpp; -uint32_t dst_bpp; -uint32_t edge; -uint32_t phasex_init; -uint32_t phasey_init; -uint32_t phasex_step; -uint32_t phasey_step; -};static uint32_t pack_pattern[] = {PPP_ARRAY0 (PACK_PATTERN )@@ -88,7 +67,8 @@ static uint32_t bg_op_chroma[] = {PPP_ARRAY1 (CHROMA_SAMP ,BG ) }; -static void rotate_dst_addr_x (struct mdp_blit_req *req,struct mdp_regs *regs) +static void rotate_dst_addr_x (struct mdp_blit_req *req, +struct ppp_regs *regs) { regs->dst0 += (req->dst_rect.w -drivers/video/msm/mdp_ppp.c +2
-1min((uint32_t)16, req->dst_rect.w)) * regs->dst_bpp;@@ -96,7 +76,8 @@ static void rotate_dst_addr_x(struct mdp_blit_req *req, struct mdp_regs *regs) min((uint32_t)16, req->dst_rect.w)) * regs->dst_bpp; } -static void rotate_dst_addr_y (struct mdp_blit_req *req,struct mdp_regs *regs) +static void rotate_dst_addr_y (struct mdp_blit_req *req, +struct ppp_regs *regs) {drivers/video/msm/mdp_ppp.c +1
-1regs->dst0 += (req->dst_rect.h - min((uint32_t)16, req->dst_rect.h)) *@@ -107,7 +88,7 @@ static void rotate_dst_addr_y(struct mdp_blit_req *req, struct mdp_regs *regs) }static void blit_rotate (struct mdp_blit_req *req, -struct mdp_regs *regs) +struct ppp_regs *regs) {if (req->flags ==MDP_ROT_NOP )drivers/video/msm/mdp_ppp.c +2
-2return ;@@ -126,7 +107,7 @@ static void blit_rotate(struct mdp_blit_req *req, regs->op |=PPP_OP_FLIP_LR ; } -static void blit_convert (struct mdp_blit_req *req,struct mdp_regs *regs) +static void blit_convert (struct mdp_blit_req *req,struct ppp_regs *regs) {if (req->src.format == req->dst.format)return ;@@ -165,7 +146,7 @@ static uint32_t transp_convert(struct mdp_blit_req *req) }#undef GET_BIT_RANGE -static void blit_blend (struct mdp_blit_req *req,struct mdp_regs *regs) +static void blit_blend (struct mdp_blit_req *req,struct ppp_regs *regs) {/* TRANSP BLEND */ drivers/video/msm/mdp_ppp.c +1
-1if (req->transp_mask !=MDP_TRANSP_NOP ) {@@ -332,7 +313,7 @@ static void get_edge_info(uint32_t src, uint32_t src_coord, uint32_t dst, *interp2 += src_coord; } -static int get_edge_cond (struct mdp_blit_req *req,struct mdp_regs *regs) +static int get_edge_cond (struct mdp_blit_req *req,struct ppp_regs *regs) {int32_t luma_interp[4 ];drivers/video/msm/mdp_ppp.c +1
-1int32_t luma_repeat[4 ];@@ -432,7 +413,7 @@ static int get_edge_cond(struct mdp_blit_req *req, struct mdp_regs *regs) }static int blit_scale (const struct mdp_info *mdp,struct mdp_blit_req *req, -struct mdp_regs *regs) +struct ppp_regs *regs) {drivers/video/msm/mdp_ppp.c +1
-1uint32_t phase_init_x, phase_init_y, phase_step_x, phase_step_y;uint32_t scale_factor_x, scale_factor_y;@@ -500,7 +481,7 @@ static int blit_scale(const struct mdp_info *mdp, struct mdp_blit_req *req, }static void blit_blur (const struct mdp_info *mdp,struct mdp_blit_req *req, -struct mdp_regs *regs) +struct ppp_regs *regs) {drivers/video/msm/mdp_ppp.c +1
-1if (!(req->flags &MDP_BLUR ))return ;@@ -534,7 +515,7 @@ static void get_len(struct mdp_img *img, struct mdp_rect *rect, uint32_t bpp, static int valid_src_dst(unsigned long src_start, unsigned long src_len, unsigned long dst_start, unsigned long dst_len, - struct mdp_blit_req *req, struct mdp_regs *regs) + struct mdp_blit_req *req, struct ppp_regs *regs) { unsigned long src_min_ok = src_start;drivers/video/msm/mdp_ppp.c +1
-1unsigned long src_max_ok = src_start + src_len;@@ -575,7 +556,7 @@ static int valid_src_dst(unsigned long src_start, unsigned long src_len, } -static void flush_imgs (struct mdp_blit_req *req,struct mdp_regs *regs, +static void flush_imgs (struct mdp_blit_req *req,struct ppp_regs *regs,struct file *src_file,struct file *dst_file) {}
drivers/video/msm/mdp_ppp.c +1
-1@@ -601,7 +582,7 @@ static void get_chroma_addr(struct mdp_img *img, struct mdp_rect *rect, }static int send_blit (const struct mdp_info *mdp,struct mdp_blit_req *req, -struct mdp_regs *regs,struct file *src_file, +struct ppp_regs *regs,struct file *src_file,struct file *dst_file){
drivers/video/msm/mdp_ppp.c +1
-1mdp_writel (mdp,1 ,0x060 );@@ -646,7 +627,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, structmdp_blit_req *req, struct file *src_file, unsigned long src_start, unsigned long src_len, struct file *dst_file, unsigned long dst_start, unsigned long dst_len) { - struct mdp_regs regs = {0}; + struct ppp_regs regs = {0};drivers/video/msm/mdp_ppp.c +0
-0if (unlikely (req->src.format >=MDP_IMGTYPE_LIMIT || req->dst.format >=MDP_IMGTYPE_LIMIT )) {drivers/video/msm/mdp_ppp.h new file +0
-0
drivers/video/msm/mdp_ppp.h line 3
Quoted 3 lines
drivers/video/msm/mdp_ppp.h new file +3
-0@@ -0,0 +1,50 @@ +/* drivers/video/msm/mdp_ppp.h +* +* Copyright (C) 2009 Google Incorporated
If you want correct copyright info (to 2009-2011) here.
Quoted 55 lines
drivers/video/msm/mdp_ppp.h new file +47
-1+* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _VIDEO_MSM_MDP_PPP_H_ +#define _VIDEO_MSM_MDP_PPP_H_ + +#include <linux/types.h> + +struct ppp_regs { +uint32_t src0; +uint32_t src1; +uint32_t dst0; +uint32_t dst1; +uint32_t src_cfg; +uint32_t dst_cfg; +uint32_t src_pack; +uint32_t dst_pack; +uint32_t src_rect; +uint32_t dst_rect; +uint32_t src_ystride; +uint32_t dst_ystride; +uint32_t op; +uint32_t src_bpp; +uint32_t dst_bpp; +uint32_t edge; +uint32_t phasex_init; +uint32_t phasey_init; +uint32_t phasex_step; +uint32_t phasey_step; + +uint32_t bg0; +uint32_t bg1; +uint32_t bg_cfg; +uint32_t bg_bpp; +uint32_t bg_pack; +uint32_t bg_ystride; +}; + +#endif /* _VIDEO_MSM_MDP_PPP_H_ */ --Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 08/20] video: msm: Refactor mdp_regs
On 03/20/2011 10:17 PM, Janorkar, Mayuresh wrote:
...
Quoted 11 lines
drivers/video/msm/mdp_ppp.h line 3
Quoted 9 lines
drivers/video/msm/mdp_ppp.h new file +3
-0@@ -0,0 +1,50 @@ +/* drivers/video/msm/mdp_ppp.h +* +* Copyright (C) 2009 Google Incorporated If you want correct copyright info (to 2009-2011) here.
Carl is submitting a change made by Google in 2009. I believe having 2009 as the only copyright year is correct. Carl/Brian, please correct me here if the date of the change was more than 2009. Thanks.
- Bryan
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [PATCH 08/20] video: msm: Refactor mdp_regs
Quoted 13 lines · Bryan Huntsman
Quoted 11 lines · Mayuresh
drivers/video/msm/mdp_ppp.h line 3
Quoted 9 lines
drivers/video/msm/mdp_ppp.h new file +3
-0@@ -0,0 +1,50 @@ +/* drivers/video/msm/mdp_ppp.h +* +* Copyright (C) 2009 Google Incorporated If you want correct copyright info (to 2009-2011) here.
Quoted 3 lines
Carl is submitting a change made by Google in 2009. ?I believe having 2009 as the only copyright year is correct. ?Carl/Brian, please correct me here if the date of the change was more than 2009. ?Thanks.
Google is fine with leaving our copyright line as originally authored.
No need to modify it.
Thanks,
Brian
PATCH 9/20 video: msm: Split out MDP2.2 HW specific code.
In reply to Carl VanderlipMoving MDP2.2 HW specific code allows for reuse of PPP code when adding other MDP HW versions. Splitting also begins simplification of mdp_probe function.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
---
arch/arm/mach-msm/Kconfig | 5 +
drivers/video/msm/Makefile | 4 +-
drivers/video/msm/mdp.c | 14 +-
drivers/video/msm/mdp_ppp.c | 358 ++++----------------
drivers/video/msm/mdp_ppp.h | 12 +
.../video/msm/{mdp_scale_tables.c => mdp_ppp22.c} | 333 ++++++++++++++++++-
drivers/video/msm/mdp_scale_tables.h | 38 --
7 files changed, 417 insertions(+), 347 deletions(-)
rename drivers/video/msm/{mdp_scale_tables.c => mdp_ppp22.c} (69%)
delete mode 100644 drivers/video/msm/mdp_scale_tables.harch/arm/mach-msm/Kconfig +5 -0
@@ -76,6 +76,11 @@ config HAS_MSM_DEBUG_UART_PHYS config MSM_VIC bool +config MSM_MDP22 + bool + depends on ARCH_MSM7X00A + default y + menu "Qualcomm MSM Board Type" config MACH_HALIBUT
drivers/video/msm/Makefile +3 -1
@@ -5,7 +5,9 @@ obj-y := msm_fb.o # MDP DMA/PPP engine # -obj-y += mdp.o mdp_scale_tables.o mdp_ppp.o +obj-y += mdp.o mdp_ppp.o + +obj-$(CONFIG_MSM_MDP22) += mdp_ppp22.o # MDDI interface #
drivers/video/msm/mdp.c +9 -5
@@ -30,6 +30,7 @@#include <linux/platform_device.h> #include "mdp_hw.h" +#include "mdp_ppp.h" struct class *mdp_class;
@@ -453,7 +454,13 @@ int register_mdp_client(struct class_interface *cint) }#include "mdp_csc_table.h" -#include "mdp_scale_tables.h" + +void mdp_hw_init (struct mdp_info *mdp) +{ +#ifdef CONFIG_MSM_MDP22 +mdp_ppp_init_scale (mdp); +#endif +}int mdp_probe (struct platform_device *pdev) {
@@ -551,15 +558,12 @@ int mdp_probe(struct platform_device *pdev)mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01e0 );mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01e4 ); -for (n =0 ; n <ARRAY_SIZE (mdp_upscale_table); n++) -mdp_writel (mdp, mdp_upscale_table[n].val, - mdp_upscale_table[n].reg); -for (n =0 ; n <9 ; n++)mdp_writel (mdp, mdp_default_ccs[n],0x40440 +4 * n);mdp_writel (mdp, mdp_default_ccs[9 ],0x40500 +4 *0 );mdp_writel (mdp, mdp_default_ccs[10 ],0x40500 +4 *0 );mdp_writel (mdp, mdp_default_ccs[11 ],0x40500 +4 *0 ); +mdp_hw_init (mdp);/* register mdp device */ mdp->mdp_dev.dev.parent = &pdev->dev;
drivers/video/msm/mdp_ppp.c +59 -299
450 lines not on this page · raw message
drivers/video/msm/mdp_ppp.h +12 -0
@@ -47,4 +47,16 @@ struct ppp_regs { uint32_t bg_ystride; }; +struct mdp_info ; +struct mdp_rect ; +struct mdp_blit_req ; + +void mdp_ppp_init_scale (const struct mdp_info *mdp); +int mdp_ppp_cfg_scale (const struct mdp_info *mdp,struct ppp_regs *regs, +struct mdp_rect *src_rect,struct mdp_rect *dst_rect, +uint32_t src_format,uint32_t dst_format); +int mdp_ppp_load_blur (const struct mdp_info *mdp); + +int mdp_ppp_cfg_edge_cond (struct mdp_blit_req *req,struct ppp_regs *regs); +#endif /* _VIDEO_MSM_MDP_PPP_H_ */
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +329 -4
348 lines not on this page · raw message
drivers/video/msm/mdp_scale_tables.h deleted +0 -38
@@ -1,38 +0,0 @@ -/* drivers/video/msm_fb/mdp_scale_tables.h -* -* Copyright (C) 2007 QUALCOMM Incorporated -* Copyright (C) 2007 Google Incorporated -* -* This software is licensed under the terms of the GNU General Public -* License version 2, as published by the Free Software Foundation, and -* may be copied, distributed, and modified under those terms. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ -#ifndef _MDP_SCALE_TABLES_H_ -#define _MDP_SCALE_TABLES_H_ - -#include <linux/types.h> -struct mdp_table_entry { -uint32_t reg; -uint32_t val; -}; - -extern struct mdp_table_entry mdp_upscale_table[64 ]; - -enum { -MDP_DOWNSCALE_PT2TOPT4 , -MDP_DOWNSCALE_PT4TOPT6 , -MDP_DOWNSCALE_PT6TOPT8 , -MDP_DOWNSCALE_PT8TO1 , -MDP_DOWNSCALE_MAX , -}; - -extern struct mdp_table_entry *mdp_downscale_x_table[MDP_DOWNSCALE_MAX ]; -extern struct mdp_table_entry *mdp_downscale_y_table[MDP_DOWNSCALE_MAX ]; -extern struct mdp_table_entry mdp_gaussian_blur_table[]; - -#endif
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [PATCH 09/20] video: msm: Split out MDP2.2 HW specific code.
Quoted 77 lines · Carl Vanderlip
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +77
-0+int mdp_ppp_cfg_edge_cond (struct mdp_blit_req *req,struct ppp_regs *regs) +{ +int32_t luma_interp[4 ]; +int32_t luma_repeat[4 ]; +int32_t chroma_interp[4 ]; +int32_t chroma_bound[4 ]; +int32_t chroma_repeat[4 ]; +uint32_t dst_w, dst_h; + +memset (&luma_interp,0 ,sizeof (int32_t ) *4 ); +memset (&luma_repeat,0 ,sizeof (int32_t ) *4 ); +memset (&chroma_interp,0 ,sizeof (int32_t ) *4 ); +memset (&chroma_bound,0 ,sizeof (int32_t ) *4 ); +memset (&chroma_repeat,0 ,sizeof (int32_t ) *4 ); + regs->edge =0 ; + +if (req->flags &MDP_ROT_90 ) { + dst_w = req->dst_rect.h; + dst_h = req->dst_rect.w; + }else { + dst_w = req->dst_rect.w; + dst_h = req->dst_rect.h; + } + +if (regs->op & (PPP_OP_SCALE_Y_ON |PPP_OP_SCALE_X_ON )) { +get_edge_info (req->src_rect.h, req->src_rect.y, dst_h, + &luma_interp[IMG_TOP ], &luma_interp[IMG_BOTTOM ], + &luma_repeat[IMG_TOP ], &luma_repeat[IMG_BOTTOM ]); +get_edge_info (req->src_rect.w, req->src_rect.x, dst_w, + &luma_interp[IMG_LEFT ], &luma_interp[IMG_RIGHT ], + &luma_repeat[IMG_LEFT ], &luma_repeat[IMG_RIGHT ]); + }else { + luma_interp[IMG_LEFT ] = req->src_rect.x; + luma_interp[IMG_RIGHT ] = req->src_rect.x + req->src_rect.w -1 ; + luma_interp[IMG_TOP ] = req->src_rect.y; + luma_interp[IMG_BOTTOM ] = req->src_rect.y + req->src_rect.h -1 ; + luma_repeat[IMG_LEFT ] =0 ; + luma_repeat[IMG_TOP ] =0 ; + luma_repeat[IMG_RIGHT ] =0 ; + luma_repeat[IMG_BOTTOM ] =0 ; + } + + chroma_interp[IMG_LEFT ] = luma_interp[IMG_LEFT ]; + chroma_interp[IMG_RIGHT ] = luma_interp[IMG_RIGHT ]; + chroma_interp[IMG_TOP ] = luma_interp[IMG_TOP ]; + chroma_interp[IMG_BOTTOM ] = luma_interp[IMG_BOTTOM ]; + + chroma_bound[IMG_LEFT ] = req->src_rect.x; + chroma_bound[IMG_RIGHT ] = req->src_rect.x + req->src_rect.w -1 ; + chroma_bound[IMG_TOP ] = req->src_rect.y; + chroma_bound[IMG_BOTTOM ] = req->src_rect.y + req->src_rect.h -1 ; + +if (IS_YCRCB (req->src.format)) { + chroma_interp[IMG_LEFT ] = chroma_interp[IMG_LEFT ] >>1 ; + chroma_interp[IMG_RIGHT ] = (chroma_interp[IMG_RIGHT ] +1 ) >>1 ; + + chroma_bound[IMG_LEFT ] = chroma_bound[IMG_LEFT ] >>1 ; + chroma_bound[IMG_RIGHT ] = chroma_bound[IMG_RIGHT ] >>1 ; + } + +if (req->src.format ==MDP_Y_CBCR_H2V2 || + req->src.format ==MDP_Y_CRCB_H2V2 ) { + chroma_interp[IMG_TOP ] = (chroma_interp[IMG_TOP ] -1 ) >>1 ; + chroma_interp[IMG_BOTTOM ] = (chroma_interp[IMG_BOTTOM ] +1 ) + >>1 ; + chroma_bound[IMG_TOP ] = (chroma_bound[IMG_TOP ] +1 ) >>1 ; + chroma_bound[IMG_BOTTOM ] = chroma_bound[IMG_BOTTOM ] >>1 ; + } + + chroma_repeat[IMG_LEFT ] = chroma_bound[IMG_LEFT ] - + chroma_interp[IMG_LEFT ]; + chroma_repeat[IMG_RIGHT ] = chroma_interp[IMG_RIGHT ] - + chroma_bound[IMG_RIGHT ]; + chroma_repeat[IMG_TOP ] = chroma_bound[IMG_TOP ] - + chroma_interp[IMG_TOP ]; + chroma_repeat[IMG_BOTTOM ] = chroma_interp[IMG_BOTTOM ] - + chroma_bound[IMG_BOTTOM ];
drivers/video/msm/mdp_ppp22.c struct mdp_table_entry mdp_gaussian_blur_table[] = { · line 925
Quoted 10 lines
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +10
-0+ +if (chroma_repeat[IMG_LEFT ] <0 || chroma_repeat[IMG_LEFT ] >3 || + chroma_repeat[IMG_RIGHT ] <0 || chroma_repeat[IMG_RIGHT ] >3 || + chroma_repeat[IMG_TOP ] <0 || chroma_repeat[IMG_TOP ] >3 || + chroma_repeat[IMG_BOTTOM ] <0 || chroma_repeat[IMG_BOTTOM ] >3 || + luma_repeat[IMG_LEFT ] <0 || luma_repeat[IMG_LEFT ] >3 || + luma_repeat[IMG_RIGHT ] <0 || luma_repeat[IMG_RIGHT ] >3 || + luma_repeat[IMG_TOP ] <0 || luma_repeat[IMG_TOP ] >3 || + luma_repeat[IMG_BOTTOM ] <0 || luma_repeat[IMG_BOTTOM ] >3 ) +return -1 ;
Lazy programming strikes again. Public functions really should not return things that look like errno codes, rather they should return real errno codes.
Secondly, why is this stuff, which looks very driver like, under arch/arm and not in drivers/ somewhere?
Re: [PATCH 09/20] video: msm: Split out MDP2.2 HW specific code.
Quoted 94 lines · Carl Vanderlip
Quoted 78 lines
+int
mdp_ppp_cfg_edge_cond(struct mdp_blit_req *req, struct ppp_regs *regs)drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +76
-0+{ +int32_t luma_interp[4 ]; +int32_t luma_repeat[4 ]; +int32_t chroma_interp[4 ]; +int32_t chroma_bound[4 ]; +int32_t chroma_repeat[4 ]; +uint32_t dst_w, dst_h; + +memset (&luma_interp,0 ,sizeof (int32_t ) *4 ); +memset (&luma_repeat,0 ,sizeof (int32_t ) *4 ); +memset (&chroma_interp,0 ,sizeof (int32_t ) *4 ); +memset (&chroma_bound,0 ,sizeof (int32_t ) *4 ); +memset (&chroma_repeat,0 ,sizeof (int32_t ) *4 ); + regs->edge =0 ; + +if (req->flags &MDP_ROT_90 ) { + dst_w = req->dst_rect.h; + dst_h = req->dst_rect.w; + }else { + dst_w = req->dst_rect.w; + dst_h = req->dst_rect.h; + } + +if (regs->op & (PPP_OP_SCALE_Y_ON |PPP_OP_SCALE_X_ON )) { +get_edge_info (req->src_rect.h, req->src_rect.y, dst_h, + &luma_interp[IMG_TOP ], &luma_interp[IMG_BOTTOM ], + &luma_repeat[IMG_TOP ], &luma_repeat[IMG_BOTTOM ]); +get_edge_info (req->src_rect.w, req->src_rect.x, dst_w, + &luma_interp[IMG_LEFT ], &luma_interp[IMG_RIGHT ], + &luma_repeat[IMG_LEFT ], &luma_repeat[IMG_RIGHT ]); + }else { + luma_interp[IMG_LEFT ] = req->src_rect.x; + luma_interp[IMG_RIGHT ] = req->src_rect.x + req->src_rect.w -1 ; + luma_interp[IMG_TOP ] = req->src_rect.y; + luma_interp[IMG_BOTTOM ] = req->src_rect.y + req->src_rect.h -1 ; + luma_repeat[IMG_LEFT ] =0 ; + luma_repeat[IMG_TOP ] =0 ; + luma_repeat[IMG_RIGHT ] =0 ; + luma_repeat[IMG_BOTTOM ] =0 ; + } + + chroma_interp[IMG_LEFT ] = luma_interp[IMG_LEFT ]; + chroma_interp[IMG_RIGHT ] = luma_interp[IMG_RIGHT ]; + chroma_interp[IMG_TOP ] = luma_interp[IMG_TOP ]; + chroma_interp[IMG_BOTTOM ] = luma_interp[IMG_BOTTOM ]; + + chroma_bound[IMG_LEFT ] = req->src_rect.x; + chroma_bound[IMG_RIGHT ] = req->src_rect.x + req->src_rect.w -1 ; + chroma_bound[IMG_TOP ] = req->src_rect.y; + chroma_bound[IMG_BOTTOM ] = req->src_rect.y + req->src_rect.h -1 ; + +if (IS_YCRCB (req->src.format)) { + chroma_interp[IMG_LEFT ] = chroma_interp[IMG_LEFT ] >>1 ; + chroma_interp[IMG_RIGHT ] = (chroma_interp[IMG_RIGHT ] +1 ) >>1 ; + + chroma_bound[IMG_LEFT ] = chroma_bound[IMG_LEFT ] >>1 ; + chroma_bound[IMG_RIGHT ] = chroma_bound[IMG_RIGHT ] >>1 ; + } + +if (req->src.format ==MDP_Y_CBCR_H2V2 || + req->src.format ==MDP_Y_CRCB_H2V2 ) { + chroma_interp[IMG_TOP ] = (chroma_interp[IMG_TOP ] -1 ) >>1 ; + chroma_interp[IMG_BOTTOM ] = (chroma_interp[IMG_BOTTOM ] +1 ) + >>1 ; + chroma_bound[IMG_TOP ] = (chroma_bound[IMG_TOP ] +1 ) >>1 ; + chroma_bound[IMG_BOTTOM ] = chroma_bound[IMG_BOTTOM ] >>1 ; + } + + chroma_repeat[IMG_LEFT ] = chroma_bound[IMG_LEFT ] - + chroma_interp[IMG_LEFT ]; + chroma_repeat[IMG_RIGHT ] = chroma_interp[IMG_RIGHT ] - + chroma_bound[IMG_RIGHT ]; + chroma_repeat[IMG_TOP ] = chroma_bound[IMG_TOP ] - + chroma_interp[IMG_TOP ]; + chroma_repeat[IMG_BOTTOM ] = chroma_interp[IMG_BOTTOM ] - + chroma_bound[IMG_BOTTOM ];drivers/video/msm/mdp_ppp22.c struct mdp_table_entry mdp_gaussian_blur_table[] = { · line 925
Quoted 10 lines
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +10
-0+ +if (chroma_repeat[IMG_LEFT ] <0 || chroma_repeat[IMG_LEFT ] >3 || + chroma_repeat[IMG_RIGHT ] <0 || chroma_repeat[IMG_RIGHT ] >3 || + chroma_repeat[IMG_TOP ] <0 || chroma_repeat[IMG_TOP ] >3 || + chroma_repeat[IMG_BOTTOM ] <0 || chroma_repeat[IMG_BOTTOM ] >3 || + luma_repeat[IMG_LEFT ] <0 || luma_repeat[IMG_LEFT ] >3 || + luma_repeat[IMG_RIGHT ] <0 || luma_repeat[IMG_RIGHT ] >3 || + luma_repeat[IMG_TOP ] <0 || luma_repeat[IMG_TOP ] >3 || + luma_repeat[IMG_BOTTOM ] <0 || luma_repeat[IMG_BOTTOM ] >3 ) +return -1 ;Lazy programming strikes again. Public functions really should not return things that look like errno codes, rather they should return real errno codes.
Quoted 3 lines
Secondly, why is this stuff, which looks very driver like, under
arch/armand not indrivers/somewhere?
Fixed.
Secondly, I think this code in particular is in drivers/video/msm; I think you've been included since there are some Kconfig updates under arch/arm (additionally, I think David B. will be pulling this into his for-next tree if approved).
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RE: [PATCH 09/20] video: msm: Split out MDP2.2 HW specific code.
In reply to Carl VanderlipQuoted 42 lines
-----Original Message-----
From: linux-fbdev-owner at vger.kernel.org [mailto:linux-fbdev- owner at vger.kernel.org] On Behalf Of Carl Vanderlip
Sent: Saturday, March 19, 2011 3:27 AM
To: Russell King; David Brown; Daniel Walker; Bryan Huntsman
Cc: Brian Swetland; Dima Zavin; Rebecca Schultz Zavin; Colin Cross; linux- fbdev at vger.kernel.org; Carl Vanderlip; linux-arm-
kernel at lists.infradead.org; linux-arm-msm at vger.kernel.org; linux- kernel at vger.kernel.org
Subject: [PATCH 09/20] video: msm: Split out MDP2.2 HW specific code.Moving MDP2.2 HW specific code allows for reuse of PPP code when adding other MDP HW versions. Splitting also begins simplification of
mdp_probefunction.Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>Signed-off-by Carl Vanderlip <[email protected]>--- arch/arm/mach-msm/Kconfig | 5 + drivers/video/msm/Makefile | 4 +- drivers/video/msm/mdp.c | 14 +- drivers/video/msm/mdp_ppp.c | 358 ++++----------- ----- drivers/video/msm/mdp_ppp.h | 12 + .../video/msm/{mdp_scale_tables.c => mdp_ppp22.c} | 333 ++++++++++++++++++- drivers/video/msm/mdp_scale_tables.h | 38 -- 7 files changed, 417 insertions(+), 347 deletions(-) rename drivers/video/msm/{mdp_scale_tables.c => mdp_ppp22.c} (69%) delete mode 100644 drivers/video/msm/mdp_scale_tables.harch/arm/mach-msm/Kconfig +0
-0
arch/arm/mach-msm/Kconfig config HAS_MSM_DEBUG_UART_PHYS · line 82
Quoted 7 lines
arch/arm/mach-msm/Kconfig +4
-0@@ -76,6 +76,11 @@ config HAS_MSM_DEBUG_UART_PHYS config MSM_VIC bool +config MSM_MDP22 + bool + depends on ARCH_MSM7X00A + default y
Please add some help here.
Quoted 87 lines
arch/arm/mach-msm/Kconfig +1
-0+ menu "Qualcomm MSM Board Type" config MACH_HALIBUTdrivers/video/msm/Makefile +3
-1@@ -5,7 +5,9 @@ obj-y := msm_fb.o # MDP DMA/PPP engine # -obj-y += mdp.o mdp_scale_tables.o mdp_ppp.o +obj-y += mdp.o mdp_ppp.o + +obj-$(CONFIG_MSM_MDP22) += mdp_ppp22.o # MDDI interface #drivers/video/msm/mdp.c +9
-5@@ -30,6 +30,7 @@#include <linux/platform_device.h> #include "mdp_hw.h" +#include "mdp_ppp.h" struct class *mdp_class;@@ -453,7 +454,13 @@ int register_mdp_client(struct class_interface *cint) }#include "mdp_csc_table.h" -#include "mdp_scale_tables.h" + +void mdp_hw_init (struct mdp_info *mdp) +{ +#ifdef CONFIG_MSM_MDP22 +mdp_ppp_init_scale (mdp); +#endif +}int mdp_probe (struct platform_device *pdev) {@@ -551,15 +558,12 @@ int mdp_probe(struct platform_device *pdev)mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01e0 );mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01e4 ); -for (n =0 ; n <ARRAY_SIZE (mdp_upscale_table); n++) -mdp_writel (mdp, mdp_upscale_table[n].val, - mdp_upscale_table[n].reg); -for (n =0 ; n <9 ; n++)mdp_writel (mdp, mdp_default_ccs[n],0x40440 +4 * n);mdp_writel (mdp, mdp_default_ccs[9 ],0x40500 +4 *0 );mdp_writel (mdp, mdp_default_ccs[10 ],0x40500 +4 *0 );mdp_writel (mdp, mdp_default_ccs[11 ],0x40500 +4 *0 ); +mdp_hw_init (mdp);/* register mdp device */ mdp->mdp_dev.dev.parent = &pdev->dev;drivers/video/msm/mdp_ppp.c +4
-4@@ -20,14 +20,14 @@#include "mdp_hw.h" #include "mdp_ppp.h" -#include "mdp_scale_tables.h" #define DLOG(x...) do {} while (0) -#define MDP_DOWNSCALE_BLUR (MDP_DOWNSCALE_MAX + 1) -static int downscale_y_table =MDP_DOWNSCALE_MAX ; -static int downscale_x_table =MDP_DOWNSCALE_MAX ; +#define IMG_LEN (rect_h, w, rect_w, bpp) (((rect_h) * w) * bpp) +#define Y_TO_CRCB_RATIO (format) \ + ((format == MDP_Y_CBCR_H2V2 || format == MDP_Y_CRCB_H2V2) ? 2 :\ + (format == MDP_Y_CBCR_H2V1 || format == MDP_Y_CRCB_H2V1) ? 1 : 1)static uint32_t pack_pattern[] = {PPP_ARRAY0 (PACK_PATTERN )
drivers/video/msm/mdp_ppp.c static uint32_t bg_op_chroma[] = { · line 74
Quoted 8 lines
drivers/video/msm/mdp_ppp.c +5
-0@@ -67,6 +67,19 @@ static uint32_t bg_op_chroma[] = { PPP_ARRAY1(CHROMA_SAMP, BG) }; +static void set_src_region (struct mdp_img *img,struct mdp_rect *rect, +struct ppp_regs *regs) +{ + regs->src_rect = (rect->h <<16 ) | (rect->w &0x1fff ); +
[cosmetic comment]: unnecessary extra line?
drivers/video/msm/mdp_ppp.c static uint32_t bg_op_chroma[] = { · line 80
Quoted 7 lines
drivers/video/msm/mdp_ppp.c +6
-0+} + +static inline void set_dst_region (struct mdp_rect *rect,struct ppp_regs *regs) +{ + regs->dst_rect = (rect->h <<16 ) | (rect->w &0xfff ); +
[cosmetic comment]: unnecessary extra line?
Quoted 658 lines
drivers/video/msm/mdp_ppp.c +2
-0+} +static void rotate_dst_addr_x (struct mdp_blit_req *req,struct ppp_regs *regs){
drivers/video/msm/mdp_ppp.c +0
-13@@ -181,254 +194,30 @@ static void blit_blend(struct mdp_blit_req *req, struct ppp_regs *regs) } regs->op |= bg_op_chroma[req->dst.format]; -} - -#define ONE_HALF (1LL << 32) -#define ONE (1LL << 33) -#define TWO (2LL << 33) -#define THREE (3LL << 33) -#define FRAC_MASK (ONE - 1) -#define INT_MASK (~FRAC_MASK) - -static int scale_params (uint32_t dim_in,uint32_t dim_out,uint32_t origin, -uint32_t *phase_init,uint32_t *phase_step) -{ -/* to improve precicsion calculations are done in U31.33 and converted
drivers/video/msm/mdp_ppp.c +0
-153-* to U3.29 at the end */ -int64_t k1, k2, k3, k4, tmp; -uint64_t n, d, os, os_p, od, od_p, oreq; -unsigned rpa =0 ; -int64_t ip64, delta; - -if (dim_out %3 ==0 ) - rpa = !(dim_in % (dim_out /3 )); - - n = ((uint64_t )dim_out) <<34 ; - d = dim_in; -if (!d) -return -1 ; -do_div (n, d); - k3 = (n +1 ) >>1 ; -if ((k3 >>4 ) < (1LL <<27 ) || (k3 >>4 ) > (1LL <<31 )) { -DLOG ("crap bad scale\n" ); -return -1 ; - } - n = ((uint64_t )dim_in) <<34 ; - d = (uint64_t )dim_out; -if (!d) -return -1 ; -do_div (n, d); - k1 = (n +1 ) >>1 ; - k2 = (k1 -ONE ) >>1 ; - - *phase_init = (int )(k2 >>4 ); - k4 = (k3 -ONE ) >>1 ; - -if (rpa) { - os = ((uint64_t )origin <<33 ) -ONE_HALF ; - tmp = (dim_out * os) +ONE_HALF ; -if (!dim_in) -return -1 ; -do_div (tmp, dim_in); - od = tmp -ONE_HALF ; - }else { - os = ((uint64_t )origin <<1 ) -1 ; - od = (((k3 * os) >>1 ) + k4); - } - - od_p = od &INT_MASK ; -if (od_p != od) - od_p +=ONE ; - -if (rpa) { - tmp = (dim_in * od_p) +ONE_HALF ; -if (!dim_in) -return -1 ; -do_div (tmp, dim_in); - os_p = tmp -ONE_HALF ; - }else { - os_p = ((k1 * (od_p >>33 )) + k2); - } - - oreq = (os_p &INT_MASK ) -ONE ; - - ip64 = os_p - oreq; - delta = ((int64_t )(origin) <<33 ) - oreq; - ip64 -= delta; -/* limit to valid range before the left shift */ - delta = (ip64 & (1LL <<63 )) ?4 :-4 ; - delta <<=33 ; -while (abs ((int )(ip64 >>33 )) >4 ) - ip64 += delta; - *phase_init = (int )(ip64 >>4 ); - *phase_step = (uint32_t )(k1 >>4 ); -return 0 ; -} - -static void load_scale_table (const struct mdp_info *mdp, -struct mdp_table_entry *table,int len) -{ -int i; -for (i =0 ; i < len; i++) -mdp_writel (mdp, table[i].val, table[i].reg); -} - -enum { -IMG_LEFT , -IMG_RIGHT , -IMG_TOP , -IMG_BOTTOM , -}; - -static void get_edge_info (uint32_t src,uint32_t src_coord,uint32_t dst, -uint32_t *interp1,uint32_t *interp2, -uint32_t *repeat1,uint32_t *repeat2) { -if (src >3 * dst) { - *interp1 =0 ; - *interp2 = src -1 ; - *repeat1 =0 ; - *repeat2 =0 ; - }else if (src ==3 * dst) { - *interp1 =0 ; - *interp2 = src; - *repeat1 =0 ; - *repeat2 =1 ; - }else if (src > dst && src <3 * dst) { - *interp1 =-1 ; - *interp2 = src; - *repeat1 =1 ; - *repeat2 =1 ; - }else if (src == dst) { - *interp1 =-1 ; - *interp2 = src +1 ; - *repeat1 =1 ; - *repeat2 =2 ; - }else { - *interp1 =-2 ; - *interp2 = src +1 ; - *repeat1 =2 ; - *repeat2 =2 ; - } - *interp1 += src_coord; - *interp2 += src_coord; -} - -static int get_edge_cond (struct mdp_blit_req *req,struct ppp_regs *regs) -{ -int32_t luma_interp[4 ]; -int32_t luma_repeat[4 ]; -int32_t chroma_interp[4 ]; -int32_t chroma_bound[4 ]; -int32_t chroma_repeat[4 ]; -uint32_t dst_w, dst_h; - -memset (&luma_interp,0 ,sizeof (int32_t ) *4 ); -memset (&luma_repeat,0 ,sizeof (int32_t ) *4 ); -memset (&chroma_interp,0 ,sizeof (int32_t ) *4 ); -memset (&chroma_bound,0 ,sizeof (int32_t ) *4 ); -memset (&chroma_repeat,0 ,sizeof (int32_t ) *4 ); - regs->edge =0 ; - -if (req->flags &MDP_ROT_90 ) { - dst_w = req->dst_rect.h; - dst_h = req->dst_rect.w; - }else { - dst_w = req->dst_rect.w; - dst_h = req->dst_rect.h; - } - -if (regs->op & (PPP_OP_SCALE_Y_ON |PPP_OP_SCALE_X_ON )) { -get_edge_info (req->src_rect.h, req->src_rect.y, dst_h, - &luma_interp[IMG_TOP ], &luma_interp[IMG_BOTTOM ], - &luma_repeat[IMG_TOP ], &luma_repeat[IMG_BOTTOM ]); -get_edge_info (req->src_rect.w, req->src_rect.x, dst_w, - &luma_interp[IMG_LEFT ], &luma_interp[IMG_RIGHT ], - &luma_repeat[IMG_LEFT ], &luma_repeat[IMG_RIGHT ]); - }else { - luma_interp[IMG_LEFT ] = req->src_rect.x; - luma_interp[IMG_RIGHT] = req->src_rect.x + req->src_rect.w -1;
drivers/video/msm/mdp_ppp.c +0
-2- luma_interp[IMG_TOP ] = req->src_rect.y; - luma_interp[IMG_BOTTOM] = req->src_rect.y + req->src_rect.h -1;
drivers/video/msm/mdp_ppp.c +0
-19- luma_repeat[IMG_LEFT ] =0 ; - luma_repeat[IMG_TOP ] =0 ; - luma_repeat[IMG_RIGHT ] =0 ; - luma_repeat[IMG_BOTTOM ] =0 ; - } - - chroma_interp[IMG_LEFT ] = luma_interp[IMG_LEFT ]; - chroma_interp[IMG_RIGHT ] = luma_interp[IMG_RIGHT ]; - chroma_interp[IMG_TOP ] = luma_interp[IMG_TOP ]; - chroma_interp[IMG_BOTTOM ] = luma_interp[IMG_BOTTOM ]; - - chroma_bound[IMG_LEFT ] = req->src_rect.x; - chroma_bound[IMG_RIGHT ] = req->src_rect.x + req->src_rect.w -1 ; - chroma_bound[IMG_TOP ] = req->src_rect.y; - chroma_bound[IMG_BOTTOM ] = req->src_rect.y + req->src_rect.h -1 ; - -if (IS_YCRCB (req->src.format)) { - chroma_interp[IMG_LEFT ] = chroma_interp[IMG_LEFT ] >>1 ; - chroma_interp[IMG_RIGHT] = (chroma_interp[IMG_RIGHT] + 1) >>1;
drivers/video/msm/mdp_ppp.c +0
-26- - chroma_bound[IMG_LEFT ] = chroma_bound[IMG_LEFT ] >>1 ; - chroma_bound[IMG_RIGHT ] = chroma_bound[IMG_RIGHT ] >>1 ; - } -if (req->src.format ==MDP_Y_CBCR_H2V2 || - req->src.format ==MDP_Y_CRCB_H2V2 ) { - chroma_interp[IMG_TOP ] = (chroma_interp[IMG_TOP ] -1 ) >>1 ; - chroma_interp[IMG_BOTTOM ] = (chroma_interp[IMG_BOTTOM ] +1 ) - >>1 ; - chroma_bound[IMG_TOP ] = (chroma_bound[IMG_TOP ] +1 ) >>1 ; - chroma_bound[IMG_BOTTOM ] = chroma_bound[IMG_BOTTOM ] >>1 ; - } - - chroma_repeat[IMG_LEFT ] = chroma_bound[IMG_LEFT ] - - chroma_interp[IMG_LEFT ]; - chroma_repeat[IMG_RIGHT ] = chroma_interp[IMG_RIGHT ] - - chroma_bound[IMG_RIGHT ]; - chroma_repeat[IMG_TOP ] = chroma_bound[IMG_TOP ] - - chroma_interp[IMG_TOP ]; - chroma_repeat[IMG_BOTTOM ] = chroma_interp[IMG_BOTTOM ] - - chroma_bound[IMG_BOTTOM ]; - -if (chroma_repeat[IMG_LEFT ] <0 || chroma_repeat[IMG_LEFT ] >3 || - chroma_repeat[IMG_RIGHT ] <0 || chroma_repeat[IMG_RIGHT ] >3 || - chroma_repeat[IMG_TOP ] <0 || chroma_repeat[IMG_TOP ] >3 || - chroma_repeat[IMG_BOTTOM] < 0 || chroma_repeat[IMG_BOTTOM] > 3||
drivers/video/msm/mdp_ppp.c +8
-15- luma_repeat[IMG_LEFT ] <0 || luma_repeat[IMG_LEFT ] >3 || - luma_repeat[IMG_RIGHT ] <0 || luma_repeat[IMG_RIGHT ] >3 || - luma_repeat[IMG_TOP ] <0 || luma_repeat[IMG_TOP ] >3 || - luma_repeat[IMG_BOTTOM] < 0 || luma_repeat[IMG_BOTTOM] > 3) - return -1; - - regs->edge |= (chroma_repeat[IMG_LEFT ] &3 ) <<MDP_LEFT_CHROMA ; - regs->edge |= (chroma_repeat[IMG_RIGHT ] &3 ) <<MDP_RIGHT_CHROMA ; - regs->edge |= (chroma_repeat[IMG_TOP ] &3 ) <<MDP_TOP_CHROMA ; - regs->edge |= (chroma_repeat[IMG_BOTTOM ] &3 ) <<MDP_BOTTOM_CHROMA ; - regs->edge |= (luma_repeat[IMG_LEFT ] &3 ) <<MDP_LEFT_LUMA ; - regs->edge |= (luma_repeat[IMG_RIGHT ] &3 ) <<MDP_RIGHT_LUMA ; - regs->edge |= (luma_repeat[IMG_TOP ] &3 ) <<MDP_TOP_LUMA ; - regs->edge |= (luma_repeat[IMG_BOTTOM ] &3 ) <<MDP_BOTTOM_LUMA ; -return 0 ; +/* since we always blend src + dst -> dst, copy most of the +* configuration from dest to bg */ + regs->bg0 = regs->dst0; + regs->bg1 = regs->dst1; + regs->bg_cfg = src_img_cfg[req->dst.format]; + regs->bg_bpp = regs->dst_bpp; + regs->bg_pack = pack_pattern[req->dst.format]; + regs->bg_ystride = regs->dst_ystride; } static int blit_scale(const struct mdp_info *mdp, struct mdp_blit_req*req,
structppp_regs*regs)
{drivers/video/msm/mdp_ppp.c +6
-11-uint32_t phase_init_x, phase_init_y, phase_step_x, phase_step_y; -uint32_t scale_factor_x, scale_factor_y; -uint32_t downscale; -uint32_t dst_w, dst_h; +struct mdp_rect dst_rect; +memcpy (&dst_rect, &req->dst_rect,sizeof (dst_rect));if (req->flags &MDP_ROT_90 ) { - dst_w = req->dst_rect.h; - dst_h = req->dst_rect.w; - }else { - dst_w = req->dst_rect.w; - dst_h = req->dst_rect.h; + dst_rect.w = req->dst_rect.h; + dst_rect.h = req->dst_rect.w; } -if ((req->src_rect.w == dst_w) && (req->src_rect.h == dst_h) && - !(req->flags &MDP_BLUR )) { + + if ((req->src_rect.w == dst_rect.w) && (req->src_rect.h ==
dst_rect.h)drivers/video/msm/mdp_ppp.c +14
-51+ && !(req->flags & MDP_BLUR)) { regs->phasex_init =0 ; regs->phasey_init =0 ; regs->phasex_step =0 ;@@ -436,73 +225,35 @@ static int blit_scale(const struct mdp_info *mdp,struct mdp_blit_req *req, return 0; } -if (scale_params (req->src_rect.w, dst_w,1 , &phase_init_x, - &phase_step_x) || -scale_params (req->src_rect.h, dst_h,1 , &phase_init_y, - &phase_step_y)) +#ifdef CONFIG_MSM_MDP22 +if (mdp_ppp_cfg_scale (mdp, regs, &req->src_rect, &dst_rect, + req->src.format, req->dst.format)) { +DLOG ("crap, bad scale\n" );return -1 ; - - scale_factor_x = (dst_w *10 ) / req->src_rect.w; - scale_factor_y = (dst_h *10 ) / req->src_rect.h; - -if (scale_factor_x >8 ) - downscale =MDP_DOWNSCALE_PT8TO1 ; -else if (scale_factor_x >6 ) - downscale =MDP_DOWNSCALE_PT6TOPT8 ; -else if (scale_factor_x >4 ) - downscale =MDP_DOWNSCALE_PT4TOPT6 ; -else - downscale =MDP_DOWNSCALE_PT2TOPT4 ; -if (downscale != downscale_x_table) { -load_scale_table (mdp, mdp_downscale_x_table[downscale],64 ); - downscale_x_table = downscale; } +#endif -if (scale_factor_y >8 ) - downscale =MDP_DOWNSCALE_PT8TO1 ; -else if (scale_factor_y >6 ) - downscale =MDP_DOWNSCALE_PT6TOPT8 ; -else if (scale_factor_y >4 ) - downscale =MDP_DOWNSCALE_PT4TOPT6 ; -else - downscale =MDP_DOWNSCALE_PT2TOPT4 ; -if (downscale != downscale_y_table) { -load_scale_table (mdp, mdp_downscale_y_table[downscale],64 ); - downscale_y_table = downscale; - } - - regs->phasex_init = phase_init_x; - regs->phasey_init = phase_init_y; - regs->phasex_step = phase_step_x; - regs->phasey_step = phase_step_y; regs->op |= (PPP_OP_SCALE_Y_ON |PPP_OP_SCALE_X_ON );return 0 ; - }static void blit_blur (const struct mdp_info *mdp,struct mdp_blit_req *req,struct ppp_regs *regs) { +#ifdef CONFIG_MSM_MDP22 +int ret; +#endif if (!(req->flags &MDP_BLUR ))return ; -if (!(downscale_x_table ==MDP_DOWNSCALE_BLUR && - downscale_y_table ==MDP_DOWNSCALE_BLUR )) { -load_scale_table (mdp, mdp_gaussian_blur_table,128 ); - downscale_x_table =MDP_DOWNSCALE_BLUR ; - downscale_y_table =MDP_DOWNSCALE_BLUR ; - } - +#ifdef CONFIG_MSM_MDP22 + ret =mdp_ppp_load_blur (mdp); +if (ret) +return ; +#endif regs->op |= (PPP_OP_SCALE_Y_ON |PPP_OP_SCALE_X_ON ); } - -#define IMG_LEN (rect_h, w, rect_w, bpp) (((rect_h) * w) * bpp) - -#define Y_TO_CRCB_RATIO (format) \ - ((format == MDP_Y_CBCR_H2V2 || format == MDP_Y_CRCB_H2V2) ? 2 :\ - (format == MDP_Y_CBCR_H2V1 || format == MDP_Y_CRCB_H2V1) ? 1 : 1) - static void get_len(struct mdp_img *img, struct mdp_rect *rect, uint32_tbpp,
uint32_t *len0, uint32_t *len1){
drivers/video/msm/mdp_ppp.c +0
-1@@ -555,7 +306,6 @@ static int valid_src_dst(unsigned long src_start,unsigned long src_len, return 1; } -static void flush_imgs (struct mdp_blit_req *req,struct ppp_regs *regs,struct file *src_file,struct file *dst_file){
drivers/video/msm/mdp_ppp.c +9
-2@@ -643,22 +393,29 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req, return -EINVAL ; } +if (unlikely (req->src_rect.x + req->src_rect.w > req->src.width || + req->src_rect.y + req->src_rect.h > req->src.height || + req->dst_rect.x + req->dst_rect.w > req->dst.width || + req->dst_rect.y + req->dst_rect.h > req->dst.height)) { +printk (KERN_ERR "mdp_ppp: img rect extends outside of img!\n"); +return -EINVAL ; + } +/* set the src image configuration */ regs.src_cfg = src_img_cfg[req->src.format]; regs.src_cfg |= (req->src_rect.x &0x1 ) ?PPP_SRC_BPP_ROI_ODD_X :0 ; regs.src_cfg |= (req->src_rect.y &0x1 ) ?PPP_SRC_BPP_ROI_ODD_Y :0 ; - regs.src_rect = (req->src_rect.h <<16 ) | req->src_rect.w; regs.src_pack = pack_pattern[req->src.format];/* set the dest image configuration */ regs.dst_cfg = dst_img_cfg[req->dst.format] |PPP_DST_OUT_SEL_AXI ; - regs.dst_rect = (req->dst_rect.h <<16 ) | req->dst_rect.w; regs.dst_pack = pack_pattern[req->dst.format];/* set src, bpp, start pixel and ystride */ regs.src_bpp = bytes_per_pixel[req->src.format]; regs.src0 = src_start + req->src.offset; regs.src_ystride = req->src.width * regs.src_bpp; +set_src_region (&req->src, &req->src_rect, ®s); get_chroma_addr(&req->src, &req->src_rect, regs.src0, regs.src_bpp,regs.src_cfg, ®s.src1, ®s.src_ystride); regs.src0 += (req->src_rect.x + (req->src_rect.y * req->src.width))*
drivers/video/msm/mdp_ppp.c +1
-0@@ -668,6 +425,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req, regs.dst_bpp = bytes_per_pixel[req->dst.format]; regs.dst0 = dst_start + req->dst.offset; regs.dst_ystride = req->dst.width * regs.dst_bpp; +set_dst_region (&req->dst_rect, ®s);get_chroma_addr (&req->dst, &req->dst_rect, regs.dst0, regs.dst_bpp, regs.dst_cfg, ®s.dst1, ®s.dst_ystride);regs.dst0 += (req->dst_rect.x + (req->dst_rect.y * req->dst.width))*
drivers/video/msm/mdp_ppp.c +4
-2@@ -703,9 +461,11 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req, req->dst_rect.x = req->dst_rect.x & (~0x1 ); req->dst_rect.w = req->dst_rect.w & (~0x1 ); } -if (get_edge_cond (req, ®s)) -return -EINVAL ; +#ifdef CONFIG_MSM_MDP22 +if (mdp_ppp_cfg_edge_cond (req, ®s)) +return -EINVAL ; +#endif send_blit (mdp, req, ®s, src_file, dst_file);return 0 ;}
drivers/video/msm/mdp_ppp.h +12
-0@@ -47,4 +47,16 @@ struct ppp_regs {uint32_t bg_ystride; }; +struct mdp_info ; +struct mdp_rect ; +struct mdp_blit_req ; + +void mdp_ppp_init_scale (const struct mdp_info *mdp); +int mdp_ppp_cfg_scale (const struct mdp_info *mdp,struct ppp_regs *regs, +struct mdp_rect *src_rect,struct mdp_rect *dst_rect, +uint32_t src_format,uint32_t dst_format); +int mdp_ppp_load_blur (const struct mdp_info *mdp); + +int mdp_ppp_cfg_edge_cond (struct mdp_blit_req *req,struct ppp_regs *regs); +#endif /* _VIDEO_MSM_MDP_PPP_H_ */
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +77
-4@@ -1,6 +1,6 @@ -/* drivers/video/msm_fb/mdp_scale_tables.c +/* drivers/video/msm/mdp_ppp22.c * -* Copyright (C) 2007 QUALCOMM Incorporated +* Copyright (C) 2007, 2011 Code Aurora Forum. All rights reserved. * Copyright (C) 2007 Google Incorporated * * This software is licensed under the terms of the GNU General Public @@ -13,10 +13,33 @@* GNU General Public License for more details. */ -#include "mdp_scale_tables.h" +#include <linux/kernel.h> +#include <linux/io.h> +#include <linux/msm_mdp.h> +#include "mdp_hw.h" +#include "mdp_ppp.h" + +struct mdp_table_entry { +uint32_t reg; +uint32_t val; +}; + +enum { +MDP_DOWNSCALE_PT2TOPT4 , +MDP_DOWNSCALE_PT4TOPT6 , +MDP_DOWNSCALE_PT6TOPT8 , +MDP_DOWNSCALE_PT8TO1 , +MDP_DOWNSCALE_MAX , + +/* not technically in the downscale table list */ +MDP_DOWNSCALE_BLUR , +}; -struct mdp_table_entry mdp_upscale_table[] = { +static int downscale_x_table; +static int downscale_y_table; + +static struct mdp_table_entry mdp_upscale_table[] = { {0x5fffc ,0x0 }, {0x50200 ,0x7fc00000 }, {0x5fffc ,0xff80000d },@@ -764,3 +787,305 @@ struct mdp_table_entry mdp_gaussian_blur_table[] = { { 0x5fffc, 0x20000080 }, { 0x5037c, 0x20000080 }, }; + +static void load_table (const struct mdp_info *mdp, +struct mdp_table_entry *table,int len) +{ +int i; +for (i =0 ; i < len; i++) +mdp_writel (mdp, table[i].val, table[i].reg); +} + +enum { +IMG_LEFT , +IMG_RIGHT , +IMG_TOP , +IMG_BOTTOM , +}; + +static void get_edge_info (uint32_t src,uint32_t src_coord,uint32_t dst, +uint32_t *interp1,uint32_t *interp2, +uint32_t *repeat1,uint32_t *repeat2) { +if (src >3 * dst) { + *interp1 =0 ; + *interp2 = src -1 ; + *repeat1 =0 ; + *repeat2 =0 ; + }else if (src ==3 * dst) { + *interp1 =0 ; + *interp2 = src; + *repeat1 =0 ; + *repeat2 =1 ; + }else if (src > dst && src <3 * dst) { + *interp1 =-1 ; + *interp2 = src; + *repeat1 =1 ; + *repeat2 =1 ; + }else if (src == dst) { + *interp1 =-1 ; + *interp2 = src +1 ; + *repeat1 =1 ; + *repeat2 =2 ; + }else { + *interp1 =-2 ; + *interp2 = src +1 ; + *repeat1 =2 ; + *repeat2 =2 ; + } + *interp1 += src_coord; + *interp2 += src_coord; +} + +int mdp_ppp_cfg_edge_cond(struct mdp_blit_req *req, struct ppp_regs*regs)
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +33
-0+{ +int32_t luma_interp[4 ]; +int32_t luma_repeat[4 ]; +int32_t chroma_interp[4 ]; +int32_t chroma_bound[4 ]; +int32_t chroma_repeat[4 ]; +uint32_t dst_w, dst_h; + +memset (&luma_interp,0 ,sizeof (int32_t ) *4 ); +memset (&luma_repeat,0 ,sizeof (int32_t ) *4 ); +memset (&chroma_interp,0 ,sizeof (int32_t ) *4 ); +memset (&chroma_bound,0 ,sizeof (int32_t ) *4 ); +memset (&chroma_repeat,0 ,sizeof (int32_t ) *4 ); + regs->edge =0 ; + +if (req->flags &MDP_ROT_90 ) { + dst_w = req->dst_rect.h; + dst_h = req->dst_rect.w; + }else { + dst_w = req->dst_rect.w; + dst_h = req->dst_rect.h; + } + +if (regs->op & (PPP_OP_SCALE_Y_ON |PPP_OP_SCALE_X_ON )) { +get_edge_info (req->src_rect.h, req->src_rect.y, dst_h, + &luma_interp[IMG_TOP ], &luma_interp[IMG_BOTTOM ], + &luma_repeat[IMG_TOP ], &luma_repeat[IMG_BOTTOM ]); +get_edge_info (req->src_rect.w, req->src_rect.x, dst_w, + &luma_interp[IMG_LEFT ], &luma_interp[IMG_RIGHT ], + &luma_repeat[IMG_LEFT ], &luma_repeat[IMG_RIGHT ]); + }else { + luma_interp[IMG_LEFT ] = req->src_rect.x; + luma_interp[IMG_RIGHT] = req->src_rect.x + req->src_rect.w -1;
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +2
-0+ luma_interp[IMG_TOP ] = req->src_rect.y; + luma_interp[IMG_BOTTOM] = req->src_rect.y + req->src_rect.h -1;
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +19
-0+ luma_repeat[IMG_LEFT ] =0 ; + luma_repeat[IMG_TOP ] =0 ; + luma_repeat[IMG_RIGHT ] =0 ; + luma_repeat[IMG_BOTTOM ] =0 ; + } + + chroma_interp[IMG_LEFT ] = luma_interp[IMG_LEFT ]; + chroma_interp[IMG_RIGHT ] = luma_interp[IMG_RIGHT ]; + chroma_interp[IMG_TOP ] = luma_interp[IMG_TOP ]; + chroma_interp[IMG_BOTTOM ] = luma_interp[IMG_BOTTOM ]; + + chroma_bound[IMG_LEFT ] = req->src_rect.x; + chroma_bound[IMG_RIGHT ] = req->src_rect.x + req->src_rect.w -1 ; + chroma_bound[IMG_TOP ] = req->src_rect.y; + chroma_bound[IMG_BOTTOM ] = req->src_rect.y + req->src_rect.h -1 ; + +if (IS_YCRCB (req->src.format)) { + chroma_interp[IMG_LEFT ] = chroma_interp[IMG_LEFT ] >>1 ; + chroma_interp[IMG_RIGHT] = (chroma_interp[IMG_RIGHT] + 1) >>1;
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +27
-0+ + chroma_bound[IMG_LEFT ] = chroma_bound[IMG_LEFT ] >>1 ; + chroma_bound[IMG_RIGHT ] = chroma_bound[IMG_RIGHT ] >>1 ; + } + +if (req->src.format ==MDP_Y_CBCR_H2V2 || + req->src.format ==MDP_Y_CRCB_H2V2 ) { + chroma_interp[IMG_TOP ] = (chroma_interp[IMG_TOP ] -1 ) >>1 ; + chroma_interp[IMG_BOTTOM ] = (chroma_interp[IMG_BOTTOM ] +1 ) + >>1 ; + chroma_bound[IMG_TOP ] = (chroma_bound[IMG_TOP ] +1 ) >>1 ; + chroma_bound[IMG_BOTTOM ] = chroma_bound[IMG_BOTTOM ] >>1 ; + } + + chroma_repeat[IMG_LEFT ] = chroma_bound[IMG_LEFT ] - + chroma_interp[IMG_LEFT ]; + chroma_repeat[IMG_RIGHT ] = chroma_interp[IMG_RIGHT ] - + chroma_bound[IMG_RIGHT ]; + chroma_repeat[IMG_TOP ] = chroma_bound[IMG_TOP ] - + chroma_interp[IMG_TOP ]; + chroma_repeat[IMG_BOTTOM ] = chroma_interp[IMG_BOTTOM ] - + chroma_bound[IMG_BOTTOM ]; + +if (chroma_repeat[IMG_LEFT ] <0 || chroma_repeat[IMG_LEFT ] >3 || + chroma_repeat[IMG_RIGHT ] <0 || chroma_repeat[IMG_RIGHT ] >3 || + chroma_repeat[IMG_TOP ] <0 || chroma_repeat[IMG_TOP ] >3 || + chroma_repeat[IMG_BOTTOM] < 0 || chroma_repeat[IMG_BOTTOM] > 3||
drivers/video/msm/mdp_ppp22.c struct mdp_table_entry mdp_gaussian_blur_table[] = { · line 925
Quoted 5 lines
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +5
-0+ luma_repeat[IMG_LEFT ] <0 || luma_repeat[IMG_LEFT ] >3 || + luma_repeat[IMG_RIGHT ] <0 || luma_repeat[IMG_RIGHT ] >3 || + luma_repeat[IMG_TOP ] <0 || luma_repeat[IMG_TOP ] >3 || + luma_repeat[IMG_BOTTOM] < 0 || luma_repeat[IMG_BOTTOM] > 3) + return -1;
Please use error codes defined by linux-kernel.
Please refer to:
http://lxr.linux.no/#linux+v2.6.38/include/asm-generic/errno-base.h
Here you can use -EINVAL for invalid value.
Quoted 24 lines
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +20
-0+ + regs->edge |= (chroma_repeat[IMG_LEFT ] &3 ) <<MDP_LEFT_CHROMA ; + regs->edge |= (chroma_repeat[IMG_RIGHT ] &3 ) <<MDP_RIGHT_CHROMA ; + regs->edge |= (chroma_repeat[IMG_TOP ] &3 ) <<MDP_TOP_CHROMA ; + regs->edge |= (chroma_repeat[IMG_BOTTOM ] &3 ) <<MDP_BOTTOM_CHROMA ; + regs->edge |= (luma_repeat[IMG_LEFT ] &3 ) <<MDP_LEFT_LUMA ; + regs->edge |= (luma_repeat[IMG_RIGHT ] &3 ) <<MDP_RIGHT_LUMA ; + regs->edge |= (luma_repeat[IMG_TOP ] &3 ) <<MDP_TOP_LUMA ; + regs->edge |= (luma_repeat[IMG_BOTTOM ] &3 ) <<MDP_BOTTOM_LUMA ; +return 0 ; +} + +#define ONE_HALF (1LL << 32) +#define ONE (1LL << 33) +#define TWO (2LL << 33) +#define THREE (3LL << 33) +#define FRAC_MASK (ONE - 1) +#define INT_MASK (~FRAC_MASK) + +static int scale_params(uint32_t dim_in, uint32_t dim_out, uint32_torigin,
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +3
-0+ uint32_t *phase_init, uint32_t *phase_step) +{ +/* to improve precicsion calculations are done in U31.33 and
Quoted 2 lines
converted
+ * to U3.29 at the end */
[cosmetic comment]: Multiline comments?
drivers/video/msm/mdp_ppp22.c struct mdp_table_entry mdp_gaussian_blur_table[] = { · line 961
Quoted 12 lines
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +12
-0+int64_t k1, k2, k3, k4, tmp; +uint64_t n, d, os, os_p, od, od_p, oreq; +unsigned rpa =0 ; +int64_t ip64, delta; + +if (dim_out %3 ==0 ) + rpa = !(dim_in % (dim_out /3 )); + + n = ((uint64_t )dim_out) <<34 ; + d = dim_in; +if (!d) +return -1 ;
Please use standard error codes.
drivers/video/msm/mdp_ppp22.c struct mdp_table_entry mdp_gaussian_blur_table[] = { · line 970
Quoted 9 lines
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +9
-0+do_div (n, d); + k3 = (n +1 ) >>1 ; +if ((k3 >>4 ) < (1LL <<27 ) || (k3 >>4 ) > (1LL <<31 )) +return -1 ; + + n = ((uint64_t )dim_in) <<34 ; + d = (uint64_t )dim_out; +if (!d) +return -1 ;
Same: Please use standard error codes.
Quoted 51 lines
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +51
-0+do_div (n, d); + k1 = (n +1 ) >>1 ; + k2 = (k1 -ONE ) >>1 ; + + *phase_init = (int )(k2 >>4 ); + k4 = (k3 -ONE ) >>1 ; + +if (rpa) { + os = ((uint64_t )origin <<33 ) -ONE_HALF ; + tmp = (dim_out * os) +ONE_HALF ; +if (!dim_in) +return -1 ; +do_div (tmp, dim_in); + od = tmp -ONE_HALF ; + }else { + os = ((uint64_t )origin <<1 ) -1 ; + od = (((k3 * os) >>1 ) + k4); + } + + od_p = od &INT_MASK ; +if (od_p != od) + od_p +=ONE ; + +if (rpa) { + tmp = (dim_in * od_p) +ONE_HALF ; +if (!dim_in) +return -1 ; +do_div (tmp, dim_in); + os_p = tmp -ONE_HALF ; + }else { + os_p = ((k1 * (od_p >>33 )) + k2); + } + + oreq = (os_p &INT_MASK ) -ONE ; + + ip64 = os_p - oreq; + delta = ((int64_t )(origin) <<33 ) - oreq; + ip64 -= delta; +/* limit to valid range before the left shift */ + delta = (ip64 & (1LL <<63 )) ?4 :-4 ; + delta <<=33 ; +while (abs ((int )(ip64 >>33 )) >4 ) + ip64 += delta; + *phase_init = (int )(ip64 >>4 ); + *phase_step = (uint32_t )(k1 >>4 ); +return 0 ; +} + +int mdp_ppp_cfg_scale (const struct mdp_info *mdp,struct ppp_regs *regs, +struct mdp_rect *src_rect,struct mdp_rect *dst_rect, +uint32_t src_format,uint32_t dst_format)
drivers/video/msm/mdp_ppp22.c struct mdp_table_entry mdp_gaussian_blur_table[] = { · line 1031
Quoted 10 lines
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +10
-0+{ +int downscale; +uint32_t phase_init_x, phase_init_y, phase_step_x, phase_step_y; +uint32_t scale_factor_x, scale_factor_y; + +if (scale_params (src_rect->w, dst_rect->w,1 , &phase_init_x, + &phase_step_x) || +scale_params (src_rect->h, dst_rect->h,1 , &phase_init_y, + &phase_step_y)) +return -1 ;
Error code?
Quoted 31 lines
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +31
-0+ + regs->phasex_init = phase_init_x; + regs->phasey_init = phase_init_y; + regs->phasex_step = phase_step_x; + regs->phasey_step = phase_step_y; + + scale_factor_x = (dst_rect->w *10 ) / src_rect->w; + scale_factor_y = (dst_rect->h *10 ) / src_rect->h; + +if (scale_factor_x >8 ) + downscale =MDP_DOWNSCALE_PT8TO1 ; +else if (scale_factor_x >6 ) + downscale =MDP_DOWNSCALE_PT6TOPT8 ; +else if (scale_factor_x >4 ) + downscale =MDP_DOWNSCALE_PT4TOPT6 ; +else + downscale =MDP_DOWNSCALE_PT2TOPT4 ; + +if (downscale != downscale_x_table) { +load_table (mdp, mdp_downscale_x_table[downscale],64 ); + downscale_x_table = downscale; + } + +if (scale_factor_y >8 ) + downscale =MDP_DOWNSCALE_PT8TO1 ; +else if (scale_factor_y >6 ) + downscale =MDP_DOWNSCALE_PT6TOPT8 ; +else if (scale_factor_y >4 ) + downscale =MDP_DOWNSCALE_PT4TOPT6 ; +else + downscale =MDP_DOWNSCALE_PT2TOPT4 ;
drivers/video/msm/mdp_ppp22.c struct mdp_table_entry mdp_gaussian_blur_table[] = { · line 1072
Quoted 10 lines
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +10
-0+ +if (downscale != downscale_y_table) { +load_table (mdp, mdp_downscale_y_table[downscale],64 ); + downscale_y_table = downscale; + } + +return 0 ; +} + +
[cosmetic comment]: Extra line?
Quoted 72 lines
drivers/video/msm/mdp_ppp22.c renamed from drivers/video/msm/mdp_scale_tables.c +19
-0+int mdp_ppp_load_blur (const struct mdp_info *mdp) +{ +if (!(downscale_x_table ==MDP_DOWNSCALE_BLUR && + downscale_y_table ==MDP_DOWNSCALE_BLUR )) { +load_table (mdp, mdp_gaussian_blur_table,128 ); + downscale_x_table =MDP_DOWNSCALE_BLUR ; + downscale_y_table =MDP_DOWNSCALE_BLUR ; + } + +return 0 ; +} + +void mdp_ppp_init_scale (const struct mdp_info *mdp) +{ + downscale_x_table =MDP_DOWNSCALE_MAX ; + downscale_y_table =MDP_DOWNSCALE_MAX ; + +load_table (mdp, mdp_upscale_table,ARRAY_SIZE (mdp_upscale_table)); +}drivers/video/msm/mdp_scale_tables.h deleted +0
-39@@ -1,38 +0,0 @@ -/* drivers/video/msm_fb/mdp_scale_tables.h -* -* Copyright (C) 2007 QUALCOMM Incorporated -* Copyright (C) 2007 Google Incorporated -* -* This software is licensed under the terms of the GNU General Public -* License version 2, as published by the Free Software Foundation, and -* may be copied, distributed, and modified under those terms. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ -#ifndef _MDP_SCALE_TABLES_H_ -#define _MDP_SCALE_TABLES_H_ - -#include <linux/types.h> -struct mdp_table_entry { -uint32_t reg; -uint32_t val; -}; - -extern struct mdp_table_entry mdp_upscale_table[64 ]; - -enum { -MDP_DOWNSCALE_PT2TOPT4 , -MDP_DOWNSCALE_PT4TOPT6 , -MDP_DOWNSCALE_PT6TOPT8 , -MDP_DOWNSCALE_PT8TO1 , -MDP_DOWNSCALE_MAX , -}; - -extern struct mdp_table_entry *mdp_downscale_x_table[MDP_DOWNSCALE_MAX ]; -extern struct mdp_table_entry *mdp_downscale_y_table[MDP_DOWNSCALE_MAX ]; -extern struct mdp_table_entry mdp_gaussian_blur_table[]; - -#endif --Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 09/20] video: msm: Split out MDP2.2 HW specific code.
In reply to Carl Vanderliparch/arm/mach-msm/Kconfig config HAS_MSM_DEBUG_UART_PHYS · line 83
Quoted 12 lines · Carl Vanderlip
index df9d74e..d6e75c3 100644
arch/arm/mach-msm/Kconfig +5
-0@@ -76,6 +76,11 @@ config HAS_MSM_DEBUG_UART_PHYS config MSM_VIC bool +config MSM_MDP22 + bool + depends on ARCH_MSM7X00A + default y +
You should remove the "default y" and this should be moved to a Kconfig under video (shouldn't be added into mach-msm).
Daniel
Re: [PATCH 09/20] video: msm: Split out MDP2.2 HW specific code.
Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+config MSM_MDP22 + ? ? ? bool + ? ? ? depends on ARCH_MSM7X00A + ? ? ? default y +You should remove the "default y" and this should be moved to a
Kconfigunder video (shouldn't be added into mach-msm).
Additionally, please have the right MDP version directly 'select'ed by the ARCH_XXXX definitions instead of doing the 'depends on' business.
--Dima
Quoted 9 lines
Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html Please read the FAQ at ?http://www.tux.org/lkml/
Re: [PATCH 09/20] video: msm: Split out MDP2.2 HW specific code.
In reply to Daniel WalkerQuoted 16 lines · Daniel Walker
arch/arm/mach-msm/Kconfig config HAS_MSM_DEBUG_UART_PHYS · line 83
Quoted 12 lines · Carl Vanderlip
index df9d74e..d6e75c3 100644
arch/arm/mach-msm/Kconfig +5
-0@@ -76,6 +76,11 @@ config HAS_MSM_DEBUG_UART_PHYS config MSM_VIC bool +config MSM_MDP22 + bool + depends on ARCH_MSM7X00A + default y +You should remove the "default y" and this should be moved to a
Kconfigunder video (shouldn't be added into mach-msm).
Quoted 2 lines
Daniel
What about removing the 'depends on' and 'default y' and making it be selected by MSM7X00A?
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [PATCH 09/20] video: msm: Split out MDP2.2 HW specific code.
Quoted 17 lines · Carl Vanderlip
Quoted 16 lines · Daniel Walker
arch/arm/mach-msm/Kconfig config HAS_MSM_DEBUG_UART_PHYS · line 83
Quoted 12 lines · Carl Vanderlip
index df9d74e..d6e75c3 100644
arch/arm/mach-msm/Kconfig +5
-0@@ -76,6 +76,11 @@ config HAS_MSM_DEBUG_UART_PHYS config MSM_VIC bool +config MSM_MDP22 + bool + depends on ARCH_MSM7X00A + default y +You should remove the "default y" and this should be moved to a
Kconfigunder video (shouldn't be added into mach-msm).
Quoted 4 lines
Quoted 2 lines
Daniel
What about removing the 'depends on' and 'default y' and making it be selected by MSM7X00A?
But why should the feature be in the Kconfig for arch/arm/mach-msm when the driver is under drivers/video/msm? If it does indeed need configuration, why not put a Kconfig under drivers/video/msm?
The last patch does select this, so it shouldn't need to get a default.
Does the code work if both MDP22 and MDP31 are defined? Eventually, it will be possible to enable multiple SOCs, so this driver will need to be able to handle that determination at run-time.
David
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 10/20 video: msm: Separate more MDP HW specific code
In reply to Carl VanderlipSimplifies mdp_probe by moving register initialization to mdp_hw_init
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- drivers/video/msm/mdp.c | 96 ++++++++++++++++++------------------- drivers/video/msm/mdp_csc_table.h | 95 ++++++++++++++++-------------------- drivers/video/msm/mdp_hw.h | 9 ++++ 3 files changed, 98 insertions(+), 102 deletions(-)
drivers/video/msm/mdp.c +46 -50
@@ -36,11 +36,6 @@ struct class *mdp_class;#define MDP_CMD_DEBUG_ACCESS_BASE (0x10000) -static uint16_t mdp_default_ccs[] = { -0x254 ,0x000 ,0x331 ,0x254 ,0xF38 ,0xE61 ,0x254 ,0x409 ,0x000 , -0x010 ,0x080 ,0x080 -}; -static DECLARE_WAIT_QUEUE_HEAD (mdp_ppp_waitqueue);static unsigned int mdp_irq_mask;DEFINE_MUTEX (mdp_mutex);
@@ -457,6 +452,52 @@ int register_mdp_client(struct class_interface *cint)void mdp_hw_init (struct mdp_info *mdp) { +int n; + + mdp_irq_mask =0 ; + +mdp_writel (mdp,0 ,MDP_INTR_ENABLE ); + +/* debug interface write access */ +mdp_writel (mdp,1 ,0x60 ); +mdp_writel (mdp,1 ,MDP_EBI2_PORTMAP_MODE ); + +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01f8 ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01fc ); +mdp_writel (mdp,1 ,0x60 ); + +for (n =0 ; n <ARRAY_SIZE (csc_color_lut); n++) +mdp_writel (mdp, csc_color_lut[n].val, csc_color_lut[n].reg); + +/* clear up unused fg/main registers */ +/* comp.plane 2&3 ystride */ +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0120 ); + +/* unpacked pattern */ +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x012c ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0130 ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0134 ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0158 ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x015c ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0160 ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0170 ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0174 ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x017c ); + +/* comp.plane 2 & 3 */ +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0114 ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0118 ); + +/* clear unused bg registers */ +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01c8 ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01d0 ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01dc ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01e0 ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01e4 ); + +for (n =0 ; n <ARRAY_SIZE (csc_matrix_config_table); n++) +mdp_writel (mdp, csc_matrix_config_table[n].val, + csc_matrix_config_table[n].reg);#ifdef CONFIG_MSM_MDP22 mdp_ppp_init_scale (mdp);#endif
@@ -466,7 +507,6 @@ int mdp_probe(struct platform_device *pdev) {struct resource *resource;int ret; -int n;struct mdp_info *mdp; resource =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
@@ -517,52 +557,8 @@ int mdp_probe(struct platform_device *pdev)if (ret) goto error_request_irq;disable_irq (mdp->irq); - mdp_irq_mask =0 ; - -/* debug interface write access */ -mdp_writel (mdp,1 ,0x60 ); - -mdp_writel (mdp,MDP_ANY_INTR_MASK ,MDP_INTR_ENABLE ); -mdp_writel (mdp,1 ,MDP_EBI2_PORTMAP_MODE ); - -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01f8 ); -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01fc ); - -for (n =0 ; n <ARRAY_SIZE (csc_table); n++) -mdp_writel (mdp, csc_table[n].val, csc_table[n].reg); - -/* clear up unused fg/main registers */ -/* comp.plane 2&3 ystride */ -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0120 ); - -/* unpacked pattern */ -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x012c ); -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0130 ); -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0134 ); -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0158 ); -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x015c ); -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0160 ); -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0170 ); -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0174 ); -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x017c );clk_enable (mdp->clk); -/* comp.plane 2 & 3 */ -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0114 ); -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x0118 ); - -/* clear unused bg registers */ -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01c8 ); -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01d0 ); -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01dc ); -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01e0 ); -mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01e4 ); - -for (n =0 ; n <9 ; n++) -mdp_writel (mdp, mdp_default_ccs[n],0x40440 +4 * n); -mdp_writel (mdp, mdp_default_ccs[9 ],0x40500 +4 *0 ); -mdp_writel (mdp, mdp_default_ccs[10 ],0x40500 +4 *0 ); -mdp_writel (mdp, mdp_default_ccs[11 ],0x40500 +4 *0 );mdp_hw_init (mdp);/* register mdp device */
drivers/video/msm/mdp_csc_table.h +43 -52
106 lines not on this page · raw message
drivers/video/msm/mdp_hw.h +9 -0
@@ -608,6 +608,15 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req,#define PPP_ADDR_BG_CFG MDP_FULL_BYPASS_WORD53#define PPP_ADDR_BG_PACK_PATTERN MDP_FULL_BYPASS_WORD54 +/* color conversion matrix configuration registers */ +/* pfmv is mv1, prmv is mv2 */ +#define MDP_CSC_PFMVn (n) (0x40400 + (4 * (n))) +#define MDP_CSC_PRMVn (n) (0x40440 + (4 * (n))) +#define MDP_CSC_PBVn (n) (0x40500 + (4 * (n))) +#define MDP_CSC_SBVn (n) (0x40540 + (4 * (n))) +#define MDP_CSC_PLVn (n) (0x40580 + (4 * (n))) +#define MDP_CSC_SLVn (n) (0x405c0 + (4 * (n))) +/* MDP_DMA_CONFIG / MDP_FULL_BYPASS_WORD32 */ #define DMA_DSTC0G_6BITS (1<<1)#define DMA_DSTC1B_6BITS (1<<3)
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 11/20 video: msm: Add MDP FB DMA configuration
In reply to Carl VanderlipSetup configure_dma, check_output_format and set_output_format functions.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- arch/arm/mach-msm/include/mach/msm_fb.h | 3 ++ drivers/video/msm/mdp.c | 61 ++++++++++++++++++++++++++++++- drivers/video/msm/mdp_hw.h | 16 ++++++++ drivers/video/msm/msm_fb.c | 5 ++- 4 files changed, 83 insertions(+), 2 deletions(-)
arch/arm/mach-msm/include/mach/msm_fb.h +3 -0
@@ -123,6 +123,9 @@ struct mdp_device {int (*blit)(struct mdp_device *mdp,struct fb_info *fb,struct mdp_blit_req *req);void (*set_grp_disp)(struct mdp_device *mdp,uint32_t disp_id); +void (*configure_dma)(struct mdp_device *mdp); +int (*check_output_format)(struct mdp_device *mdp,int bpp); +int (*set_output_format)(struct mdp_device *mdp,int bpp); };struct class_interface ;
drivers/video/msm/mdp.c +60 -1
79 lines not on this page · raw message
drivers/video/msm/mdp_hw.h +16 -0
@@ -42,6 +42,9 @@ struct mdp_info {int irq;struct clk *clk;struct mdp_out_interface out_if[MSM_MDP_NUM_INTERFACES ]; +int format; +int pack_pattern; +bool dma_config_dirty; }; extern int mdp_out_if_register(struct mdp_device *mdp_dev, int interface,
@@ -183,6 +186,15 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req,#define MDP_TEST_CAPTURED_DCLK (0xd0210)#define MDP_TEST_MISR_CAPT_VAL_DCLK (0xd0214)#define MDP_LCDC_CTL (0xe0000) + +#define MDP_DMA_P_START (0x00044) +#define MDP_DMA_P_CONFIG (0x90000) +#define MDP_DMA_P_SIZE (0x90004) +#define MDP_DMA_P_IBUF_ADDR (0x90008) +#define MDP_DMA_P_IBUF_Y_STRIDE (0x9000c) +#define MDP_DMA_P_OUT_XY (0x90010) +#define MDP_DMA_P_COLOR_CORRECT_CONFIG (0x90070) +#define MDP_LCDC_HSYNC_CTL (0xe0004)#define MDP_LCDC_VSYNC_CTL (0xe0008)#define MDP_LCDC_ACTIVE_HCTL (0xe000c)
@@ -629,8 +641,11 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req,#define DMA_PACK_LOOSE 0#define DMA_PACK_ALIGN_LSB 0#define DMA_PACK_ALIGN_MSB (1<<7) +#define DMA_PACK_PATTERN_MASK (0x3f<<8)#define DMA_PACK_PATTERN_RGB \ (MDP_GET_PACK_PATTERN(0, CLR_R, CLR_G, CLR_B, 2)<<8) +#define DMA_PACK_PATTERN_BGR \ + (MDP_GET_PACK_PATTERN(0, CLR_B, CLR_G, CLR_R, 2)<<8)#define DMA_OUT_SEL_AHB 0#define DMA_OUT_SEL_MDDI (1<<14)
@@ -645,6 +660,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req,#define DMA_IBUF_FORMAT_RGB565 (1<<20)#define DMA_IBUF_FORMAT_RGB888_OR_ARGB8888 0 +#define DMA_IBUF_FORMAT_MASK (1 << 20)#define DMA_IBUF_NONCONTIGUOUS (1<<21)
drivers/video/msm/msm_fb.c +4 -1
@@ -332,7 +332,7 @@ static int msmfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)if ((var->xres != info->var.xres) || (var->yres != info->var.yres) || (var->xoffset != info->var.xoffset) || - (var->bits_per_pixel != info->var.bits_per_pixel) || + (mdp->check_output_format (mdp, var->bits_per_pixel)) || (var->grayscale != info->var.grayscale))return -EINVAL ;
@@ -365,6 +365,7 @@ static int msmfb_set_par(struct fb_info *info) var->blue.length =5 ; }else return -1 ; + mdp->set_output_format (mdp, var->bits_per_pixel); fix->line_length = var->xres * var->bits_per_pixel /8 ;return 0 ;
@@ -519,6 +520,8 @@ static void setup_fb_info(struct msmfb_info *msmfb) fb_info->var.blue.length =5 ; fb_info->var.blue.msb_right =0 ; + mdp->set_output_format (mdp, fb_info->var.bits_per_pixel); + r =fb_alloc_cmap (&fb_info->cmap,16 ,0 ); fb_info->pseudo_palette =PP ;
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RE: [PATCH 11/20] video: msm: Add MDP FB DMA configuration
Quoted 78 lines
-----Original Message-----
From: linux-fbdev-owner at vger.kernel.org [mailto:linux-fbdev- owner at vger.kernel.org] On Behalf Of Carl Vanderlip
Sent: Saturday, March 19, 2011 3:28 AM
To: Russell King; David Brown; Daniel Walker; Bryan Huntsman
Cc: Brian Swetland; Dima Zavin; Rebecca Schultz Zavin; Colin Cross; linux- fbdev at vger.kernel.org; Carl Vanderlip; linux-arm-
kernel at lists.infradead.org; linux-arm-msm at vger.kernel.org; linux- kernel at vger.kernel.org
Subject: [PATCH 11/20] video: msm: Add MDP FB DMA configurationSetup
configure_dma,check_output_formatandset_output_formatfunctions.Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>Signed-off-by Carl Vanderlip <[email protected]>--- arch/arm/mach-msm/include/mach/msm_fb.h | 3 ++ drivers/video/msm/mdp.c | 61 ++++++++++++++++++++++++++++++- drivers/video/msm/mdp_hw.h | 16 ++++++++ drivers/video/msm/msm_fb.c | 5 ++- 4 files changed, 83 insertions(+), 2 deletions(-)arch/arm/mach- renamed from arch/arm/mach-msm/include/mach/msm_fb.h +0
-0
msm/include/mach/msm_fb.h
index 2d0899c..238ea2a 100644arch/arm/mach-msm/include/mach/msm_fb.h +3
-0@@ -123,6 +123,9 @@ struct mdp_device {int (*blit)(struct mdp_device *mdp,struct fb_info *fb,struct mdp_blit_req *req);void (*set_grp_disp)(struct mdp_device *mdp,uint32_t disp_id); +void (*configure_dma)(struct mdp_device *mdp); +int (*check_output_format)(struct mdp_device *mdp,int bpp); +int (*set_output_format)(struct mdp_device *mdp,int bpp); };struct class_interface ;drivers/video/msm/mdp.c +15
-1@@ -223,7 +223,7 @@ static void mdp_dma_to_mddi(void *priv, uint32_t addr,uint32_t stride, DMA_OUT_SEL_AHB |DMA_IBUF_NONCONTIGUOUS ; - dma2_cfg |=DMA_IBUF_FORMAT_RGB565 ; + dma2_cfg |= mdp->format; dma2_cfg |=DMA_OUT_SEL_MDDI ;@@ -304,6 +304,62 @@ void put_img(struct file *src_file, struct file *dst_file) { } +void mdp_configure_dma (struct mdp_device *mdp_dev) +{ + struct mdp_info *mdp = container_of(mdp_dev, struct mdp_info, mdp_dev); +uint32_t dma_cfg; + +if (!mdp->dma_config_dirty) +return ; + dma_cfg =mdp_readl (mdp,MDP_DMA_P_CONFIG ); + dma_cfg &= ~DMA_IBUF_FORMAT_MASK ; + dma_cfg &= ~DMA_PACK_PATTERN_MASK ; + dma_cfg |= (mdp->format | mdp->pack_pattern); +mdp_writel (mdp, dma_cfg,MDP_DMA_P_CONFIG ); + mdp->dma_config_dirty = false; +
drivers/video/msm/mdp.c void put_img(struct file *src_file, struct file · line 332
Quoted 10 lines
drivers/video/msm/mdp.c +10
-0+return ; +} + +int mdp_check_output_format (struct mdp_device *mdp_dev,int bpp) +{ +switch (bpp) { +case 16 : +case 24 : +case 32 : +break ;
Why break?
You can return with a value 0 from here.
Quoted 139 lines
drivers/video/msm/mdp.c +32
-0+default : +return -EINVAL ; + } +return 0 ; +} + +int mdp_set_output_format (struct mdp_device *mdp_dev,int bpp) +{ + struct mdp_info *mdp = container_of(mdp_dev, struct mdp_info, mdp_dev); +uint32_t format, pack_pattern; + +switch (bpp) { +case 16 : + format =DMA_IBUF_FORMAT_RGB565 ; + pack_pattern =DMA_PACK_PATTERN_RGB ; +break ; +case 24 : +case 32 : + format =DMA_IBUF_FORMAT_RGB888_OR_ARGB8888 ; +break ; +default : +return -EINVAL ; + } +if (format != mdp->format || pack_pattern != mdp->pack_pattern) { + mdp->format = format; + mdp->pack_pattern = pack_pattern; + mdp->dma_config_dirty = true; + } + +return 0 ; +} +int mdp_blit_and_wait(struct
mdp_info*mdp, structmdp_blit_req*req,drivers/video/msm/mdp.c +3
-0struct file *src_file, unsigned long src_start, unsigned long src_len, struct file *dst_file,@@ -540,6 +596,9 @@ int mdp_probe(struct platform_device *pdev) mdp->mdp_dev.dma_wait = mdp_dma_wait; mdp->mdp_dev.blit = mdp_blit; mdp->mdp_dev.set_grp_disp = mdp_set_grp_disp; + mdp->mdp_dev.set_output_format = mdp_set_output_format; + mdp->mdp_dev.check_output_format = mdp_check_output_format; + mdp->mdp_dev.configure_dma = mdp_configure_dma; ret = mdp_out_if_register(&mdp->mdp_dev, MSM_MDDI_PMDH_INTERFACE, mdp,drivers/video/msm/mdp.c +0
-0MDP_DMA_P_DONE, mdp_dma_to_mddi);drivers/video/msm/mdp_hw.h +12
-0@@ -42,6 +42,9 @@ struct mdp_info {int irq;struct clk *clk;struct mdp_out_interface out_if[MSM_MDP_NUM_INTERFACES ]; +int format; +int pack_pattern; +bool dma_config_dirty; }; extern int mdp_out_if_register(struct mdp_device *mdp_dev, int interface,@@ -183,6 +186,15 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req,#define MDP_TEST_CAPTURED_DCLK (0xd0210)#define MDP_TEST_MISR_CAPT_VAL_DCLK (0xd0214)#define MDP_LCDC_CTL (0xe0000) + +#define MDP_DMA_P_START (0x00044) +#define MDP_DMA_P_CONFIG (0x90000) +#define MDP_DMA_P_SIZE (0x90004) +#define MDP_DMA_P_IBUF_ADDR (0x90008) +#define MDP_DMA_P_IBUF_Y_STRIDE (0x9000c) +#define MDP_DMA_P_OUT_XY (0x90010) +#define MDP_DMA_P_COLOR_CORRECT_CONFIG (0x90070) +#define MDP_LCDC_HSYNC_CTL (0xe0004)#define MDP_LCDC_VSYNC_CTL (0xe0008)#define
MDP_LCDC_ACTIVE_HCTL(0xe000c)drivers/video/msm/mdp_hw.h +3
-0@@ -629,8 +641,11 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req,#define DMA_PACK_LOOSE 0#define DMA_PACK_ALIGN_LSB 0#define DMA_PACK_ALIGN_MSB (1<<7) +#define DMA_PACK_PATTERN_MASK (0x3f<<8)#define DMA_PACK_PATTERN_RGB \ (MDP_GET_PACK_PATTERN(0, CLR_R, CLR_G, CLR_B, 2)<<8) +#define DMA_PACK_PATTERN_BGR \ + (MDP_GET_PACK_PATTERN(0, CLR_B, CLR_G, CLR_R, 2)<<8)#define DMA_OUT_SEL_AHB 0#define
DMA_OUT_SEL_MDDI(1<<14)drivers/video/msm/mdp_hw.h +1
-0@@ -645,6 +660,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req,#define DMA_IBUF_FORMAT_RGB565 (1<<20)#define DMA_IBUF_FORMAT_RGB888_OR_ARGB8888 0 +#define DMA_IBUF_FORMAT_MASK (1 << 20)#define DMA_IBUF_NONCONTIGUOUS (1<<21)drivers/video/msm/msm_fb.c +4
-2@@ -332,7 +332,7 @@ static int msmfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)if ((var->xres != info->var.xres) || (var->yres != info->var.yres) || (var->xoffset != info->var.xoffset) || - (var->bits_per_pixel != info->var.bits_per_pixel) || + (mdp->check_output_format (mdp, var->bits_per_pixel)) || (var->grayscale != info->var.grayscale))return -EINVAL ;@@ -365,6 +365,7 @@ static int msmfb_set_par(struct fb_info *info) var->blue.length =5 ; }else return -1 ; + mdp->set_output_format (mdp, var->bits_per_pixel); fix->line_length = var->xres * var->bits_per_pixel /8 ;return 0 ;@@ -519,6 +520,8 @@ static void setup_fb_info(struct msmfb_info *msmfb) fb_info->var.blue.length =5 ; fb_info->var.blue.msb_right =0 ; + mdp->set_output_format (mdp, fb_info->var.bits_per_pixel); + r =fb_alloc_cmap (&fb_info->cmap,16 ,0 ); fb_info->pseudo_palette =PP ; --Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 12/20 video: msm: Add IRQ callback for MDP interface
In reply to Carl VanderlipAllows interface client to setup notification for non-DMA irqs (e.g. LCDC/TV-out frame start)
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- drivers/video/msm/mdp.c | 41 +++++++++++++++++++++++++++++++++++++++++ drivers/video/msm/mdp_hw.h | 9 +++++++++ 2 files changed, 50 insertions(+), 0 deletions(-)
drivers/video/msm/mdp.c +41 -0
@@ -130,6 +130,10 @@ static irqreturn_t mdp_isr(int irq, void *data) }wake_up (&out_if->dma_waitqueue); } +if (status & out_if->irq_mask) { + out_if->irq_cb->func (out_if->irq_cb); + out_if->irq_cb =NULL ; + } }if (status &DL0_ROI_DONE )
@@ -494,6 +498,43 @@ done:return ret; } +int mdp_out_if_req_irq (struct mdp_device *mdp_dev,int interface, +uint32_t mask,struct msmfb_callback *cb) +{ + struct mdp_info *mdp = container_of(mdp_dev, struct mdp_info, mdp_dev); +unsigned long flags; +int ret =0 ; + +if (interface <0 || interface >=MSM_MDP_NUM_INTERFACES ) { +pr_err ("%s: invalid interface (%d)\n" , __func__, interface); +BUG (); + }else if (!mdp->out_if[interface].registered) { +pr_err ("%s: interface (%d) not registered\n" , __func__, + interface); +BUG (); + } + +spin_lock_irqsave (&mdp->lock, flags); + +if (mask) { + ret =locked_enable_mdp_irq (mdp, mask); +if (ret) { +pr_err ("%s: busy\n" , __func__); + goto done; + } + mdp->out_if[interface].irq_mask = mask; + mdp->out_if[interface].irq_cb = cb; + }else { +locked_disable_mdp_irq (mdp, mask); + mdp->out_if[interface].irq_mask =0 ; + mdp->out_if[interface].irq_cb =NULL ; + } + +done: +spin_unlock_irqrestore (&mdp->lock, flags); +return ret; +} +int register_mdp_client (struct class_interface *cint) {if (!mdp_class) {
drivers/video/msm/mdp_hw.h +9 -0
@@ -33,6 +33,11 @@ struct mdp_out_interface {struct msmfb_callback *dma_cb;wait_queue_head_t dma_waitqueue; + +/* If the interface client wants to be notified of non-DMA irqs, +* e.g. LCDC/TV-out frame start */ +uint32_t irq_mask; +struct msmfb_callback *irq_cb; };struct mdp_info {
@@ -50,6 +55,10 @@ struct mdp_info {extern int mdp_out_if_register (struct mdp_device *mdp_dev,int interface,void *private_data,uint32_t dma_mask,mdp_dma_start_func_t dma_start); + +extern int mdp_out_if_req_irq (struct mdp_device *mdp_dev,int interface, +uint32_t mask,struct msmfb_callback *cb); +struct mdp_blit_req ;struct mdp_device ; int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req,
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 13/20 video: msm: Debugging for send_blit
In reply to Carl VanderlipAllows for mdp_writel_dbg to be redefined as needed to debug blits.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- drivers/video/msm/mdp_hw.h | 2 +- drivers/video/msm/mdp_ppp.c | 61 ++++++++++++++++++++++-------------------- 2 files changed, 33 insertions(+), 30 deletions(-)
drivers/video/msm/mdp_hw.h +1 -1
@@ -87,7 +87,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req,#define MDP_DISPLAY0_ADDR (0x00054)#define MDP_DISPLAY1_ADDR (0x00058)#define MDP_EBI2_PORTMAP_MODE (0x0005c) -#define MDP_MODE (0x00060) +#define MDP_PPP_CMD_MODE (0x00060)#define MDP_TV_OUT_STATUS (0x00064)#define MDP_HW_VERSION (0x00070)#define MDP_SW_RESET (0x00074)
drivers/video/msm/mdp_ppp.c +32 -29
77 lines not on this page · raw message
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RE: [PATCH 13/20] video: msm: Debugging for send_blit
Quoted 65 lines
-----Original Message-----
From: linux-fbdev-owner at vger.kernel.org [mailto:linux-fbdev- owner at vger.kernel.org] On Behalf Of Carl Vanderlip
Sent: Saturday, March 19, 2011 3:29 AM
To: David Brown; Daniel Walker; Bryan Huntsman
Cc: Brian Swetland; Dima Zavin; Rebecca Schultz Zavin; Colin Cross; linux- fbdev at vger.kernel.org; Carl Vanderlip; linux-arm-
kernel at lists.infradead.org; linux-arm-msm at vger.kernel.org; linux- kernel at vger.kernel.org
Subject: [PATCH 13/20] video: msm: Debugging forsend_blitAllows for
mdp_writel_dbgto be redefined as needed to debug blits.Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>Signed-off-by Carl Vanderlip <[email protected]>--- drivers/video/msm/mdp_hw.h | 2 +- drivers/video/msm/mdp_ppp.c | 61 ++++++++++++++++++++++---------------- ---- 2 files changed, 33 insertions(+), 30 deletions(-)drivers/video/msm/mdp_hw.h +1
-1@@ -87,7 +87,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req,#define MDP_DISPLAY0_ADDR (0x00054)#define MDP_DISPLAY1_ADDR (0x00058)#define MDP_EBI2_PORTMAP_MODE (0x0005c) -#define MDP_MODE (0x00060) +#define MDP_PPP_CMD_MODE (0x00060)#define MDP_TV_OUT_STATUS (0x00064)#define MDP_HW_VERSION (0x00070)#define
MDP_SW_RESET(0x00074)drivers/video/msm/mdp_ppp.c +2
-8@@ -331,45 +331,48 @@ static void get_chroma_addr(struct mdp_img *img, struct mdp_rect *rect, } } +#define mdp_writel_dbg (mdp, val, reg) mdp_writel((mdp), (val), (reg)) +static int send_blit (const struct mdp_info *mdp,struct mdp_blit_req *req,struct ppp_regs *regs,struct file *src_file,struct file *dst_file) { -mdp_writel (mdp,1 ,0x060 ); -mdp_writel (mdp, regs->src_rect,PPP_ADDR_SRC_ROI ); -mdp_writel (mdp, regs->src0,PPP_ADDR_SRC0 ); -mdp_writel (mdp, regs->src1,PPP_ADDR_SRC1 ); -mdp_writel (mdp, regs->src_ystride,PPP_ADDR_SRC_YSTRIDE ); -mdp_writel (mdp, regs->src_cfg,PPP_ADDR_SRC_CFG ); -mdp_writel (mdp, regs->src_pack,PPP_ADDR_SRC_PACK_PATTERN ); -
drivers/video/msm/mdp_ppp.c static void get_chroma_addr(struct mdp_img *img, · line 344
Quoted 10 lines
drivers/video/msm/mdp_ppp.c +3
-7-mdp_writel (mdp, regs->op,PPP_ADDR_OPERATION ); -mdp_writel (mdp, regs->phasex_init,PPP_ADDR_PHASEX_INIT ); -mdp_writel (mdp, regs->phasey_init,PPP_ADDR_PHASEY_INIT ); -mdp_writel (mdp, regs->phasex_step,PPP_ADDR_PHASEX_STEP ); -mdp_writel (mdp, regs->phasey_step,PPP_ADDR_PHASEY_STEP ); - - mdp_writel(mdp, (req->alpha << 24) | (req->transp_mask & 0xffffff), +#if 0 +mdp_writel_dbg (mdp,1 ,MDP_PPP_CMD_MODE ); +#endif
Unused code? You can add a comment explaining why is this not being used couurently.
Quoted 60 lines
drivers/video/msm/mdp_ppp.c +27
-15+mdp_writel_dbg (mdp, regs->src_rect,PPP_ADDR_SRC_ROI ); +mdp_writel_dbg (mdp, regs->src0,PPP_ADDR_SRC0 ); +mdp_writel_dbg (mdp, regs->src1,PPP_ADDR_SRC1 ); +mdp_writel_dbg (mdp, regs->src_ystride,PPP_ADDR_SRC_YSTRIDE ); +mdp_writel_dbg (mdp, regs->src_cfg,PPP_ADDR_SRC_CFG ); +mdp_writel_dbg (mdp, regs->src_pack,PPP_ADDR_SRC_PACK_PATTERN ); + +mdp_writel_dbg (mdp, regs->op,PPP_ADDR_OPERATION ); +mdp_writel_dbg (mdp, regs->phasex_init,PPP_ADDR_PHASEX_INIT ); +mdp_writel_dbg (mdp, regs->phasey_init,PPP_ADDR_PHASEY_INIT ); +mdp_writel_dbg (mdp, regs->phasex_step,PPP_ADDR_PHASEX_STEP ); +mdp_writel_dbg (mdp, regs->phasey_step,PPP_ADDR_PHASEY_STEP ); + +mdp_writel_dbg (mdp, regs->edge,PPP_ADDR_EDGE ); +mdp_writel_dbg (mdp, (req->alpha <<24 ) | (req->transp_mask &0xffffff ),PPP_ADDR_ALPHA_TRANSP ); -mdp_writel (mdp, regs->dst_cfg,PPP_ADDR_DST_CFG ); -mdp_writel (mdp, regs->dst_pack,PPP_ADDR_DST_PACK_PATTERN ); -mdp_writel (mdp, regs->dst_rect,PPP_ADDR_DST_ROI ); -mdp_writel (mdp, regs->dst0,PPP_ADDR_DST0 ); -mdp_writel (mdp, regs->dst1,PPP_ADDR_DST1 ); -mdp_writel (mdp, regs->dst_ystride,PPP_ADDR_DST_YSTRIDE ); +mdp_writel_dbg (mdp, regs->dst_cfg,PPP_ADDR_DST_CFG ); +mdp_writel_dbg (mdp, regs->dst_pack,PPP_ADDR_DST_PACK_PATTERN ); +mdp_writel_dbg (mdp, regs->dst_rect,PPP_ADDR_DST_ROI ); +mdp_writel_dbg (mdp, regs->dst0,PPP_ADDR_DST0 ); +mdp_writel_dbg (mdp, regs->dst1,PPP_ADDR_DST1 ); +mdp_writel_dbg (mdp, regs->dst_ystride,PPP_ADDR_DST_YSTRIDE ); -mdp_writel (mdp, regs->edge,PPP_ADDR_EDGE );if (regs->op &PPP_OP_BLEND_ON ) { -mdp_writel (mdp, regs->dst0,PPP_ADDR_BG0 ); -mdp_writel (mdp, regs->dst1,PPP_ADDR_BG1 ); -mdp_writel (mdp, regs->dst_ystride,PPP_ADDR_BG_YSTRIDE ); -mdp_writel (mdp, src_img_cfg[req->dst.format], PPP_ADDR_BG_CFG); -mdp_writel (mdp, pack_pattern[req->dst.format], -PPP_ADDR_BG_PACK_PATTERN ); +mdp_writel_dbg (mdp, regs->bg0,PPP_ADDR_BG0 ); +mdp_writel_dbg (mdp, regs->bg1,PPP_ADDR_BG1 ); +mdp_writel_dbg (mdp, regs->bg_ystride,PPP_ADDR_BG_YSTRIDE ); +mdp_writel_dbg (mdp, regs->bg_cfg,PPP_ADDR_BG_CFG ); +mdp_writel_dbg (mdp, regs->bg_pack,PPP_ADDR_BG_PACK_PATTERN ); }flush_imgs (req, regs, src_file, dst_file); -mdp_writel (mdp,0x1000 ,MDP_DISPLAY0_START ); +mdp_writel_dbg (mdp,0x1000 ,MDP_DISPLAY0_START );return 0 ; } --Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 14/20 video: msm: Write IRQ mask to MDP registers
In reply to Carl VanderlipWriting MDP IRQ mask to the MDP IRQ register to fully disable interrupt.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- drivers/video/msm/mdp.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/video/msm/mdp.c +6 -0
@@ -59,9 +59,13 @@ static int locked_enable_mdp_irq(struct mdp_info *mdp, uint32_t mask)enable_irq (mdp->irq); } +/* clear out any previous irqs for the requested mask*/ +mdp_writel (mdp, mask,MDP_INTR_CLEAR ); +/* update the irq mask to reflect the fact that the interrupt is * enabled */ mdp_irq_mask |= mask; +mdp_writel (mdp, mdp_irq_mask,MDP_INTR_ENABLE );return 0 ; }
@@ -87,6 +91,8 @@ static int locked_disable_mdp_irq(struct mdp_info *mdp, uint32_t mask)/* update the irq mask to reflect the fact that the interrupt is * disabled */ mdp_irq_mask &= ~(mask); +mdp_writel (mdp, mdp_irq_mask,MDP_INTR_ENABLE ); +/* if no one is waiting on the interrupt, disable it */ if (!mdp_irq_mask) {disable_irq_nosync (mdp->irq);
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 15/20 video: msm: convert printk to pr_*
In reply to Carl VanderlipReword debugging messages to use pr_err and pr_warning
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- drivers/video/msm/mdp.c | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-)
drivers/video/msm/mdp.c +4 -7
@@ -42,16 +42,13 @@ DEFINE_MUTEX(mdp_mutex);static int locked_enable_mdp_irq (struct mdp_info *mdp,uint32_t mask) { -int ret =0 ; -BUG_ON (!mask);/* if the mask bits are already set return an error, this interrupt * is already enabled */ if (mdp_irq_mask & mask) { -printk (KERN_ERR "mdp irq already on already on %x %x\n" , - mdp_irq_mask, mask); - ret =-1 ; +pr_err ("mdp irq already on %x %x\n" , mdp_irq_mask, mask); +return -1 ; }/* if the mdp irq is not already enabled enable it */ if (!mdp_irq_mask) {
@@ -172,9 +169,9 @@ static int mdp_wait(struct mdp_info *mdp, uint32_t mask, wait_queue_head_t *wq)spin_lock_irqsave (&mdp->lock, irq_flags);if (mdp_irq_mask & mask) { +pr_warning ("%s: timeout waiting for mdp to complete 0x%x\n" , + __func__, mask);locked_disable_mdp_irq (mdp, mask); -printk (KERN_WARNING "timeout waiting for mdp to complete %x\n" , - mask); ret = -ETIMEDOUT ; }spin_unlock_irqrestore (&mdp->lock, irq_flags);
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RE: [PATCH 15/20] video: msm: convert printk to pr_*
Quoted 35 lines
-----Original Message-----
From: linux-fbdev-owner at vger.kernel.org [mailto:linux-fbdev- owner at vger.kernel.org] On Behalf Of Carl Vanderlip
Sent: Saturday, March 19, 2011 3:29 AM
To: David Brown; Daniel Walker; Bryan Huntsman
Cc: Brian Swetland; Dima Zavin; Rebecca Schultz Zavin; Colin Cross; linux- fbdev at vger.kernel.org; Carl Vanderlip; linux-arm-
kernel at lists.infradead.org; linux-arm-msm at vger.kernel.org; linux- kernel at vger.kernel.org
Subject: [PATCH 15/20] video: msm: convert printk to pr_*Reword debugging messages to use
pr_errandpr_warningAuthors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>Signed-off-by Carl Vanderlip <[email protected]>--- drivers/video/msm/mdp.c | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-)drivers/video/msm/mdp.c +0
-2@@ -42,16 +42,13 @@ DEFINE_MUTEX(mdp_mutex);static int locked_enable_mdp_irq (struct mdp_info *mdp,uint32_t mask) { -int ret =0 ; -
drivers/video/msm/mdp.c DEFINE_MUTEX(mdp_mutex); · line 51
Quoted 10 lines
drivers/video/msm/mdp.c +2
-3BUG_ON (!mask);/* if the mask bits are already set return an error, this interrupt * is already enabled */ if (mdp_irq_mask & mask) { -printk (KERN_ERR "mdp irq already on already on %x %x\n" , - mdp_irq_mask, mask); - ret =-1 ; +pr_err ("mdp irq already on %x %x\n" , mdp_irq_mask, mask); +return -1 ;
Please use standard error codes.
http://lxr.linux.no/#linux+v2.6.38/include/asm-generic/errno-base.h
The code would be more readable.
Plus it would help in debugging.
Quoted 25 lines
drivers/video/msm/mdp.c +2
-2}/* if the mdp irq is not already enabled enable it */ if (!mdp_irq_mask) {@@ -172,9 +169,9 @@ static int mdp_wait(struct mdp_info *mdp, uint32_t mask, wait_queue_head_t *wq)spin_lock_irqsave (&mdp->lock, irq_flags);if (mdp_irq_mask & mask) { +pr_warning ("%s: timeout waiting for mdp to complete 0x%x\n" , + __func__, mask);locked_disable_mdp_irq (mdp, mask); - printk(KERN_WARNING "timeout waiting for mdp to complete %x\n", - mask); ret = -ETIMEDOUT ;drivers/video/msm/mdp.c +0
-1}spin_unlock_irqrestore (&mdp->lock, irq_flags); --Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 15/20] video: msm: convert printk to pr_*
In reply to Carl VanderlipHello.
Quoted 22 lines · Carl Vanderlip
Reword debugging messages to use
pr_errandpr_warningAuthors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>Signed-off-by Carl Vanderlip <[email protected]>--- drivers/video/msm/mdp.c | 11 ++++------- 1 files changed, 4 insertions(+), 7 deletions(-)drivers/video/msm/mdp.c +0
-2@@ -42,16 +42,13 @@ DEFINE_MUTEX(mdp_mutex);static int locked_enable_mdp_irq (struct mdp_info *mdp,uint32_t mask) { -int ret =0 ; -
drivers/video/msm/mdp.c DEFINE_MUTEX(mdp_mutex); · line 51
Quoted 10 lines
drivers/video/msm/mdp.c +2
-3BUG_ON (!mask);/* if the mask bits are already set return an error, this interrupt * is already enabled */ if (mdp_irq_mask & mask) { -printk (KERN_ERR "mdp irq already on already on %x %x\n" , - mdp_irq_mask, mask); - ret =-1 ; +pr_err ("mdp irq already on %x %x\n" , mdp_irq_mask, mask); +return -1 ;
This change to *return* is not described.
WBR, Sergei
PATCH 16/20 video: msm: Set the EBI1 clock to 128MHz when performing blits
In reply to Carl VanderlipThis makes sure that the MDP (locked to AXI) and the AXI/ABI1 run at the maximum frequency during blit operations.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- drivers/video/msm/mdp.c | 11 +++++++++++ drivers/video/msm/mdp_hw.h | 1 + 2 files changed, 12 insertions(+), 0 deletions(-)
drivers/video/msm/mdp.c +11 -0
@@ -52,6 +52,7 @@ static int locked_enable_mdp_irq(struct mdp_info *mdp, uint32_t mask) }/* if the mdp irq is not already enabled enable it */ if (!mdp_irq_mask) { +clk_set_rate (mdp->ebi1_clk,128000000 );clk_enable (mdp->clk);enable_irq (mdp->irq); }
@@ -656,6 +657,13 @@ int mdp_probe(struct platform_device *pdev) goto error_get_mdp_clk; } + mdp->ebi1_clk =clk_get (NULL ,"ebi1_clk" ); +if (IS_ERR (mdp->ebi1_clk)) { +pr_err ("mdp: failed to get ebi1 clk\n" ); + ret =PTR_ERR (mdp->ebi1_clk); + goto error_get_ebi1_clk; + } + ret =request_irq (mdp->irq, mdp_isr,IRQF_DISABLED ,"msm_mdp" , mdp);if (ret) goto error_request_irq;
@@ -681,6 +689,9 @@ int mdp_probe(struct platform_device *pdev) error_device_register:free_irq (mdp->irq, mdp); error_request_irq: +clk_put (mdp->ebi1_clk); +error_get_ebi1_clk: +clk_put (mdp->clk); error_get_mdp_clk: error_mddi_pmdh_register:iounmap (mdp->base);
drivers/video/msm/mdp_hw.h +1 -0
@@ -46,6 +46,7 @@ struct mdp_info {char *__iomem base;int irq;struct clk *clk; +struct clk *ebi1_clk;struct mdp_out_interface out_if[MSM_MDP_NUM_INTERFACES ];int format;int pack_pattern;
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 16/20 video: msm: Set the EBI1 clock to 128MHz when performing blits
How long does it take to ramp up the clock, are there blit operations where the clock change could take longer than the blit (such as partial updates)?
--
Timothy Meade
tmzt on freenode
drivers/video/msm/mdp.c static int locked_enable_mdp_irq(struct mdp_info *mdp,
Quoted 19 lines · Carl Vanderlip
This makes sure that the MDP (locked to AXI) and the AXI/ABI1 run at the maximum frequency during blit operations.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>Signed-off-by Carl Vanderlip <[email protected]>---
drivers/video/msm/mdp.c| 11 +++++++++++drivers/video/msm/mdp_hw.h| 1 +2 files changed, 12 insertions(+), 0 deletions(-)drivers/video/msm/mdp.c +0
-0@@ -52,6 +52,7 @@ static int locked_enable_mdp_irq(struct mdp_info *mdp,
uint32_t mask)
Quoted 47 lines
drivers/video/msm/mdp.c +8
-0}/* if the mdp irq is not already enabled enable it */ if (!mdp_irq_mask) { +clk_set_rate (mdp->ebi1_clk,128000000 );clk_enable (mdp->clk);enable_irq (mdp->irq); }@@ -656,6 +657,13 @@ int mdp_probe(struct platform_device *pdev) goto error_get_mdp_clk; } + mdp->ebi1_clk =clk_get (NULL ,"ebi1_clk" ); +if (IS_ERR (mdp->ebi1_clk)) { +pr_err ("mdp: failed to get ebi1 clk\n" ); + ret =PTR_ERR (mdp->ebi1_clk); + goto error_get_ebi1_clk; + } + ret =request_irq (mdp->irq, mdp_isr,IRQF_DISABLED ,"msm_mdp" , mdp);if (ret) goto error_request_irq;@@ -681,6 +689,9 @@ int mdp_probe(struct platform_device *pdev)
error_device_register:free_irq(mdp->irq, mdp);error_request_irq:
+clk_put(mdp->ebi1_clk);
+error_get_ebi1_clk:
+clk_put(mdp->clk);error_get_mdp_clk:error_mddi_pmdh_register:iounmap(mdp->base);drivers/video/msm/mdp_hw.h +1
-1@@ -46,6 +46,7 @@ struct mdp_info {char *__iomem base;int irq;struct clk *clk; +struct clk *ebi1_clk;struct mdp_out_interface out_if[MSM_MDP_NUM_INTERFACES ];int format;int pack_pattern; --Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Quoted 2 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm"
in
Quoted 2 lines
the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110319/77063af8/attachment-0001.html>
Re: [PATCH 16/20] video: msm: Set the EBI1 clock to 128MHz when performing blits
In reply to Carl Vanderlipdrivers/video/msm/mdp.c int mdp_probe(struct platform_device *pdev) · line 660
Quoted 9 lines · Carl Vanderlip
drivers/video/msm/mdp.c +1
-0@@ -656,6 +657,13 @@ int mdp_probe(struct platform_device *pdev) goto error_get_mdp_clk; } + mdp->ebi1_clk =clk_get (NULL ,"ebi1_clk" );
Please pass a device pointer as the first argument so we can match up the ebi1_clk to the right device. MSM supports clkdev now so it's fairly simple to do this.
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 17/20 video: msm: Prevent framebuffer glitch during initialization
In reply to Carl VanderlipHolds a reference to the mdp_clk until lateinit, and moves the frambuffer initialization to device_init. The framebuffer lcdc driver will grab a reference to mdp_clk, which prevents the clock from being disabled by clock_late_init.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- drivers/video/msm/mdp.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/video/msm/mdp.c +10 -0
@@ -38,6 +38,7 @@ struct class *mdp_class;static DECLARE_WAIT_QUEUE_HEAD (mdp_ppp_waitqueue);static unsigned int mdp_irq_mask; +struct clk *mdp_clk_to_disable_later;DEFINE_MUTEX (mdp_mutex);static int locked_enable_mdp_irq (struct mdp_info *mdp,uint32_t mask)
@@ -670,6 +671,7 @@ int mdp_probe(struct platform_device *pdev)disable_irq (mdp->irq);clk_enable (mdp->clk); + mdp_clk_to_disable_later = mdp->clk;mdp_hw_init (mdp);/* register mdp device */
@@ -706,6 +708,13 @@ static struct platform_driver msm_mdp_driver = { .driver = {.name = "msm_mdp"}, }; +static int __init mdp_lateinit (void ) +{ +if (mdp_clk_to_disable_later) +clk_disable (mdp_clk_to_disable_later); +return 0 ; +} +static int __init mdp_init (void ) { mdp_class =class_create (THIS_MODULE ,"msm_mdp" );
@@ -717,3 +726,4 @@ static int __init mdp_init(void) }subsys_initcall (mdp_init); +late_initcall (mdp_lateinit);
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [PATCH 17/20] video: msm: Prevent framebuffer glitch during initialization
Hello.
Quoted 2 lines · Carl Vanderlip
Holds a reference to the
mdp_clkuntil lateinit, and moves the frambuffer initialization todevice_init.
Maybe I'm just blind but I don't see where the patch does the latter...
Quoted 19 lines
The framebuffer lcdc driver will grab a
reference tomdp_clk, which prevents the clock from being disabled byclock_late_init.Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>Signed-off-by Carl Vanderlip <[email protected]>--- drivers/video/msm/mdp.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)drivers/video/msm/mdp.c +0
-0
drivers/video/msm/mdp.c struct class *mdp_class; · line 41
Quoted 4 lines
drivers/video/msm/mdp.c +1
-0@@ -38,6 +38,7 @@ struct class *mdp_class;static DECLARE_WAIT_QUEUE_HEAD (mdp_ppp_waitqueue);static unsigned int mdp_irq_mask; +struct clk *mdp_clk_to_disable_later;
Why not just 'mdp_clk'? :-)
WBR, Sergei
Re: [PATCH 17/20] video: msm: Prevent framebuffer glitch during initialization
Quoted 19 lines
Quoted 3 lines · Carl Vanderlip
Holds a reference to the
mdp_clkuntil lateinit, and moves the frambuffer
initialization todevice_init.Maybe I'm just blind but I don't see where the patch does the
latter...Quoted 8 lines
The framebuffer lcdc driver will grab a
reference tomdp_clk, which prevents the clock from being disabled byclock_late_init.Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
Fear not. You are not going blind :P, I got a bit overzealous when trying to re-use the commit text that was available from the squashed patch that this patch set is spawned from (hence why [18/20] also has this same issue.
I will be re-writing this commit text for v2 (unless this c-text is desired to be kept for "historical" purposes).
Quoted 10 lines
Quoted 10 lines
--- drivers/video/msm/mdp.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)drivers/video/msm/mdp.c +0
-0@@ -38,6 +38,7 @@ struct class *mdp_class;
Quoted 6 lines
drivers/video/msm/mdp.c struct class *mdp_class; · line 41
Quoted 3 lines
drivers/video/msm/mdp.c +1
-0static DECLARE_WAIT_QUEUE_HEAD (mdp_ppp_waitqueue);static unsigned int mdp_irq_mask; +struct clk *mdp_clk_to_disable_later;Why not just 'mdp_clk'? :-)
I was not the original author for these variable names, though I do see some reason behind the naming of this variable. I'd be more willing to change this name, to "mdp_clk" if it weren't so visually similar to mdp->clk (tired programmer eyes/brain could read (or write) the wrong one).
As it is, the name is a little long, but it makes it extraordinarily clear what its purpose is (i.e. you know exactly what it is being used for without having to go searching for other places it is used).
So while I don't like the name as it is, I don't really like 'mdp_clk' either (though would be willing to change it if anyone feels like being stubborn :-)).
-Carl V.
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 18/20 video: msm: Prevent DMA lockups when switching bit depths
In reply to Carl VanderlipForces the lcdc off and waits a frame vsync period to prevent the MDP DMA engine crashing if the DMA bit depth is changed. A sleep cannot be used because lcdc_dma_start is called in irq context.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- drivers/video/msm/mdp.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/video/msm/mdp.c +7 -0
@@ -564,6 +564,13 @@ void mdp_hw_init(struct mdp_info *mdp)mdp_writel (mdp,1 ,0x60 );mdp_writel (mdp,1 ,MDP_EBI2_PORTMAP_MODE ); +/* disable lcdc */ +mdp_writel (mdp,0 ,MDP_LCDC_CTL ); +/* enable auto clock gating for all blocks by default */ +mdp_writel (mdp,0xffffffff ,MDP_CGC_EN ); +/* reset color/gamma correct parms */ +mdp_writel (mdp,0 ,MDP_DMA_P_COLOR_CORRECT_CONFIG ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01f8 );mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01fc );mdp_writel (mdp,1 ,0x60 );
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [PATCH 18/20] video: msm: Prevent DMA lockups when switching bit depths
Hello.
Quoted 3 lines · Carl Vanderlip
Forces the lcdc off and waits a frame vsync period to prevent the MDP DMA engine crashing if the DMA bit depth is changed. A sleep cannot be used because
lcdc_dma_startis called in irq context.
Maybe I'm blind again but I don't see any waiting...
Quoted 18 lines
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>Signed-off-by Carl Vanderlip <[email protected]>--- drivers/video/msm/mdp.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)drivers/video/msm/mdp.c +0
-0@@ -564,6 +564,13 @@ void mdp_hw_init(struct mdp_info *mdp)mdp_writel (mdp,1 ,0x60 );mdp_writel (mdp,1 ,MDP_EBI2_PORTMAP_MODE );
drivers/video/msm/mdp.c void mdp_hw_init(struct mdp_info *mdp) · line 576
Quoted 10 lines
drivers/video/msm/mdp.c +7
-0+/* disable lcdc */ +mdp_writel (mdp,0 ,MDP_LCDC_CTL ); +/* enable auto clock gating for all blocks by default */ +mdp_writel (mdp,0xffffffff ,MDP_CGC_EN ); +/* reset color/gamma correct parms */ +mdp_writel (mdp,0 ,MDP_DMA_P_COLOR_CORRECT_CONFIG ); +mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01f8 );mdp_writel (mdp,0 ,MDP_CMD_DEBUG_ACCESS_BASE +0x01fc );mdp_writel (mdp,1 ,0x60 );
WBR, Sergei
PATCH 19/20 video: msm: Separate calculation of base and offset
In reply to Carl VanderlipSeparating the calculation of base and offset for luma and chroma allows for easier specialization for HW targets.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- drivers/video/msm/mdp_ppp.c | 56 ++++++++++++++++++++++-------------------- 1 files changed, 29 insertions(+), 27 deletions(-)
drivers/video/msm/mdp_ppp.c +29 -27
@@ -100,6 +100,17 @@ static void rotate_dst_addr_y(struct mdp_blit_req *req, regs->dst_ystride; } +static uint32_t get_luma_offset (struct mdp_img *img, +struct mdp_rect *rect,uint32_t bpp) +{ +return 0 ; +} + +static uint32_t get_chroma_offset (struct mdp_img *img, +struct mdp_rect *rect,uint32_t bpp) +{ +return 0 ; +}static void blit_rotate (struct mdp_blit_req *req,struct ppp_regs *regs) {
@@ -311,24 +322,14 @@ static void flush_imgs(struct mdp_blit_req *req, struct ppp_regs *regs, { } -static void get_chroma_addr (struct mdp_img *img,struct mdp_rect *rect, -uint32_t base,uint32_t bpp,uint32_t cfg, -uint32_t *addr,uint32_t *ystride) +static uint32_t get_chroma_base (struct mdp_img *img,uint32_t base, +uint32_t bpp) { -uint32_t compress_v =Y_TO_CRCB_RATIO (img->format); -uint32_t compress_h =2 ; -uint32_t offset; - -if (IS_PSEUDOPLNR (img->format)) { - offset = (rect->x / compress_h) * compress_h; - offset += rect->y ==0 ?0 : - ((rect->y +1 ) / compress_v) * img->width; - *addr = base + (img->width * img->height * bpp); - *addr += offset * bpp; - *ystride |= *ystride <<16 ; - }else { - *addr =0 ; - } +uint32_t addr =0 ; + +if (IS_PSEUDOPLNR (img->format)) + addr = base + (img->width * img->height * bpp); +return addr; }#define mdp_writel_dbg (mdp, val, reg) mdp_writel((mdp), (val), (reg))
@@ -381,6 +382,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req, struct file *dst_file, unsigned long dst_start, unsigned long dst_len) { struct ppp_regs regs = {0}; +uint32_t luma_base;if (unlikely (req->src.format >=MDP_IMGTYPE_LIMIT || req->dst.format >=MDP_IMGTYPE_LIMIT )) {
@@ -416,23 +418,23 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req,/* set src, bpp, start pixel and ystride */ regs.src_bpp = bytes_per_pixel[req->src.format]; - regs.src0 = src_start + req->src.offset; + luma_base = src_start + req->src.offset; + regs.src0 = luma_base + +get_luma_offset (&req->src, &req->src_rect, regs.src_bpp); + regs.src1 =get_chroma_base (&req->src, luma_base, regs.src_bpp); + regs.src1 +=get_chroma_offset (&req->src, &req->src_rect, regs.src_bpp); regs.src_ystride = req->src.width * regs.src_bpp;set_src_region (&req->src, &req->src_rect, ®s); -get_chroma_addr (&req->src, &req->src_rect, regs.src0, regs.src_bpp, - regs.src_cfg, ®s.src1, ®s.src_ystride); - regs.src0 += (req->src_rect.x + (req->src_rect.y * req->src.width)) * - regs.src_bpp;/* set dst, bpp, start pixel and ystride */ regs.dst_bpp = bytes_per_pixel[req->dst.format]; - regs.dst0 = dst_start + req->dst.offset; + luma_base = dst_start + req->dst.offset; + regs.dst0 = luma_base + +get_luma_offset (&req->dst, &req->dst_rect, regs.dst_bpp); + regs.dst1 =get_chroma_base (&req->dst, luma_base, regs.dst_bpp); + regs.dst1 +=get_chroma_offset (&req->dst, &req->dst_rect, regs.dst_bpp); regs.dst_ystride = req->dst.width * regs.dst_bpp;set_dst_region (&req->dst_rect, ®s); -get_chroma_addr (&req->dst, &req->dst_rect, regs.dst0, regs.dst_bpp, - regs.dst_cfg, ®s.dst1, ®s.dst_ystride); - regs.dst0 += (req->dst_rect.x + (req->dst_rect.y * req->dst.width)) * - regs.dst_bpp;if (!valid_src_dst (src_start, src_len, dst_start, dst_len, req, ®s)) {
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 20/20 video: msm: Add support for MDP 3.1 (qsd8k)
In reply to Carl VanderlipIncludes support for the PPP which does scale, rotate, blend, color-convert , etc.
Authors:
Dima Zavin <[email protected]>
Rebecca Schultz Zavin <[email protected]>
Colin Cross <[email protected]>
--- arch/arm/mach-msm/Kconfig | 7 +- drivers/video/msm/Makefile | 1 + drivers/video/msm/mdp.c | 114 ++++++++++--- drivers/video/msm/mdp_csc_table.h | 68 ++++++++ drivers/video/msm/mdp_hw.h | 140 ++++++++++++---- drivers/video/msm/mdp_ppp.c | 117 ++++++++++++- drivers/video/msm/mdp_ppp.h | 20 +++ drivers/video/msm/mdp_ppp31.c | 335 +++++++++++++++++++++++++++++++++++++ 8 files changed, 731 insertions(+), 71 deletions(-) create mode 100644 drivers/video/msm/mdp_ppp31.c
arch/arm/mach-msm/Kconfig +5 -2
@@ -13,6 +13,7 @@ config ARCH_MSM7X00A select CPU_V6 select MSM_PROC_COMM select HAS_MSM_DEBUG_UART_PHYS + select MSM_MDP22 config ARCH_MSM7X30 bool "MSM7x30"
@@ -35,6 +36,7 @@ config ARCH_QSD8X50 select MSM_GPIOMUX select MSM_PROC_COMM select HAS_MSM_DEBUG_UART_PHYS + select MSM_MDP31 config ARCH_MSM8X60 bool "MSM8X60"
@@ -78,8 +80,9 @@ config MSM_VIC config MSM_MDP22 bool - depends on ARCH_MSM7X00A - default y + +config MSM_MDP31 + bool menu "Qualcomm MSM Board Type"
drivers/video/msm/Makefile +1 -0
@@ -8,6 +8,7 @@ obj-y := msm_fb.o obj-y += mdp.o mdp_ppp.o obj-$(CONFIG_MSM_MDP22) += mdp_ppp22.o +obj-$(CONFIG_MSM_MDP31) += mdp_ppp31.o # MDDI interface #
drivers/video/msm/mdp.c +87 -27
175 lines not on this page · raw message
drivers/video/msm/mdp_csc_table.h +68 -0
80 lines not on this page · raw message
drivers/video/msm/mdp_hw.h +105 -35
232 lines not on this page · raw message
drivers/video/msm/mdp_ppp.c +110 -7
201 lines not on this page · raw message
drivers/video/msm/mdp_ppp.h +20 -0
@@ -45,6 +45,18 @@ struct ppp_regs {uint32_t bg_bpp;uint32_t bg_pack;uint32_t bg_ystride; + +#ifdef CONFIG_MSM_MDP31 +uint32_t src_xy; +uint32_t src_img_sz; +uint32_t dst_xy; +uint32_t bg_xy; +uint32_t bg_img_sz; +uint32_t bg_alpha_sel; + +uint32_t scale_cfg; +uint32_t csc_cfg; +#endif };struct mdp_info ;
@@ -57,6 +69,14 @@ int mdp_ppp_cfg_scale(const struct mdp_info *mdp, struct ppp_regs *regs, uint32_t src_format, uint32_t dst_format);int mdp_ppp_load_blur (const struct mdp_info *mdp); +#ifndef CONFIG_MSM_MDP31 int mdp_ppp_cfg_edge_cond (struct mdp_blit_req *req,struct ppp_regs *regs); +#else +static inline int mdp_ppp_cfg_edge_cond (struct mdp_blit_req *req, +struct ppp_regs *regs) +{ +return 0 ; +} +#endif #endif /* _VIDEO_MSM_MDP_PPP_H_ */
drivers/video/msm/mdp_ppp31.c new file +335 -0
335 lines not on this page · raw message
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.