All of lore.kernel.org
 help / color / mirror / Atom feed
From: ville.syrjala@nokia.com
To: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Cc: "Imre Deak" <imre.deak@nokia.com>,
	linux-fbdev@vger.kernel.org, linux-omap@vger.kernel.org,
	"Ville Syrjälä" <ville.syrjala@nokia.com>
Subject: [PATCH v4 1/8] DSS2: OMAPFB: Refactor overlay address calculations
Date: Wed, 17 Mar 2010 22:46:16 +0000	[thread overview]
Message-ID: <1268865983-16270-2-git-send-email-ville.syrjala@nokia.com> (raw)
In-Reply-To: <1268865983-16270-1-git-send-email-ville.syrjala@nokia.com>

From: Ville Syrj채l채 <ville.syrjala@nokia.com>

Split the overlay address calculations into their own function.

Signed-off-by: Ville Syrj채l채 <ville.syrjala@nokia.com>
---
 drivers/video/omap2/omapfb/omapfb-main.c |   63 ++++++++++++++++++------------
 1 files changed, 38 insertions(+), 25 deletions(-)

diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index 4a76917..ea619a9 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -821,6 +821,40 @@ static unsigned calc_rotation_offset_vrfb(const struct fb_var_screeninfo *var,
 	return offset;
 }
 
+static void omapfb_calc_addr(const struct omapfb_info *ofbi,
+			     const struct fb_var_screeninfo *var,
+			     const struct fb_fix_screeninfo *fix,
+			     int rotation, u32 *paddr, void __iomem **vaddr)
+{
+	u32 data_start_p;
+	void __iomem *data_start_v;
+	int offset;
+
+	if (ofbi->rotation_type = OMAP_DSS_ROT_VRFB) {
+		data_start_p = omapfb_get_region_rot_paddr(ofbi, rotation);
+		data_start_v = NULL;
+	} else {
+		data_start_p = omapfb_get_region_paddr(ofbi);
+		data_start_v = omapfb_get_region_vaddr(ofbi);
+	}
+
+	if (ofbi->rotation_type = OMAP_DSS_ROT_VRFB)
+		offset = calc_rotation_offset_vrfb(var, fix, rotation);
+	else
+		offset = calc_rotation_offset_dma(var, fix, rotation);
+
+	data_start_p += offset;
+	data_start_v += offset;
+
+	if (offset)
+		DBG("offset %d, %d = %d\n",
+		    var->xoffset, var->yoffset, offset);
+
+	DBG("paddr %x, vaddr %p\n", data_start_p, data_start_v);
+
+	*paddr = data_start_p;
+	*vaddr = data_start_v;
+}
 
 /* setup overlay according to the fb */
 static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
@@ -831,9 +865,8 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
 	struct fb_var_screeninfo *var = &fbi->var;
 	struct fb_fix_screeninfo *fix = &fbi->fix;
 	enum omap_color_mode mode = 0;
-	int offset;
-	u32 data_start_p;
-	void __iomem *data_start_v;
+	u32 data_start_p = 0;
+	void __iomem *data_start_v = NULL;
 	struct omap_overlay_info info;
 	int xres, yres;
 	int screen_width;
@@ -860,28 +893,8 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
 		yres = var->yres;
 	}
 
-
-	if (ofbi->rotation_type = OMAP_DSS_ROT_VRFB) {
-		data_start_p = omapfb_get_region_rot_paddr(ofbi, rotation);
-		data_start_v = NULL;
-	} else {
-		data_start_p = omapfb_get_region_paddr(ofbi);
-		data_start_v = omapfb_get_region_vaddr(ofbi);
-	}
-
-	if (ofbi->rotation_type = OMAP_DSS_ROT_VRFB)
-		offset = calc_rotation_offset_vrfb(var, fix, rotation);
-	else
-		offset = calc_rotation_offset_dma(var, fix, rotation);
-
-	data_start_p += offset;
-	data_start_v += offset;
-
-	if (offset)
-		DBG("offset %d, %d = %d\n",
-				var->xoffset, var->yoffset, offset);
-
-	DBG("paddr %x, vaddr %p\n", data_start_p, data_start_v);
+	omapfb_calc_addr(ofbi, var, fix, rotation,
+			 &data_start_p, &data_start_v);
 
 	r = fb_mode_to_dss_mode(var, &mode);
 	if (r) {
-- 
1.6.4.4

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

WARNING: multiple messages have this Message-ID (diff)
From: ville.syrjala@nokia.com
To: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Cc: "Imre Deak" <imre.deak@nokia.com>,
	linux-fbdev@vger.kernel.org, linux-omap@vger.kernel.org,
	"Ville Syrjälä" <ville.syrjala@nokia.com>
Subject: [PATCH v4 1/8] DSS2: OMAPFB: Refactor overlay address calculations
Date: Thu, 18 Mar 2010 00:46:16 +0200	[thread overview]
Message-ID: <1268865983-16270-2-git-send-email-ville.syrjala@nokia.com> (raw)
In-Reply-To: <1268865983-16270-1-git-send-email-ville.syrjala@nokia.com>

From: Ville Syrjälä <ville.syrjala@nokia.com>

Split the overlay address calculations into their own function.

Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com>
---
 drivers/video/omap2/omapfb/omapfb-main.c |   63 ++++++++++++++++++------------
 1 files changed, 38 insertions(+), 25 deletions(-)

diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index 4a76917..ea619a9 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -821,6 +821,40 @@ static unsigned calc_rotation_offset_vrfb(const struct fb_var_screeninfo *var,
 	return offset;
 }
 
+static void omapfb_calc_addr(const struct omapfb_info *ofbi,
+			     const struct fb_var_screeninfo *var,
+			     const struct fb_fix_screeninfo *fix,
+			     int rotation, u32 *paddr, void __iomem **vaddr)
+{
+	u32 data_start_p;
+	void __iomem *data_start_v;
+	int offset;
+
+	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
+		data_start_p = omapfb_get_region_rot_paddr(ofbi, rotation);
+		data_start_v = NULL;
+	} else {
+		data_start_p = omapfb_get_region_paddr(ofbi);
+		data_start_v = omapfb_get_region_vaddr(ofbi);
+	}
+
+	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
+		offset = calc_rotation_offset_vrfb(var, fix, rotation);
+	else
+		offset = calc_rotation_offset_dma(var, fix, rotation);
+
+	data_start_p += offset;
+	data_start_v += offset;
+
+	if (offset)
+		DBG("offset %d, %d = %d\n",
+		    var->xoffset, var->yoffset, offset);
+
+	DBG("paddr %x, vaddr %p\n", data_start_p, data_start_v);
+
+	*paddr = data_start_p;
+	*vaddr = data_start_v;
+}
 
 /* setup overlay according to the fb */
 static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
