Message ID | 8f29a983d42d9d68bd8cae2f9481d3c139f8750a.1646683502.git.geert@linux-m68k.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm: Add support for low-color frame buffer formats | expand |
On 3/7/22 21:52, Geert Uytterhoeven wrote: > When allocating a frame buffer, the number of bits per pixel needed is > derived from the deprecated drm_format_info.cpp[] field. While this > works 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>
diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c index ce45e380f4a2028f..c6a279e3de95591a 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; @@ -372,7 +372,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;