Hi
Am 06.11.26 um 16:41 schrieb Oarora Etimis:
Thanks for your patch. I don't think it should be merged as it is.
The patch is absolutely correct.
1. The patch changes almost nothing
vkms takes the path where no explicit format is passed, so the
framebuffer is XRGB8888 before and after the patch. This is the
function that decides it
(drivers/gpu/drm/clients/drm_fbdev_client.c:drm_fbdev_client_setup()):
int drm_fbdev_client_setup(struct drm_device *dev, const struct drm_format_info
*format)
{
struct drm_fb_helper *fb_helper;
unsigned int color_mode;
int ret;
/* TODO: Use format info throughout DRM */
if (format) {
...
} else {
switch (dev->mode_config.preferred_depth) {
case 0:
case 24:
color_mode = 32;
break;
This is a workaround because the setting of format, depth and bpp has
always been somewhat inconsistent.
default:
color_mode = dev->mode_config.preferred_depth;
}
}
...
}
0 and 24 are two labels on the same branch, so the patch neither adds a
user of that branch nor removes one; it only changes which label vkms
takes. The only visible difference is that DRM_IOCTL_GET_CAP with
DRM_CAP_DUMB_PREFERRED_DEPTH returns 24 instead of 0.
User space (specifically Xorg) takes this value to decide about the
color format.
2. This field conflates depth and bpp; no value can fix that.
No, that field stores the depth, which is 24 for both RGB888 and
XRGB888. Drivers sometimes do conflate the meaning.
XRGB8888 is 24 bits of colour in 32 bits per pixel. This field holds the
first number, the fbdev helpers want the second, and the switch above is
what patches over the difference - without it, 24 would select RGB888.
And the newer formats have no depth to give. XRGB16161616 and its three
siblings are .depth = 0 in struct drm_format_info, and vkms advertises
all four on its primary plane. Move the default to one of them and
there is no number to write.
So 0 is not a placeholder waiting to be filled in; it is the only value
that does not claim to name a format.
That's also not really the case. Ideally, we want preferred_depth to go
away in all drivers. Instead the primary plane would tell us what the
preferred depth is. But that's not so easy and might never work.
Setting the correct value to preferred_depth it the next best thing.
3. Deleting the comment loses the only explanation of 0
The current comment is misleading. There is no confusion about depth and
bpp.
Best regards
Thomas
Nothing else in the tree says what 0 means here. The kerneldoc for
preferred_depth is a single line, "preferred RBG pixel depth, used by fb
helpers", and does not mention 0 at all. If that FIXME goes, the next
person who wonders why vkms writes 0 has nowhere to look. If it has to
go because the helper no longer substitutes depth for bpp, then replace
it with something that still explains the 0.
Thanks,
Oarora Etimis
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)