video: Allow driver to specify the line length
authorSimon Glass <sjg@chromium.org>
Thu, 29 Nov 2018 22:08:52 +0000 (15:08 -0700)
committerAnatolij Gustschin <agust@denx.de>
Mon, 3 Dec 2018 18:09:44 +0000 (19:09 +0100)
At present line_length is always calculated in video_post_probe(). But
some hardware may use a different line length, e.g. with a 1366-wide
display.

Allow the driver to set this value if needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
drivers/pci/pci_rom.c
drivers/video/video-uclass.c
include/video.h

index eaacd4066e8297f31a989a87584c1a2c058e5f36..7d9b75c2c457aa2b6502990fb449dca579e07d6c 100644 (file)
@@ -331,6 +331,7 @@ int vbe_setup_video_priv(struct vesa_mode_info *vesa,
                return log_msg_ret("No x resolution", -ENXIO);
        uc_priv->xsize = vesa->x_resolution;
        uc_priv->ysize = vesa->y_resolution;
+       uc_priv->line_length = vesa->bytes_per_scanline;
        switch (vesa->bits_per_pixel) {
        case 32:
        case 24:
index b6551b69d3ae2cc039032909dae539919807953c..f307cf243bdcb876b355b2e9c30990fbaf1bd318 100644 (file)
@@ -226,7 +226,9 @@ static int video_post_probe(struct udevice *dev)
 
        /* Set up the line and display size */
        priv->fb = map_sysmem(plat->base, plat->size);
-       priv->line_length = priv->xsize * VNBYTES(priv->bpix);
+       if (!priv->line_length)
+               priv->line_length = priv->xsize * VNBYTES(priv->bpix);
+
        priv->fb_size = priv->line_length * priv->ysize;
 
        /* Set up colors  */
index 3f9139eea445eec966ae5ebc612e6967fbe7612a..1d57b48b173807dfb9914793e7ff283ab5962425 100644 (file)
@@ -61,7 +61,9 @@ enum video_log2_bpp {
  * @font_size: Font size in pixels (0 to use a default value)
  * @fb:                Frame buffer
  * @fb_size:   Frame buffer size
- * @line_length:       Length of each frame buffer line, in bytes
+ * @line_length:       Length of each frame buffer line, in bytes. This can be
+ *             set by the driver, but if not, the uclass will set it after
+ *             probing
  * @colour_fg: Foreground colour (pixel value)
  * @colour_bg: Background colour (pixel value)
  * @flush_dcache:      true to enable flushing of the data cache after