Skip to content

Commit d2b524c

Browse files
committed
drm/nouveau: Pass along the format info from .fb_create() to drm_helper_mode_fill_fb_struct()
Plumb the format info from .fb_create() all the way to drm_helper_mode_fill_fb_struct() to avoid the redundant lookup. The patch is based on the driver parts of the patchset at Link: below, which missed converting the nouveau driver. Due to the absence of this change in the patchset at Link:, after the Fixed: commit below, nouveau_framebuffer_new() -> drm_helper_mode_fill_fb_struct() set drm_framebuffer::format incorrectly to NULL, which lead to the !fb->format WARN() in drm_framebuffer_init() and causing framebuffer creation to fail. This patch fixes both of these issues. v2: Amend the commit log mentioning the functional issues the patch fixes. (Tomi) Cc: Ville Syrjälä <[email protected]> Cc: Lyude Paul <[email protected]> Cc: Danilo Krummrich <[email protected]> Cc: Thomas Zimmermann <[email protected]> Cc: Maarten Lankhorst <[email protected]> Cc: Maxime Ripard <[email protected]> Cc: Tomi Valkeinen <[email protected]> Cc: [email protected] Fixes: 41ab92d ("drm: Make passing of format info to drm_helper_mode_fill_fb_struct() mandatory") Link: https://lore.kernel.org/all/[email protected] Acked-by: Alex Deucher <[email protected]> Acked-by: Danilo Krummrich <[email protected]> Reviewed-by: James Jones <[email protected]> Tested-by: Linux Kernel Functional Testing <[email protected]> Tested-by: James Jones <[email protected]> Signed-off-by: Imre Deak <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f8f6e72 commit d2b524c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

drivers/gpu/drm/nouveau/nouveau_display.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,14 @@ nouveau_check_bl_size(struct nouveau_drm *drm, struct nouveau_bo *nvbo,
253253

254254
int
255255
nouveau_framebuffer_new(struct drm_device *dev,
256+
const struct drm_format_info *info,
256257
const struct drm_mode_fb_cmd2 *mode_cmd,
257258
struct drm_gem_object *gem,
258259
struct drm_framebuffer **pfb)
259260
{
260261
struct nouveau_drm *drm = nouveau_drm(dev);
261262
struct nouveau_bo *nvbo = nouveau_gem_object(gem);
262263
struct drm_framebuffer *fb;
263-
const struct drm_format_info *info;
264264
unsigned int height, i;
265265
uint32_t tile_mode;
266266
uint8_t kind;
@@ -295,9 +295,6 @@ nouveau_framebuffer_new(struct drm_device *dev,
295295
kind = nvbo->kind;
296296
}
297297

298-
info = drm_get_format_info(dev, mode_cmd->pixel_format,
299-
mode_cmd->modifier[0]);
300-
301298
for (i = 0; i < info->num_planes; i++) {
302299
height = drm_format_info_plane_height(info,
303300
mode_cmd->height,
@@ -321,7 +318,7 @@ nouveau_framebuffer_new(struct drm_device *dev,
321318
if (!(fb = *pfb = kzalloc(sizeof(*fb), GFP_KERNEL)))
322319
return -ENOMEM;
323320

324-
drm_helper_mode_fill_fb_struct(dev, fb, NULL, mode_cmd);
321+
drm_helper_mode_fill_fb_struct(dev, fb, info, mode_cmd);
325322
fb->obj[0] = gem;
326323

327324
ret = drm_framebuffer_init(dev, fb, &nouveau_framebuffer_funcs);
@@ -344,7 +341,7 @@ nouveau_user_framebuffer_create(struct drm_device *dev,
344341
if (!gem)
345342
return ERR_PTR(-ENOENT);
346343

347-
ret = nouveau_framebuffer_new(dev, mode_cmd, gem, &fb);
344+
ret = nouveau_framebuffer_new(dev, info, mode_cmd, gem, &fb);
348345
if (ret == 0)
349346
return fb;
350347

drivers/gpu/drm/nouveau/nouveau_display.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@
88

99
#include <drm/drm_framebuffer.h>
1010

11+
struct drm_format_info;
12+
1113
int
1214
nouveau_framebuffer_new(struct drm_device *dev,
15+
const struct drm_format_info *info,
1316
const struct drm_mode_fb_cmd2 *mode_cmd,
1417
struct drm_gem_object *gem,
1518
struct drm_framebuffer **pfb);

0 commit comments

Comments
 (0)