Skip to content

Commit

Permalink
drm/client: Convert drm_client_buffer_addfb() to drm_mode_addfb2()
Browse files Browse the repository at this point in the history
Currently drm_client_buffer_addfb() uses the legacy drm_mode_addfb(),
which uses bpp and depth to guess the wanted buffer format.
However, drm_client_buffer_addfb() already knows the exact buffer
format, so there is no need to convert back and forth between buffer
format and bpp/depth, and the function can just call drm_mode_addfb2()
directly instead.

Signed-off-by: Geert Uytterhoeven <[email protected]>
Reviewed-by: Javier Martinez Canillas <[email protected]>
Tested-by: Javier Martinez Canillas <[email protected]>
Signed-off-by: Hamza Mahfooz <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/4b84adfc686288714e69d0442d22f1259ff74903.1697379891.git.geert@linux-m68k.org
  • Loading branch information
geertu authored and effective-light committed Oct 24, 2023
1 parent f70a669 commit 6ae2ff2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions drivers/gpu/drm/drm_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,19 +395,16 @@ static int drm_client_buffer_addfb(struct drm_client_buffer *buffer,
u32 handle)
{
struct drm_client_dev *client = buffer->client;
struct drm_mode_fb_cmd fb_req = { };
const struct drm_format_info *info;
struct drm_mode_fb_cmd2 fb_req = { };
int ret;

info = drm_format_info(format);
fb_req.bpp = drm_format_info_bpp(info, 0);
fb_req.depth = info->depth;
fb_req.width = width;
fb_req.height = height;
fb_req.handle = handle;
fb_req.pitch = buffer->pitch;
fb_req.pixel_format = format;
fb_req.handles[0] = handle;
fb_req.pitches[0] = buffer->pitch;

ret = drm_mode_addfb(client->dev, &fb_req, client->file);
ret = drm_mode_addfb2(client->dev, &fb_req, client->file);
if (ret)
return ret;

Expand Down

0 comments on commit 6ae2ff2

Please sign in to comment.