From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: shobhit.kumar@intel.com, akash.goel@intel.com,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 6/6] drm/i915: New drm crtc property for varying the Crtc size
Date: Thu, 14 Aug 2014 18:06:58 +0300 [thread overview]
Message-ID: <20140814150658.GF4193@intel.com> (raw)
In-Reply-To: <20140814144201.GS10500@phenom.ffwll.local>
On Thu, Aug 14, 2014 at 04:42:01PM +0200, Daniel Vetter wrote:
> On Thu, Aug 14, 2014 at 02:54:27PM +0530, akash.goel@intel.com wrote:
> > From: Akash Goel <akash.goel@intel.com>
> > + /* Check if the current FB is compatible with new requested
> > + Pipesrc values by the User */
> > + if (new_width > fb->width ||
> > + new_height > fb->height ||
> > + crtc->x > fb->width - new_width ||
> > + crtc->y > fb->height - new_height) {
> > + DRM_DEBUG_KMS("New Pipe Src values %dx%d is incompatible with current fb size & viewport %ux%u+%d+%d\n",
> > + new_width, new_height, fb->width, fb->height, crtc->x, crtc->y);
> > + return -EINVAL;
> > + }
>
> I think this part here is the achilles heel of your approach. Right now we
> use crtc->mode.hdisplay/vdisplay
We don't use it in i915. If we do that's a bug. All the relevant places
should be loooking at pipe_src_{w,h}. In the core the viewport check
should be about the only place that cares about this stuff.
> in a lot of places both in i915 and the
> drm core to make sure that the primary plane fb, sprite fb and positioning
> and cursor placement all make sense.
>
> If my understanding of the pipe src rectangle is correct (please correct
> me if I'm wrong) we should switch _all_ these checks to instead look at
> the new crtc_w/h field. Even worse that we need to change drm core code
> and as a result of that all drm drivers. Awful lot of code to check, test
> and for i915 validate with i-g-t testcases.
>
> Now the solution thus far (for the normal panel fitter operation) is that
> the logical input mode for the crtc ends up in crtc->config.mode and as a
> copy in crtc->mode. And the actual output mode is in
> crtc->config.adjusted_mode.
>
> Our modeset code already takes care of copying crtc->config.mode to
> crtc->mode, so we only need to concern ourselfs with crtc->config.mode. If
> we'd copy the pipe_src_w/h values back into it the existing code would
> still be able to check all the sprite/cursor/fb constraints.
>
> So the flow on a modeset (and that's what we'll end up calling from the
> set_property function too) is:
>
> 1. Userspace requested mode goes into pipe_config->mode.
> 2. We make a copy into pipe_config->adjusted_mode and frob it more.
> 3. crtc compute_config code notices the special pipe src window, and
> adjusts pipe_config->mode plus computes the panel fitter configuration.
>
> If all that checks out we continue with the modeset sequence.
>
> 4. We store the new pipe_config into crtc->config.
> 5. Actual hw register writes for the modeset change happens.
> 6. We copy crtc->config.mode into crtc->mode so that drm core and helper
> functions can validate fb/sprite/cursors again.
We shouldn't just magically change the user specified mode, we need it
to stay intact for a subsequent modeset so that we can start the
adjusted_mode frobbery fresh next time around. It also seems weird to
report back a different mode to userspace than what the user provided.
What you suggest was exactly the previous approach and I NAKed it.
> The result would be that the set_property function here would do _no_
> argument checking, but would instead fully rely upon the modeset sequence
> to compute the desired configuration.
We don't have sufficient checks in the modeset path. The
drm_crtc_check_viewport() call is in drm_mode_setcrtc() which is too
high up in the stack to affect modesets originating from property
changes. That being said we should definitely use drm_crtc_check_viewport()
here instead of hand rolling the exacty same thing in i915.
And to avoid having to touch too much code, drm_crtc_check_viewport()
should encapsulate the logic to fall back to mode->{h,v}display when
crtc->{w,h} are zero.
> And if it fails it would restore the
> old configuration like you already do.
>
> Now test coverage: I think we need a few i-g-ts that provoke this, i.e.
> which set the pipe_src != requested mode and then place cursor/sprite/fb
> to validate that the checking is still correct.
>
> Aside: In the shiny new world of atomic display updates we always need to
> have similar procedures i.e.
>
> 1. Store state without much checking.
> 2. Run full modeset machinery to compute the new resulting state.
> 3. Check that, and only if that checks out, commit it.
>
> If we duplicate special cases of these checks all over, then we'll have an
> unmaintainable mess in shorter order. C.f. compare the discussion about
> rotation properties.
>
> Thoughts, better ideas and issues with this plan?
>
> Thanks, Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel OTC
next prev parent reply other threads:[~2014-08-14 15:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-14 9:24 [PATCH 0/6] New drm crtc property for varying the Crtc size akash.goel
2014-08-14 9:24 ` [PATCH 1/6] drm/i915: Added a return type for panel fitter config functions akash.goel
2014-08-14 9:24 ` [PATCH 2/6] drm/i915: Added a return type for the restore crtc mode function akash.goel
2014-08-14 9:24 ` [PATCH 3/6] drm/i915: Added Max down-scale ratio checks when enabling Panel fitter akash.goel
2014-08-14 9:24 ` [PATCH 4/6] drm/i915: Added support to allow change in FB pitch across flips akash.goel
2014-08-14 14:27 ` Daniel Vetter
2014-08-14 9:24 ` [PATCH 5/6] Documentation/drm: Describing crtc size property akash.goel
2014-08-14 9:24 ` [PATCH 6/6] drm/i915: New drm crtc property for varying the Crtc size akash.goel
2014-08-14 14:42 ` Daniel Vetter
2014-08-14 15:06 ` Ville Syrjälä [this message]
2014-08-14 15:26 ` Daniel Vetter
2014-08-14 15:32 ` Ville Syrjälä
2014-08-14 15:45 ` Ville Syrjälä
2014-08-14 16:07 ` Daniel Vetter
2014-08-14 16:45 ` Ville Syrjälä
2014-08-14 17:36 ` Daniel Vetter
2014-08-14 17:58 ` Ville Syrjälä
2014-08-14 18:33 ` Daniel Vetter
2014-08-14 18:51 ` Ville Syrjälä
2014-08-14 15:32 ` [PATCH 0/6] " Damien Lespiau
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=20140814150658.GF4193@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=akash.goel@intel.com \
--cc=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=shobhit.kumar@intel.com \
/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.