Allow ASYNC flip with atomic helpers.
Subsystems (5)
v5 cover Allow ASYNC flip with atomic helpers.
This series is a folow-up on
https://patchwork.kernel.org/patch/9501787/
The first patch makes changes to atomic helpers to allow for drives with ASYNC flip support to use them. Patch 2 is to use this in AMDGPU/DC.
Patch 3 is possible cleanup in nouveau/kms who seems to have to duplicate the helper as we did to support ASYNC flips.
v2:
Resend drm/atomic: Save flip flags in drm_plane_state since the original patch was incomplete. Squash 2 AMD changes into one to not break compilation.
v3:
Following Daniel's comments, save flip flags in crtc_state instead of plane_state.
v4:
Lauren's comment, reset flp flags before using again. Harry's comment, fix identation in amd/display.
v5:
Rename the flag, fix typo in header.
Andrey Grodzovsky (3):
drm/atomic: Save flip flags in drm_crtc_state drm/nouveau/kms/nv50: Switch to using atomic helper for flip. drm/amd/display: Switch to using atomic_helper for flip.
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 113 +++++---------------- drivers/gpu/drm/drm_atomic_helper.c | 20 ++-- drivers/gpu/drm/nouveau/nv50_display.c | 84 ++------------- include/drm/drm_crtc.h | 9 +- 5 files changed, 48 insertions(+), 179 deletions(-)
Signature · 6 lines
1.9.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v5 1/3 drm/atomic: Save flip flags in drm_crtc_state
Allows using atomic flip helpers for drivers using ASYNC flip.
Remove ASYNC_FLIP restriction in helpers and caches the page flip flags in drm_crtc_state to be used in the low level drivers.
v2:
Resending the patch since the original was broken.
v3:
Save flag in crtc_state instead of plane_state
v4:
Reset the flag before using again.
v5:
Fix type in header.
Rename the field to pageflip_flags. Remove unrelated hunk.
--- drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++-------------- include/drm/drm_crtc.h | 9 ++++++++- 2 files changed, 14 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +6 -14
@@ -2737,7 +2737,8 @@ static int page_flip_common(struct drm_atomic_state *state, struct drm_crtc *crtc, struct drm_framebuffer *fb, - struct drm_pending_vblank_event *event) + struct drm_pending_vblank_event *event, + uint32_t flags) { struct drm_plane *plane = crtc->primary;struct drm_plane_state *plane_state;
@@ -2749,12 +2750,12 @@ static int page_flip_common(return PTR_ERR (crtc_state); crtc_state->event = event; + crtc_state->pageflip_flags = flags; plane_state =drm_atomic_get_plane_state (state, plane);if (IS_ERR (plane_state))return PTR_ERR (plane_state); - ret =drm_atomic_set_crtc_for_plane (plane_state, crtc);if (ret !=0 )return ret;
@@ -2781,10 +2782,6 @@ static int page_flip_common(* Provides a default &drm_crtc_funcs.page_flip implementation * using the atomic driver interface. * -* Note that for now so called async page flips (i.e. updates which are not -* synchronized to vblank) are not supported, since the atomic interfaces have -* no provisions for this yet. -* * Returns: * Returns 0 on success, negative errno numbers on failure. *
@@ -2800,9 +2797,6 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc,struct drm_atomic_state *state;int ret =0 ; -if (flags &DRM_MODE_PAGE_FLIP_ASYNC ) -return -EINVAL ; - state =drm_atomic_state_alloc (plane->dev);if (!state)return -ENOMEM ;
@@ -2810,7 +2804,7 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, state->acquire_ctx =drm_modeset_legacy_acquire_ctx (crtc); retry: - ret =page_flip_common (state, crtc, fb, event); + ret =page_flip_common (state, crtc, fb, event, flags);if (ret !=0 ) goto fail;
@@ -2865,9 +2859,6 @@ int drm_atomic_helper_page_flip_target(struct drm_crtc_state *crtc_state;int ret =0 ; -if (flags &DRM_MODE_PAGE_FLIP_ASYNC ) -return -EINVAL ; - state =drm_atomic_state_alloc (plane->dev);if (!state)return -ENOMEM ;
@@ -2875,7 +2866,7 @@ int drm_atomic_helper_page_flip_target( state->acquire_ctx =drm_modeset_legacy_acquire_ctx (crtc); retry: - ret =page_flip_common (state, crtc, fb, event); + ret =page_flip_common (state, crtc, fb, event, flags);if (ret !=0 ) goto fail;
@@ -3072,6 +3063,7 @@ void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc, state->color_mgmt_changed = false; state->zpos_changed = false; state->event =NULL ; + state->pageflip_flags =0 ; }EXPORT_SYMBOL (__drm_atomic_helper_crtc_duplicate_state);
include/drm/drm_crtc.h +8 -1
@@ -162,10 +162,17 @@ struct drm_crtc_state {* Target vertical blank period when a page flip * should take effect. */ -u32 target_vblank;/** +* @pageflip_flags: +* +* DRM_MODE_PAGE_FLIP_* flags, as passed to the page flip ioctl. +* Zero in any other case. +*/ +u32 pageflip_flags; + +/** * @event: * * Optional pointer to a DRM event to signal upon completion of the
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 1486072591-3893-1-git-send-email-Andrey.Grodzovsky-5C7GfCeVMHo@public.gmane.org
PATCH v5 2/3 drm/nouveau/kms/nv50: Switch to using atomic helper for flip.
v2:
Update code after flip_flags moved from plane_state to crtc_state
v5:
Rename to pageflip_flags.
--- drivers/gpu/drm/nouveau/nv50_display.c | 84 ++++------------------------------ 1 file changed, 10 insertions(+), 74 deletions(-)
drivers/gpu/drm/nouveau/nv50_display.c +10 -74
@@ -831,7 +831,8 @@ struct nv50_wndw_func {static int nv50_wndw_atomic_check_acquire (struct nv50_wndw *wndw,struct nv50_wndw_atom *asyw, -struct nv50_head_atom *asyh) +struct nv50_head_atom *asyh, +u32 pflip_flags) {struct nouveau_framebuffer *fb =nouveau_framebuffer (asyw->state.fb);struct nouveau_drm *drm =nouveau_drm (wndw->plane.dev);
@@ -846,6 +847,9 @@ struct nv50_wndw_func { asyw->image.w = fb->base.width; asyw->image.h = fb->base.height; asyw->image.kind = (fb->nvbo->tile_flags &0x0000ff00 ) >>8 ; + + asyw->interval = pflip_flags &DRM_MODE_PAGE_FLIP_ASYNC ?0 :1 ; +if (asyw->image.kind) { asyw->image.layout =0 ;if (drm->device.info.chipset >=0xc0 )
@@ -883,6 +887,7 @@ struct nv50_wndw_func {struct nv50_head_atom *harm =NULL , *asyh =NULL ;bool varm = false, asyv = false, asym = false;int ret; +u32 pflip_flags =0 ;NV_ATOMIC (drm,"%s atomic_check\n" , plane->name);if (asyw->state.crtc) {
@@ -891,6 +896,7 @@ struct nv50_wndw_func {return PTR_ERR (asyh); asym =drm_atomic_crtc_needs_modeset (&asyh->state); asyv = asyh->state.active; + pflip_flags = asyh->state.pageflip_flags; }if (armw->state.crtc) {
@@ -907,7 +913,8 @@ struct nv50_wndw_func { asyw->set.point = true;if (!varm || asym || armw->state.fb != asyw->state.fb) { - ret =nv50_wndw_atomic_check_acquire (wndw, asyw, asyh); + ret =nv50_wndw_atomic_check_acquire ( + wndw, asyw, asyh, pflip_flags);if (ret)return ret; }
@@ -2221,77 +2228,6 @@ struct nv50_base { .atomic_check = nv50_head_atomic_check, }; -/* This is identical to the version in the atomic helpers, except that -* it supports non-vblanked ("async") page flips. -*/ -static int -nv50_head_page_flip (struct drm_crtc *crtc,struct drm_framebuffer *fb, -struct drm_pending_vblank_event *event,u32 flags) -{ -struct drm_plane *plane = crtc->primary; -struct drm_atomic_state *state; -struct drm_plane_state *plane_state; -struct drm_crtc_state *crtc_state; -int ret =0 ; - - state =drm_atomic_state_alloc (plane->dev); -if (!state) -return -ENOMEM ; - - state->acquire_ctx =drm_modeset_legacy_acquire_ctx (crtc); -retry: - crtc_state =drm_atomic_get_crtc_state (state, crtc); -if (IS_ERR (crtc_state)) { - ret =PTR_ERR (crtc_state); - goto fail; - } - crtc_state->event = event; - - plane_state =drm_atomic_get_plane_state (state, plane); -if (IS_ERR (plane_state)) { - ret =PTR_ERR (plane_state); - goto fail; - } - - ret =drm_atomic_set_crtc_for_plane (plane_state, crtc); -if (ret !=0 ) - goto fail; -drm_atomic_set_fb_for_plane (plane_state, fb); - -/* Make sure we don't accidentally do a full modeset. */ - state->allow_modeset = false; -if (!crtc_state->active) { -DRM_DEBUG_ATOMIC ("[CRTC:%d] disabled, rejecting legacy flip\n" , - crtc->base.id); - ret = -EINVAL ; - goto fail; - } - -if (flags &DRM_MODE_PAGE_FLIP_ASYNC ) -nv50_wndw_atom (plane_state)->interval =0 ; - - ret =drm_atomic_nonblocking_commit (state); -fail: -if (ret == -EDEADLK ) - goto backoff; - -drm_atomic_state_put (state); -return ret; - -backoff: -drm_atomic_state_clear (state); -drm_atomic_legacy_backoff (state); - -/* -* Someone might have exchanged the framebuffer while we dropped locks -* in the backoff code. We need to fix up the fb refcount tracking the -* core does for us. -*/ - plane->old_fb = plane->fb; - - goto retry; -} -static int nv50_head_gamma_set (struct drm_crtc *crtc,u16 *r,u16 *g,u16 *b,uint32_t size)
@@ -2386,7 +2322,7 @@ struct nv50_base { .gamma_set = nv50_head_gamma_set, .destroy = nv50_head_destroy, .set_config = drm_atomic_helper_set_config, - .page_flip = nv50_head_page_flip, + .page_flip = drm_atomic_helper_page_flip, .set_property = drm_atomic_helper_crtc_set_property, .atomic_duplicate_state = nv50_head_atomic_duplicate_state, .atomic_destroy_state = nv50_head_atomic_destroy_state,
Signature · 6 lines
1.9.1 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH v5 3/3 drm/amd/display: Switch to using atomic_helper for flip.
In reply to a message not in the archivev2:
Modify for movig pflip flags to crtc_state
v4:
Fix identation.
v5:
Rename field to pageflip_flags.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 113 +++++---------------- 2 files changed, 24 insertions(+), 90 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +0 -1
@@ -443,7 +443,6 @@ struct amdgpu_crtc {enum amdgpu_interrupt_state vsync_timer_enabled;int otg_inst; -uint32_t flip_flags;/* After Set Mode target will be non-NULL */ struct dc_target *target; };
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +24 -89
169 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau
Alex Deucher
Reviewed-byQuoted 14 lines · Andrey Grodzovsky
This series is a folow-up on
https://patchwork.kernel.org/patch/9501787/The first patch makes changes to atomic helpers to allow for drives with ASYNC flip support to use them. Patch 2 is to use this in AMDGPU/DC.
Patch 3 is possible cleanup in nouveau/kms who seems to have to duplicate the helper as we did to support ASYNC flips.v2:
Resend drm/atomic: Save flip flags indrm_plane_statesince the original patch was incomplete. Squash 2 AMD changes into one to not break compilation.v3:
Following Daniel's comments, save flip flags incrtc_stateinstead ofplane_state.
Quoted 6 lines
v4:
Lauren's comment, reset flp flags before using again. Harry's comment, fix identation in amd/display.v5:
Rename the flag, fix typo in header.
Looks good. The series is:
Unless there are any objections I'll push to drm-misc today.
Thanks!
Alex
Quoted 13 lines
Andrey Grodzovsky (3):
drm/atomic: Save flip flags indrm_crtc_statedrm/nouveau/kms/nv50: Switch to using atomic helper for flip. drm/amd/display: Switch to usingatomic_helperfor flip.drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 113 +++++---------------- drivers/gpu/drm/drm_atomic_helper.c | 20 ++-- drivers/gpu/drm/nouveau/nv50_display.c | 84 ++------------- include/drm/drm_crtc.h | 9 +- 5 files changed, 48 insertions(+), 179 deletions(-)
Quoted 7 lines
--
1.9.1_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): CADnq5_N74zmu+O-yHMp28+8pihvwYV06mzTfD_NbzZnKJB+r_w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Edward O'Callaghan
Reviewed-byQuoted 47 lines · Alex Deucher
Quoted 14 lines · Andrey Grodzovsky
This series is a folow-up on
https://patchwork.kernel.org/patch/9501787/The first patch makes changes to atomic helpers to allow for drives with ASYNC flip support to use them. Patch 2 is to use this in AMDGPU/DC.
Patch 3 is possible cleanup in nouveau/kms who seems to have to duplicate the helper as we did to support ASYNC flips.v2:
Resend drm/atomic: Save flip flags indrm_plane_statesince the original patch was incomplete. Squash 2 AMD changes into one to not break compilation.v3:
Following Daniel's comments, save flip flags incrtc_stateinstead ofplane_state.Quoted 6 lines
v4:
Lauren's comment, reset flp flags before using again. Harry's comment, fix identation in amd/display.v5:
Rename the flag, fix typo in header.Looks good. The series is:
Reviewed-by Alex Deucher <[email protected]>Unless there are any objections I'll push to drm-misc today.
Thanks!
Alex
Quoted 16 lines
Andrey Grodzovsky (3):
drm/atomic: Save flip flags indrm_crtc_statedrm/nouveau/kms/nv50: Switch to using atomic helper for flip. drm/amd/display: Switch to usingatomic_helperfor flip.drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 113 +++++---------------- drivers/gpu/drm/drm_atomic_helper.c | 20 ++-- drivers/gpu/drm/nouveau/nv50_display.c | 84 ++------------- include/drm/drm_crtc.h | 9 +- 5 files changed, 48 insertions(+), 179 deletions(-)--
1.9.1
Quoted 9 lines
Quoted 4 lines
_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx