All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anatolij Gustschin <agust@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/2] video: bcm2835: respect the pitch value
Date: Fri, 8 Nov 2013 00:04:01 +0100	[thread overview]
Message-ID: <20131108000401.48a22e85@crub> (raw)
In-Reply-To: <1382637641-1919-1-git-send-email-a.heider@gmail.com>

On Thu, 24 Oct 2013 20:00:41 +0200
Andre Heider <a.heider@gmail.com> wrote:
...
> @@ -90,6 +94,7 @@ void lcd_ctrl_init(void *lcdbase)
>  
>  	w = msg_setup->physical_w_h.body.resp.width;
>  	h = msg_setup->physical_w_h.body.resp.height;
> +	bcm2835_pitch = msg_setup->pitch.body.resp.pitch;
>  
>  	debug("bcm2835: Final resolution is %d x %d\n", w, h);
>  
> @@ -102,4 +107,6 @@ void lcd_ctrl_init(void *lcdbase)
>  
>  void lcd_enable(void)
>  {
> +	if (bcm2835_pitch)
> +		lcd_line_length = bcm2835_pitch;
>  }

setting lcd_line_length in lcd_enable() is wrong, it should
happen earlier, before lcd_clear() is called in the lcd.c
driver. I suggest making the lcd_get_size() in lcd.c a weak
function and then provide bcm2835 specific lcd_get_size()
which sets the pitch as needed:

diff --git a/common/lcd.c b/common/lcd.c
index 5dd7948..60faa62 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -386,8 +386,13 @@ static void test_pattern(void)
 /************************************************************************/
 /* ** GENERIC Initialization Routines                                  */
 /************************************************************************/
-
-int lcd_get_size(int *line_length)
+/*
+ * Implement a weak default function for getting the length/size
+ * from panel_info parameters. With some boards/drivers the
+ * length might need adjustments, so allow defining the driver
+ * specific lcd_get_size() function.
+ */
+__weak int lcd_get_size(int *line_length)
 {
        *line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
        return *line_length * panel_info.vl_row;

and

diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c
index 58a6163..45b470a 100644
--- a/drivers/video/bcm2835.c
+++ b/drivers/video/bcm2835.c
@@ -103,3 +103,9 @@ void lcd_ctrl_init(void *lcdbase)
 void lcd_enable(void)
 {
 }
+
+void lcd_get_size(int *line_length)
+{
+       *line_length = bcm2835_pitch;
+       return *line_length * panel_info.vl_row;
+}

Anatolij

  parent reply	other threads:[~2013-11-07 23:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22 20:27 [U-Boot] [PATCH 2/2] video: bcm2835: fix various output modes Andre Heider
2013-10-23 16:57 ` Stephen Warren
2013-10-23 20:06   ` Andre Heider
2013-10-24 18:14   ` Andre Heider
2013-10-24 22:08     ` Stephen Warren
2013-10-24 18:00 ` [U-Boot] [PATCH v2 2/2] video: bcm2835: respect the pitch value Andre Heider
2013-10-24 22:13   ` Stephen Warren
2013-11-07 23:04   ` Anatolij Gustschin [this message]
2013-11-09 10:00   ` [U-Boot] [PATCH] lcd: allow overriding lcd_get_size() Anatolij Gustschin
2013-11-12  8:44     ` Anatolij Gustschin
2013-11-09 10:07   ` [U-Boot] [PATCH v3 2/2] video: bcm2835: respect the pitch value Anatolij Gustschin
2013-11-09 12:25     ` Andre Heider
2013-11-12  8:39       ` Anatolij Gustschin
2013-11-11 16:45     ` Stephen Warren
2013-11-12  8:48     ` Anatolij Gustschin

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=20131108000401.48a22e85@crub \
    --to=agust@denx.de \
    --cc=u-boot@lists.denx.de \
    /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.