From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: "Daniel Vetter" <daniel@ffwll.ch>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915/skl: Allow universal planes to position
Date: Thu, 8 Oct 2015 09:58:34 +0100 [thread overview]
Message-ID: <5616303A.5060809@linux.intel.com> (raw)
In-Reply-To: <20151007141954.GJ3383@phenom.ffwll.local>
On 07/10/15 15:19, Daniel Vetter wrote:
> On Tue, Oct 06, 2015 at 07:28:10PM +0300, Ville Syrjälä wrote:
>> On Tue, Oct 06, 2015 at 08:16:19AM -0700, Matt Roper wrote:
>>> On Tue, Oct 06, 2015 at 05:42:42PM +0300, Ville Syrjälä wrote:
>>>> On Tue, Oct 06, 2015 at 07:29:54AM -0700, Matt Roper wrote:
>>>>> On Tue, Oct 06, 2015 at 02:32:47PM +0100, Tvrtko Ursulin wrote:
>>>>>>
>>>>>> On 10/04/15 10:07, Sonika Jindal wrote:
>>>>>>> Signed-off-by: Sonika Jindal <sonika.jindal@intel.com>
>>>>>>> Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
>>>>>>> ---
>>>>>>> drivers/gpu/drm/i915/intel_display.c | 7 ++++++-
>>>>>>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>>>>>>
>>>>>>> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
>>>>>>> index ceb2e61..f0bbc22 100644
>>>>>>> --- a/drivers/gpu/drm/i915/intel_display.c
>>>>>>> +++ b/drivers/gpu/drm/i915/intel_display.c
>>>>>>> @@ -12150,16 +12150,21 @@ intel_check_primary_plane(struct drm_plane *plane,
>>>>>>> struct drm_rect *dest = &state->dst;
>>>>>>> struct drm_rect *src = &state->src;
>>>>>>> const struct drm_rect *clip = &state->clip;
>>>>>>> + bool can_position = false;
>>>>>>> int ret;
>>>>>>>
>>>>>>> crtc = crtc ? crtc : plane->crtc;
>>>>>>> intel_crtc = to_intel_crtc(crtc);
>>>>>>>
>>>>>>> + if (INTEL_INFO(dev)->gen >= 9)
>>>>>>> + can_position = true;
>>>>>>> +
>>>>>>> ret = drm_plane_helper_check_update(plane, crtc, fb,
>>>>>>> src, dest, clip,
>>>>>>> DRM_PLANE_HELPER_NO_SCALING,
>>>>>>> DRM_PLANE_HELPER_NO_SCALING,
>>>>>>> - false, true, &state->visible);
>>>>>>> + can_position, true,
>>>>>>> + &state->visible);
>>>>>>> if (ret)
>>>>>>> return ret;
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> I have discovered today that, while this allows SetCrtc and SetPlane
>>>>>> ioctls to work with frame buffers which do not cover the plane, page
>>>>>> flips are not that lucky and fail roughly with:
>>>>>>
>>>>>> [drm:drm_crtc_check_viewport] Invalid fb size 1080x1080 for CRTC
>>>>>> viewport 1920x1080+0+0.
>>>>>
>>>>> Maybe I'm misunderstanding your explanation, but a framebuffer is always
>>>>> required to fill/cover the plane scanning out of it. What this patch is
>>>>> supposed to be allowing is for the primary plane to not cover the entire
>>>>> CRTC (since that's something that only became possible for Intel
>>>>> hardware on the gen9+ platforms). I.e., the primary plane is now
>>>>> allowed to positioned and resized to cover a subset of the CRTC area,
>>>>> just like "sprite" planes have always been able to.
>>>>>
>>>>> If you've got a 1080x1080 framebuffer, then it's legal to have a
>>>>> 1080x1080 primary plane while running in 1920x1080 mode on SKL/BXT.
>>>>> However it is not legal to size the primary plane as 1920x1080 and use
>>>>> this same 1080x1080 framebuffer with any of our interfaces (setplane,
>>>>> setcrtc, pageflip, or atomic).
>>>>>
>>>>> Are you using ioctls/libdrm directly or are you using igt_kms helpers?
>>>>> IIRC, the IGT helpers will try to be extra helpful and automatically
>>>>> size the plane to match the framebuffer (unless you override that
>>>>> behavior), so that might be what's causing the confusion here.
>>>>
>>>> The problem is clear as day in drm_mode_page_flip_ioctl():
>>>> ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y, &crtc->mode, fb);
>>>> if (ret)
>>>> goto out;
>>>>
>>>> The fix should be easy; just extract the current src coordinates from
>>>> the plane state and check those against the new fb size. And then hope
>>>> that the plane state is really up to date.
>>>
>>> Yep, that's the conclusion we came to once Tvrtko explained what he was
>>> seeing on IRC. I'm not sure whether non-atomic drivers have enough
>>> state setup by the default helpers to work properly. Worst case we'll
>>> just assume that a non-atomic driver won't support primary plane
>>> windowing (since none have in the past) and fall back to looking at the
>>> mode for legacy non-atomic drivers.
>>>
>>>>
>>>> And I'm sure rotated cases will go boom in some other ways. Probably
>>>> we should just switch over to using the full plane update for mmio
>>>> flips to fix it.
>>>
>>> Yeah; the core looks at a drm_plane->invert_dimensions field that's only
>>> set by omap. That should probably be updated to look at the state's
>>> rotation on atomic-capable drivers.
>>
>> We can just look at the src coordinates. Those always match the fb
>> orientation.
>
> Can we just not bother with legacy pageflips on rotated planes? setplane
> works and once you rotate it kinda gets nasty anyway.
I don't know - thought it is simple enough to make it work so why not?
Just " [PATCH] drm/i915: Consider plane rotation when calculating stride
in skl_do_mmio_flip" I posted, plus Matt's "[PATCH] drm: Check fb
against plane size rather than CRTC mode for pageflip" to allow smaller
than mode planes.
> The problem I see is that with legacy pageflip we also need to hack up
> something that doesn't look at plane->state for legacy and all that for a
> grand total of about 2 drivers, both getting converted to atomic.
I'll leave the legacy/atomic/etc considerations to the experts. :)
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-10-08 8:58 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-10 9:07 [PATCH 1/2] drm/i915/skl: Allow universal planes to position Sonika Jindal
2015-04-10 9:07 ` [PATCH 2/2] drm/i915/skl: Support for 90/270 rotation Sonika Jindal
2015-04-10 14:17 ` Daniel Vetter
2015-04-10 14:44 ` Ville Syrjälä
2015-04-13 4:06 ` Jindal, Sonika
2015-04-13 10:10 ` Ville Syrjälä
2015-04-13 10:23 ` Jindal, Sonika
2015-04-13 10:49 ` Ville Syrjälä
2015-04-13 23:39 ` Matt Roper
2015-04-14 12:19 ` Jindal, Sonika
2015-04-14 17:27 ` Daniel Vetter
2015-04-15 10:05 ` [PATCH 1/2] drm/i915: Swapping 90 and 270 to be compliant with Xrandr Sonika Jindal
2015-04-15 10:05 ` [PATCH 2/2] Documentation/drm: Update rotation property with 90/270 and description Sonika Jindal
2015-04-15 10:27 ` Daniel Vetter
2015-04-15 10:29 ` Jindal, Sonika
2015-04-15 10:42 ` Daniel Vetter
2015-04-15 10:35 ` [PATCH] " Sonika Jindal
2015-05-12 12:50 ` [Intel-gfx] " Ville Syrjälä
2015-05-13 4:27 ` Jindal, Sonika
2015-05-20 6:39 ` Jindal, Sonika
2015-05-20 7:49 ` Jindal, Sonika
2015-05-20 14:03 ` Ville Syrjälä
2015-05-28 11:05 ` [PATCH] Documentation/drm: Update rotation property Sonika Jindal
2015-05-28 11:19 ` [Intel-gfx] " Daniel Vetter
2015-05-12 12:35 ` [PATCH 1/2] drm/i915: Swapping 90 and 270 to be compliant with Xrandr Ville Syrjälä
2015-05-20 8:10 ` [PATCH] " Sonika Jindal
2015-05-20 9:15 ` Daniel Vetter
2015-04-13 11:10 ` [PATCH 2/2] drm/i915/skl: Support for 90/270 rotation Damien Lespiau
2015-04-13 4:02 ` Jindal, Sonika
2015-04-14 3:56 ` shuang.he
2015-10-06 13:32 ` [PATCH 1/2] drm/i915/skl: Allow universal planes to position Tvrtko Ursulin
2015-10-06 14:29 ` Matt Roper
2015-10-06 14:42 ` Ville Syrjälä
2015-10-06 15:16 ` Matt Roper
2015-10-06 16:28 ` Ville Syrjälä
2015-10-07 14:19 ` Daniel Vetter
2015-10-08 8:58 ` Tvrtko Ursulin [this message]
2015-10-16 12:23 ` Tvrtko Ursulin
-- strict thread matches above, loose matches on Subject: below --
2015-03-30 8:34 Sonika Jindal
2015-04-01 18:21 ` Matt Roper
2015-04-02 4:38 ` Jindal, Sonika
2015-04-02 15:48 ` Matt Roper
2015-04-06 5:20 ` Jindal, Sonika
2015-04-07 8:16 ` Daniel Vetter
2015-04-07 8:21 ` Jindal, Sonika
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=5616303A.5060809@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox