From f861f084a7bcea1b7685bb13fa25bf6b3aa2029f Mon Sep 17 00:00:00 2001 From: "Le.Ma" Date: Tue, 24 Oct 2017 10:46:47 +0800 Subject: [PATCH 2351/4131] drm/amdkcl: [4.12] Reserve flip_flags used by amdgpu_dm The pageflip_flags is introduced from 4.12. Change-Id: I1d0a681f5bd721260aa913f8f7e30b95f0a27cdc Signed-off-by: Le.Ma Reviewed-by: Xiaojie Yuan --- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 3 +++ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h index 11bdfd1..48af370 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h @@ -443,6 +443,9 @@ struct amdgpu_crtc { enum amdgpu_interrupt_state vsync_timer_enabled; int otg_inst; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) + uint32_t flip_flags; +#endif /* After Set Mode stream will be non-NULL */ const struct dc_stream_state *stream; struct drm_pending_vblank_event *event; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index ec68b33..57f48fa 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4021,7 +4021,11 @@ static void amdgpu_dm_do_flip( struct amdgpu_framebuffer *afb = to_amdgpu_framebuffer(fb); struct amdgpu_bo *abo = gem_to_amdgpu_bo(afb->obj); struct amdgpu_device *adev = crtc->dev->dev_private; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) + bool async_flip = (acrtc->flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0; +#else bool async_flip = (crtc->state->pageflip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0; +#endif struct dc_flip_addrs addr = { {0} }; /* TODO eliminate or rename surface_update */ struct dc_surface_update surface_updates[1] = { {0} }; @@ -4153,7 +4157,11 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, * TODO Check if it's correct */ *wait_for_vblank = +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) + acrtc_attach->flip_flags & DRM_MODE_PAGE_FLIP_ASYNC ? +#else pcrtc->state->pageflip_flags & DRM_MODE_PAGE_FLIP_ASYNC ? +#endif false : true; /* TODO: Needs rework for multiplane flip */ @@ -4164,6 +4172,12 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, crtc, fb, drm_crtc_vblank_count(crtc) + *wait_for_vblank); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) + /*TODO BUG remove ASAP in 4.12 to avoid race between worker and flip IOCTL */ + + /*clean up the flags for next usage*/ + acrtc_attach->flip_flags = 0; +#endif } } -- 2.7.4