drm/radeon: remove (pre|post)_page_flip callbacks
Subsystems (2)
PATCH 1/5 drm/radeon: remove (pre|post)_page_flip callbacks
From: Christian König <[email protected]>
They are doing the same on all generations anyway.
--- drivers/gpu/drm/radeon/evergreen.c | 30 ---------------------- drivers/gpu/drm/radeon/r100.c | 30 ---------------------- drivers/gpu/drm/radeon/radeon.h | 4 --- drivers/gpu/drm/radeon/radeon_asic.c | 44 --------------------------------- drivers/gpu/drm/radeon/radeon_asic.h | 6 ----- drivers/gpu/drm/radeon/radeon_display.c | 4 +-- drivers/gpu/drm/radeon/rs600.c | 12 --------- 7 files changed, 2 insertions(+), 128 deletions(-)
drivers/gpu/drm/radeon/evergreen.c +0 -30
@@ -1301,36 +1301,6 @@ void dce4_wait_for_vblank(struct radeon_device *rdev, int crtc) }/** -* radeon_irq_kms_pflip_irq_get - pre-pageflip callback. -* -* @rdev: radeon_device pointer -* @crtc: crtc to prepare for pageflip on -* -* Pre-pageflip callback (evergreen+). -* Enables the pageflip irq (vblank irq). -*/ -void evergreen_pre_page_flip (struct radeon_device *rdev,int crtc) -{ -/* enable the pflip int */ -radeon_irq_kms_pflip_irq_get (rdev, crtc); -} - -/** -* evergreen_post_page_flip - pos-pageflip callback. -* -* @rdev: radeon_device pointer -* @crtc: crtc to cleanup pageflip on -* -* Post-pageflip callback (evergreen+). -* Disables the pageflip irq (vblank irq). -*/ -void evergreen_post_page_flip (struct radeon_device *rdev,int crtc) -{ -/* disable the pflip int */ -radeon_irq_kms_pflip_irq_put (rdev, crtc); -} - -/** * evergreen_page_flip - pageflip callback. * * @rdev: radeon_device pointer
drivers/gpu/drm/radeon/r100.c +0 -30
@@ -142,36 +142,6 @@ void r100_wait_for_vblank(struct radeon_device *rdev, int crtc) }/** -* r100_pre_page_flip - pre-pageflip callback. -* -* @rdev: radeon_device pointer -* @crtc: crtc to prepare for pageflip on -* -* Pre-pageflip callback (r1xx-r4xx). -* Enables the pageflip irq (vblank irq). -*/ -void r100_pre_page_flip (struct radeon_device *rdev,int crtc) -{ -/* enable the pflip int */ -radeon_irq_kms_pflip_irq_get (rdev, crtc); -} - -/** -* r100_post_page_flip - pos-pageflip callback. -* -* @rdev: radeon_device pointer -* @crtc: crtc to cleanup pageflip on -* -* Post-pageflip callback (r1xx-r4xx). -* Disables the pageflip irq (vblank irq). -*/ -void r100_post_page_flip (struct radeon_device *rdev,int crtc) -{ -/* disable the pflip int */ -radeon_irq_kms_pflip_irq_put (rdev, crtc); -} - -/** * r100_page_flip - pageflip callback. * * @rdev: radeon_device pointer
drivers/gpu/drm/radeon/radeon.h +0 -4
@@ -1882,9 +1882,7 @@ struct radeon_asic { } dpm;/* pageflipping */ struct { -void (*pre_page_flip)(struct radeon_device *rdev,int crtc);u32 (*page_flip)(struct radeon_device *rdev,int crtc,u64 crtc_base); -void (*post_page_flip)(struct radeon_device *rdev,int crtc); } pflip; };
@@ -2743,9 +2741,7 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v);#define radeon_pm_finish (rdev) (rdev)->asic->pm.finish((rdev))#define radeon_pm_init_profile (rdev) (rdev)->asic->pm.init_profile((rdev))#define radeon_pm_get_dynpm_state (rdev) (rdev)->asic->pm.get_dynpm_state((rdev)) -#define radeon_pre_page_flip (rdev, crtc) (rdev)->asic->pflip.pre_page_flip((rdev), (crtc))#define radeon_page_flip (rdev, crtc, base) (rdev)->asic->pflip.page_flip((rdev), (crtc), (base)) -#define radeon_post_page_flip (rdev, crtc) (rdev)->asic->pflip.post_page_flip((rdev), (crtc))#define radeon_wait_for_vblank (rdev, crtc) (rdev)->asic->display.wait_for_vblank((rdev), (crtc))#define radeon_mc_wait_for_idle (rdev) (rdev)->asic->mc_wait_for_idle((rdev))#define radeon_get_xclk (rdev) (rdev)->asic->get_xclk((rdev))
drivers/gpu/drm/radeon/radeon_asic.c +0 -44
198 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_asic.h +0 -6
@@ -135,9 +135,7 @@ extern void r100_pm_prepare(struct radeon_device *rdev);extern void r100_pm_finish (struct radeon_device *rdev);extern void r100_pm_init_profile (struct radeon_device *rdev);extern void r100_pm_get_dynpm_state (struct radeon_device *rdev); -extern void r100_pre_page_flip (struct radeon_device *rdev,int crtc);extern u32 r100_page_flip (struct radeon_device *rdev,int crtc,u64 crtc_base); -extern void r100_post_page_flip (struct radeon_device *rdev,int crtc);extern void r100_wait_for_vblank (struct radeon_device *rdev,int crtc);extern int r100_mc_wait_for_idle (struct radeon_device *rdev);
@@ -241,9 +239,7 @@ void rs600_hpd_set_polarity(struct radeon_device *rdev,extern void rs600_pm_misc (struct radeon_device *rdev);extern void rs600_pm_prepare (struct radeon_device *rdev);extern void rs600_pm_finish (struct radeon_device *rdev); -extern void rs600_pre_page_flip (struct radeon_device *rdev,int crtc);extern u32 rs600_page_flip (struct radeon_device *rdev,int crtc,u64 crtc_base); -extern void rs600_post_page_flip (struct radeon_device *rdev,int crtc);void rs600_set_safe_registers (struct radeon_device *rdev);extern void avivo_wait_for_vblank (struct radeon_device *rdev,int crtc);extern int rs600_mc_wait_for_idle (struct radeon_device *rdev);
@@ -513,9 +509,7 @@ extern void sumo_pm_init_profile(struct radeon_device *rdev);extern void btc_pm_init_profile (struct radeon_device *rdev);int sumo_set_uvd_clocks (struct radeon_device *rdev,u32 vclk,u32 dclk);int evergreen_set_uvd_clocks (struct radeon_device *rdev,u32 vclk,u32 dclk); -extern void evergreen_pre_page_flip (struct radeon_device *rdev,int crtc);extern u32 evergreen_page_flip (struct radeon_device *rdev,int crtc,u64 crtc_base); -extern void evergreen_post_page_flip (struct radeon_device *rdev,int crtc);extern void dce4_wait_for_vblank (struct radeon_device *rdev,int crtc);void evergreen_disable_interrupt_state (struct radeon_device *rdev);int evergreen_mc_wait_for_idle (struct radeon_device *rdev);
drivers/gpu/drm/radeon/radeon_display.c +2 -2
@@ -346,7 +346,7 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)drm_vblank_put (rdev->ddev, radeon_crtc->crtc_id);radeon_fence_unref (&work->fence); -radeon_post_page_flip (work->rdev, work->crtc_id); +radeon_irq_kms_pflip_irq_get (rdev, work->crtc_id);schedule_work (&work->work); }
@@ -475,7 +475,7 @@ static int radeon_crtc_page_flip(struct drm_crtc *crtc, }/* set the proper interrupt */ -radeon_pre_page_flip (rdev, radeon_crtc->crtc_id); +radeon_irq_kms_pflip_irq_get (rdev, radeon_crtc->crtc_id);return 0 ;
drivers/gpu/drm/radeon/rs600.c +0 -12
@@ -109,18 +109,6 @@ void avivo_wait_for_vblank(struct radeon_device *rdev, int crtc) } } -void rs600_pre_page_flip (struct radeon_device *rdev,int crtc) -{ -/* enable the pflip int */ -radeon_irq_kms_pflip_irq_get (rdev, crtc); -} - -void rs600_post_page_flip (struct radeon_device *rdev,int crtc) -{ -/* disable the pflip int */ -radeon_irq_kms_pflip_irq_put (rdev, crtc); -} -u32 rs600_page_flip (struct radeon_device *rdev,int crtc_id,u64 crtc_base) {struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/5 drm/radeon: split page flip and pending callback
From: Christian König <[email protected]>
--- drivers/gpu/drm/radeon/evergreen.c | 18 ++++++++++++++++-- drivers/gpu/drm/radeon/r100.c | 21 ++++++++++++++++++--- drivers/gpu/drm/radeon/radeon.h | 4 +++- drivers/gpu/drm/radeon/radeon_asic.c | 22 ++++++++++++++++++++++ drivers/gpu/drm/radeon/radeon_asic.h | 15 +++++++++++---- drivers/gpu/drm/radeon/radeon_display.c | 3 ++- drivers/gpu/drm/radeon/rs600.c | 10 ++++++++-- drivers/gpu/drm/radeon/rv770.c | 10 ++++++++-- 8 files changed, 88 insertions(+), 15 deletions(-)
drivers/gpu/drm/radeon/evergreen.c +16 -2
@@ -1313,7 +1313,7 @@ void dce4_wait_for_vblank(struct radeon_device *rdev, int crtc)* double buffered update to take place. * Returns the current update pending status. */ -u32 evergreen_page_flip (struct radeon_device *rdev,int crtc_id,u64 crtc_base) +void evergreen_page_flip (struct radeon_device *rdev,int crtc_id,u64 crtc_base) {struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];u32 tmp =RREG32 (EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset);
@@ -1345,9 +1345,23 @@ u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base)/* Unlock the lock, so double-buffering can take place inside vblank */ tmp &= ~EVERGREEN_GRPH_UPDATE_LOCK ;WREG32 (EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset, tmp); +} + +/** +* evergreen_page_flip_pending - check if page flip is still pending +* +* @rdev: radeon_device pointer +* @crtc_id: crtc to check +* +* Returns the current update pending status. +*/ +bool evergreen_page_flip_pending (struct radeon_device *rdev,int crtc_id) +{ +struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];/* Return current update_pending status: */ -return RREG32 (EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset) &EVERGREEN_GRPH_SURFACE_UPDATE_PENDING ; +return !!(RREG32 (EVERGREEN_GRPH_UPDATE + radeon_crtc->crtc_offset) & +EVERGREEN_GRPH_SURFACE_UPDATE_PENDING ); }/* get temperature in millidegrees */
drivers/gpu/drm/radeon/r100.c +18 -3
@@ -152,9 +152,8 @@ void r100_wait_for_vblank(struct radeon_device *rdev, int crtc)* During vblank we take the crtc lock and wait for the update_pending * bit to go high, when it does, we release the lock, and allow the * double buffered update to take place. -* Returns the current update pending status. */ -u32 r100_page_flip (struct radeon_device *rdev,int crtc_id,u64 crtc_base) +void r100_page_flip (struct radeon_device *rdev,int crtc_id,u64 crtc_base) {struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];u32 tmp = ((u32 )crtc_base) |RADEON_CRTC_OFFSET__OFFSET_LOCK ;
@@ -176,8 +175,24 @@ u32 r100_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) tmp &= ~RADEON_CRTC_OFFSET__OFFSET_LOCK ;WREG32 (RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset, tmp); +} + +/** +* r100_page_flip_pending - check if page flip is still pending +* +* @rdev: radeon_device pointer +* @crtc_id: crtc to check +* +* Check if the last pagefilp is still pending (r1xx-r4xx). +* Returns the current update pending status. +*/ +bool r100_page_flip_pending (struct radeon_device *rdev,int crtc_id) +{ +struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; +/* Return current update_pending status: */ -return RREG32 (RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset) &RADEON_CRTC_OFFSET__GUI_TRIG_OFFSET ; +return !!(RREG32 (RADEON_CRTC_OFFSET + radeon_crtc->crtc_offset) & +RADEON_CRTC_OFFSET__GUI_TRIG_OFFSET ); }/**
drivers/gpu/drm/radeon/radeon.h +3 -1
@@ -1882,7 +1882,8 @@ struct radeon_asic { } dpm;/* pageflipping */ struct { -u32 (*page_flip)(struct radeon_device *rdev,int crtc,u64 crtc_base); +void (*page_flip)(struct radeon_device *rdev,int crtc,u64 crtc_base); +bool (*page_flip_pending)(struct radeon_device *rdev,int crtc); } pflip; };
@@ -2742,6 +2743,7 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v);#define radeon_pm_init_profile (rdev) (rdev)->asic->pm.init_profile((rdev))#define radeon_pm_get_dynpm_state (rdev) (rdev)->asic->pm.get_dynpm_state((rdev))#define radeon_page_flip (rdev, crtc, base) (rdev)->asic->pflip.page_flip((rdev), (crtc), (base)) +#define radeon_page_flip_pending (rdev, crtc) (rdev)->asic->pflip.page_flip_pending((rdev), (crtc))#define radeon_wait_for_vblank (rdev, crtc) (rdev)->asic->display.wait_for_vblank((rdev), (crtc))#define radeon_mc_wait_for_idle (rdev) (rdev)->asic->mc_wait_for_idle((rdev))#define radeon_get_xclk (rdev) (rdev)->asic->get_xclk((rdev))
drivers/gpu/drm/radeon/radeon_asic.c +22 -0
@@ -249,6 +249,7 @@ static struct radeon_asic r100_asic = { }, .pflip = { .page_flip = &r100_page_flip, + .page_flip_pending = &r100_page_flip_pending, }, };
@@ -314,6 +315,7 @@ static struct radeon_asic r200_asic = { }, .pflip = { .page_flip = &r100_page_flip, + .page_flip_pending = &r100_page_flip_pending, }, };
@@ -393,6 +395,7 @@ static struct radeon_asic r300_asic = { }, .pflip = { .page_flip = &r100_page_flip, + .page_flip_pending = &r100_page_flip_pending, }, };
@@ -458,6 +461,7 @@ static struct radeon_asic r300_asic_pcie = { }, .pflip = { .page_flip = &r100_page_flip, + .page_flip_pending = &r100_page_flip_pending, }, };
@@ -523,6 +527,7 @@ static struct radeon_asic r420_asic = { }, .pflip = { .page_flip = &r100_page_flip, + .page_flip_pending = &r100_page_flip_pending, }, };
@@ -588,6 +593,7 @@ static struct radeon_asic rs400_asic = { }, .pflip = { .page_flip = &r100_page_flip, + .page_flip_pending = &r100_page_flip_pending, }, };
@@ -655,6 +661,7 @@ static struct radeon_asic rs600_asic = { }, .pflip = { .page_flip = &rs600_page_flip, + .page_flip_pending = &rs600_page_flip_pending, }, };
@@ -722,6 +729,7 @@ static struct radeon_asic rs690_asic = { }, .pflip = { .page_flip = &rs600_page_flip, + .page_flip_pending = &rs600_page_flip_pending, }, };
@@ -787,6 +795,7 @@ static struct radeon_asic rv515_asic = { }, .pflip = { .page_flip = &rs600_page_flip, + .page_flip_pending = &rs600_page_flip_pending, }, };
@@ -852,6 +861,7 @@ static struct radeon_asic r520_asic = { }, .pflip = { .page_flip = &rs600_page_flip, + .page_flip_pending = &rs600_page_flip_pending, }, };
@@ -949,6 +959,7 @@ static struct radeon_asic r600_asic = { }, .pflip = { .page_flip = &rs600_page_flip, + .page_flip_pending = &rs600_page_flip_pending, }, };
@@ -1038,6 +1049,7 @@ static struct radeon_asic rv6xx_asic = { }, .pflip = { .page_flip = &rs600_page_flip, + .page_flip_pending = &rs600_page_flip_pending, }, };
@@ -1127,6 +1139,7 @@ static struct radeon_asic rs780_asic = { }, .pflip = { .page_flip = &rs600_page_flip, + .page_flip_pending = &rs600_page_flip_pending, }, };
@@ -1231,6 +1244,7 @@ static struct radeon_asic rv770_asic = { }, .pflip = { .page_flip = &rv770_page_flip, + .page_flip_pending = &rv770_page_flip_pending, }, };
@@ -1348,6 +1362,7 @@ static struct radeon_asic evergreen_asic = { }, .pflip = { .page_flip = &evergreen_page_flip, + .page_flip_pending = &evergreen_page_flip_pending, }, };
@@ -1438,6 +1453,7 @@ static struct radeon_asic sumo_asic = { }, .pflip = { .page_flip = &evergreen_page_flip, + .page_flip_pending = &evergreen_page_flip_pending, }, };
@@ -1529,6 +1545,7 @@ static struct radeon_asic btc_asic = { }, .pflip = { .page_flip = &evergreen_page_flip, + .page_flip_pending = &evergreen_page_flip_pending, }, };
@@ -1671,6 +1688,7 @@ static struct radeon_asic cayman_asic = { }, .pflip = { .page_flip = &evergreen_page_flip, + .page_flip_pending = &evergreen_page_flip_pending, }, };
@@ -1770,6 +1788,7 @@ static struct radeon_asic trinity_asic = { }, .pflip = { .page_flip = &evergreen_page_flip, + .page_flip_pending = &evergreen_page_flip_pending, }, };
@@ -1899,6 +1918,7 @@ static struct radeon_asic si_asic = { }, .pflip = { .page_flip = &evergreen_page_flip, + .page_flip_pending = &evergreen_page_flip_pending, }, };
@@ -2060,6 +2080,7 @@ static struct radeon_asic ci_asic = { }, .pflip = { .page_flip = &evergreen_page_flip, + .page_flip_pending = &evergreen_page_flip_pending, }, };
@@ -2163,6 +2184,7 @@ static struct radeon_asic kv_asic = { }, .pflip = { .page_flip = &evergreen_page_flip, + .page_flip_pending = &evergreen_page_flip_pending, }, };
drivers/gpu/drm/radeon/radeon_asic.h +11 -4
@@ -135,7 +135,9 @@ extern void r100_pm_prepare(struct radeon_device *rdev);extern void r100_pm_finish (struct radeon_device *rdev);extern void r100_pm_init_profile (struct radeon_device *rdev);extern void r100_pm_get_dynpm_state (struct radeon_device *rdev); -extern u32 r100_page_flip (struct radeon_device *rdev,int crtc,u64 crtc_base); +extern void r100_page_flip (struct radeon_device *rdev,int crtc, +u64 crtc_base); +extern bool r100_page_flip_pending (struct radeon_device *rdev,int crtc);extern void r100_wait_for_vblank (struct radeon_device *rdev,int crtc);extern int r100_mc_wait_for_idle (struct radeon_device *rdev);
@@ -239,7 +241,9 @@ void rs600_hpd_set_polarity(struct radeon_device *rdev,extern void rs600_pm_misc (struct radeon_device *rdev);extern void rs600_pm_prepare (struct radeon_device *rdev);extern void rs600_pm_finish (struct radeon_device *rdev); -extern u32 rs600_page_flip (struct radeon_device *rdev,int crtc,u64 crtc_base); +extern void rs600_page_flip (struct radeon_device *rdev,int crtc, +u64 crtc_base); +extern bool rs600_page_flip_pending (struct radeon_device *rdev,int crtc);void rs600_set_safe_registers (struct radeon_device *rdev);extern void avivo_wait_for_vblank (struct radeon_device *rdev,int crtc);extern int rs600_mc_wait_for_idle (struct radeon_device *rdev);
@@ -443,7 +447,8 @@ void rv770_fini(struct radeon_device *rdev);int rv770_suspend (struct radeon_device *rdev);int rv770_resume (struct radeon_device *rdev);void rv770_pm_misc (struct radeon_device *rdev); -u32 rv770_page_flip (struct radeon_device *rdev,int crtc,u64 crtc_base); +void rv770_page_flip (struct radeon_device *rdev,int crtc,u64 crtc_base); +bool rv770_page_flip_pending (struct radeon_device *rdev,int crtc);void r700_vram_gtt_location (struct radeon_device *rdev,struct radeon_mc *mc);void r700_cp_stop (struct radeon_device *rdev);void r700_cp_fini (struct radeon_device *rdev);
@@ -509,7 +514,9 @@ extern void sumo_pm_init_profile(struct radeon_device *rdev);extern void btc_pm_init_profile (struct radeon_device *rdev);int sumo_set_uvd_clocks (struct radeon_device *rdev,u32 vclk,u32 dclk);int evergreen_set_uvd_clocks (struct radeon_device *rdev,u32 vclk,u32 dclk); -extern u32 evergreen_page_flip (struct radeon_device *rdev,int crtc,u64 crtc_base); +extern void evergreen_page_flip (struct radeon_device *rdev,int crtc, +u64 crtc_base); +extern bool evergreen_page_flip_pending (struct radeon_device *rdev,int crtc);extern void dce4_wait_for_vblank (struct radeon_device *rdev,int crtc);void evergreen_disable_interrupt_state (struct radeon_device *rdev);int evergreen_mc_wait_for_idle (struct radeon_device *rdev);
drivers/gpu/drm/radeon/radeon_display.c +2 -1
@@ -298,7 +298,8 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)/* New pageflip, or just completion of a previous one? */ if (!radeon_crtc->deferred_flip_completion) {/* do the flip (mmio) */ - update_pending =radeon_page_flip (rdev, crtc_id, work->new_crtc_base); +radeon_page_flip (rdev, crtc_id, work->new_crtc_base); + update_pending =radeon_page_flip_pending (rdev, crtc_id); }else {/* This is just a completion of a flip queued in crtc * at last invocation. Make sure we go directly to
drivers/gpu/drm/radeon/rs600.c +8 -2
@@ -109,7 +109,7 @@ void avivo_wait_for_vblank(struct radeon_device *rdev, int crtc) } } -u32 rs600_page_flip (struct radeon_device *rdev,int crtc_id,u64 crtc_base) +void rs600_page_flip (struct radeon_device *rdev,int crtc_id,u64 crtc_base) {struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];u32 tmp =RREG32 (AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset);
@@ -136,9 +136,15 @@ u32 rs600_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base)/* Unlock the lock, so double-buffering can take place inside vblank */ tmp &= ~AVIVO_D1GRPH_UPDATE_LOCK ;WREG32 (AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset, tmp); +} + +bool rs600_page_flip_pending (struct radeon_device *rdev,int crtc_id) +{ +struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];/* Return current update_pending status: */ -return RREG32 (AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) &AVIVO_D1GRPH_SURFACE_UPDATE_PENDING ; +return !!(RREG32 (AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) & +AVIVO_D1GRPH_SURFACE_UPDATE_PENDING ); }void avivo_program_fmt (struct drm_encoder *encoder)
drivers/gpu/drm/radeon/rv770.c +8 -2
@@ -801,7 +801,7 @@ u32 rv770_get_xclk(struct radeon_device *rdev)return reference_clock; } -u32 rv770_page_flip (struct radeon_device *rdev,int crtc_id,u64 crtc_base) +void rv770_page_flip (struct radeon_device *rdev,int crtc_id,u64 crtc_base) {struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];u32 tmp =RREG32 (AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset);
@@ -835,9 +835,15 @@ u32 rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base)/* Unlock the lock, so double-buffering can take place inside vblank */ tmp &= ~AVIVO_D1GRPH_UPDATE_LOCK ;WREG32 (AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset, tmp); +} + +bool rv770_page_flip_pending (struct radeon_device *rdev,int crtc_id) +{ +struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];/* Return current update_pending status: */ -return RREG32 (AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) &AVIVO_D1GRPH_SURFACE_UPDATE_PENDING ; +return !!(RREG32 (AVIVO_D1GRPH_UPDATE + radeon_crtc->crtc_offset) & +AVIVO_D1GRPH_SURFACE_UPDATE_PENDING ); }/* get temperature in millidegrees */
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/5 drm/radeon: separate vblank and pflip crtc handling
In reply to Christian KönigFrom: Christian König <[email protected]>
--- drivers/gpu/drm/radeon/cik.c | 12 ++++++------ drivers/gpu/drm/radeon/evergreen.c | 12 ++++++------ drivers/gpu/drm/radeon/r100.c | 4 ++-- drivers/gpu/drm/radeon/r600.c | 4 ++-- drivers/gpu/drm/radeon/radeon_display.c | 33 +++++++++++++++++++++++++++++++-- drivers/gpu/drm/radeon/radeon_mode.h | 1 + drivers/gpu/drm/radeon/rs600.c | 4 ++-- drivers/gpu/drm/radeon/si.c | 12 ++++++------ 8 files changed, 56 insertions(+), 26 deletions(-)
drivers/gpu/drm/radeon/cik.c +6 -6
@@ -7378,7 +7378,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[0 ])) -radeon_crtc_handle_flip (rdev,0 ); +radeon_crtc_handle_vblank (rdev,0 ); rdev->irq.stat_regs.cik.disp_int &= ~LB_D1_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D1 vblank\n" ); }
@@ -7404,7 +7404,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[1 ])) -radeon_crtc_handle_flip (rdev,1 ); +radeon_crtc_handle_vblank (rdev,1 ); rdev->irq.stat_regs.cik.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D2 vblank\n" ); }
@@ -7430,7 +7430,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[2 ])) -radeon_crtc_handle_flip (rdev,2 ); +radeon_crtc_handle_vblank (rdev,2 ); rdev->irq.stat_regs.cik.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D3 vblank\n" ); }
@@ -7456,7 +7456,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[3 ])) -radeon_crtc_handle_flip (rdev,3 ); +radeon_crtc_handle_vblank (rdev,3 ); rdev->irq.stat_regs.cik.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D4 vblank\n" ); }
@@ -7482,7 +7482,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[4 ])) -radeon_crtc_handle_flip (rdev,4 ); +radeon_crtc_handle_vblank (rdev,4 ); rdev->irq.stat_regs.cik.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D5 vblank\n" ); }
@@ -7508,7 +7508,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[5 ])) -radeon_crtc_handle_flip (rdev,5 ); +radeon_crtc_handle_vblank (rdev,5 ); rdev->irq.stat_regs.cik.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D6 vblank\n" ); }
drivers/gpu/drm/radeon/evergreen.c +6 -6
@@ -4794,7 +4794,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[0 ])) -radeon_crtc_handle_flip (rdev,0 ); +radeon_crtc_handle_vblank (rdev,0 ); rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D1 vblank\n" ); }
@@ -4820,7 +4820,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[1 ])) -radeon_crtc_handle_flip (rdev,1 ); +radeon_crtc_handle_vblank (rdev,1 ); rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D2 vblank\n" ); }
@@ -4846,7 +4846,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[2 ])) -radeon_crtc_handle_flip (rdev,2 ); +radeon_crtc_handle_vblank (rdev,2 ); rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D3 vblank\n" ); }
@@ -4872,7 +4872,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[3 ])) -radeon_crtc_handle_flip (rdev,3 ); +radeon_crtc_handle_vblank (rdev,3 ); rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D4 vblank\n" ); }
@@ -4898,7 +4898,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[4 ])) -radeon_crtc_handle_flip (rdev,4 ); +radeon_crtc_handle_vblank (rdev,4 ); rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D5 vblank\n" ); }
@@ -4924,7 +4924,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[5 ])) -radeon_crtc_handle_flip (rdev,5 ); +radeon_crtc_handle_vblank (rdev,5 ); rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D6 vblank\n" ); }
drivers/gpu/drm/radeon/r100.c +2 -2
@@ -779,7 +779,7 @@ int r100_irq_process(struct radeon_device *rdev)wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[0 ])) -radeon_crtc_handle_flip (rdev,0 ); +radeon_crtc_handle_vblank (rdev,0 ); }if (status &RADEON_CRTC2_VBLANK_STAT ) {if (rdev->irq.crtc_vblank_int[1 ]) {
@@ -788,7 +788,7 @@ int r100_irq_process(struct radeon_device *rdev)wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[1 ])) -radeon_crtc_handle_flip (rdev,1 ); +radeon_crtc_handle_vblank (rdev,1 ); }if (status &RADEON_FP_DETECT_STAT ) { queue_hotplug = true;
drivers/gpu/drm/radeon/r600.c +2 -2
@@ -3875,7 +3875,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[0 ])) -radeon_crtc_handle_flip (rdev,0 ); +radeon_crtc_handle_vblank (rdev,0 ); rdev->irq.stat_regs.r600.disp_int &= ~LB_D1_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D1 vblank\n" ); }
@@ -3901,7 +3901,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[1 ])) -radeon_crtc_handle_flip (rdev,1 ); +radeon_crtc_handle_vblank (rdev,1 ); rdev->irq.stat_regs.r600.disp_int &= ~LB_D2_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D2 vblank\n" ); }
drivers/gpu/drm/radeon/radeon_display.c +31 -2
@@ -276,7 +276,7 @@ static void radeon_unpin_work_func(struct work_struct *__work)kfree (work); } -void radeon_crtc_handle_flip (struct radeon_device *rdev,int crtc_id) +void radeon_crtc_handle_vblank (struct radeon_device *rdev,int crtc_id) {struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];struct radeon_unpin_work *work;
@@ -306,7 +306,6 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)* completion routine. */ update_pending =0 ; - radeon_crtc->deferred_flip_completion =0 ; }/* Has the pageflip already completed in crtc, or is it certain
@@ -334,10 +333,40 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id) radeon_crtc->deferred_flip_completion =1 ;spin_unlock_irqrestore (&rdev->ddev->event_lock, flags);return ; + }else { +spin_unlock_irqrestore (&rdev->ddev->event_lock, flags); +radeon_crtc_handle_flip (rdev, crtc_id); + } +} + +/** +* radeon_crtc_handle_flip - page flip completed +* +* @rdev: radeon device pointer +* @crtc_id: crtc number this event is for +* +* Called when we are sure that a page flip for this crtc is completed. +*/ +void radeon_crtc_handle_flip (struct radeon_device *rdev,int crtc_id) +{ +struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id]; +struct radeon_unpin_work *work; +unsigned long flags; + +/* this can happen at init */ +if (radeon_crtc ==NULL ) +return ; + +spin_lock_irqsave (&rdev->ddev->event_lock, flags); + work = radeon_crtc->unpin_work; +if (work ==NULL ) { +spin_unlock_irqrestore (&rdev->ddev->event_lock, flags); +return ; }/* Pageflip (will be) certainly completed in this vblank. Clean up. */ radeon_crtc->unpin_work =NULL ; + radeon_crtc->deferred_flip_completion =0 ;/* wakeup userspace */ if (work->event)
drivers/gpu/drm/radeon/radeon_mode.h +1 -0
@@ -906,6 +906,7 @@ bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj)void radeon_fb_output_poll_changed (struct radeon_device *rdev); +void radeon_crtc_handle_vblank (struct radeon_device *rdev,int crtc_id);void radeon_crtc_handle_flip (struct radeon_device *rdev,int crtc_id);int radeon_align_pitch (struct radeon_device *rdev,int width,int bpp,bool tiled);
drivers/gpu/drm/radeon/rs600.c +2 -2
@@ -781,7 +781,7 @@ int rs600_irq_process(struct radeon_device *rdev)wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[0 ])) -radeon_crtc_handle_flip (rdev,0 ); +radeon_crtc_handle_vblank (rdev,0 ); }if (G_007EDC_LB_D2_VBLANK_INTERRUPT (rdev->irq.stat_regs.r500.disp_int)) {if (rdev->irq.crtc_vblank_int[1 ]) {
@@ -790,7 +790,7 @@ int rs600_irq_process(struct radeon_device *rdev)wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[1 ])) -radeon_crtc_handle_flip (rdev,1 ); +radeon_crtc_handle_vblank (rdev,1 ); }if (G_007EDC_DC_HOT_PLUG_DETECT1_INTERRUPT (rdev->irq.stat_regs.r500.disp_int)) { queue_hotplug = true;
drivers/gpu/drm/radeon/si.c +6 -6
@@ -6151,7 +6151,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[0 ])) -radeon_crtc_handle_flip (rdev,0 ); +radeon_crtc_handle_vblank (rdev,0 ); rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D1 vblank\n" ); }
@@ -6177,7 +6177,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[1 ])) -radeon_crtc_handle_flip (rdev,1 ); +radeon_crtc_handle_vblank (rdev,1 ); rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D2 vblank\n" ); }
@@ -6203,7 +6203,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[2 ])) -radeon_crtc_handle_flip (rdev,2 ); +radeon_crtc_handle_vblank (rdev,2 ); rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D3 vblank\n" ); }
@@ -6229,7 +6229,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[3 ])) -radeon_crtc_handle_flip (rdev,3 ); +radeon_crtc_handle_vblank (rdev,3 ); rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D4 vblank\n" ); }
@@ -6255,7 +6255,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[4 ])) -radeon_crtc_handle_flip (rdev,4 ); +radeon_crtc_handle_vblank (rdev,4 ); rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D5 vblank\n" ); }
@@ -6281,7 +6281,7 @@ restart_ih:wake_up (&rdev->irq.vblank_queue); }if (atomic_read (&rdev->irq.pflip[5 ])) -radeon_crtc_handle_flip (rdev,5 ); +radeon_crtc_handle_vblank (rdev,5 ); rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D6 vblank\n" ); }
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/5 drm/radeon: rework page flip handling
In reply to Christian KönigFrom: Christian König <[email protected]>
Instead of trying to flip inside the vblank period when the buffer is idle, offload blocking for idle to a kernel thread and program the flip directly into the hardware.
--- drivers/gpu/drm/radeon/radeon.h | 16 ++- drivers/gpu/drm/radeon/radeon_display.c | 231 +++++++++++++++++--------------- drivers/gpu/drm/radeon/radeon_mode.h | 4 +- 3 files changed, 134 insertions(+), 117 deletions(-)
drivers/gpu/drm/radeon/radeon.h +9 -7
@@ -676,14 +676,16 @@ void radeon_doorbell_free(struct radeon_device *rdev, u32 doorbell);* IRQS. */ -struct radeon_unpin_work { -struct work_struct work; -struct radeon_device *rdev; -int crtc_id; -struct radeon_fence *fence; +struct radeon_flip_work { +struct work_struct flip_work; +struct work_struct unpin_work; +struct radeon_device *rdev; +int crtc_id; +struct drm_framebuffer *fb;struct drm_pending_vblank_event *event; -struct radeon_bo *old_rbo; -u64 new_crtc_base; +struct radeon_bo *old_rbo; +struct radeon_bo *new_rbo; +struct radeon_fence *fence; };struct r500_irq_stat_regs {
drivers/gpu/drm/radeon/radeon_display.c +123 -108
344 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_mode.h +2 -2
@@ -324,8 +324,8 @@ struct radeon_crtc {struct drm_display_mode native_mode;int pll_id;/* page flipping */ -struct radeon_unpin_work *unpin_work; -int deferred_flip_completion; +struct workqueue_struct *flip_queue; +struct radeon_flip_work *flip_work;/* pll sharing */ struct radeon_atom_ss ss;bool ss_enabled;
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 4/5] drm/radeon: rework page flip handling
Quoted 7 lines · Christian König
From: Christian König <[email protected]>
Instead of trying to flip inside the vblank period when the buffer is idle, offload blocking for idle to a kernel thread and program the flip directly into the hardware.
Signed-off-by Christian König <[email protected]>
[...]
Quoted 9 lines
drivers/gpu/drm/radeon/radeon_display.c +8
-0+/** +* radeon_flip_work_func - page flip framebuffer +* +* @work - kernel work item +* +* Wait for the buffer object to become idle and do the actual page flip +*/ +static void radeon_flip_work_func (struct work_struct *__work) {
[...]
drivers/gpu/drm/radeon/radeon_display.c static int radeon_crtc_page_flip(struct drm_crtc *crtc, · line 466
Quoted 5 lines
drivers/gpu/drm/radeon/radeon_display.c +5
-0+if (radeon_crtc->flip_work) { +DRM_DEBUG_DRIVER ("flip queue: crtc already busy\n" ); +spin_unlock_irqrestore (&crtc->dev->event_lock, flags); + goto pflip_cleanup1; + }
I'm a little worried about this case. AFAICT this would drop the flip if a previous one is still pending? I'm not sure current userspace can actually hit this, but sooner or later we'll probably want to support things like triple buffering, flips replacing previous ones still pending, and asynchronous flips (not synchronized to vertical blank). Those will probably require changes to the kernel/user interface, but it might be good to at least keep them in mind already for the infrastructure.
Also, in patch 5, we could stop calling drm_vblank_get/put() when we're not using the vblank interrupt for flipping?
The series looks good to me other than that.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 4/5] drm/radeon: rework page flip handling
Quoted 3 lines
I'm a little worried about this case. AFAICT this would drop the flip if a previous one is still pending? I'm not sure current userspace can actually hit this
Yeah, that concerned me as well. The old code dropped the the new flip as well, so I'm pretty sure that the new handling is right and userspace won't hit that.
The only difference to the old code is that I've offloaded it to a separate thread and so can't return -EBUSY any more.
Quoted 2 lines
but sooner or later we'll probably want to support things like triple buffering,
Triple buffering should still work like expected (at least if userspace makes sure to not submit more than one flip at a time).
Quoted 2 lines
flips replacing previous ones still
pending,
Flips replacing previous one is tricky to implement without causing a race condition, so I would rather like to avoid doing it for now.
Quoted 1 line
and asynchronous flips (not synchronized to vertical blank).
Actually that's one of the things I've implement in 3.15 by using the pflip interrupt. All you need to do is to set the appropriate bits in the hardware to sync the flip to VBLANK, HBLANK or not at all. For the pflip interrupt that doesn't matter it should just fire as soon as the new base address is used by the hardware.
Quoted 2 lines
Also, in patch 5, we could stop calling drm_vblank_get/put() when we're not using the vblank interrupt for flipping?
Mhm, good point. But I think the question is rather why did we needed that in the first place?
The VBLANK interrupt is turned on by radeon_irq_kms_pflip_irq_get anyway, so that call seems to be superfluous even on the old system.
Thanks for the review, going to work on v2 now,
Christian.
Am 02.05.2014 09:25, schrieb Michel Dänzer:
Quoted 33 lines · Christian König
Quoted 7 lines
From: Christian König <[email protected]>
Instead of trying to flip inside the vblank period when the buffer is idle, offload blocking for idle to a kernel thread and program the flip directly into the hardware.
Signed-off-by Christian König <[email protected]>[...]
Quoted 9 lines
drivers/gpu/drm/radeon/radeon_display.c +8
-0+/** +* radeon_flip_work_func - page flip framebuffer +* +* @work - kernel work item +* +* Wait for the buffer object to become idle and do the actual page flip +*/ +static void radeon_flip_work_func (struct work_struct *__work) {[...]
drivers/gpu/drm/radeon/radeon_display.c static int radeon_crtc_page_flip(struct drm_crtc *crtc, · line 466
Quoted 5 lines
drivers/gpu/drm/radeon/radeon_display.c +5
-0+if (radeon_crtc->flip_work) { +DRM_DEBUG_DRIVER ("flip queue: crtc already busy\n" ); +spin_unlock_irqrestore (&crtc->dev->event_lock, flags); + goto pflip_cleanup1; + }I'm a little worried about this case. AFAICT this would drop the flip if a previous one is still pending? I'm not sure current userspace can actually hit this, but sooner or later we'll probably want to support things like triple buffering, flips replacing previous ones still pending, and asynchronous flips (not synchronized to vertical blank). Those will probably require changes to the kernel/user interface, but it might be good to at least keep them in mind already for the infrastructure.
Quoted 7 lines
Also, in patch 5, we could stop calling drm_vblank_get/put() when we're not using the vblank interrupt for flipping?
The series looks good to me other than that.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 4/5] drm/radeon: rework page flip handling
Quoted 14 lines · Christian König
Am 02.05.2014 09:25, schrieb Michel Dänzer:
Quoted 5 lines · Christian König
Quoted 3 lines
+static void
radeon_flip_work_func(struct work_struct *__work)
{[...]
Quoted 8 lines
drivers/gpu/drm/radeon/radeon_display.c static int radeon_crtc_page_flip(struct drm_crtc *crtc, · line 466
Quoted 5 lines
drivers/gpu/drm/radeon/radeon_display.c +5
-0+if (radeon_crtc->flip_work) { +DRM_DEBUG_DRIVER ("flip queue: crtc already busy\n" ); +spin_unlock_irqrestore (&crtc->dev->event_lock, flags); + goto pflip_cleanup1; + }I'm a little worried about this case. AFAICT this would drop the flip if a previous one is still pending? I'm not sure current userspace can actually hit this
Quoted 6 lines
Yeah, that concerned me as well. The old code dropped the the new flip as well, so I'm pretty sure that the new handling is right and userspace won't hit that.
The only difference to the old code is that I've offloaded it to a separate thread and so can't return
-EBUSYany more.
That's an important difference though: Userspace can react to the -EBUSY appropriately, but if flips get dropped silently, bad things will happen, such as the wrong buffer being scanned out.
Keep in mind that we don't control all userspace, e.g. I expect there will be an increasing number of Wayland compositors using this functionality.
Quoted 9 lines
Quoted 2 lines
but sooner or later we'll probably want to support things like triple buffering,
Triple buffering should still work like expected (at least if userspace makes sure to not submit more than one flip at a time).
Quoted 2 lines
flips replacing previous ones still
pending,Flips replacing previous one is tricky to implement without causing a race condition, so I would rather like to avoid doing it for now.
It may be tricky, but it's important. Otherwise it's not possible to achieve framerates higher than the refresh rate without tearing and with low latency (using triple buffering).
Quoted 6 lines
Quoted 1 line
and asynchronous flips (not synchronized to vertical blank).
Actually that's one of the things I've implement in 3.15 by using the pflip interrupt. All you need to do is to set the appropriate bits in the hardware to sync the flip to VBLANK, HBLANK or not at all. For the pflip interrupt that doesn't matter it should just fire as soon as the new base address is used by the hardware.
Sounds great. :) Then we just need to expose that to userspace somehow.
Quoted 7 lines
Quoted 2 lines
Also, in patch 5, we could stop calling drm_vblank_get/put() when we're not using the vblank interrupt for flipping?
Mhm, good point. But I think the question is rather why did we needed that in the first place?
The VBLANK interrupt is turned on by
radeon_irq_kms_pflip_irq_getanyway, so that call seems to be superfluous even on the old system.
Indeed, looks like it.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 4/5] drm/radeon: rework page flip handling
Quoted 22 lines · Michel Dänzer
Quoted 14 lines · Christian König
Am 02.05.2014 09:25, schrieb Michel Dänzer:
Quoted 5 lines · Christian König
Quoted 3 lines
+static void
radeon_flip_work_func(struct work_struct *__work)
{[...]
Quoted 8 lines
drivers/gpu/drm/radeon/radeon_display.c static int radeon_crtc_page_flip(struct drm_crtc *crtc, · line 466
Quoted 5 lines
drivers/gpu/drm/radeon/radeon_display.c +5
-0+if (radeon_crtc->flip_work) { +DRM_DEBUG_DRIVER ("flip queue: crtc already busy\n" ); +spin_unlock_irqrestore (&crtc->dev->event_lock, flags); + goto pflip_cleanup1; + }I'm a little worried about this case. AFAICT this would drop the flip if a previous one is still pending? I'm not sure current userspace can actually hit this
Quoted 6 lines
Yeah, that concerned me as well. The old code dropped the the new flip as well, so I'm pretty sure that the new handling is right and userspace won't hit that.
The only difference to the old code is that I've offloaded it to a separate thread and so can't return
-EBUSYany more.
Quoted 7 lines
That's an important difference though: Userspace can react to the
-EBUSYappropriately, but if flips get dropped silently, bad things will happen, such as the wrong buffer being scanned out.Keep in mind that we don't control all userspace, e.g. I expect there will be an increasing number of Wayland compositors using this functionality.
Rules on i915 are that if the pageflip confirmation event hasn't been sent out yet the driver returns -EBUSY. The locking for that is done using irq-save spinlocks, so should be doable to check this synchronously before latching some kinda of async worker.
I didnt read one line of radeon code to check this though ;-)
Cheers, Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 4/5] drm/radeon: rework page flip handling
In reply to Michel DänzerQuoted 11 lines · Michel Dänzer
Quoted 8 lines · Christian König
Am 02.05.2014 09:25, schrieb Michel Dänzer:
Quoted 2 lines
and asynchronous flips (not synchronized to vertical blank).
Actually that's one of the things I've implement in 3.15 by using the pflip interrupt. All you need to do is to set the appropriate bits in the hardware to sync the flip to VBLANK, HBLANK or not at all. For the pflip interrupt that doesn't matter it should just fire as soon as the new base address is used by the hardware.
Sounds great. :) Then we just need to expose that to userspace somehow.
Actually, looks like that should be quite simple:
git grep -i async_page_flip
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/5 drm/radeon: stop using vblank irq on EG+
In reply to Christian KönigFrom: Christian König <[email protected]>
The page flip irq seems to be stable, let's use it.
--- drivers/gpu/drm/radeon/cik.c | 30 +++++------------------- drivers/gpu/drm/radeon/evergreen.c | 48 +++++++------------------------------- drivers/gpu/drm/radeon/si.c | 30 +++++------------------- 3 files changed, 21 insertions(+), 87 deletions(-)
drivers/gpu/drm/radeon/cik.c +6 -24
@@ -6972,33 +6972,27 @@ int cik_irq_set(struct radeon_device *rdev) dma_cntl1 |=TRAP_ENABLE ; } -if (rdev->irq.crtc_vblank_int[0 ] || -atomic_read (&rdev->irq.pflip[0 ])) { +if (rdev->irq.crtc_vblank_int[0 ]) {DRM_DEBUG ("cik_irq_set: vblank 0\n" ); crtc1 |=VBLANK_INTERRUPT_MASK ; } -if (rdev->irq.crtc_vblank_int[1 ] || -atomic_read (&rdev->irq.pflip[1 ])) { +if (rdev->irq.crtc_vblank_int[1 ]) {DRM_DEBUG ("cik_irq_set: vblank 1\n" ); crtc2 |=VBLANK_INTERRUPT_MASK ; } -if (rdev->irq.crtc_vblank_int[2 ] || -atomic_read (&rdev->irq.pflip[2 ])) { +if (rdev->irq.crtc_vblank_int[2 ]) {DRM_DEBUG ("cik_irq_set: vblank 2\n" ); crtc3 |=VBLANK_INTERRUPT_MASK ; } -if (rdev->irq.crtc_vblank_int[3 ] || -atomic_read (&rdev->irq.pflip[3 ])) { +if (rdev->irq.crtc_vblank_int[3 ]) {DRM_DEBUG ("cik_irq_set: vblank 3\n" ); crtc4 |=VBLANK_INTERRUPT_MASK ; } -if (rdev->irq.crtc_vblank_int[4 ] || -atomic_read (&rdev->irq.pflip[4 ])) { +if (rdev->irq.crtc_vblank_int[4 ]) {DRM_DEBUG ("cik_irq_set: vblank 4\n" ); crtc5 |=VBLANK_INTERRUPT_MASK ; } -if (rdev->irq.crtc_vblank_int[5 ] || -atomic_read (&rdev->irq.pflip[5 ])) { +if (rdev->irq.crtc_vblank_int[5 ]) {DRM_DEBUG ("cik_irq_set: vblank 5\n" ); crtc6 |=VBLANK_INTERRUPT_MASK ; }
@@ -7377,8 +7371,6 @@ restart_ih: rdev->pm.vblank_sync = true;wake_up (&rdev->irq.vblank_queue); } -if (atomic_read (&rdev->irq.pflip[0 ])) -radeon_crtc_handle_vblank (rdev,0 ); rdev->irq.stat_regs.cik.disp_int &= ~LB_D1_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D1 vblank\n" ); }
@@ -7403,8 +7395,6 @@ restart_ih: rdev->pm.vblank_sync = true;wake_up (&rdev->irq.vblank_queue); } -if (atomic_read (&rdev->irq.pflip[1 ])) -radeon_crtc_handle_vblank (rdev,1 ); rdev->irq.stat_regs.cik.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D2 vblank\n" ); }
@@ -7429,8 +7419,6 @@ restart_ih: rdev->pm.vblank_sync = true;wake_up (&rdev->irq.vblank_queue); } -if (atomic_read (&rdev->irq.pflip[2 ])) -radeon_crtc_handle_vblank (rdev,2 ); rdev->irq.stat_regs.cik.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D3 vblank\n" ); }
@@ -7455,8 +7443,6 @@ restart_ih: rdev->pm.vblank_sync = true;wake_up (&rdev->irq.vblank_queue); } -if (atomic_read (&rdev->irq.pflip[3 ])) -radeon_crtc_handle_vblank (rdev,3 ); rdev->irq.stat_regs.cik.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D4 vblank\n" ); }
@@ -7481,8 +7467,6 @@ restart_ih: rdev->pm.vblank_sync = true;wake_up (&rdev->irq.vblank_queue); } -if (atomic_read (&rdev->irq.pflip[4 ])) -radeon_crtc_handle_vblank (rdev,4 ); rdev->irq.stat_regs.cik.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D5 vblank\n" ); }
@@ -7507,8 +7491,6 @@ restart_ih: rdev->pm.vblank_sync = true;wake_up (&rdev->irq.vblank_queue); } -if (atomic_read (&rdev->irq.pflip[5 ])) -radeon_crtc_handle_vblank (rdev,5 ); rdev->irq.stat_regs.cik.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D6 vblank\n" ); }
drivers/gpu/drm/radeon/evergreen.c +9 -39
126 lines not on this page · raw message
drivers/gpu/drm/radeon/si.c +6 -24
@@ -5835,33 +5835,27 @@ int si_irq_set(struct radeon_device *rdev)DRM_DEBUG ("si_irq_set: sw int dma1\n" ); dma_cntl1 |=TRAP_ENABLE ; } -if (rdev->irq.crtc_vblank_int[0 ] || -atomic_read (&rdev->irq.pflip[0 ])) { +if (rdev->irq.crtc_vblank_int[0 ]) {DRM_DEBUG ("si_irq_set: vblank 0\n" ); crtc1 |=VBLANK_INT_MASK ; } -if (rdev->irq.crtc_vblank_int[1 ] || -atomic_read (&rdev->irq.pflip[1 ])) { +if (rdev->irq.crtc_vblank_int[1 ]) {DRM_DEBUG ("si_irq_set: vblank 1\n" ); crtc2 |=VBLANK_INT_MASK ; } -if (rdev->irq.crtc_vblank_int[2 ] || -atomic_read (&rdev->irq.pflip[2 ])) { +if (rdev->irq.crtc_vblank_int[2 ]) {DRM_DEBUG ("si_irq_set: vblank 2\n" ); crtc3 |=VBLANK_INT_MASK ; } -if (rdev->irq.crtc_vblank_int[3 ] || -atomic_read (&rdev->irq.pflip[3 ])) { +if (rdev->irq.crtc_vblank_int[3 ]) {DRM_DEBUG ("si_irq_set: vblank 3\n" ); crtc4 |=VBLANK_INT_MASK ; } -if (rdev->irq.crtc_vblank_int[4 ] || -atomic_read (&rdev->irq.pflip[4 ])) { +if (rdev->irq.crtc_vblank_int[4 ]) {DRM_DEBUG ("si_irq_set: vblank 4\n" ); crtc5 |=VBLANK_INT_MASK ; } -if (rdev->irq.crtc_vblank_int[5 ] || -atomic_read (&rdev->irq.pflip[5 ])) { +if (rdev->irq.crtc_vblank_int[5 ]) {DRM_DEBUG ("si_irq_set: vblank 5\n" ); crtc6 |=VBLANK_INT_MASK ; }
@@ -6150,8 +6144,6 @@ restart_ih: rdev->pm.vblank_sync = true;wake_up (&rdev->irq.vblank_queue); } -if (atomic_read (&rdev->irq.pflip[0 ])) -radeon_crtc_handle_vblank (rdev,0 ); rdev->irq.stat_regs.evergreen.disp_int &= ~LB_D1_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D1 vblank\n" ); }
@@ -6176,8 +6168,6 @@ restart_ih: rdev->pm.vblank_sync = true;wake_up (&rdev->irq.vblank_queue); } -if (atomic_read (&rdev->irq.pflip[1 ])) -radeon_crtc_handle_vblank (rdev,1 ); rdev->irq.stat_regs.evergreen.disp_int_cont &= ~LB_D2_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D2 vblank\n" ); }
@@ -6202,8 +6192,6 @@ restart_ih: rdev->pm.vblank_sync = true;wake_up (&rdev->irq.vblank_queue); } -if (atomic_read (&rdev->irq.pflip[2 ])) -radeon_crtc_handle_vblank (rdev,2 ); rdev->irq.stat_regs.evergreen.disp_int_cont2 &= ~LB_D3_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D3 vblank\n" ); }
@@ -6228,8 +6216,6 @@ restart_ih: rdev->pm.vblank_sync = true;wake_up (&rdev->irq.vblank_queue); } -if (atomic_read (&rdev->irq.pflip[3 ])) -radeon_crtc_handle_vblank (rdev,3 ); rdev->irq.stat_regs.evergreen.disp_int_cont3 &= ~LB_D4_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D4 vblank\n" ); }
@@ -6254,8 +6240,6 @@ restart_ih: rdev->pm.vblank_sync = true;wake_up (&rdev->irq.vblank_queue); } -if (atomic_read (&rdev->irq.pflip[4 ])) -radeon_crtc_handle_vblank (rdev,4 ); rdev->irq.stat_regs.evergreen.disp_int_cont4 &= ~LB_D5_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D5 vblank\n" ); }
@@ -6280,8 +6264,6 @@ restart_ih: rdev->pm.vblank_sync = true;wake_up (&rdev->irq.vblank_queue); } -if (atomic_read (&rdev->irq.pflip[5 ])) -radeon_crtc_handle_vblank (rdev,5 ); rdev->irq.stat_regs.evergreen.disp_int_cont5 &= ~LB_D6_VBLANK_INTERRUPT ;DRM_DEBUG ("IH: D6 vblank\n" ); }
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel