linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/rockchip: vop: Dither down to RGB666 if output bpc is 6
@ 2019-02-17 13:42 Urja Rannikko
       [not found] ` <20190217134255.6287-1-urjaman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Urja Rannikko @ 2019-02-17 13:42 UTC (permalink / raw)
  To: linux-rockchip; +Cc: Urja Rannikko, heiko, linux-arm-kernel, hjc

Tested to fix banding on the 6-bit panel of the ASUS C201.

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 0c35a88e33dd..96ba1b4cd07b 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -896,6 +896,7 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc,
 	u16 vsync_len = adjusted_mode->vsync_end - adjusted_mode->vsync_start;
 	u16 vact_st = adjusted_mode->vtotal - adjusted_mode->vsync_start;
 	u16 vact_end = vact_st + vdisplay;
+	uint32_t dither_bits = 0;
 	uint32_t pin_pol, val;
 	int ret;
 
@@ -951,10 +952,15 @@ static void vop_crtc_atomic_enable(struct drm_crtc *crtc,
 	    !(vop_data->feature & VOP_FEATURE_OUTPUT_RGB10))
 		s->output_mode = ROCKCHIP_OUT_MODE_P888;
 
-	if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA && s->output_bpc == 8)
-		VOP_REG_SET(vop, common, pre_dither_down, 1);
-	else
-		VOP_REG_SET(vop, common, pre_dither_down, 0);
+	/* dither_down includes the bit for pre_dither_down */
+	if (s->output_bpc) { /* Only dither if bpc known. */
+		if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA && s->output_bpc <= 8)
+			dither_bits = 0x1;
+		/* Enable allegro dither to RGB666 */
+		if (s->output_bpc == 6)
+			dither_bits |= 0x6;
+	}
+	VOP_REG_SET(vop, common, dither_down, dither_bits);
 
 	VOP_REG_SET(vop, common, out_mode, s->output_mode);
 
-- 
2.20.1

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

end of thread, other threads:[~2019-03-30 22:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-17 13:42 [PATCH] drm/rockchip: vop: Dither down to RGB666 if output bpc is 6 Urja Rannikko
     [not found] ` <20190217134255.6287-1-urjaman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-02-17 20:17   ` Heiko Stuebner
2019-02-19 10:08   ` [PATCH v2] drm/rockchip: vop: Support dithering to RGB666 Urja Rannikko
     [not found]     ` <20190219100848.2222-1-urjaman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-13 20:26       ` Urja Rannikko
     [not found]         ` <CAPCnQJnDB5Z=xNCdBw0R3k18GDKdUeZ__2fBA_YKYzZ6Rdny2Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-03-14 17:20           ` Johan Jonker
     [not found]             ` <223cf04e-5b35-4194-33c2-5614b329ec4b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-18 13:47               ` Urja Rannikko
     [not found]                 ` <CAPCnQJ=V32yJ01NZr0EO8hjjs=-zj+0MGddS+qd6txWqFs0mvg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-03-18 14:01                   ` Heiko Stübner
2019-03-18 13:57       ` [PATCH v3] " Urja Rannikko
     [not found]         ` <20190318135701.7098-1-urjaman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-18 15:44           ` [PATCH v4] " Urja Rannikko
     [not found]             ` <20190318154412.26994-1-urjaman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-03-30 22:47               ` Heiko Stuebner

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).