summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_client.c
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert@linux-m68k.org>2022-07-08 20:20:48 +0200
committerSam Ravnborg <sam@ravnborg.org>2022-07-09 15:00:52 +0200
commit356d2c8e76ebb1134a0685ce4b923d8201337475 (patch)
tree96faa5b150816c53d8f7d54cdd74182a295c02fc /drivers/gpu/drm/drm_client.c
parentdrm/fourcc: Add drm_format_info.is_color_indexed flag (diff)
downloadlinux-356d2c8e76ebb1134a0685ce4b923d8201337475.tar.xz
linux-356d2c8e76ebb1134a0685ce4b923d8201337475.zip
drm/client: Use actual bpp when allocating frame buffers
When allocating a frame buffer, the number of bits per pixel needed is derived from the deprecated drm_format_info.cpp[] field. While this may work for formats using less than 8 bits per pixel, it does lead to a large overallocation. Reduce memory consumption by using the actual number of bits per pixel instead. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/eabcf4f298184dabe46823fcf5ceffa1da0ec7ef.1657294931.git.geert@linux-m68k.org
Diffstat (limited to 'drivers/gpu/drm/drm_client.c')
-rw-r--r--drivers/gpu/drm/drm_client.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index af3b7395bf69..2b230b4d6942 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -264,7 +264,7 @@ drm_client_buffer_create(struct drm_client_dev *client, u32 width, u32 height, u
dumb_args.width = width;
dumb_args.height = height;
- dumb_args.bpp = info->cpp[0] * 8;
+ dumb_args.bpp = drm_format_info_bpp(info, 0);
ret = drm_mode_create_dumb(dev, &dumb_args, client->file);
if (ret)
goto err_delete;
@@ -373,7 +373,7 @@ static int drm_client_buffer_addfb(struct drm_client_buffer *buffer,
int ret;
info = drm_format_info(format);
- fb_req.bpp = info->cpp[0] * 8;
+ fb_req.bpp = drm_format_info_bpp(info, 0);
fb_req.depth = info->depth;
fb_req.width = width;
fb_req.height = height;