mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 17:41:44 +00:00
drm/radeon: split page flip and pending callback
Signed-off-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
75f36d8619
commit
157fa14dc4
@ -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 */
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1881,7 +1881,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;
|
||||
};
|
||||
|
||||
@ -2741,6 +2742,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))
|
||||
|
@ -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,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
@ -448,7 +452,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);
|
||||
@ -516,7 +521,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);
|
||||
|
@ -294,7 +294,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
|
||||
|
@ -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)
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user