From: Thomas Zimmermann <tzimmermann@suse.de>
To: daniel@ffwll.ch, airlied@gmail.com, mripard@kernel.org,
maarten.lankhorst@linux.intel.com, xinliang.liu@linaro.org,
tiantao6@hisilicon.com, jstultz@google.com,
kong.kongxinwei@hisilicon.com, puck.chen@hisilicon.com,
paul.kocialkowski@bootlin.com, javierm@redhat.com,
airlied@redhat.com, kraxel@redhat.com
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
dri-devel@lists.freedesktop.org,
virtualization@lists.linux-foundation.org
Subject: [PATCH 7/7] drm/fb-helper: Don't use the preferred depth for the BPP default
Date: Wed, 16 Nov 2022 17:09:17 +0100 [thread overview]
Message-ID: <20221116160917.26342-8-tzimmermann@suse.de> (raw)
In-Reply-To: <20221116160917.26342-1-tzimmermann@suse.de>
If no preferred value for bits-per-pixel has been given, fall back
to 32. Never use the preferred depth. The color depth is the number
of color/alpha bits per pixel, while bpp is the overall number of
bits in most cases.
Most noteworthy, XRGB8888 has a depth of 24 and a bpp value of 32.
Using depth for bpp would make the value 24 as well and format
selection in fbdev helpers fails. Unfortunately XRGB8888 is the most
common format and the old heuristic therefore fails for most of
the drivers (unless they implement the 24-bit RGB888 format).
Picking a bpp of 32 will lateron result in a default depth of 24
and the format XRGB8888. As XRGB8888 is the default format for most
of the current and legacy graphics stack, all drivers must support
it. So it is the safe choice.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/drm_fbdev_generic.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
index ab86956692795..0a4c160e0e58a 100644
--- a/drivers/gpu/drm/drm_fbdev_generic.c
+++ b/drivers/gpu/drm/drm_fbdev_generic.c
@@ -431,7 +431,6 @@ static const struct drm_client_funcs drm_fbdev_client_funcs = {
* drm_fbdev_generic_setup() - Setup generic fbdev emulation
* @dev: DRM device
* @preferred_bpp: Preferred bits per pixel for the device.
- * @dev->mode_config.preferred_depth is used if this is zero.
*
* This function sets up generic fbdev emulation for drivers that supports
* dumb buffers with a virtual address and that can be mmap'ed.
@@ -475,12 +474,16 @@ void drm_fbdev_generic_setup(struct drm_device *dev,
}
/*
- * FIXME: This mixes up depth with bpp, which results in a glorious
- * mess, resulting in some drivers picking wrong fbdev defaults and
- * others wrong preferred_depth defaults.
+ * Pick a preferred bpp of 32 if no value has been given. This
+ * will select XRGB8888 for the framebuffer formats. All drivers
+ * have to support XRGB8888 for backwards compatibility with legacy
+ * userspace, so it's the safe choice here.
+ *
+ * TODO: Replace struct drm_mode_config.preferred_depth and this
+ * bpp value with a preferred format that is given as struct
+ * drm_format_info. Then derive all other values from the
+ * format.
*/
- if (!preferred_bpp)
- preferred_bpp = dev->mode_config.preferred_depth;
if (!preferred_bpp)
preferred_bpp = 32;
fb_helper->preferred_bpp = preferred_bpp;
--
2.38.1
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
WARNING: multiple messages have this Message-ID (diff)
From: Thomas Zimmermann <tzimmermann@suse.de>
To: daniel@ffwll.ch, airlied@gmail.com, mripard@kernel.org,
maarten.lankhorst@linux.intel.com, xinliang.liu@linaro.org,
tiantao6@hisilicon.com, jstultz@google.com,
kong.kongxinwei@hisilicon.com, puck.chen@hisilicon.com,
paul.kocialkowski@bootlin.com, javierm@redhat.com,
airlied@redhat.com, kraxel@redhat.com
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
dri-devel@lists.freedesktop.org,
virtualization@lists.linux-foundation.org
Subject: [PATCH 7/7] drm/fb-helper: Don't use the preferred depth for the BPP default
Date: Wed, 16 Nov 2022 17:09:17 +0100 [thread overview]
Message-ID: <20221116160917.26342-8-tzimmermann@suse.de> (raw)
In-Reply-To: <20221116160917.26342-1-tzimmermann@suse.de>
If no preferred value for bits-per-pixel has been given, fall back
to 32. Never use the preferred depth. The color depth is the number
of color/alpha bits per pixel, while bpp is the overall number of
bits in most cases.
Most noteworthy, XRGB8888 has a depth of 24 and a bpp value of 32.
Using depth for bpp would make the value 24 as well and format
selection in fbdev helpers fails. Unfortunately XRGB8888 is the most
common format and the old heuristic therefore fails for most of
the drivers (unless they implement the 24-bit RGB888 format).
Picking a bpp of 32 will lateron result in a default depth of 24
and the format XRGB8888. As XRGB8888 is the default format for most
of the current and legacy graphics stack, all drivers must support
it. So it is the safe choice.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/drm_fbdev_generic.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
index ab86956692795..0a4c160e0e58a 100644
--- a/drivers/gpu/drm/drm_fbdev_generic.c
+++ b/drivers/gpu/drm/drm_fbdev_generic.c
@@ -431,7 +431,6 @@ static const struct drm_client_funcs drm_fbdev_client_funcs = {
* drm_fbdev_generic_setup() - Setup generic fbdev emulation
* @dev: DRM device
* @preferred_bpp: Preferred bits per pixel for the device.
- * @dev->mode_config.preferred_depth is used if this is zero.
*
* This function sets up generic fbdev emulation for drivers that supports
* dumb buffers with a virtual address and that can be mmap'ed.
@@ -475,12 +474,16 @@ void drm_fbdev_generic_setup(struct drm_device *dev,
}
/*
- * FIXME: This mixes up depth with bpp, which results in a glorious
- * mess, resulting in some drivers picking wrong fbdev defaults and
- * others wrong preferred_depth defaults.
+ * Pick a preferred bpp of 32 if no value has been given. This
+ * will select XRGB8888 for the framebuffer formats. All drivers
+ * have to support XRGB8888 for backwards compatibility with legacy
+ * userspace, so it's the safe choice here.
+ *
+ * TODO: Replace struct drm_mode_config.preferred_depth and this
+ * bpp value with a preferred format that is given as struct
+ * drm_format_info. Then derive all other values from the
+ * format.
*/
- if (!preferred_bpp)
- preferred_bpp = dev->mode_config.preferred_depth;
if (!preferred_bpp)
preferred_bpp = 32;
fb_helper->preferred_bpp = preferred_bpp;
--
2.38.1
next prev parent reply other threads:[~2022-11-16 16:09 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-16 16:09 [PATCH 0/7] drm: Fix the color-depth/bpp confusion Thomas Zimmermann
2022-11-16 16:09 ` Thomas Zimmermann
2022-11-16 16:09 ` [PATCH 1/7] drm/hisilicon/hibmc: Fix preferred depth and bpp Thomas Zimmermann
2022-11-16 16:09 ` Thomas Zimmermann
2022-11-18 12:52 ` Javier Martinez Canillas
2022-11-18 13:18 ` Thomas Zimmermann
2022-11-18 13:18 ` Thomas Zimmermann
2022-11-18 13:31 ` Javier Martinez Canillas
2022-11-16 16:09 ` [PATCH 2/7] drm/logicvc: Fix preferred fbdev cpp Thomas Zimmermann
2022-11-16 16:09 ` Thomas Zimmermann
2022-11-18 13:08 ` Javier Martinez Canillas
2022-11-18 13:22 ` Thomas Zimmermann
2022-11-18 13:22 ` Thomas Zimmermann
2022-11-18 13:41 ` Javier Martinez Canillas
2022-11-18 13:48 ` Thomas Zimmermann
2022-11-18 13:48 ` Thomas Zimmermann
2022-11-18 14:01 ` Javier Martinez Canillas
2022-11-16 16:09 ` [PATCH 3/7] drm/cirrus: Decouple fbdev bpp value from color depth Thomas Zimmermann
2022-11-16 16:09 ` Thomas Zimmermann
2022-11-18 13:44 ` Javier Martinez Canillas
2022-11-16 16:09 ` [PATCH 4/7] drm/ofdrm: Set preferred depth from format of scanout buffer Thomas Zimmermann
2022-11-16 16:09 ` Thomas Zimmermann
2022-11-18 14:06 ` Javier Martinez Canillas
2022-11-16 16:09 ` [PATCH 5/7] drm/simpledrm: " Thomas Zimmermann
2022-11-16 16:09 ` Thomas Zimmermann
2022-11-18 14:07 ` Javier Martinez Canillas
2022-11-16 16:09 ` [PATCH 6/7] drm/solomon: Set preferred color depth and bpp to the correct values Thomas Zimmermann
2022-11-16 16:09 ` Thomas Zimmermann
2022-11-18 14:08 ` Javier Martinez Canillas
2022-11-16 16:09 ` Thomas Zimmermann [this message]
2022-11-16 16:09 ` [PATCH 7/7] drm/fb-helper: Don't use the preferred depth for the BPP default Thomas Zimmermann
2022-11-18 14:12 ` Javier Martinez Canillas
2022-11-22 14:43 ` Daniel Vetter
2022-11-22 14:43 ` Daniel Vetter
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=20221116160917.26342-8-tzimmermann@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@gmail.com \
--cc=airlied@redhat.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=jstultz@google.com \
--cc=kong.kongxinwei@hisilicon.com \
--cc=kraxel@redhat.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=paul.kocialkowski@bootlin.com \
--cc=puck.chen@hisilicon.com \
--cc=tiantao6@hisilicon.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=xinliang.liu@linaro.org \
/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: link
Be 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.