Skip to content

Commit

Permalink
video: Allow driver to specify the line length
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Anatolij Gustschin <[email protected]>
  • Loading branch information
sjg20 authored and vdsao committed Dec 3, 2018
1 parent 8f5bfb7 commit 06696eb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/pci/pci_rom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion drivers/video/video-uclass.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 3 additions & 1 deletion include/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 06696eb

Please sign in to comment.