drm/nouveau: Pass along the format info from .fb_create() nouveau_framebuffer_new()
Subsystems (3)
PATCH 1/1 drm/nouveau: Pass along the format info from .fb_create() nouveau_framebuffer_new()
Plumb the format info from .fb_create() all the way to nouveau_framebuffer_new() to avoid the redundant lookup. Also plumb the format info from there down to drm_helper_mode_fill_fb_struct() as required, avoiding a WARN_ON() and failure every time this path is used, e.g., during fbdev init.
--- drivers/gpu/drm/nouveau/nouveau_display.c | 9 +++------ drivers/gpu/drm/nouveau/nouveau_display.h | 1 + 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nouveau_display.c +3 -6
@@ -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;
drivers/gpu/drm/nouveau/nouveau_display.h +1 -0
@@ -10,6 +10,7 @@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);
Signature · 1 line
2.50.1
Quoted 10 lines · James Jones
Plumb the format info from .fb_create() all the way to
nouveau_framebuffer_new()to avoid the redundant lookup. Also plumb the format info from there down todrm_helper_mode_fill_fb_struct()as required, avoiding aWARN_ON()and failure every time this path is used, e.g., during fbdev init.Fixes 41ab92d35ccd ("drm: Make passing of format info to drm_helper_mode_fill_fb_struct() mandatory")Signed-off-by James Jones <[email protected]>CC Ville Syrjälä <[email protected]>
I posted this change already:
https://lore.kernel.org/all/[email protected]
Quoted 68 lines
--- drivers/gpu/drm/nouveau/nouveau_display.c | 9 +++------ drivers/gpu/drm/nouveau/nouveau_display.h | 1 + 2 files changed, 4 insertions(+), 6 deletions(-)drivers/gpu/drm/nouveau/nouveau_display.c +3
-6@@ -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;drivers/gpu/drm/nouveau/nouveau_display.h +1
-0@@ -10,6 +10,7 @@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);Signature · 1 line
2.50.1
Apologies, I saw your changes for another chipset, but missed the nouveau part. I've responded to your thread now. Thanks for making the fix!
-James
Quoted 83 lines · Imre Deak
Quoted 10 lines · James Jones
Plumb the format info from .fb_create() all the way to
nouveau_framebuffer_new()to avoid the redundant lookup. Also plumb the format info from there down todrm_helper_mode_fill_fb_struct()as required, avoiding aWARN_ON()and failure every time this path is used, e.g., during fbdev init.Fixes 41ab92d35ccd ("drm: Make passing of format info to drm_helper_mode_fill_fb_struct() mandatory")Signed-off-by James Jones <[email protected]>CC Ville Syrjälä <[email protected]>I posted this change already:
https://lore.kernel.org/all/[email protected]Quoted 68 lines
--- drivers/gpu/drm/nouveau/nouveau_display.c | 9 +++------ drivers/gpu/drm/nouveau/nouveau_display.h | 1 + 2 files changed, 4 insertions(+), 6 deletions(-)drivers/gpu/drm/nouveau/nouveau_display.c +3
-6@@ -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;drivers/gpu/drm/nouveau/nouveau_display.h +1
-0@@ -10,6 +10,7 @@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);Signature · 1 line
2.50.1
Quoted 2 lines · James Jones
Apologies, I saw your changes for another chipset, but missed the nouveau part.
Ok, no problem, thanks for testing it and the review. The omap patch is still missing an ack/review, the patchset can be merged after an omap maintainer can provide that.
Quoted 82 lines
I've responded to your thread now. Thanks for making the fix!
-James
Quoted 76 lines · Imre Deak
Quoted 10 lines · James Jones
Plumb the format info from .fb_create() all the way to
nouveau_framebuffer_new()to avoid the redundant lookup. Also plumb the format info from there down todrm_helper_mode_fill_fb_struct()as required, avoiding aWARN_ON()and failure every time this path is used, e.g., during fbdev init.Fixes 41ab92d35ccd ("drm: Make passing of format info to drm_helper_mode_fill_fb_struct() mandatory")Signed-off-by James Jones <[email protected]>CC Ville Syrjälä <[email protected]>I posted this change already:
https://lore.kernel.org/all/[email protected]Quoted 61 lines
--- drivers/gpu/drm/nouveau/nouveau_display.c | 9 +++------ drivers/gpu/drm/nouveau/nouveau_display.h | 1 + 2 files changed, 4 insertions(+), 6 deletions(-)drivers/gpu/drm/nouveau/nouveau_display.c +3
-6@@ -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;drivers/gpu/drm/nouveau/nouveau_display.h +1
-0@@ -10,6 +10,7 @@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);Signature · 1 line
2.50.1