@@ -831,9 +865,8 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
 	struct fb_var_screeninfo *var = &fbi->var;
 	struct fb_fix_screeninfo *fix = &fbi->fix;
 	enum omap_color_mode mode = 0;
-	int offset;
-	u32 data_start_p;
-	void __iomem *data_start_v;
+	u32 data_start_p = 0;
+	void __iomem *data_start_v = NULL;
 	struct omap_overlay_info info;
 	int xres, yres;
 	int screen_width;
@@ -860,28 +893,8 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
 		yres = var->yres;
 	}
 
-
-	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
-		data_start_p = omapfb_get_region_rot_paddr(ofbi, rotation);
-		data_start_v = NULL;
-	} else {
-		data_start_p = omapfb_get_region_paddr(ofbi);
-		data_start_v = omapfb_get_region_vaddr(ofbi);
-	}
-
-	if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
-		offset = calc_rotation_offset_vrfb(var, fix, rotation);
-	else
-		offset = calc_rotation_offset_dma(var, fix, rotation);
-
-	data_start_p += offset;
-	data_start_v += offset;
-
-	if (offset)
-		DBG("offset %d, %d = %d\n",
-				var->xoffset, var->yoffset, offset);
-
-	DBG("paddr %x, vaddr %p\n", data_start_p, data_start_v);
+	omapfb_calc_addr(ofbi, var, fix, rotation,
+			 &data_start_p, &data_start_v);
 
 	r = fb_mode_to_dss_mode(var, &mode);
 	if (r) {
-- 
1.6.4.4

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

  reply	other threads:[~2010-03-17 22:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-17 22:46 omapfb mem_idx patchset ville.syrjala
2010-03-17 22:46 ` ville.syrjala
2010-03-17 22:46 ` ville.syrjala [this message]
2010-03-17 22:46   ` [PATCH v4 1/8] DSS2: OMAPFB: Refactor overlay address calculations ville.syrjala
2010-03-17 22:46 ` [PATCH v4 2/8] DSS2: OMAPFB: Check var even if there isn't memory ville.syrjala
2010-03-17 22:46   ` ville.syrjala
2010-03-17 22:46 ` [PATCH v4 3/8] DSS2: OMAPFB: Skip unnecessary set_overlay_info() ville.syrjala
2010-03-17 22:46   ` ville.syrjala
2010-03-17 22:46 ` [PATCH v4 4/8] DSS2: OMAPFB: Add support for switching memory regions ville.syrjala
2010-03-17 22:46   ` ville.syrjala
2010-03-17 22:46 ` [PATCH v4 5/8] DSS2: OMAPFB: Add locking for " ville.syrjala
2010-03-17 22:46   ` ville.syrjala
2010-03-17 22:46 ` [PATCH v4 6/8] DSS2: OMAPFB: Convert the memory region locking to rwsem ville.syrjala
2010-03-17 22:46   ` ville.syrjala
2010-03-17 22:46 ` [PATCH v4 7/8] DSS2: OMAPFB: Make lockdep happy ville.syrjala
2010-03-17 22:46   ` ville.syrjala
2010-03-17 22:46 ` [PATCH v4 8/8] DSS2: OMAPFB: Add some locking debug checks ville.syrjala
2010-03-17 22:46   ` ville.syrjala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1268865983-16270-2-git-send-email-ville.syrjala@nokia.com \
    --to=ville.syrjala@nokia.com \
    --cc=imre.deak@nokia.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tomi.valkeinen@nokia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.