]> git.sur5r.net Git - u-boot/commitdiff
video: bcm2835: respect the pitch value
authorAndre Heider <a.heider@gmail.com>
Sat, 9 Nov 2013 10:07:53 +0000 (11:07 +0100)
committerAnatolij Gustschin <agust@denx.de>
Tue, 12 Nov 2013 08:35:40 +0000 (09:35 +0100)
Depending on the firmware's video options [1] the active SDTV or
HDTV mode can yield a framebuffer with noncontiguous horizontal lines,
giving a messed up display, for both, u-boot and the loaded kernel.

Fix this by setting lcd_line_length to the pitch value of the configured
framebuffer.

[1] http://elinux.org/RPiconfig#Video_mode_options

Signed-off-by: Andre Heider <a.heider@gmail.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
drivers/video/bcm2835.c

index 58a616317a6a5c826edfbe47d38b9d65fa92c146..1f18231ac69ddc3c698720b90dbd389a615f43dc 100644 (file)
@@ -14,6 +14,8 @@ DECLARE_GLOBAL_DATA_PTR;
 /* Global variables that lcd.c expects to exist */
 vidinfo_t panel_info;
 
+static u32 bcm2835_pitch;
+
 struct msg_query {
        struct bcm2835_mbox_hdr hdr;
        struct bcm2835_mbox_tag_physical_w_h physical_w_h;
@@ -30,6 +32,7 @@ struct msg_setup {
        struct bcm2835_mbox_tag_virtual_offset virtual_offset;
        struct bcm2835_mbox_tag_overscan overscan;
        struct bcm2835_mbox_tag_allocate_buffer allocate_buffer;
+       struct bcm2835_mbox_tag_pitch pitch;
        u32 end_tag;
 };
 
@@ -80,6 +83,7 @@ void lcd_ctrl_init(void *lcdbase)
        msg_setup->overscan.body.req.right = 0;
        BCM2835_MBOX_INIT_TAG(&msg_setup->allocate_buffer, ALLOCATE_BUFFER);
        msg_setup->allocate_buffer.body.req.alignment = 0x100;
+       BCM2835_MBOX_INIT_TAG_NO_REQ(&msg_setup->pitch, GET_PITCH);
 
        ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg_setup->hdr);
        if (ret) {
@@ -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);
 
@@ -103,3 +108,9 @@ void lcd_ctrl_init(void *lcdbase)
 void lcd_enable(void)
 {
 }
+
+int lcd_get_size(int *line_length)
+{
+       *line_length = bcm2835_pitch;
+       return *line_length * panel_info.vl_row;
+}