linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/mipi_dbi: Fix off-by-one bugs in mipi_dbi_blank()
@ 2019-12-30 13:06 Geert Uytterhoeven
  2020-01-02 14:52 ` Noralf Trønnes
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2019-12-30 13:06 UTC (permalink / raw)
  To: Noralf Trønnes, Maarten Lankhorst, Maxime Ripard, Sean Paul,
	David Airlie, Daniel Vetter
  Cc: Thierry Reding, dri-devel, linux-renesas-soc, linux-kernel,
	Geert Uytterhoeven

When configuring the frame memory window, the last column and row
numbers are written to the column resp. page address registers.  These
numbers are thus one less than the actual window width resp. height.

While this is handled correctly in mipi_dbi_fb_dirty() since commit
03ceb1c8dfd1e293 ("drm/tinydrm: Fix setting of the column/page end
addresses."), it is not in mipi_dbi_blank().  The latter still forgets
to subtract one when calculating the most significant bytes of the
column and row numbers, thus programming wrong values when the display
width or height is a multiple of 256.

Fixes: 02dd95fe31693626 ("drm/tinydrm: Add MIPI DBI support")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/gpu/drm/drm_mipi_dbi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index e34058c721becd6b..16bff1be4b8ac622 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -367,9 +367,9 @@ static void mipi_dbi_blank(struct mipi_dbi_dev *dbidev)
 	memset(dbidev->tx_buf, 0, len);
 
 	mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS, 0, 0,
-			 (width >> 8) & 0xFF, (width - 1) & 0xFF);
+			 ((width - 1) >> 8) & 0xFF, (width - 1) & 0xFF);
 	mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS, 0, 0,
-			 (height >> 8) & 0xFF, (height - 1) & 0xFF);
+			 ((height - 1) >> 8) & 0xFF, (height - 1) & 0xFF);
 	mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START,
 			     (u8 *)dbidev->tx_buf, len);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/mipi_dbi: Fix off-by-one bugs in mipi_dbi_blank()
  2019-12-30 13:06 [PATCH] drm/mipi_dbi: Fix off-by-one bugs in mipi_dbi_blank() Geert Uytterhoeven
@ 2020-01-02 14:52 ` Noralf Trønnes
  0 siblings, 0 replies; 2+ messages in thread
From: Noralf Trønnes @ 2020-01-02 14:52 UTC (permalink / raw)
  To: Geert Uytterhoeven, Maarten Lankhorst, Maxime Ripard, Sean Paul,
	David Airlie, Daniel Vetter
  Cc: Thierry Reding, dri-devel, linux-renesas-soc, linux-kernel



Den 30.12.2019 14.06, skrev Geert Uytterhoeven:
> When configuring the frame memory window, the last column and row
> numbers are written to the column resp. page address registers.  These
> numbers are thus one less than the actual window width resp. height.
> 
> While this is handled correctly in mipi_dbi_fb_dirty() since commit
> 03ceb1c8dfd1e293 ("drm/tinydrm: Fix setting of the column/page end
> addresses."), it is not in mipi_dbi_blank().  The latter still forgets
> to subtract one when calculating the most significant bytes of the
> column and row numbers, thus programming wrong values when the display
> width or height is a multiple of 256.
> 
> Fixes: 02dd95fe31693626 ("drm/tinydrm: Add MIPI DBI support")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---

Thanks, applied to drm-misc-next.

Noralf.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-02 14:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-30 13:06 [PATCH] drm/mipi_dbi: Fix off-by-one bugs in mipi_dbi_blank() Geert Uytterhoeven
2020-01-02 14:52 ` Noralf Trønnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).