Message ID | ZS4eX0PtTuNvHezILcTWeWINOkRyMS4krXND3cIE@cp4-web-032.plabs.ch (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] drm: log errors in drm_gem_fb_init_with_funcs | expand |
On 05/03, Simon Ser wrote: > Let the user know what went wrong in drm_gem_fb_init_with_funcs > failure paths. > > v2: use proper format specifier for size_t (kernel test robot) > > Signed-off-by: Simon Ser <contact@emersion.fr> > Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > Cc: Sam Ravnborg <sam@ravnborg.org> > Cc: Noralf Trønnes <noralf@tronnes.org> > Cc: Andrzej Pietrasiewicz <andrzej.p@collabora.com> > --- > drivers/gpu/drm/drm_gem_framebuffer_helper.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c > index 109d11fb4cd4..aeb808a0ba54 100644 > --- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c > +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c > @@ -155,8 +155,10 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev, > int ret, i; > > info = drm_get_format_info(dev, mode_cmd); > - if (!info) > + if (!info) { > + drm_dbg_kms(dev, "Failed to get FB format info\n"); Just for curiosity, Why not say something like "FB format is not supported" by the driver? I'm asking because the kernel-doc for drm_get_format_info says "NULL if the format is unsupported". Thanks Siqueira > return -EINVAL; > + } > > for (i = 0; i < info->num_planes; i++) { > unsigned int width = mode_cmd->width / (i ? info->hsub : 1); > @@ -175,6 +177,9 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev, > + mode_cmd->offsets[i]; > > if (objs[i]->size < min_size) { > + drm_dbg_kms(dev, > + "GEM object size (%zu) smaller than minimum size (%u) for plane %d\n", > + objs[i]->size, min_size, i); > drm_gem_object_put(objs[i]); > ret = -EINVAL; > goto err_gem_object_put; > -- > 2.31.1 > > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&data=04%7C01%7CRodrigo.Siqueira%40amd.com%7Cd602106c4a3d4f0d9ba208d90e28289f%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637556387922456015%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=b%2B7HCBCtToQVE5nJ9gqTr9vV1Amj4PS%2BXJSJB5743%2Fc%3D&reserved=0
On Monday, May 3rd, 2021 at 4:20 PM, Rodrigo Siqueira <Rodrigo.Siqueira@amd.com> wrote: > > diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c > > index 109d11fb4cd4..aeb808a0ba54 100644 > > --- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c > > +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c > > @@ -155,8 +155,10 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev, > > int ret, i; > > > > info = drm_get_format_info(dev, mode_cmd); > > - if (!info) > > + if (!info) { > > + drm_dbg_kms(dev, "Failed to get FB format info\n"); > > Just for curiosity, > Why not say something like "FB format is not supported" by the driver? > I'm asking because the kernel-doc for drm_get_format_info says "NULL if > the format is unsupported". As Ville said, if things got this far and the format is unsupported, something must be going wrong. I'm not confident enough to switch this to a WARN_ON, though.
On 05/03, Simon Ser wrote: > On Monday, May 3rd, 2021 at 4:20 PM, Rodrigo Siqueira <Rodrigo.Siqueira@amd.com> wrote: > > > > diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c > > > index 109d11fb4cd4..aeb808a0ba54 100644 > > > --- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c > > > +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c > > > @@ -155,8 +155,10 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev, > > > int ret, i; > > > > > > info = drm_get_format_info(dev, mode_cmd); > > > - if (!info) > > > + if (!info) { > > > + drm_dbg_kms(dev, "Failed to get FB format info\n"); > > > > Just for curiosity, > > Why not say something like "FB format is not supported" by the driver? > > I'm asking because the kernel-doc for drm_get_format_info says "NULL if > > the format is unsupported". > > As Ville said, if things got this far and the format is unsupported, something > must be going wrong. I'm not confident enough to switch this to a WARN_ON, > though. Hi Simon, thanks for your explanation. Is it common to get "!info" equal true? If not, and imho, I think that WARN_ON would be good to raise attention to a possible issue.
On Wednesday, May 5th, 2021 at 2:14 AM, Rodrigo Siqueira <Rodrigo.Siqueira@amd.com> wrote: > > As Ville said, if things got this far and the format is unsupported, something > > must be going wrong. I'm not confident enough to switch this to a WARN_ON, > > though. > > Hi Simon, thanks for your explanation. > > Is it common to get "!info" equal true? If not, and imho, I think that > WARN_ON would be good to raise attention to a possible issue. Maybe, but: - I don't know enough to tell. - Should be a separate patch anyway if we want to go with this, so that the WARN_ON can easily be reverted if need be (without reverting the logging additions).
diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c index 109d11fb4cd4..aeb808a0ba54 100644 --- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c @@ -155,8 +155,10 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev, int ret, i; info = drm_get_format_info(dev, mode_cmd); - if (!info) + if (!info) { + drm_dbg_kms(dev, "Failed to get FB format info\n"); return -EINVAL; + } for (i = 0; i < info->num_planes; i++) { unsigned int width = mode_cmd->width / (i ? info->hsub : 1); @@ -175,6 +177,9 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev, + mode_cmd->offsets[i]; if (objs[i]->size < min_size) { + drm_dbg_kms(dev, + "GEM object size (%zu) smaller than minimum size (%u) for plane %d\n", + objs[i]->size, min_size, i); drm_gem_object_put(objs[i]); ret = -EINVAL; goto err_gem_object_put;