Revert "drm/amdgpu: Refactor flip into prepare submit and submit. (v2)"
Subsystems (2)
PATCH 1/1 Revert "drm/amdgpu: Refactor flip into prepare submit and submit. (v2)"
From: Michel Dänzer <[email protected]>
This reverts commit cb341a319f7e66f879d69af929c3dadfc1a8f31e.
The purpose of the refactor was for amdgpu_crtc_prepare/submit_flip to be used by the DC code, but that's no longer the case.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 147 ++++++---------------------- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 17 ---- 2 files changed, 29 insertions(+), 135 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +29 -118
@@ -138,56 +138,10 @@ static void amdgpu_unpin_work_func(struct work_struct *__work)kfree (work); } - -static void amdgpu_flip_work_cleanup (struct amdgpu_flip_work *work) -{ -int i; - -amdgpu_bo_unref (&work->old_abo); -fence_put (work->excl); -for (i =0 ; i < work->shared_count; ++i) -fence_put (work->shared[i]); -kfree (work->shared); -kfree (work); -} - -static void amdgpu_flip_cleanup_unreserve ( -struct amdgpu_flip_work *work, -struct amdgpu_bo *new_abo) -{ -amdgpu_bo_unreserve (new_abo); -amdgpu_flip_work_cleanup (work); -} - -static void amdgpu_flip_cleanup_unpin ( -struct amdgpu_flip_work *work, -struct amdgpu_bo *new_abo) -{ -if (unlikely (amdgpu_bo_unpin (new_abo) !=0 )) -DRM_ERROR ("failed to unpin new abo in error path\n" ); -amdgpu_flip_cleanup_unreserve (work, new_abo); -} - -void amdgpu_crtc_cleanup_flip_ctx ( -struct amdgpu_flip_work *work, -struct amdgpu_bo *new_abo) -{ -if (unlikely (amdgpu_bo_reserve (new_abo, false) !=0 )) { -DRM_ERROR ("failed to reserve new abo in error path\n" ); -amdgpu_flip_work_cleanup (work); -return ; - } -amdgpu_flip_cleanup_unpin (work, new_abo); -} - -int amdgpu_crtc_prepare_flip ( -struct drm_crtc *crtc, -struct drm_framebuffer *fb, -struct drm_pending_vblank_event *event, -uint32_t page_flip_flags, -uint32_t target, -struct amdgpu_flip_work **work_p, -struct amdgpu_bo **new_abo_p) +int amdgpu_crtc_page_flip_target (struct drm_crtc *crtc, +struct drm_framebuffer *fb, +struct drm_pending_vblank_event *event, +uint32_t page_flip_flags,uint32_t target) {struct drm_device *dev = crtc->dev;struct amdgpu_device *adev = dev->dev_private;
@@ -200,7 +154,7 @@ int amdgpu_crtc_prepare_flip(unsigned long flags;u64 tiling_flags;u64 base; -int r; +int i, r; work =kzalloc (sizeof *work,GFP_KERNEL );if (work ==NULL )
@@ -261,84 +215,41 @@ int amdgpu_crtc_prepare_flip(spin_unlock_irqrestore (&crtc->dev->event_lock, flags); r = -EBUSY ; goto pflip_cleanup; - } -spin_unlock_irqrestore (&crtc->dev->event_lock, flags); - - *work_p = work; - *new_abo_p = new_abo; -return 0 ; - -pflip_cleanup: -amdgpu_crtc_cleanup_flip_ctx (work, new_abo); -return r; - -unpin: -amdgpu_flip_cleanup_unpin (work, new_abo); -return r; - -unreserve: -amdgpu_flip_cleanup_unreserve (work, new_abo); -return r; - -cleanup: -amdgpu_flip_work_cleanup (work); -return r; - -} - -void amdgpu_crtc_submit_flip ( -struct drm_crtc *crtc, -struct drm_framebuffer *fb, -struct amdgpu_flip_work *work, -struct amdgpu_bo *new_abo) -{ -unsigned long flags; -struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); - -spin_lock_irqsave (&crtc->dev->event_lock, flags); amdgpu_crtc->pflip_status =AMDGPU_FLIP_PENDING ; amdgpu_crtc->pflip_works = work; + +DRM_DEBUG_DRIVER ("crtc:%d[%p], pflip_stat:AMDGPU_FLIP_PENDING, work: %p,\n" , + amdgpu_crtc->crtc_id, amdgpu_crtc, work);/* update crtc fb */ crtc->primary->fb = fb;spin_unlock_irqrestore (&crtc->dev->event_lock, flags); - -DRM_DEBUG_DRIVER ( -"crtc:%d[%p], pflip_stat:AMDGPU_FLIP_PENDING, work: %p,\n" , - amdgpu_crtc->crtc_id, amdgpu_crtc, work); -amdgpu_flip_work_func (&work->flip_work.work); -} +return 0 ; -int amdgpu_crtc_page_flip_target (struct drm_crtc *crtc, -struct drm_framebuffer *fb, -struct drm_pending_vblank_event *event, -uint32_t page_flip_flags, -uint32_t target) -{ -struct amdgpu_bo *new_abo; -struct amdgpu_flip_work *work; -int r =amdgpu_crtc_prepare_flip ( - crtc, - fb, - event, - page_flip_flags, - target, - &work, - &new_abo); - -if (r) -return r; - -amdgpu_crtc_submit_flip ( - crtc, - fb, - work, - new_abo); +pflip_cleanup: +if (unlikely (amdgpu_bo_reserve (new_abo, false) !=0 )) { +DRM_ERROR ("failed to reserve new abo in error path\n" ); + goto cleanup; + } +unpin: +if (unlikely (amdgpu_bo_unpin (new_abo) !=0 )) { +DRM_ERROR ("failed to unpin new abo in error path\n" ); + } +unreserve: +amdgpu_bo_unreserve (new_abo); -return 0 ; +cleanup: +amdgpu_bo_unref (&work->old_abo); +fence_put (work->excl); +for (i =0 ; i < work->shared_count; ++i) +fence_put (work->shared[i]); +kfree (work->shared); +kfree (work); + +return r; }int amdgpu_crtc_set_config (struct drm_mode_set *set)
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +0 -17
@@ -702,23 +702,6 @@ int amdgpu_crtc_page_flip_target(struct drm_crtc *crtc,struct drm_framebuffer *fb, struct drm_pending_vblank_event *event, uint32_t page_flip_flags, uint32_t target); -void amdgpu_crtc_cleanup_flip_ctx ( -struct amdgpu_flip_work *work, -struct amdgpu_bo *new_abo); -int amdgpu_crtc_prepare_flip (struct drm_crtc *crtc, -struct drm_framebuffer *fb, -struct drm_pending_vblank_event *event, -uint32_t page_flip_flags, -uint32_t target, -struct amdgpu_flip_work **work, -struct amdgpu_bo **new_abo); - -void amdgpu_crtc_submit_flip ( -struct drm_crtc *crtc, -struct drm_framebuffer *fb, -struct amdgpu_flip_work *work, -struct amdgpu_bo *new_abo); -extern const struct drm_mode_config_funcs amdgpu_mode_funcs;#endif
Signature · 6 lines
2.11.0 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20170427081838.2424-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Am 27.04.2017 um 10:18 schrieb Michel Dänzer:
Quoted 163 lines
From: Michel Dänzer <[email protected]>
This reverts commit
cb341a319f7e66f879d69af929c3dadfc1a8f31e.The purpose of the refactor was for amdgpu_crtc_prepare/submit_flip to be used by the DC code, but that's no longer the case.
Signed-off-by Michel Dänzer <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 147 ++++++---------------------- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 17 ---- 2 files changed, 29 insertions(+), 135 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +9
-109@@ -138,56 +138,10 @@ static void amdgpu_unpin_work_func(struct work_struct *__work)kfree (work); } - -static void amdgpu_flip_work_cleanup (struct amdgpu_flip_work *work) -{ -int i; - -amdgpu_bo_unref (&work->old_abo); -fence_put (work->excl); -for (i =0 ; i < work->shared_count; ++i) -fence_put (work->shared[i]); -kfree (work->shared); -kfree (work); -} - -static void amdgpu_flip_cleanup_unreserve ( -struct amdgpu_flip_work *work, -struct amdgpu_bo *new_abo) -{ -amdgpu_bo_unreserve (new_abo); -amdgpu_flip_work_cleanup (work); -} - -static void amdgpu_flip_cleanup_unpin ( -struct amdgpu_flip_work *work, -struct amdgpu_bo *new_abo) -{ -if (unlikely (amdgpu_bo_unpin (new_abo) !=0 )) -DRM_ERROR ("failed to unpin new abo in error path\n" ); -amdgpu_flip_cleanup_unreserve (work, new_abo); -} - -void amdgpu_crtc_cleanup_flip_ctx ( -struct amdgpu_flip_work *work, -struct amdgpu_bo *new_abo) -{ -if (unlikely (amdgpu_bo_reserve (new_abo, false) !=0 )) { -DRM_ERROR ("failed to reserve new abo in error path\n" ); -amdgpu_flip_work_cleanup (work); -return ; - } -amdgpu_flip_cleanup_unpin (work, new_abo); -} - -int amdgpu_crtc_prepare_flip ( -struct drm_crtc *crtc, -struct drm_framebuffer *fb, -struct drm_pending_vblank_event *event, -uint32_t page_flip_flags, -uint32_t target, -struct amdgpu_flip_work **work_p, -struct amdgpu_bo **new_abo_p) +int amdgpu_crtc_page_flip_target (struct drm_crtc *crtc, +struct drm_framebuffer *fb, +struct drm_pending_vblank_event *event, +uint32_t page_flip_flags,uint32_t target) {struct drm_device *dev = crtc->dev;struct amdgpu_device *adev = dev->dev_private;@@ -200,7 +154,7 @@ int amdgpu_crtc_prepare_flip(unsigned long flags;u64 tiling_flags;u64 base; -int r; +int i, r; work =kzalloc (sizeof *work,GFP_KERNEL );if (work ==NULL )@@ -261,84 +215,41 @@ int amdgpu_crtc_prepare_flip(spin_unlock_irqrestore (&crtc->dev->event_lock, flags); r = -EBUSY ; goto pflip_cleanup; - } -spin_unlock_irqrestore (&crtc->dev->event_lock, flags); - - *work_p = work; - *new_abo_p = new_abo; -return 0 ; - -pflip_cleanup: -amdgpu_crtc_cleanup_flip_ctx (work, new_abo); -return r; - -unpin: -amdgpu_flip_cleanup_unpin (work, new_abo); -return r; - -unreserve: -amdgpu_flip_cleanup_unreserve (work, new_abo); -return r; - -cleanup: -amdgpu_flip_work_cleanup (work); -return r; - -} - -void amdgpu_crtc_submit_flip ( -struct drm_crtc *crtc, -struct drm_framebuffer *fb, -struct amdgpu_flip_work *work, -struct amdgpu_bo *new_abo) -{ -unsigned long flags; -struct amdgpu_crtc *amdgpu_crtc =to_amdgpu_crtc (crtc); - -spin_lock_irqsave (&crtc->dev->event_lock, flags); amdgpu_crtc->pflip_status =AMDGPU_FLIP_PENDING ; amdgpu_crtc->pflip_works = work; + +DRM_DEBUG_DRIVER ("crtc:%d[%p], pflip_stat:AMDGPU_FLIP_PENDING, work: %p,\n" , + amdgpu_crtc->crtc_id, amdgpu_crtc, work);/* update crtc fb */ crtc->primary->fb = fb;spin_unlock_irqrestore (&crtc->dev->event_lock, flags); - -DRM_DEBUG_DRIVER ( -"crtc:%d[%p], pflip_stat:AMDGPU_FLIP_PENDING, work: %p,\n" , - amdgpu_crtc->crtc_id, amdgpu_crtc, work); -amdgpu_flip_work_func (&work->flip_work.work); -} +return 0 ; -int amdgpu_crtc_page_flip_target (struct drm_crtc *crtc, -struct drm_framebuffer *fb, -struct drm_pending_vblank_event *event, -uint32_t page_flip_flags, -uint32_t target) -{ -struct amdgpu_bo *new_abo; -struct amdgpu_flip_work *work; -int r =amdgpu_crtc_prepare_flip ( - crtc, - fb, - event, - page_flip_flags, - target, - &work, - &new_abo); -
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c int amdgpu_crtc_prepare_flip( · line 233
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2
-8-if (r) -return r; - -amdgpu_crtc_submit_flip ( - crtc, - fb, - work, - new_abo); +pflip_cleanup: +if (unlikely (amdgpu_bo_reserve (new_abo, false) !=0 )) {
Well here we explicitly shouldn't use an interruptible wait, otherwise we would keep the BO pinned.
Christian.
Quoted 41 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +18
-1+DRM_ERROR ("failed to reserve new abo in error path\n" ); + goto cleanup; + } +unpin: +if (unlikely (amdgpu_bo_unpin (new_abo) !=0 )) { +DRM_ERROR ("failed to unpin new abo in error path\n" ); + } +unreserve: +amdgpu_bo_unreserve (new_abo); -return 0 ; +cleanup: +amdgpu_bo_unref (&work->old_abo); +fence_put (work->excl); +for (i =0 ; i < work->shared_count; ++i) +fence_put (work->shared[i]); +kfree (work->shared); +kfree (work); + +return r; }int amdgpu_crtc_set_config (struct drm_mode_set *set)drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +0
-10@@ -702,23 +702,6 @@ int amdgpu_crtc_page_flip_target(struct drm_crtc *crtc,struct drm_framebuffer *fb, struct drm_pending_vblank_event *event, uint32_t page_flip_flags, uint32_t target); -void amdgpu_crtc_cleanup_flip_ctx ( -struct amdgpu_flip_work *work, -struct amdgpu_bo *new_abo); -int amdgpu_crtc_prepare_flip (struct drm_crtc *crtc, -struct drm_framebuffer *fb, -struct drm_pending_vblank_event *event, -uint32_t page_flip_flags, -uint32_t target, -struct amdgpu_flip_work **work, -struct amdgpu_bo **new_abo);
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h int amdgpu_crtc_page_flip_target(struct drm_crtc *crtc, · line 707
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +0
-7- -void amdgpu_crtc_submit_flip ( -struct drm_crtc *crtc, -struct drm_framebuffer *fb, -struct amdgpu_flip_work *work, -struct amdgpu_bo *new_abo); -extern const struct drm_mode_config_funcs amdgpu_mode_funcs;#endif
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 4e89bf8d-1620-e0e8-a331-9e2d53341635-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
Quoted 9 lines · Christian König
Am 27.04.2017 um 10:18 schrieb Michel Dänzer:
Quoted 8 lines
From: Michel Dänzer <[email protected]>
This reverts commit
cb341a319f7e66f879d69af929c3dadfc1a8f31e.The purpose of the refactor was for amdgpu_crtc_prepare/submit_flip to be used by the DC code, but that's no longer the case.
Signed-off-by Michel Dänzer <[email protected]>
[...]
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c int amdgpu_crtc_prepare_flip( · line 233
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2
-0+pflip_cleanup: +if (unlikely (amdgpu_bo_reserve (new_abo, false) !=0 )) {Well here we explicitly shouldn't use an interruptible wait, otherwise we would keep the BO pinned.
Makes sense, but this patch just reverts another commit and moves this code unchanged. I'll send a follow-up patch which fixes this (possibly also in other error paths).
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 64d1457a-8edb-b4bd-8b22-c8cad1bc53d9-otUistvHUpPR7s880joybQ@public.gmane.org
Am 28.04.2017 um 08:59 schrieb Michel Dänzer:
Quoted 12 lines · Christian König
Quoted 9 lines
Am 27.04.2017 um 10:18 schrieb Michel Dänzer:
Quoted 8 lines
From: Michel Dänzer <[email protected]>
This reverts commit
cb341a319f7e66f879d69af929c3dadfc1a8f31e.The purpose of the refactor was for amdgpu_crtc_prepare/submit_flip to be used by the DC code, but that's no longer the case.
Signed-off-by Michel Dänzer <[email protected]>[...]
Quoted 7 lines
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c int amdgpu_crtc_prepare_flip( · line 233
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2
-0+pflip_cleanup: +if (unlikely (amdgpu_bo_reserve (new_abo, false) !=0 )) {Well here we explicitly shouldn't use an interruptible wait, otherwise we would keep the BO pinned.
Makes sense, but this patch just reverts another commit and moves this code unchanged. I'll send a follow-up patch which fixes this (possibly also in other error paths).
Sounds good, and feel free to CC me as well.
Christian.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): a9e60838-eee6-f420-7c66-210158f72262-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
Quoted 19 lines · Christian König
Am 28.04.2017 um 08:59 schrieb Michel Dänzer:
Quoted 18 lines · Christian König
Quoted 9 lines
Am 27.04.2017 um 10:18 schrieb Michel Dänzer:
Quoted 8 lines
From: Michel Dänzer <[email protected]>
This reverts commit
cb341a319f7e66f879d69af929c3dadfc1a8f31e.The purpose of the refactor was for amdgpu_crtc_prepare/submit_flip to be used by the DC code, but that's no longer the case.
Signed-off-by Michel Dänzer <[email protected]>[...]
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+pflip_cleanup: + if (unlikely(amdgpu_bo_reserve(new_abo, false) != 0)) {Well here we explicitly shouldn't use an interruptible wait, otherwise we would keep the BO pinned.
Makes sense, but this patch just reverts another commit and moves this code unchanged.
Actually, after rebasing to current amd-staging-4.9, it already looks like you suggested. Can I get your Reviewed-by for that?
Quoted 4 lines
Quoted 2 lines
I'll send a follow-up patch which fixes this (possibly also in other error paths).
Sounds good, and feel free to CC me as well.
Done.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 36fdc234-42e9-5e94-8d6a-886ff5ad5ea3-otUistvHUpPR7s880joybQ@public.gmane.org
Am 28.04.2017 um 10:48 schrieb Michel Dänzer:
Quoted 14 lines · Christian König
Quoted 13 lines
Am 28.04.2017 um 08:59 schrieb Michel Dänzer:
Quoted 12 lines · Christian König
Quoted 9 lines
Am 27.04.2017 um 10:18 schrieb Michel Dänzer:
Quoted 8 lines
From: Michel Dänzer <[email protected]>
This reverts commit
cb341a319f7e66f879d69af929c3dadfc1a8f31e.The purpose of the refactor was for amdgpu_crtc_prepare/submit_flip to be used by the DC code, but that's no longer the case.
Signed-off-by Michel Dänzer <[email protected]>[...]
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+pflip_cleanup: + if (unlikely(amdgpu_bo_reserve(new_abo, false) != 0)) {Well here we explicitly shouldn't use an interruptible wait, otherwise we would keep the BO pinned.
Makes sense, but this patch just reverts another commit and moves this code unchanged.
Actually, after rebasing to current amd-staging-4.9, it already looks like you suggested. Can I get your Reviewed-by for that?
Yes, feel free to add my rb.
Christian.
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
I'll send a follow-up patch which fixes this (possibly also in other error paths).
Sounds good, and feel free to CC me as well.
Done.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx