Commit 06696ebe674de7f65d4f5046a8639b358c6b358c

Authored by Simon Glass
Committed by Anatolij Gustschin
1 parent 8f5bfb7615

video: Allow driver to specify the line length

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>

Showing 3 changed files with 7 additions and 2 deletions Side-by-side Diff

drivers/pci/pci_rom.c
... ... @@ -331,6 +331,7 @@
331 331 return log_msg_ret("No x resolution", -ENXIO);
332 332 uc_priv->xsize = vesa->x_resolution;
333 333 uc_priv->ysize = vesa->y_resolution;
  334 + uc_priv->line_length = vesa->bytes_per_scanline;
334 335 switch (vesa->bits_per_pixel) {
335 336 case 32:
336 337 case 24:
drivers/video/video-uclass.c
... ... @@ -226,7 +226,9 @@
226 226  
227 227 /* Set up the line and display size */
228 228 priv->fb = map_sysmem(plat->base, plat->size);
229   - priv->line_length = priv->xsize * VNBYTES(priv->bpix);
  229 + if (!priv->line_length)
  230 + priv->line_length = priv->xsize * VNBYTES(priv->bpix);
  231 +
230 232 priv->fb_size = priv->line_length * priv->ysize;
231 233  
232 234 /* Set up colors */
... ... @@ -61,7 +61,9 @@
61 61 * @font_size: Font size in pixels (0 to use a default value)
62 62 * @fb: Frame buffer
63 63 * @fb_size: Frame buffer size
64   - * @line_length: Length of each frame buffer line, in bytes
  64 + * @line_length: Length of each frame buffer line, in bytes. This can be
  65 + * set by the driver, but if not, the uclass will set it after
  66 + * probing
65 67 * @colour_fg: Foreground colour (pixel value)
66 68 * @colour_bg: Background colour (pixel value)
67 69 * @flush_dcache: true to enable flushing of the data cache after