drm/i915: Drop return value from intel_fill_fb_ggtt_view
Subsystems (2)
PATCH 1/3 drm/i915: Drop return value from intel_fill_fb_ggtt_view
It can't fail and there's even a WARN_ON suggesting that if it would, it would be a disaster.
Correct this to make things less confusing.
--- drivers/gpu/drm/i915/intel_display.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_display.c +5 -11
@@ -2243,7 +2243,7 @@ intel_fb_align_height(struct drm_device *dev, unsigned int height, fb_format_modifier, 0)); } -static int +static void intel_fill_fb_ggtt_view (struct i915_ggtt_view *view,struct drm_framebuffer *fb,const struct drm_plane_state *plane_state) {
@@ -2253,10 +2253,10 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, *view = i915_ggtt_view_normal;if (!plane_state) -return 0 ; +return ;if (!intel_rotation_90_or_270 (plane_state->rotation)) -return 0 ; +return ; *view = i915_ggtt_view_rotated;
@@ -2283,8 +2283,6 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, info->size_uv = info->width_pages_uv * info->height_pages_uv *PAGE_SIZE ; } - -return 0 ; }static unsigned int intel_linear_alignment (struct drm_i915_private *dev_priv)
@@ -2340,9 +2338,7 @@ intel_pin_and_fence_fb_obj(struct drm_plane *plane,return -EINVAL ; } - ret =intel_fill_fb_ggtt_view (&view, fb, plane_state); -if (ret) -return ret; +intel_fill_fb_ggtt_view (&view, fb, plane_state);/* Note that the w/a also requires 64 PTE of padding following the * bo. We currently fill all unused PTE with the shadow page and so
@@ -2406,12 +2402,10 @@ static void intel_unpin_fb_obj(struct drm_framebuffer *fb, {struct drm_i915_gem_object *obj =intel_fb_obj (fb);struct i915_ggtt_view view; -int ret;WARN_ON (!mutex_is_locked (&obj->base.dev->struct_mutex)); - ret =intel_fill_fb_ggtt_view (&view, fb, plane_state); -WARN_ONCE (ret,"Couldn't get view from plane state!" ); +intel_fill_fb_ggtt_view (&view, fb, plane_state);i915_gem_object_unpin_fence (obj);i915_gem_object_unpin_from_display_plane (obj, &view);
Signature · 6 lines
2.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/3 drm/i915: Stuff rotation params into view union
We don't need 2 separate unions.
Note that this was done intentinoally
Author: Joonas Lahtinen <[email protected]> Date: Wed May 6 14:35:38 2015 +0300
drm/i915: Add a partial GGTT view type
on Tvrtko's request, but without a clear justification. Rotated views are also not checking for matching paramters in i915_ggtt_view_equal, which seems like a bug. But this patch here doesn't change that.
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++-- drivers/gpu/drm/i915/i915_gem_gtt.h | 5 +---- drivers/gpu/drm/i915/intel_display.c | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +2 -2
@@ -3283,7 +3283,7 @@ static struct sg_table * intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view, struct drm_i915_gem_object *obj) { - struct intel_rotation_info *rot_info = &ggtt_view->rotation_info; + struct intel_rotation_info *rot_info = &ggtt_view->params.rotation_info;unsigned int size_pages = rot_info->size >>PAGE_SHIFT ;unsigned int size_pages_uv;struct sg_page_iter sg_iter;
@@ -3515,7 +3515,7 @@ i915_ggtt_view_size(struct drm_i915_gem_object *obj,if (view->type ==I915_GGTT_VIEW_NORMAL ) {return obj->base.size; }else if (view->type ==I915_GGTT_VIEW_ROTATED ) { -return view->rotation_info.size; +return view->params.rotation_info.size; }else if (view->type ==I915_GGTT_VIEW_PARTIAL ) {return view->params.partial.size <<PAGE_SHIFT ; }else {
drivers/gpu/drm/i915/i915_gem_gtt.h +1 -4
@@ -156,13 +156,10 @@ struct i915_ggtt_view {u64 offset;unsigned int size; } partial; +struct intel_rotation_info rotation_info; } params;struct sg_table *pages; - -union { -struct intel_rotation_info rotation_info; - }; };extern const struct i915_ggtt_view i915_ggtt_view_normal;
drivers/gpu/drm/i915/intel_display.c +2 -2
@@ -2247,7 +2247,7 @@ static void intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, const struct drm_plane_state *plane_state) { - struct intel_rotation_info *info = &view->rotation_info; + struct intel_rotation_info *info = &view->params.rotation_info;unsigned int tile_height, tile_pitch; *view = i915_ggtt_view_normal;
@@ -2909,7 +2909,7 @@ unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, offset = (unsigned char *)vma->node.start;if (plane ==1 ) { - offset += vma->ggtt_view.rotation_info.uv_start_page * + offset += vma->ggtt_view.params.rotation_info.uv_start_page *PAGE_SIZE ; }
Signature · 6 lines
2.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/3] drm/i915: Stuff rotation params into view union
Quoted 49 lines · Daniel Vetter
We don't need 2 separate unions.
Note that this was done intentinoally
Author: Joonas Lahtinen <[email protected]> Date: Wed May 6 14:35:38 2015 +0300drm/i915: Add a partial GGTT view type
on Tvrtko's request, but without a clear justification. Rotated views are also not checking for matching paramters in
i915_ggtt_view_equal, which seems like a bug. But this patch here doesn't change that.Cc Tvrtko Ursulin <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 4 ++-- drivers/gpu/drm/i915/i915_gem_gtt.h | 5 +---- drivers/gpu/drm/i915/intel_display.c | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +2
-2@@ -3283,7 +3283,7 @@ static struct sg_table * intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view, struct drm_i915_gem_object *obj) { - struct intel_rotation_info *rot_info = &ggtt_view->rotation_info; + struct intel_rotation_info *rot_info = &ggtt_view->params.rotation_info;unsigned int size_pages = rot_info->size >>PAGE_SHIFT ;unsigned int size_pages_uv;struct sg_page_iter sg_iter;@@ -3515,7 +3515,7 @@ i915_ggtt_view_size(struct drm_i915_gem_object *obj,if (view->type ==I915_GGTT_VIEW_NORMAL ) {return obj->base.size; }else if (view->type ==I915_GGTT_VIEW_ROTATED ) { -return view->rotation_info.size; +return view->params.rotation_info.size; }else if (view->type ==I915_GGTT_VIEW_PARTIAL ) {return view->params.partial.size <<PAGE_SHIFT ; }else {drivers/gpu/drm/i915/i915_gem_gtt.h +0
-0@@ -156,13 +156,10 @@ struct i915_ggtt_view {u64 offset;
drivers/gpu/drm/i915/i915_gem_gtt.h struct i915_ggtt_view { · line 165
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.h +1
-4unsigned int size; } partial; +struct intel_rotation_info rotation_info; } params;struct sg_table *pages; - -union { -struct intel_rotation_info rotation_info; - };
So, I basically just sent the same patch, except I made the union anonymous, and I renamed 'rotation_info' to 'rotated' to match the type.
Quoted 32 lines
drivers/gpu/drm/i915/i915_gem_gtt.h +0
-0};extern const struct i915_ggtt_view i915_ggtt_view_normal;drivers/gpu/drm/i915/intel_display.c +2
-2@@ -2247,7 +2247,7 @@ static void intel_fill_fb_ggtt_view(struct i915_ggtt_view *view, struct drm_framebuffer *fb, const struct drm_plane_state *plane_state) { - struct intel_rotation_info *info = &view->rotation_info; + struct intel_rotation_info *info = &view->params.rotation_info;unsigned int tile_height, tile_pitch; *view = i915_ggtt_view_normal;@@ -2909,7 +2909,7 @@ unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, offset = (unsigned char *)vma->node.start;if (plane ==1 ) { - offset += vma->ggtt_view.rotation_info.uv_start_page * + offset += vma->ggtt_view.params.rotation_info.uv_start_page *PAGE_SIZE ; }Signature · 6 lines
2.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/3 drm/i915: Fix i915_ggtt_view_equal to handle rotation correctly
In reply to Daniel VetterThe rotated view depends upon the rotation paramters, but thus far we didn't bother checking for those. This seems to have been an issue ever since this was introduce in
commit fe14d5f4e5468c5b80a24f1a64abcbe116143670
Author: Tvrtko Ursulin <[email protected]> Date: Wed Dec 10 17:27:58 2014 +0000
drm/i915: Infrastructure for supporting different GGTT views per object
But userspace is allowed to reuse framebuffer backing storage with different framebuffers with different pixel formats/stride/whatever. And e.g. SNA indeed does this. Hence we must check for all the paramters to match, not just that it's rotated.
v2: intel_plane_obj_offset also needs to construct the full view, to avoid fallout since they don't fully match.
--- drivers/gpu/drm/i915/i915_gem_gtt.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.h +1 -1
@@ -551,7 +551,7 @@ i915_ggtt_view_equal(const struct i915_ggtt_view *a,if (a->type != b->type)return false; -if (a->type ==I915_GGTT_VIEW_PARTIAL ) +if (a->type !=I915_GGTT_VIEW_NORMAL )return !memcmp (&a->params, &b->params,sizeof (a->params));return true; }
drivers/gpu/drm/i915/intel_display.c +5 -5
@@ -2894,16 +2894,16 @@ unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, struct drm_i915_gem_object *obj, unsigned int plane) { -const struct i915_ggtt_view *view = &i915_ggtt_view_normal; +struct i915_ggtt_view view;struct i915_vma *vma;unsigned char *offset; -if (intel_rotation_90_or_270 (intel_plane->base.state->rotation)) - view = &i915_ggtt_view_rotated; +intel_fill_fb_ggtt_view (&view, intel_plane->base.fb, + intel_plane->base.state); - vma =i915_gem_obj_to_ggtt_view (obj, view); + vma =i915_gem_obj_to_ggtt_view (obj, &view);if (WARN (!vma,"ggtt vma for display object not found! (view=%u)\n" , - view->type)) + view.type))return -1 ; offset = (unsigned char *)vma->node.start;
Signature · 6 lines
2.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/3] drm/i915: Fix i915_ggtt_view_equal to handle rotation correctly
Hi,
Quoted 55 lines · Daniel Vetter
The rotated view depends upon the rotation paramters, but thus far we didn't bother checking for those. This seems to have been an issue ever since this was introduce in
commit
fe14d5f4e5468c5b80a24f1a64abcbe116143670Author: Tvrtko Ursulin <[email protected]> Date: Wed Dec 10 17:27:58 2014 +0000drm/i915: Infrastructure for supporting different GGTT views per object
But userspace is allowed to reuse framebuffer backing storage with different framebuffers with different pixel formats/stride/whatever. And e.g. SNA indeed does this. Hence we must check for all the paramters to match, not just that it's rotated.
v2:
intel_plane_obj_offsetalso needs to construct the full view, to avoid fallout since they don't fully match.Cc Tvrtko Ursulin <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.h +1
-1@@ -551,7 +551,7 @@ i915_ggtt_view_equal(const struct i915_ggtt_view *a,if (a->type != b->type)return false; -if (a->type ==I915_GGTT_VIEW_PARTIAL ) +if (a->type !=I915_GGTT_VIEW_NORMAL )return !memcmp (&a->params, &b->params,sizeof (a->params));return true; }drivers/gpu/drm/i915/intel_display.c +2
-3@@ -2894,16 +2894,16 @@ unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, struct drm_i915_gem_object *obj, unsigned int plane) { -const struct i915_ggtt_view *view = &i915_ggtt_view_normal; +struct i915_ggtt_view view;struct i915_vma *vma;unsigned char *offset; -if (intel_rotation_90_or_270 (intel_plane->base.state->rotation)) - view = &i915_ggtt_view_rotated; + intel_fill_fb_ggtt_view(&view, intel_plane->base.fb,
drivers/gpu/drm/i915/intel_display.c unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, · line 2909
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +3
-2+ intel_plane->base.state); - vma =i915_gem_obj_to_ggtt_view (obj, view); + vma =i915_gem_obj_to_ggtt_view (obj, &view);if (WARN (!vma,"ggtt vma for display object not found! (view=%u)\n" , - view->type)) + view.type))return -1 ; offset = (unsigned char *)vma->node.start;
As we discussed on IRC I had wrong assumptions when developing this. Luckily SNA is not using hardware 90/270 yet so we are safe there. And Android probably doesn't reuse the fb obj or it would have been reported. But I'll check.
So thanks for the cleanup! For all three:
Just a shame this means so much more computation in intel_plane_obj_offset, really highlights that vma should be stored in the state, if it is possible.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/3] drm/i915: Fix i915_ggtt_view_equal to handle rotation correctly
Quoted 75 lines · Tvrtko Ursulin
Hi,
Quoted 55 lines · Daniel Vetter
The rotated view depends upon the rotation paramters, but thus far we didn't bother checking for those. This seems to have been an issue ever since this was introduce in
commit
fe14d5f4e5468c5b80a24f1a64abcbe116143670Author: Tvrtko Ursulin <[email protected]> Date: Wed Dec 10 17:27:58 2014 +0000drm/i915: Infrastructure for supporting different GGTT views per object
But userspace is allowed to reuse framebuffer backing storage with different framebuffers with different pixel formats/stride/whatever. And e.g. SNA indeed does this. Hence we must check for all the paramters to match, not just that it's rotated.
v2:
intel_plane_obj_offsetalso needs to construct the full view, to avoid fallout since they don't fully match.Cc Tvrtko Ursulin <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.h +1
-1@@ -551,7 +551,7 @@ i915_ggtt_view_equal(const struct i915_ggtt_view *a,if (a->type != b->type)return false; -if (a->type ==I915_GGTT_VIEW_PARTIAL ) +if (a->type !=I915_GGTT_VIEW_NORMAL )return !memcmp (&a->params, &b->params,sizeof (a->params));return true; }drivers/gpu/drm/i915/intel_display.c +2
-3@@ -2894,16 +2894,16 @@ unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, struct drm_i915_gem_object *obj, unsigned int plane) { -const struct i915_ggtt_view *view = &i915_ggtt_view_normal; +struct i915_ggtt_view view;struct i915_vma *vma;unsigned char *offset; -if (intel_rotation_90_or_270 (intel_plane->base.state->rotation)) - view = &i915_ggtt_view_rotated; + intel_fill_fb_ggtt_view(&view, intel_plane->base.fb,drivers/gpu/drm/i915/intel_display.c unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, · line 2909
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +3
-2+ intel_plane->base.state); - vma =i915_gem_obj_to_ggtt_view (obj, view); + vma =i915_gem_obj_to_ggtt_view (obj, &view);if (WARN (!vma,"ggtt vma for display object not found! (view=%u)\n" , - view->type)) + view.type))return -1 ; offset = (unsigned char *)vma->node.start;As we discussed on IRC I had wrong assumptions when developing this. Luckily SNA is not using hardware 90/270 yet so we are safe there. And Android probably doesn't reuse the fb obj or it would have been reported. But I'll check.
Quoted 7 lines
So thanks for the cleanup! For all three:
Reviewed-by Tvrtko Ursulin <[email protected]>Just a shame this means so much more computation in
intel_plane_obj_offset, really highlights that vma should be stored in the state, if it is possible.
On your todo list is reviewing the patches that eliminate intel_plane_obj_offset.
:-p
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/3] drm/i915: Fix i915_ggtt_view_equal to handle rotation correctly
Quoted 80 lines · Chris Wilson
Quoted 79 lines · Tvrtko Ursulin
Hi,
Quoted 55 lines · Daniel Vetter
The rotated view depends upon the rotation paramters, but thus far we didn't bother checking for those. This seems to have been an issue ever since this was introduce in
commit
fe14d5f4e5468c5b80a24f1a64abcbe116143670Author: Tvrtko Ursulin <[email protected]> Date: Wed Dec 10 17:27:58 2014 +0000drm/i915: Infrastructure for supporting different GGTT views per object
But userspace is allowed to reuse framebuffer backing storage with different framebuffers with different pixel formats/stride/whatever. And e.g. SNA indeed does this. Hence we must check for all the paramters to match, not just that it's rotated.
v2:
intel_plane_obj_offsetalso needs to construct the full view, to avoid fallout since they don't fully match.Cc Tvrtko Ursulin <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.h +1
-1@@ -551,7 +551,7 @@ i915_ggtt_view_equal(const struct i915_ggtt_view *a,if (a->type != b->type)return false; -if (a->type ==I915_GGTT_VIEW_PARTIAL ) +if (a->type !=I915_GGTT_VIEW_NORMAL )return !memcmp (&a->params, &b->params,sizeof (a->params));return true; }drivers/gpu/drm/i915/intel_display.c +2
-3@@ -2894,16 +2894,16 @@ unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, struct drm_i915_gem_object *obj, unsigned int plane) { -const struct i915_ggtt_view *view = &i915_ggtt_view_normal; +struct i915_ggtt_view view;struct i915_vma *vma;unsigned char *offset; -if (intel_rotation_90_or_270 (intel_plane->base.state->rotation)) - view = &i915_ggtt_view_rotated; + intel_fill_fb_ggtt_view(&view, intel_plane->base.fb,drivers/gpu/drm/i915/intel_display.c unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, · line 2909
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +3
-2+ intel_plane->base.state); - vma =i915_gem_obj_to_ggtt_view (obj, view); + vma =i915_gem_obj_to_ggtt_view (obj, &view);if (WARN (!vma,"ggtt vma for display object not found! (view=%u)\n" , - view->type)) + view.type))return -1 ; offset = (unsigned char *)vma->node.start;As we discussed on IRC I had wrong assumptions when developing this. Luckily SNA is not using hardware 90/270 yet so we are safe there. And Android probably doesn't reuse the fb obj or it would have been reported. But I'll check.
So thanks for the cleanup! For all three:
Reviewed-by Tvrtko Ursulin <[email protected]>
Quoted 7 lines
Quoted 3 lines
Just a shame this means so much more computation in
intel_plane_obj_offset, really highlights that vma should be stored in the state, if it is possible.On your todo list is reviewing the patches that eliminate
intel_plane_obj_offset.
:-p
Have I missed something? I thought I reviewed what you sent so far.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/3] drm/i915: Fix i915_ggtt_view_equal to handle rotation correctly
Quoted 86 lines · Tvrtko Ursulin
Quoted 84 lines · Chris Wilson
Quoted 82 lines · Tvrtko Ursulin
Hi,
Quoted 55 lines · Daniel Vetter
The rotated view depends upon the rotation paramters, but thus far we didn't bother checking for those. This seems to have been an issue ever since this was introduce in
commit
fe14d5f4e5468c5b80a24f1a64abcbe116143670Author: Tvrtko Ursulin <[email protected]> Date: Wed Dec 10 17:27:58 2014 +0000drm/i915: Infrastructure for supporting different GGTT views per object
But userspace is allowed to reuse framebuffer backing storage with different framebuffers with different pixel formats/stride/whatever. And e.g. SNA indeed does this. Hence we must check for all the paramters to match, not just that it's rotated.
v2:
intel_plane_obj_offsetalso needs to construct the full view, to avoid fallout since they don't fully match.Cc Tvrtko Ursulin <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.h +1
-1@@ -551,7 +551,7 @@ i915_ggtt_view_equal(const struct i915_ggtt_view *a,if (a->type != b->type)return false; -if (a->type ==I915_GGTT_VIEW_PARTIAL ) +if (a->type !=I915_GGTT_VIEW_NORMAL )return !memcmp (&a->params, &b->params,sizeof (a->params));return true; }drivers/gpu/drm/i915/intel_display.c +2
-3@@ -2894,16 +2894,16 @@ unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, struct drm_i915_gem_object *obj, unsigned int plane) { -const struct i915_ggtt_view *view = &i915_ggtt_view_normal; +struct i915_ggtt_view view;struct i915_vma *vma;unsigned char *offset; -if (intel_rotation_90_or_270 (intel_plane->base.state->rotation)) - view = &i915_ggtt_view_rotated; + intel_fill_fb_ggtt_view(&view, intel_plane->base.fb,drivers/gpu/drm/i915/intel_display.c unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, · line 2909
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +3
-2+ intel_plane->base.state); - vma =i915_gem_obj_to_ggtt_view (obj, view); + vma =i915_gem_obj_to_ggtt_view (obj, &view);if (WARN (!vma,"ggtt vma for display object not found! (view=%u)\n" , - view->type)) + view.type))return -1 ; offset = (unsigned char *)vma->node.start;As we discussed on IRC I had wrong assumptions when developing this. Luckily SNA is not using hardware 90/270 yet so we are safe there. And Android probably doesn't reuse the fb obj or it would have been reported. But I'll check.
So thanks for the cleanup! For all three:
Reviewed-by Tvrtko Ursulin <[email protected]>Just a shame this means so much more computation in
intel_plane_obj_offset, really highlights that vma should be stored in the state, if it is possible.
Quoted 5 lines
Quoted 3 lines
On your todo list is reviewing the patches that eliminate
intel_plane_obj_offset.
:-pHave I missed something? I thought I reviewed what you sent so far.
It's the next step of the vma rewrite which was in the previous pile. Once we are using the VMA as the pin/unpin cookie, storiing it in the plane->state and using the VMA directly is a natural consequence. It just requires playing along with atomic.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/3] drm/i915: Fix i915_ggtt_view_equal to handle rotation correctly
In reply to Tvrtko UrsulinQuoted 67 lines · Tvrtko Ursulin
Hi,
Quoted 63 lines · Daniel Vetter
The rotated view depends upon the rotation paramters, but thus far we didn't bother checking for those. This seems to have been an issue ever since this was introduce in
commit
fe14d5f4e5468c5b80a24f1a64abcbe116143670Author: Tvrtko Ursulin <[email protected]> Date: Wed Dec 10 17:27:58 2014 +0000drm/i915: Infrastructure for supporting different GGTT views per object
But userspace is allowed to reuse framebuffer backing storage with different framebuffers with different pixel formats/stride/whatever. And e.g. SNA indeed does this. Hence we must check for all the paramters to match, not just that it's rotated.
v2:
intel_plane_obj_offsetalso needs to construct the full view, to avoid fallout since they don't fully match.Cc Tvrtko Ursulin <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.h +1
-1@@ -551,7 +551,7 @@ i915_ggtt_view_equal(const struct i915_ggtt_view *a,if (a->type != b->type)return false; -if (a->type ==I915_GGTT_VIEW_PARTIAL ) +if (a->type !=I915_GGTT_VIEW_NORMAL )return !memcmp (&a->params, &b->params,sizeof (a->params));return true; }drivers/gpu/drm/i915/intel_display.c +5
-5@@ -2894,16 +2894,16 @@ unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, struct drm_i915_gem_object *obj, unsigned int plane) { -const struct i915_ggtt_view *view = &i915_ggtt_view_normal; +struct i915_ggtt_view view;struct i915_vma *vma;unsigned char *offset; -if (intel_rotation_90_or_270 (intel_plane->base.state->rotation)) - view = &i915_ggtt_view_rotated; +intel_fill_fb_ggtt_view (&view, intel_plane->base.fb, + intel_plane->base.state); - vma =i915_gem_obj_to_ggtt_view (obj, view); + vma =i915_gem_obj_to_ggtt_view (obj, &view);if (WARN (!vma,"ggtt vma for display object not found! (view=%u)\n" , - view->type)) + view.type))return -1 ;
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, · line 2909
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c +0
-0offset = (unsigned char *)vma->node.start;As we discussed on IRC I had wrong assumptions when developing this. Luckily SNA is not using hardware 90/270 yet so we are safe there.
*by default (since it requires Y-tiling of the frontbuffer and that makes other accesses very slow and needing workarounds to prevent overall degredation, for some workloads in particular). -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/3] drm/i915: Fix i915_ggtt_view_equal to handle rotation correctly
Quoted 74 lines · Chris Wilson
Quoted 67 lines · Tvrtko Ursulin
Hi,
Quoted 63 lines · Daniel Vetter
The rotated view depends upon the rotation paramters, but thus far we didn't bother checking for those. This seems to have been an issue ever since this was introduce in
commit
fe14d5f4e5468c5b80a24f1a64abcbe116143670Author: Tvrtko Ursulin <[email protected]> Date: Wed Dec 10 17:27:58 2014 +0000drm/i915: Infrastructure for supporting different GGTT views per object
But userspace is allowed to reuse framebuffer backing storage with different framebuffers with different pixel formats/stride/whatever. And e.g. SNA indeed does this. Hence we must check for all the paramters to match, not just that it's rotated.
v2:
intel_plane_obj_offsetalso needs to construct the full view, to avoid fallout since they don't fully match.Cc Tvrtko Ursulin <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.h +1
-1@@ -551,7 +551,7 @@ i915_ggtt_view_equal(const struct i915_ggtt_view *a,if (a->type != b->type)return false; -if (a->type ==I915_GGTT_VIEW_PARTIAL ) +if (a->type !=I915_GGTT_VIEW_NORMAL )return !memcmp (&a->params, &b->params,sizeof (a->params));return true; }drivers/gpu/drm/i915/intel_display.c +5
-5@@ -2894,16 +2894,16 @@ unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, struct drm_i915_gem_object *obj, unsigned int plane) { -const struct i915_ggtt_view *view = &i915_ggtt_view_normal; +struct i915_ggtt_view view;struct i915_vma *vma;unsigned char *offset; -if (intel_rotation_90_or_270 (intel_plane->base.state->rotation)) - view = &i915_ggtt_view_rotated; +intel_fill_fb_ggtt_view (&view, intel_plane->base.fb, + intel_plane->base.state); - vma =i915_gem_obj_to_ggtt_view (obj, view); + vma =i915_gem_obj_to_ggtt_view (obj, &view);if (WARN (!vma,"ggtt vma for display object not found! (view=%u)\n" , - view->type)) + view.type))return -1 ;Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, · line 2909
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c +0
-0offset = (unsigned char *)vma->node.start;As we discussed on IRC I had wrong assumptions when developing this. Luckily SNA is not using hardware 90/270 yet so we are safe there.
Quoted 3 lines
*by default (since it requires Y-tiling of the frontbuffer and that makes other accesses very slow and needing workarounds to prevent overall degredation, for some workloads in particular).
Even if compiled to use Y tiling it still goes back to X tiled when 90/270 rotation is attempted. I reported that here: https://bugs.freedesktop.org/show_bug.cgi?id=91562#c14
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/3] drm/i915: Fix i915_ggtt_view_equal to handle rotation correctly
Quoted 76 lines · Tvrtko Ursulin
Quoted 74 lines · Chris Wilson
Quoted 72 lines · Tvrtko Ursulin
Hi,
Quoted 55 lines · Daniel Vetter
The rotated view depends upon the rotation paramters, but thus far we didn't bother checking for those. This seems to have been an issue ever since this was introduce in
commit
fe14d5f4e5468c5b80a24f1a64abcbe116143670Author: Tvrtko Ursulin <[email protected]> Date: Wed Dec 10 17:27:58 2014 +0000drm/i915: Infrastructure for supporting different GGTT views per object
But userspace is allowed to reuse framebuffer backing storage with different framebuffers with different pixel formats/stride/whatever. And e.g. SNA indeed does this. Hence we must check for all the paramters to match, not just that it's rotated.
v2:
intel_plane_obj_offsetalso needs to construct the full view, to avoid fallout since they don't fully match.Cc Tvrtko Ursulin <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.h +1
-1@@ -551,7 +551,7 @@ i915_ggtt_view_equal(const struct i915_ggtt_view *a,if (a->type != b->type)return false; -if (a->type ==I915_GGTT_VIEW_PARTIAL ) +if (a->type !=I915_GGTT_VIEW_NORMAL )return !memcmp (&a->params, &b->params,sizeof (a->params));return true; }drivers/gpu/drm/i915/intel_display.c +2
-3@@ -2894,16 +2894,16 @@ unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, struct drm_i915_gem_object *obj, unsigned int plane) { -const struct i915_ggtt_view *view = &i915_ggtt_view_normal; +struct i915_ggtt_view view;struct i915_vma *vma;unsigned char *offset; -if (intel_rotation_90_or_270 (intel_plane->base.state->rotation)) - view = &i915_ggtt_view_rotated; + intel_fill_fb_ggtt_view(&view, intel_plane->base.fb,drivers/gpu/drm/i915/intel_display.c unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, · line 2909
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +3
-2+ intel_plane->base.state); - vma =i915_gem_obj_to_ggtt_view (obj, view); + vma =i915_gem_obj_to_ggtt_view (obj, &view);if (WARN (!vma,"ggtt vma for display object not found! (view=%u)\n" , - view->type)) + view.type))return -1 ; offset = (unsigned char *)vma->node.start;As we discussed on IRC I had wrong assumptions when developing this. Luckily SNA is not using hardware 90/270 yet so we are safe there.
Quoted 7 lines
Quoted 3 lines
*by default (since it requires Y-tiling of the frontbuffer and that makes other accesses very slow and needing workarounds to prevent overall degredation, for some workloads in particular).
Even if compiled to use Y tiling it still goes back to X tiled when 90/270 rotation is attempted. I reported that here:
https://bugs.freedesktop.org/show_bug.cgi?id=91562#c14
Which says the kernel rejected the setcrtc with the primary rotation property set to 2 (either ROTATE_90 or 270, I forget which). -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/3] drm/i915: Fix i915_ggtt_view_equal to handle rotation correctly
In reply to Tvrtko UrsulinQuoted 75 lines · Tvrtko Ursulin
Hi,
Quoted 55 lines · Daniel Vetter
The rotated view depends upon the rotation paramters, but thus far we didn't bother checking for those. This seems to have been an issue ever since this was introduce in
commit
fe14d5f4e5468c5b80a24f1a64abcbe116143670Author: Tvrtko Ursulin <[email protected]> Date: Wed Dec 10 17:27:58 2014 +0000drm/i915: Infrastructure for supporting different GGTT views per object
But userspace is allowed to reuse framebuffer backing storage with different framebuffers with different pixel formats/stride/whatever. And e.g. SNA indeed does this. Hence we must check for all the paramters to match, not just that it's rotated.
v2:
intel_plane_obj_offsetalso needs to construct the full view, to avoid fallout since they don't fully match.Cc Tvrtko Ursulin <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.h +1
-1@@ -551,7 +551,7 @@ i915_ggtt_view_equal(const struct i915_ggtt_view *a,if (a->type != b->type)return false; -if (a->type ==I915_GGTT_VIEW_PARTIAL ) +if (a->type !=I915_GGTT_VIEW_NORMAL )return !memcmp (&a->params, &b->params,sizeof (a->params));return true; }drivers/gpu/drm/i915/intel_display.c +2
-3@@ -2894,16 +2894,16 @@ unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, struct drm_i915_gem_object *obj, unsigned int plane) { -const struct i915_ggtt_view *view = &i915_ggtt_view_normal; +struct i915_ggtt_view view;struct i915_vma *vma;unsigned char *offset; -if (intel_rotation_90_or_270 (intel_plane->base.state->rotation)) - view = &i915_ggtt_view_rotated; + intel_fill_fb_ggtt_view(&view, intel_plane->base.fb,drivers/gpu/drm/i915/intel_display.c unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, · line 2909
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +3
-2+ intel_plane->base.state); - vma =i915_gem_obj_to_ggtt_view (obj, view); + vma =i915_gem_obj_to_ggtt_view (obj, &view);if (WARN (!vma,"ggtt vma for display object not found! (view=%u)\n" , - view->type)) + view.type))return -1 ; offset = (unsigned char *)vma->node.start;As we discussed on IRC I had wrong assumptions when developing this. Luckily SNA is not using hardware 90/270 yet so we are safe there. And Android probably doesn't reuse the fb obj or it would have been reported. But I'll check.
Quoted 3 lines
So thanks for the cleanup! For all three:
Reviewed-by Tvrtko Ursulin <[email protected]>
Just rebased my pile and noticed that these three still cleanly apply. So pushed them, thanks for the review.
-Daniel
Quoted 11 lines
Just a shame this means so much more computation in
intel_plane_obj_offset, really highlights that vma should be stored in the state, if it is possible.Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/3] drm/i915: Fix i915_ggtt_view_equal to handle rotation correctly
In reply to Daniel VetterQuoted 30 lines · Daniel Vetter
The rotated view depends upon the rotation paramters, but thus far we didn't bother checking for those. This seems to have been an issue ever since this was introduce in
commit
fe14d5f4e5468c5b80a24f1a64abcbe116143670Author: Tvrtko Ursulin <[email protected]> Date: Wed Dec 10 17:27:58 2014 +0000drm/i915: Infrastructure for supporting different GGTT views per object
But userspace is allowed to reuse framebuffer backing storage with different framebuffers with different pixel formats/stride/whatever. And e.g. SNA indeed does this. Hence we must check for all the paramters to match, not just that it's rotated.
v2:
intel_plane_obj_offsetalso needs to construct the full view, to avoid fallout since they don't fully match.Cc Tvrtko Ursulin <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.h +0
-0
drivers/gpu/drm/i915/i915_gem_gtt.h i915_ggtt_view_equal(const struct i915_ggtt_view *a, · line 555
Quoted 6 lines
drivers/gpu/drm/i915/i915_gem_gtt.h +1
-1@@ -551,7 +551,7 @@ i915_ggtt_view_equal(const struct i915_ggtt_view *a,if (a->type != b->type)return false; -if (a->type ==I915_GGTT_VIEW_PARTIAL ) +if (a->type !=I915_GGTT_VIEW_NORMAL )return !memcmp (&a->params, &b->params,sizeof (a->params));
Again I have basically the same patch, except in mine the union is anoymous so mine needs to handle partial and rotated sepeartely.
Quoted 35 lines
drivers/gpu/drm/i915/i915_gem_gtt.h +0
-0return true; }drivers/gpu/drm/i915/intel_display.c +5
-5@@ -2894,16 +2894,16 @@ unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane, struct drm_i915_gem_object *obj, unsigned int plane) { -const struct i915_ggtt_view *view = &i915_ggtt_view_normal; +struct i915_ggtt_view view;struct i915_vma *vma;unsigned char *offset; -if (intel_rotation_90_or_270 (intel_plane->base.state->rotation)) - view = &i915_ggtt_view_rotated; +intel_fill_fb_ggtt_view (&view, intel_plane->base.fb, + intel_plane->base.state); - vma =i915_gem_obj_to_ggtt_view (obj, view); + vma =i915_gem_obj_to_ggtt_view (obj, &view);if (WARN (!vma,"ggtt vma for display object not found! (view=%u)\n" , - view->type)) + view.type))return -1 ; offset = (unsigned char *)vma->node.start;Signature · 6 lines
2.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx