Skip to contentSkip to conversation

video: Allow driver to specify the line length

PATCH New Simon Glass 2 participants 3 messages Nov 29, 2018 – Dec 1, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---

 drivers/pci/pci_rom.c        | 1 +
 drivers/video/video-uclass.c | 4 +++-
 include/video.h              | 4 +++-
 3 files changed, 7 insertions(+), 2 deletions(-)
drivers/pci/pci_rom.c +1 -0
index 29113f79586..b4dabead01d 100644
@@ -331,6 +331,7 @@ int vbe_setup_video_priv(struct vesa_mode_info *vesa,
 		return -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:
drivers/video/video-uclass.c +3 -1
index dd0873767ba..804576b65a8 100644
@@ -213,7 +213,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  */
include/video.h +3 -1
index ddc2eeb5a95..dce8c5518bb 100644
@@ -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
Signature · 1 line
2.20.0.rc0.387.gc7a69e6b6c-goog
#1 lore raw

PATCH 1/1 video: Allow driver to specify the line length

Hi Simon,

Quoted 7 lines · On Thu, 29 Nov 2018 15:08:52 -0700 Simon Glass sjg at chromium.org wrote:

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.

--
Anatolij

#2 lore raw

PATCH 1/1 video: Allow driver to specify the line length

In reply to Simon Glass
Quoted 6 lines · On Thu, 29 Nov 2018 15:08:52 -0700 Simon Glass sjg at chromium.org wrote:

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.

Quoted 7 lines

---

 drivers/pci/pci_rom.c        | 1 +
 drivers/video/video-uclass.c | 4 +++-
 include/video.h              | 4 +++-
 3 files changed, 7 insertions(+), 2 deletions(-)

Applied to u-boot-video/master, thanks!

--
Anatolij