public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Vivek Kasireddy <vivek.kasireddy@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Make sure fb objects with rotated views are also fenceable
Date: Tue, 15 Sep 2015 10:29:27 +0100	[thread overview]
Message-ID: <55F7E4F7.6040407@linux.intel.com> (raw)
In-Reply-To: <20150914190911.5d582e15@vkasired-desk2.amr.corp.intel.com>


On 09/15/2015 03:09 AM, Vivek Kasireddy wrote:
> On Mon, 14 Sep 2015 10:08:19 +0100
> Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> wrote:
>
>>
>> Hi,
>>
>> On 09/12/2015 02:44 AM, Vivek Kasireddy wrote:
>>> From: Vivek Kasireddy <vivek.kasireddy@intel.com>
>>>
>>> Currently, fb objects with rotated views are ignored while pinning.
>>> Therefore, include the rotated view type and use the view size
>>> instead of the object's size to determine if it is fenceable. And,
>>> look at the view and its offset while writing and pinning to the
>>> fence registers.
>>
>> I didn't figure out from the commit message if something is broken or?
>>
>> AFAIR rotated views deliberately skip on fencing since rotated view
>> has shuffled pages in memory so it would be a weird view for
>> userspace to handle.
>
> Hi Tvrtko,
> I apologize for the short and ambiguous commit message.
> As I mentioned in my other reply to Chris, the reason for this patch is
> because of this:
> 	if (WARN_ON(!obj->map_and_fenceable))
> 		return -EINVAL;
> inside i915_find_fence_reg(). I am trying to enable 90 degree rotation
> for the Weston compositor as part of which I need to allocate and flip
> a Y-tiled fb obj. This fails because i915_gem_object_do_pin() ignores

The use case itself has been exercised in general and it does work.

However I suspect you are using SET_TILING on the object to set it to Y 
tiled? That would explain i915_gem_object_get_fence trying to enable 
fencing.

This indeed looks like an omission in test coverage, needs a test case 
in kms_addfb_basic/addfb25 test group.

> the rotated view passed by i915_gem_object_pin_to_display_plane() and
> hence obj->map_and_fenceable never gets set.
>
>>
>> Especially this below:
>>
>>>    static void i965_write_fence_reg(struct drm_device *dev, int reg,
>>> -				 struct drm_i915_gem_object *obj)
>>> +				 struct drm_i915_gem_object *obj,
>>> +				 const struct i915_ggtt_view *view)
>>>    {
>>>    	struct drm_i915_private *dev_priv = dev->dev_private;
>>>    	int fence_reg;
>>>    	int fence_pitch_shift;
>>> +	const struct i915_ggtt_view *ggtt_view = view;
>>>
>>>    	if (INTEL_INFO(dev)->gen >= 6) {
>>>    		fence_reg = FENCE_REG_SANDYBRIDGE_0;
>>> @@ -95,9 +97,13 @@ static void i965_write_fence_reg(struct
>>> drm_device *dev, int reg, size = (size / row_size) * row_size;
>>>    		}
>>>
>>> -		val = (uint64_t)((i915_gem_obj_ggtt_offset(obj) +
>>> size - 4096) &
>>> -				 0xfffff000) << 32;
>>> -		val |= i915_gem_obj_ggtt_offset(obj) & 0xfffff000;
>>> +		if (!ggtt_view)
>>> +			ggtt_view = &i915_ggtt_view_normal;
>>> +
>>> +		val =
>>> (uint64_t)((i915_gem_obj_ggtt_offset_view((obj), ggtt_view)
>>> +				  + size - 4096) & 0xfffff000) <<
>>> 32;
>>> +		val |= i915_gem_obj_ggtt_offset_view((obj),
>>> ggtt_view) & 0xfffff000; +
>>
>> Looks like the code can be setting up a fence with a rotated view
>> GGTT address which looks wrong? Is this really what is wanted and why?
>>
>> Regards,
>>
>> Tvrtko
> Well, i915_gem_obj_ggtt_offset() always calls
> i915_gem_obj_ggtt_offset_view() with the default normal view type which
> I suppose is incorrect right? When a rotated view is passed from
> i915_gem_object_pin_to_display_plane(), i915_gem_obj_ggtt_offset_view()
> will not be able to find the associated vma.

I think it is correct since for setting up fences we do want the normal 
view. What would you do that in userspace with fenced rotated view and 
would it even work? And it wouldn't even be predictable which type of 
view you got for your mmap since it would depend on view instantiation 
ordering, no?

I think what might work is that we skip fence creation on rotated view 
pinning, and instead do it when mmap is requested, instantiating a 
normal view at that time if not present.

Regards,

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

  reply	other threads:[~2015-09-15  9:30 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-12  1:44 [PATCH] drm/i915: Make sure fb objects with rotated views are also fenceable Vivek Kasireddy
2015-09-12  7:49 ` Chris Wilson
2015-09-15  1:38   ` Vivek Kasireddy
2015-09-14  9:08 ` Tvrtko Ursulin
2015-09-15  2:09   ` Vivek Kasireddy
2015-09-15  9:29     ` Tvrtko Ursulin [this message]
2015-09-16  1:38       ` Vivek Kasireddy
2015-09-16  2:05       ` [PATCH] drm/i915: Skip fence installation for objects with rotated views Vivek Kasireddy
2015-09-16  8:03         ` Chris Wilson
2015-09-16 17:36           ` Vivek Kasireddy
2015-09-17 10:25             ` Tvrtko Ursulin
2015-09-19  1:56               ` Vivek Kasireddy
2015-09-19  1:57               ` [PATCH] drm/i915: Skip fence installation for objects with rotated views (v2) Vivek Kasireddy
2015-09-23  8:46                 ` Daniel Vetter
2015-09-24  2:19                   ` Vivek
2015-10-26 10:25                 ` Tvrtko Ursulin
2015-10-27  1:23                   ` Vivek Kasireddy
2015-10-27 10:35                     ` Tvrtko Ursulin
2015-10-27 12:51                     ` Ville Syrjälä
2015-10-27 13:34                       ` Tvrtko Ursulin
2015-10-27 13:48                         ` Ville Syrjälä
2015-10-27 14:26                           ` Tvrtko Ursulin
2015-10-27 18:03                             ` Chris Wilson
2015-10-27 18:35                               ` Ville Syrjälä
2015-10-27 18:47                                 ` Chris Wilson
2015-10-27 18:58                                   ` Ville Syrjälä
2015-10-28 10:17                                     ` Tvrtko Ursulin
2015-10-29  1:24                                       ` [PATCH] drm/i915: Skip fence installation for objects with rotated views (v3) Vivek Kasireddy
2015-10-29 10:31                                         ` Tvrtko Ursulin
2015-10-29 13:20                                         ` Ville Syrjälä
2015-10-29 13:33                                           ` Tvrtko Ursulin
2015-10-30  1:54                                             ` [PATCH] drm/i915: Skip fence installation for objects with rotated views (v4) Vivek Kasireddy
2015-10-30  9:44                                               ` Ville Syrjälä
2015-11-05 12:01                                                 ` Jani Nikula

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=55F7E4F7.6040407@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=vivek.kasireddy@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