Imre Deak
2025-Aug-05 17:57 UTC
[PATCH v2 0/3] drm: Fix initializing format info in drm_framebuffer
This is v2 of [1], describing in the patch logs the functional issue the
patchset fixes based on Tomi's feedback and adding the T-b/A-b/R-b
tags.
I would like this patchset to be included in the v6.17-rc1 release, if
this is still possible. One way is to merge it to drm-misc-next-fixes,
if there won't be pull request from that branch any more, could the
maintainers suggest a better way?
Thanks,
Imre
[1] https://lore.kernel.org/all/20250728101603.243788-1-imre.deak at intel.com
Cc: Ville Syrj?l? <ville.syrjala at linux.intel.com>
Cc: Mark Brown <broonie at kernel.org>
Cc: Tomi Valkeinen <tomi.valkeinen at ideasonboard.com>
Cc: Lyude Paul <lyude at redhat.com>
Cc: Danilo Krummrich <dakr at kernel.org>
Cc: Alex Deucher <alexander.deucher at amd.com>
Cc: James Jones <jajones at nvidia.com>
Cc: Naresh Kamboju <naresh.kamboju at linaro.org>
Cc: David Airlie <airlied at gmail.com>
Cc: Simona Vetter <simona at ffwll.ch>
Cc: Christian K?nig <christian.koenig at amd.com>
Cc: Thomas Zimmermann <tzimmermann at suse.de>
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Cc: Maxime Ripard <mripard at kernel.org>
Cc: amd-gfx at lists.freedesktop.org
Cc: nouveau at lists.freedesktop.org
Imre Deak (3):
drm/omap: Pass along the format info from .fb_create() to
drm_helper_mode_fill_fb_struct()
drm/nouveau: Pass along the format info from .fb_create() to
drm_helper_mode_fill_fb_struct()
drm/radeon: Pass along the format info from .fb_create() to
drm_helper_mode_fill_fb_struct()
drivers/gpu/drm/nouveau/nouveau_display.c | 9 +++------
drivers/gpu/drm/nouveau/nouveau_display.h | 3 +++
drivers/gpu/drm/omapdrm/omap_fb.c | 23 ++++++++++-------------
drivers/gpu/drm/omapdrm/omap_fb.h | 2 ++
drivers/gpu/drm/omapdrm/omap_fbdev.c | 5 ++++-
drivers/gpu/drm/radeon/radeon_display.c | 5 +++--
drivers/gpu/drm/radeon/radeon_fbdev.c | 11 ++++++-----
drivers/gpu/drm/radeon/radeon_mode.h | 2 ++
8 files changed, 33 insertions(+), 27 deletions(-)
--
2.49.1
Imre Deak
2025-Aug-05 17:57 UTC
[PATCH v2 2/3] 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? <ville.syrjala at linux.intel.com>
Cc: Lyude Paul <lyude at redhat.com>
Cc: Danilo Krummrich <dakr at kernel.org>
Cc: Thomas Zimmermann <tzimmermann at suse.de>
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Cc: Maxime Ripard <mripard at kernel.org>
Cc: Tomi Valkeinen <tomi.valkeinen at ideasonboard.com>
Cc: nouveau at lists.freedesktop.org
Fixes: 41ab92d35ccd ("drm: Make passing of format info to
drm_helper_mode_fill_fb_struct() mandatory")
Link: https://lore.kernel.org/all/20250701090722.13645-1-ville.syrjala at
linux.intel.com
Acked-by: Alex Deucher <alexander.deucher at amd.com>
Acked-by: Danilo Krummrich <dakr at kernel.org>
Reviewed-by: James Jones <jajones at nvidia.com>
Tested-by: Linux Kernel Functional Testing <lkft at linaro.org>
Tested-by: James Jones <jajones at nvidia.com>
Signed-off-by: Imre Deak <imre.deak at intel.com>
---
drivers/gpu/drm/nouveau/nouveau_display.c | 9 +++------
drivers/gpu/drm/nouveau/nouveau_display.h | 3 +++
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c
b/drivers/gpu/drm/nouveau/nouveau_display.c
index e1e5421263103..805d0a87aa546 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.c
+++ b/drivers/gpu/drm/nouveau/nouveau_display.c
@@ -253,6 +253,7 @@ nouveau_check_bl_size(struct nouveau_drm *drm, struct
nouveau_bo *nvbo,
int
nouveau_framebuffer_new(struct drm_device *dev,
+ const struct drm_format_info *info,
const struct drm_mode_fb_cmd2 *mode_cmd,
struct drm_gem_object *gem,
struct drm_framebuffer **pfb)
@@ -260,7 +261,6 @@ nouveau_framebuffer_new(struct drm_device *dev,
struct nouveau_drm *drm = nouveau_drm(dev);
struct nouveau_bo *nvbo = nouveau_gem_object(gem);
struct drm_framebuffer *fb;
- const struct drm_format_info *info;
unsigned int height, i;
uint32_t tile_mode;
uint8_t kind;
@@ -295,9 +295,6 @@ nouveau_framebuffer_new(struct drm_device *dev,
kind = nvbo->kind;
}
- info = drm_get_format_info(dev, mode_cmd->pixel_format,
- mode_cmd->modifier[0]);
-
for (i = 0; i < info->num_planes; i++) {
height = drm_format_info_plane_height(info,
mode_cmd->height,
@@ -321,7 +318,7 @@ nouveau_framebuffer_new(struct drm_device *dev,
if (!(fb = *pfb = kzalloc(sizeof(*fb), GFP_KERNEL)))
return -ENOMEM;
- drm_helper_mode_fill_fb_struct(dev, fb, NULL, mode_cmd);
+ drm_helper_mode_fill_fb_struct(dev, fb, info, mode_cmd);
fb->obj[0] = gem;
ret = drm_framebuffer_init(dev, fb, &nouveau_framebuffer_funcs);
@@ -344,7 +341,7 @@ nouveau_user_framebuffer_create(struct drm_device *dev,
if (!gem)
return ERR_PTR(-ENOENT);
- ret = nouveau_framebuffer_new(dev, mode_cmd, gem, &fb);
+ ret = nouveau_framebuffer_new(dev, info, mode_cmd, gem, &fb);
if (ret == 0)
return fb;
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h
b/drivers/gpu/drm/nouveau/nouveau_display.h
index e45f211501f61..470e0910d4845 100644
--- a/drivers/gpu/drm/nouveau/nouveau_display.h
+++ b/drivers/gpu/drm/nouveau/nouveau_display.h
@@ -8,8 +8,11 @@
#include <drm/drm_framebuffer.h>
+struct drm_format_info;
+
int
nouveau_framebuffer_new(struct drm_device *dev,
+ const struct drm_format_info *info,
const struct drm_mode_fb_cmd2 *mode_cmd,
struct drm_gem_object *gem,
struct drm_framebuffer **pfb);
--
2.49.1
Imre Deak
2025-Aug-06 12:38 UTC
[PATCH v2 0/3] drm: Fix initializing format info in drm_framebuffer
On Tue, Aug 05, 2025 at 08:57:49PM +0300, Imre Deak wrote:> This is v2 of [1], describing in the patch logs the functional issue the > patchset fixes based on Tomi's feedback and adding the T-b/A-b/R-b > tags. > > I would like this patchset to be included in the v6.17-rc1 release, if > this is still possible. One way is to merge it to drm-misc-next-fixes, > if there won't be pull request from that branch any more, could the > maintainers suggest a better way?Ok, not sure if there will be a v6.17-rc1 PR from drm-misc-next-fixes, but merging the patchset there makes sense to me in any case, so did that now. Thanks for the report, testing, acks and reviews.> Thanks, > Imre > > [1] https://lore.kernel.org/all/20250728101603.243788-1-imre.deak at intel.com > > Cc: Ville Syrj?l? <ville.syrjala at linux.intel.com> > Cc: Mark Brown <broonie at kernel.org> > Cc: Tomi Valkeinen <tomi.valkeinen at ideasonboard.com> > Cc: Lyude Paul <lyude at redhat.com> > Cc: Danilo Krummrich <dakr at kernel.org> > Cc: Alex Deucher <alexander.deucher at amd.com> > Cc: James Jones <jajones at nvidia.com> > Cc: Naresh Kamboju <naresh.kamboju at linaro.org> > Cc: David Airlie <airlied at gmail.com> > Cc: Simona Vetter <simona at ffwll.ch> > Cc: Christian K?nig <christian.koenig at amd.com> > Cc: Thomas Zimmermann <tzimmermann at suse.de> > Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com> > Cc: Maxime Ripard <mripard at kernel.org> > Cc: amd-gfx at lists.freedesktop.org > Cc: nouveau at lists.freedesktop.org > > Imre Deak (3): > drm/omap: Pass along the format info from .fb_create() to > drm_helper_mode_fill_fb_struct() > drm/nouveau: Pass along the format info from .fb_create() to > drm_helper_mode_fill_fb_struct() > drm/radeon: Pass along the format info from .fb_create() to > drm_helper_mode_fill_fb_struct() > > drivers/gpu/drm/nouveau/nouveau_display.c | 9 +++------ > drivers/gpu/drm/nouveau/nouveau_display.h | 3 +++ > drivers/gpu/drm/omapdrm/omap_fb.c | 23 ++++++++++------------- > drivers/gpu/drm/omapdrm/omap_fb.h | 2 ++ > drivers/gpu/drm/omapdrm/omap_fbdev.c | 5 ++++- > drivers/gpu/drm/radeon/radeon_display.c | 5 +++-- > drivers/gpu/drm/radeon/radeon_fbdev.c | 11 ++++++----- > drivers/gpu/drm/radeon/radeon_mode.h | 2 ++ > 8 files changed, 33 insertions(+), 27 deletions(-) > > -- > 2.49.1 >