From: Paul Cercueil <paul@crapouillou.net> To: David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch> Cc: od@zcrc.me, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil <paul@crapouillou.net> Subject: [PATCH 1/3] gpu/drm: ingenic: Add trick to support 16bpp on 24-bit panels Date: Sun, 16 Feb 2020 12:58:09 -0300 [thread overview] Message-ID: <20200216155811.68463-1-paul@crapouillou.net> (raw) If the panel interface is 24-bit but our primary plane is 16bpp, configure as if the panel was 18-bit. This tricks permits the display of 16bpp data on a 24-bit panel by wiring each color component to the MSBs of the 24-bit interface. Signed-off-by: Paul Cercueil <paul@crapouillou.net> --- drivers/gpu/drm/ingenic/ingenic-drm.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ingenic-drm.c index 6d47ef7b148c..034961a40e98 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm.c @@ -400,6 +400,8 @@ static void ingenic_drm_encoder_atomic_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode = &crtc_state->adjusted_mode; struct drm_connector *conn = conn_state->connector; struct drm_display_info *info = &conn->display_info; + struct drm_plane_state *plane_state = crtc_state->crtc->primary->state; + const struct drm_format_info *finfo = NULL; unsigned int cfg; priv->panel_is_sharp = info->bus_flags & DRM_BUS_FLAG_SHARP_SIGNALS; @@ -435,7 +437,22 @@ static void ingenic_drm_encoder_atomic_mode_set(struct drm_encoder *encoder, cfg |= JZ_LCD_CFG_MODE_GENERIC_18BIT; break; case MEDIA_BUS_FMT_RGB888_1X24: - cfg |= JZ_LCD_CFG_MODE_GENERIC_24BIT; + if (plane_state && plane_state->fb) + finfo = plane_state->fb->format; + + /* + * If the panel interface is 24-bit but our + * primary plane is 16bpp, configure as if the + * panel was 18-bit. This tricks permits the + * display of 16bpp data on a 24-bit panel by + * wiring each color component to the MSBs of + * the 24-bit interface. + */ + if (finfo && + finfo->format != DRM_FORMAT_XRGB8888) + cfg |= JZ_LCD_CFG_MODE_GENERIC_18BIT; + else + cfg |= JZ_LCD_CFG_MODE_GENERIC_24BIT; break; case MEDIA_BUS_FMT_RGB888_3X8: cfg |= JZ_LCD_CFG_MODE_8BIT_SERIAL; -- 2.25.0
WARNING: multiple messages have this Message-ID (diff)
From: Paul Cercueil <paul@crapouillou.net> To: David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch> Cc: Paul Cercueil <paul@crapouillou.net>, od@zcrc.me, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH 1/3] gpu/drm: ingenic: Add trick to support 16bpp on 24-bit panels Date: Sun, 16 Feb 2020 12:58:09 -0300 [thread overview] Message-ID: <20200216155811.68463-1-paul@crapouillou.net> (raw) If the panel interface is 24-bit but our primary plane is 16bpp, configure as if the panel was 18-bit. This tricks permits the display of 16bpp data on a 24-bit panel by wiring each color component to the MSBs of the 24-bit interface. Signed-off-by: Paul Cercueil <paul@crapouillou.net> --- drivers/gpu/drm/ingenic/ingenic-drm.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ingenic-drm.c index 6d47ef7b148c..034961a40e98 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm.c @@ -400,6 +400,8 @@ static void ingenic_drm_encoder_atomic_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode = &crtc_state->adjusted_mode; struct drm_connector *conn = conn_state->connector; struct drm_display_info *info = &conn->display_info; + struct drm_plane_state *plane_state = crtc_state->crtc->primary->state; + const struct drm_format_info *finfo = NULL; unsigned int cfg; priv->panel_is_sharp = info->bus_flags & DRM_BUS_FLAG_SHARP_SIGNALS; @@ -435,7 +437,22 @@ static void ingenic_drm_encoder_atomic_mode_set(struct drm_encoder *encoder, cfg |= JZ_LCD_CFG_MODE_GENERIC_18BIT; break; case MEDIA_BUS_FMT_RGB888_1X24: - cfg |= JZ_LCD_CFG_MODE_GENERIC_24BIT; + if (plane_state && plane_state->fb) + finfo = plane_state->fb->format; + + /* + * If the panel interface is 24-bit but our + * primary plane is 16bpp, configure as if the + * panel was 18-bit. This tricks permits the + * display of 16bpp data on a 24-bit panel by + * wiring each color component to the MSBs of + * the 24-bit interface. + */ + if (finfo && + finfo->format != DRM_FORMAT_XRGB8888) + cfg |= JZ_LCD_CFG_MODE_GENERIC_18BIT; + else + cfg |= JZ_LCD_CFG_MODE_GENERIC_24BIT; break; case MEDIA_BUS_FMT_RGB888_3X8: cfg |= JZ_LCD_CFG_MODE_8BIT_SERIAL; -- 2.25.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next reply other threads:[~2020-02-16 15:58 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-02-16 15:58 Paul Cercueil [this message] 2020-02-16 15:58 ` [PATCH 1/3] gpu/drm: ingenic: Add trick to support 16bpp on 24-bit panels Paul Cercueil 2020-02-16 15:58 ` [PATCH 2/3] gpu/drm: ingenic: Switch emulated fbdev to 16bpp Paul Cercueil 2020-02-16 15:58 ` Paul Cercueil 2020-02-17 9:30 ` Daniel Vetter 2020-02-17 9:30 ` Daniel Vetter 2020-02-16 15:58 ` [PATCH 3/3] gpu/drm: ingenic: Add option to mmap GEM buffers cached Paul Cercueil 2020-02-16 15:58 ` Paul Cercueil 2020-02-18 17:58 ` kbuild test robot 2020-02-18 17:58 ` kbuild test robot
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200216155811.68463-1-paul@crapouillou.net \ --to=paul@crapouillou.net \ --cc=airlied@linux.ie \ --cc=daniel@ffwll.ch \ --cc=dri-devel@lists.freedesktop.org \ --cc=linux-kernel@vger.kernel.org \ --cc=od@zcrc.me \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.