[Intel-gfx] [PATCH 04/26] drm/fb-helper: Add fill_info() functions
Daniel Vetter
daniel at ffwll.ch
Fri Jan 25 10:15:26 UTC 2019
On Fri, Jan 25, 2019 at 10:46 AM Noralf Trønnes <noralf at tronnes.org> wrote:
>
>
>
> Den 25.01.2019 09.48, skrev Daniel Vetter:
> > On Thu, Jan 24, 2019 at 06:40:52PM +0100, Noralf Trønnes wrote:
> >>
> >>
> >> Den 24.01.2019 17.58, skrev Daniel Vetter:
> >>> The fbdev split between fix and var information is kinda
> >>> pointless for drm drivers since everything is fixed: The fbdev
> >>> emulation doesn't support changing modes at all.
> >>>
> >>> Create a new simplified helper and use it in the generic fbdev
> >>> helper code. Follow-up patches will beef it up more and roll
> >>> it out to all drivers.
> >>>
> >>> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> >>> ---
> >>> drivers/gpu/drm/drm_fb_helper.c | 27 +++++++++++++++++++++++++--
> >>> include/drm/drm_fb_helper.h | 1 +
> >>> 2 files changed, 26 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> >>> index 5eaccd202f4f..34c4ed378796 100644
> >>> --- a/drivers/gpu/drm/drm_fb_helper.c
> >>> +++ b/drivers/gpu/drm/drm_fb_helper.c
> >>> @@ -2105,6 +2105,30 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpe
> >>> }
> >>> EXPORT_SYMBOL(drm_fb_helper_fill_var);
> >>>
> >>> +/**
> >>> + * drm_fb_helper_fill_info - initializes fbdev information
> >>> + * @info: fbdev instance to set up
> >>> + * @fb_helper: fb helper instance to use as template
> >>> + *
> >>> + *
> >>> + * Sets up the variable and fixed fbdev metainformation from the given fb helper
> >>> + * instance and the drm framebuffer allocated in &drm_fb_helper.fb.
> >>> + *
> >>> + * Drivers should call this (or their equivalent setup code) from their
> >>> + * &drm_fb_helper_funcs.fb_probe callback after having allocated the fbdev
> >>> + * backing storage framebuffer.
> >>> + */
> >>> +void drm_fb_helper_fill_info(struct fb_info *info,
> >>
> >> No need to pass in fb_info it's available as fb_helper->fbdev. Set by
> >> drm_fb_helper_alloc_fbi().
> >
> > Uh, I get to edit all the patches. Still, thanks for pointing out.
> >
> > I also realized that I've forgotten to add the dummy functiont for
> > !CONFIG_FB, will fix that too.
> >
> >>> + struct drm_fb_helper *fb_helper)
> >>> +{
> >>> + struct drm_framebuffer *fb = fb_helper->fb;
> >>> +
> >>> + drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
> >>> + drm_fb_helper_fill_var(info, fb_helper, fb->width, fb->height);
> >>
> >> AFAIU fb->width/height can be different from sizes->fb_width/fb_height
> >> when there's double/triple buffering. I belive you need to use the sizes
> >> values here.
> >
> > Yup they're bigger than the actual screen size, but so is sizes: For
> > overallocting we adjust sizes before we call ->fb_probe, and the
> > ->fb_probe callbacks in turn then call this helper. So I think it should
> > be all equivalent. Agreed or do I miss something?
>
> I did a test setting drm_fbdev_overalloc = 200:
>
> [drm:drm_setup_crtcs] desired mode 320x240 set on crtc 33 (0,0)
> [drm:drm_fb_helper_generic_probe] surface width(320), height(480) and
> bpp(16)
> [drm:drm_fb_helper_generic_probe] fb_width(320), fb_height(240)
>
> sizes->surface_height != sizes->fb_height
>
> sizes->surface_height is used to create the framebuffer -> fb->height.
> My driver doesn't allow me to create such a big framebuffer so I didn't
> see the actual fb->height value come out the other end, but I still
> believe you need to use sizes->fb_height.
Hm right, I totally missed that. So the right interface would be:
drm_fb_helper_fill_info(fb_helper, sizes);
I also just noticed tha we could move the call to
drm_fb_helper_fill_info into the helper itself, I think that would
work for all drivers.
-Daniel
>
> Noralf.
>
> > -Daniel
> >
> >>
> >> Noralf.
> >>
> >>> +
> >>> +}
> >>> +EXPORT_SYMBOL(drm_fb_helper_fill_info);
> >>> +
> >>> static int drm_fb_helper_probe_connector_modes(struct drm_fb_helper *fb_helper,
> >>> uint32_t maxX,
> >>> uint32_t maxY)
> >>> @@ -3163,8 +3187,7 @@ int drm_fb_helper_generic_probe(struct drm_fb_helper *fb_helper,
> >>> #endif
> >>> strcpy(fbi->fix.id, "DRM emulated");
> >>>
> >>> - drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->format->depth);
> >>> - drm_fb_helper_fill_var(fbi, fb_helper, sizes->fb_width, sizes->fb_height);
> >>> + drm_fb_helper_fill_info(fbi, fb_helper);
> >>>
> >>> if (fb->funcs->dirty) {
> >>> struct fb_ops *fbops;
> >>> diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
> >>> index bb9acea61369..e8d92724f472 100644
> >>> --- a/include/drm/drm_fb_helper.h
> >>> +++ b/include/drm/drm_fb_helper.h
> >>> @@ -292,6 +292,7 @@ void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helpe
> >>> uint32_t fb_width, uint32_t fb_height);
> >>> void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
> >>> uint32_t depth);
> >>> +void drm_fb_helper_fill_info(struct fb_info *info, struct drm_fb_helper *fb_helper);
> >>>
> >>> void drm_fb_helper_unlink_fbi(struct drm_fb_helper *fb_helper);
> >>>
> >>>
> >
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
More information about the Intel-gfx
mailing list