All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: John Stultz <john.stultz@linaro.org>
Cc: "David Lechner" <david@lechnology.com>,
	"Xinliang Liu" <xinliang.liu@linaro.org>,
	"Intel Graphics Development" <intel-gfx@lists.freedesktop.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>
Subject: Re: [PATCH v5 4/8] drm/cma-helper: Use the generic fbdev emulation
Date: Thu, 23 Aug 2018 09:37:51 +0200	[thread overview]
Message-ID: <20180823073751.GX21634@phenom.ffwll.local> (raw)
In-Reply-To: <CALAqxLXh2OPdatWSiSYwS+FOHcoaQdTqbUS46FVOGkTpTxV52Q@mail.gmail.com>

On Wed, Aug 22, 2018 at 11:21:11PM -0700, John Stultz wrote:
> On Wed, Aug 22, 2018 at 10:51 PM, Daniel Vetter <daniel@ffwll.ch> wrote:
> > On Thu, Aug 23, 2018 at 6:14 AM, John Stultz <john.stultz@linaro.org> wrote:
> >> On Mon, Aug 20, 2018 at 11:44 PM, John Stultz <john.stultz@linaro.org> wrote:
> >>> Hey Noralf, all,
> >>>   I've been digging for a bit on the regression that this patch has
> >>> tripped on the HiKey board as reported here:
> >>> https://lkml.org/lkml/2018/8/16/81
> >>>
> >>> The first issue was that the kirin driver was setting
> >>> mode_config.max_width/height = 2048, which was causing errors as the
> >>> the requested resolution was 1920x2160 (due to surfaceflinger
> >>> requesting y*2 for page flipping).
> >>
> >> Hey Noralf,
> >>   Sorry, I know your probably sick of me. But I just wanted to circle
> >> around on this little bit. So part of the issue I found earlier, was
> >> that I'm running w/ CONFIG_DRM_FBDEV_OVERALLOC=200, to support
> >> Surfaceflinger's request for page flipping. This is what makes the Y
> >> resolution 2160, which runs afoul of the new max_height check of 2048
> >> in the generic code.
> >>
> >> I was checking with Xinliang, who know the kirin display hardware,
> >> about the max_height being set to 2048 to ensure bumping it up wasn't
> >> a problem, but he said 2048x2048  was unfortunately not arbitrary, and
> >> that was the hard limit of the display hardware. However, with
> >> overalloc, the 1920x2160 res fbdev should still be ok, as only
> >> 1920x1080 is actually displayed at one time.
> >>
> >> So it seems like we might need to multiply the max_height by the
> >> overalloc factor when we are checking it in
> >> drm_internal_framebuffer_create?
> >>
> >> Does that approach sound sane, or would folks prefer something different?
> >
> > I guess we could simply not check against the height limit when
> > allocating framebuffers. But we've done that for userspace buffers
> > since forever (they just allocate 2 buffers for page-flipping), so I
> > have no idea what would all break if we'd suddenly lift this
> > restriction. And whether we'd lift it for fbdev only or for everyone
> > doesn't really make much of a difference, since either this works, or
> > it doesn't (across all chips).
> 
> That feels a bit more risky then what I was thinking.  What about
> something like (apologies, whitespace corrupted)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index fe7e545..0424a71 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -1810,6 +1810,7 @@ static int drm_fb_helper_single_fb_probe(struct
> drm_fb_helper *fb_helper,
>         int i;
>         struct drm_fb_helper_surface_size sizes;
>         int gamma_size = 0;
> +       struct drm_mode_config *config;
> 
>         memset(&sizes, 0, sizeof(struct drm_fb_helper_surface_size));
>         sizes.surface_depth = 24;
> @@ -1910,6 +1911,11 @@ static int drm_fb_helper_single_fb_probe(struct
> drm_fb_helper *fb_helper,
>         sizes.surface_height *= drm_fbdev_overalloc;
>         sizes.surface_height /= 100;
> 
> +       config = &fb_helper->client.dev->mode_config;
> +       config->max_height *= drm_fbdev_overalloc;
> +       config->max_height /= 100;
> +
> +
>         /* push down into drivers */
>         ret = (*fb_helper->funcs->fb_probe)(fb_helper, &sizes);
>         if (ret < 0)
> 
> 
> That way it only effects the fbdev + overalloc case?

Still changes it for everyone, not just fbdev, if you enable overalloc.
You'd need to reset.

Another, cleaner way to fix this would be to overallocate the buffer, but
have the drm_framebuffer limited. But that means we need to change the
fbdev scrolling logic. And the entire interface between fbdev helpers and
drivers needs a rework, since atm the driver allocates the drm_framebuffer
for you. That's what userspace can/will do in this case I guess. Has all
the issues of scrolling by moving the drm_fb without hw knowledge.

I guess maybe just dropping the max_height check in fbdev is ok, if we put
a really big comment/FIXME there. Or maybe make it conditional on
fbdev_overalloc being at the default value, that'd probably be better
even.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-08-23  7:37 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-03 16:03 [PATCH v5 0/8] drm: Add generic fbdev emulation Noralf Trønnes
2018-07-03 16:03 ` [PATCH v5 1/8] drm: Begin an API for in-kernel clients Noralf Trønnes
2018-07-03 16:03 ` [PATCH v5 2/8] drm/fb-helper: Add generic fbdev emulation .fb_probe function Noralf Trønnes
2018-07-03 16:03 ` [PATCH v5 3/8] drm/pl111: Set .gem_prime_vmap and .gem_prime_mmap Noralf Trønnes
2018-07-03 16:03 ` [PATCH v5 4/8] drm/cma-helper: Use the generic fbdev emulation Noralf Trønnes
2018-08-21  6:44   ` John Stultz
2018-08-21  8:44     ` Daniel Vetter
2018-08-21 14:59       ` Noralf Trønnes
2018-08-21 15:41         ` Daniel Vetter
2018-08-21 16:03           ` Noralf Trønnes
2018-08-21 16:46             ` Daniel Vetter
2018-08-21 18:43         ` John Stultz
2018-08-22  7:56           ` Daniel Vetter
2018-08-21 14:15     ` Noralf Trønnes
2018-08-23  4:14     ` John Stultz
2018-08-23  5:51       ` Daniel Vetter
2018-08-23  6:21         ` John Stultz
2018-08-23  7:37           ` Daniel Vetter [this message]
2018-08-23 16:49             ` Noralf Trønnes
2018-08-23 17:15               ` Daniel Vetter
2018-08-23  7:46       ` Laurent Pinchart
2018-08-23  8:09         ` Daniel Vetter
2018-08-23 17:48           ` John Stultz
2018-08-23 20:49             ` Laurent Pinchart
2018-08-23 21:12               ` John Stultz
2018-08-24  8:57                 ` Laurent Pinchart
2018-08-23 17:38         ` John Stultz
2018-08-23 17:24       ` Ville Syrjälä
2018-08-23 17:42         ` John Stultz
2018-07-03 16:03 ` [PATCH v5 5/8] drm/debugfs: Add internal client debugfs file Noralf Trønnes
2018-07-03 16:03 ` [PATCH v5 6/8] drm/fb-helper: Finish the generic fbdev emulation Noralf Trønnes
2018-07-03 16:03 ` [PATCH v5 7/8] drm/tinydrm: Use drm_fbdev_generic_setup() Noralf Trønnes
2018-07-03 16:03 ` [PATCH v5 8/8] drm/cma-helper: Remove drm_fb_cma_fbdev_init_with_funcs() Noralf Trønnes
2018-07-03 16:15 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Add generic fbdev emulation Patchwork
2018-07-03 16:18 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-07-03 16:32 ` ✓ Fi.CI.BAT: success " Patchwork
2018-07-04  2:38 ` ✓ Fi.CI.IGT: " Patchwork
2018-07-04  8:19 ` [PATCH v5 0/8] " Daniel Vetter
2018-07-10 13:10 ` Noralf Trønnes
2018-08-23  6:25 ` ✗ Fi.CI.BAT: failure for drm: Add generic fbdev emulation (rev2) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180823073751.GX21634@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=david@lechnology.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=john.stultz@linaro.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=noralf@tronnes.org \
    --cc=xinliang.liu@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.