public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Intel-gfx@lists.freedesktop.org
Subject: Re: [RFC 4/6] drm/i915: Use framebuffer tiling mode for display purposes
Date: Mon, 02 Feb 2015 10:29:19 +0000	[thread overview]
Message-ID: <54CF517F.9010807@linux.intel.com> (raw)
In-Reply-To: <20150202094929.GR14009@phenom.ffwll.local>


On 02/02/2015 09:49 AM, Daniel Vetter wrote:
> On Fri, Jan 30, 2015 at 05:36:56PM +0000, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> To prepare for framebuffer modifiers, move tiling definition from the
>> object into the framebuffer. Move in a way that framebuffer tiling is
>> now used for display while object tiling remains for fencing.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> ---
>>   drivers/gpu/drm/i915/intel_display.c | 46 +++++++++++++++++++++---------------
>>   drivers/gpu/drm/i915/intel_drv.h     |  2 ++
>>   drivers/gpu/drm/i915/intel_pm.c      |  7 +++---
>>   drivers/gpu/drm/i915/intel_sprite.c  | 26 ++++++++++----------
>>   4 files changed, 46 insertions(+), 35 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
>> index 4425e86..e22afbe 100644
>> --- a/drivers/gpu/drm/i915/intel_display.c
>> +++ b/drivers/gpu/drm/i915/intel_display.c
>> @@ -2211,7 +2211,7 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,
>>
>>   	WARN_ON(!mutex_is_locked(&dev->struct_mutex));
>>
>> -	switch (obj->tiling_mode) {
>> +	switch (to_intel_framebuffer(fb)->tiling_mode) {
>>   	case I915_TILING_NONE:
>
> Imo we should just look at fb->modifier[0] and flip over all the enums. A
> bit more invasive, but we also don't need to change all the platform code
> at once - set_tiling already guarantees that no one can modify the bo
> tiling mode when there's an fb object using it. Which means we can change
> the code over at leasure.

What do you mean by "flip over"?

To make places which need to get fb tiling format use fb->modifier[0] 
directly rather than have them mapped to tiling enums at fb init?

>> @@ -9764,6 +9768,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
>>   	work->event = event;
>>   	work->crtc = crtc;
>>   	work->old_fb_obj = intel_fb_obj(old_fb);
>> +	work->old_tiling_mode = to_intel_framebuffer(old_fb)->tiling_mode;
>
> Hm, that's actually an interesting bugfix - currently userspace could be
> sneaky and destroy the old fb immediately after the flip completes and the
> change the tiling of the underlying object before the unpin work had a
> chance to run (needs some fudgin with rt prios to starve workers to make
> this work though).
>
> Imo the right fix is to hold a reference onto the fb and not the
> underlying gem object. With that tiling is guaranteed not to change.

Ok I'll pull it out in a separate patch.

>>   	INIT_WORK(&work->work, intel_unpin_work_fn);
>>
>>   	ret = drm_crtc_vblank_get(crtc);
>> @@ -9814,7 +9819,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
>>
>>   	if (IS_VALLEYVIEW(dev)) {
>>   		ring = &dev_priv->ring[BCS];
>> -		if (obj->tiling_mode != work->old_fb_obj->tiling_mode)
>> +		if (to_intel_framebuffer(fb)->tiling_mode !=
>> +		    work->old_tiling_mode)
>>   			/* vlv: DISPLAY_FLIP fails to change tiling */
>>   			ring = NULL;
>>   	} else if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) {
>> @@ -12190,7 +12196,8 @@ intel_check_cursor_plane(struct drm_plane *plane,
>>
>>   	/* we only need to pin inside GTT if cursor is non-phy */
>>   	mutex_lock(&dev->struct_mutex);
>> -	if (!INTEL_INFO(dev)->cursor_needs_physical && obj->tiling_mode) {
>> +	if (!INTEL_INFO(dev)->cursor_needs_physical &&
>> +	    to_intel_framebuffer(fb)->tiling_mode) {
>>   		DRM_DEBUG_KMS("cursor cannot be tiled\n");
>>   		ret = -EINVAL;
>>   	}
>> @@ -12772,6 +12779,7 @@ static int intel_framebuffer_init(struct drm_device *dev,
>>   	drm_helper_mode_fill_fb_struct(&intel_fb->base, mode_cmd);
>>   	intel_fb->obj = obj;
>>   	intel_fb->obj->framebuffer_references++;
>> +	intel_fb->tiling_mode = obj->tiling_mode;
>
> One side-effect of using fb->modifier[0] is that if the modifier flag is
> _not_ set, we need to reconstruct this field from obj->tiling_mode here.
> Otoh if it is set this code here should check that fb->modifier and
> obj->tiling_mode are consistent.
>
> Perhaps best to split this change out as a prep patch, like you've done
> with the code for the initial framebuffer.

If I understood correctly what you meant in the first quote then yes.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-02-02 10:29 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30 17:36 [RFC 0/6] Use framebuffer modifiers for tiled display Tvrtko Ursulin
2015-01-30 17:36 ` [RFC 1/6] RFC: drm: add support for tiled/compressed/etc modifier in addfb2 Tvrtko Ursulin
2015-01-30 17:36 ` [RFC 2/6] drm/i915: Add tiled framebuffer modifiers Tvrtko Ursulin
2015-02-02  9:41   ` Daniel Vetter
2015-02-02  9:58     ` [Intel-gfx] " Daniel Vetter
2015-02-02 10:23       ` Tvrtko Ursulin
2015-02-02 15:55         ` [Intel-gfx] " Daniel Vetter
2015-02-02 15:58         ` Daniel Vetter
2015-02-02 16:35           ` Rob Clark
2015-02-02 16:32     ` [Intel-gfx] " Rob Clark
2015-02-02 16:42       ` Tvrtko Ursulin
2015-02-02 16:59         ` Daniel Vetter
2015-02-02 19:25           ` Rob Clark
2015-01-30 17:36 ` [RFC 3/6] drm/i915: Set up fb modifier on initial takeover Tvrtko Ursulin
2015-01-30 17:36 ` [RFC 4/6] drm/i915: Use framebuffer tiling mode for display purposes Tvrtko Ursulin
2015-02-02  9:49   ` Daniel Vetter
2015-02-02 10:29     ` Tvrtko Ursulin [this message]
2015-02-02 17:09       ` Daniel Vetter
2015-01-30 17:36 ` [RFC 5/6] drm/i915: Allow fb modifier to set framebuffer tiling Tvrtko Ursulin
2015-02-02  9:54   ` Daniel Vetter
2015-02-02 10:36     ` Tvrtko Ursulin
2015-02-02 17:15       ` Daniel Vetter
2015-02-02 17:30         ` Tvrtko Ursulin
2015-02-02 20:17           ` Daniel Vetter
2015-02-03 10:41             ` Tvrtko Ursulin
2015-02-03 11:41               ` Daniel Vetter
2015-01-30 17:36 ` [RFC 6/6] drm/i915: Announce support for framebuffer modifiers Tvrtko Ursulin
2015-02-02  9:51   ` Daniel Vetter
2015-02-03 17:22 ` [RFC v2 0/4] Use framebuffer modifiers for tiled display Tvrtko Ursulin
2015-02-03 17:22   ` [PATCH 1/4] RFC: drm: add support for tiled/compressed/etc modifier in addfb2 Tvrtko Ursulin
2015-02-03 17:22   ` [PATCH 2/4] drm/i915: Add tiled framebuffer modifiers Tvrtko Ursulin
2015-02-03 17:22   ` [PATCH 3/4] drm/i915: Use frame buffer modifiers for tiled display Tvrtko Ursulin
2015-02-03 19:47     ` Daniel Vetter
2015-02-04 10:01       ` Tvrtko Ursulin
2015-02-04 14:25         ` Daniel Vetter
2015-02-04 15:09           ` Tvrtko Ursulin
2015-02-04 15:33             ` Daniel Vetter
2015-02-04 15:44               ` Tvrtko Ursulin
2015-02-05 14:14                 ` Daniel Vetter
2015-02-03 17:22   ` [PATCH 4/4] drm/i915: Announce support for framebuffer modifiers Tvrtko Ursulin
2015-02-05 14:41 ` [RFC v3 0/4] Use framebuffer modifiers for tiled display Tvrtko Ursulin
2015-02-05 14:41   ` [PATCH 1/4] RFC: drm: add support for tiled/compressed/etc modifier in addfb2 Tvrtko Ursulin
2015-02-05 15:06     ` Daniel Stone
2015-02-05 14:41   ` [PATCH 2/4] drm/i915: Add tiled framebuffer modifiers Tvrtko Ursulin
2015-02-09 16:55     ` Daniel Vetter
2015-02-09 16:58     ` Daniel Vetter
2015-02-05 14:41   ` [PATCH 3/4] drm/i915: Use frame buffer modifiers for tiled display Tvrtko Ursulin
2015-02-05 14:41   ` [PATCH 4/4] drm/i915: Announce support for framebuffer modifiers Tvrtko Ursulin
2015-02-08  6:00     ` shuang.he
     [not found]     ` <6c3329$kb0jfs@orsmga002.jf.intel.com>
2015-02-08 12:43       ` He, Shuang
2015-02-08 12:44     ` shuang.he
2015-02-06 17:26   ` [PATCH 3/4 v3] drm/i915: Use frame buffer modifiers for tiled display Tvrtko Ursulin

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=54CF517F.9010807@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=daniel@ffwll.ch \
    /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