diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2022-07-08 21:20:49 +0300 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2022-07-09 16:01:20 +0300 |
commit | 4c59b0805e9bf873fd3f5dca4fc53d8c220e39b4 (patch) | |
tree | 8b645c575991a66c7234e08b58e0d059b8af4950 | |
parent | 356d2c8e76ebb1134a0685ce4b923d8201337475 (diff) | |
download | linux-4c59b0805e9bf873fd3f5dca4fc53d8c220e39b4.tar.xz |
drm/framebuffer: Use actual bpp for DRM_IOCTL_MODE_GETFB
When userspace queries the properties of a frame buffer, the number of
bits per pixel is derived from the deprecated drm_format_info.cpp[]
field, which does not take into account block sizes.
Fix this by using the actual number of bits per pixel instead.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/b612780feef200b7f914a674db28ed227e7cdc64.1657294931.git.geert@linux-m68k.org
-rw-r--r-- | drivers/gpu/drm/drm_framebuffer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 4562a8b86579..9899bf1485b2 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -530,7 +530,7 @@ int drm_mode_getfb(struct drm_device *dev, r->height = fb->height; r->width = fb->width; r->depth = fb->format->depth; - r->bpp = fb->format->cpp[0] * 8; + r->bpp = drm_format_info_bpp(fb->format, 0); r->pitch = fb->pitches[0]; /* GET_FB() is an unprivileged ioctl so we must not return a |