mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-29 23:36:45 +07:00
drm/radeon: add initial support for R6xx/R7xx GPUs
This adds support for 2D/Xv acceleration in the X.org 2D driver, to the drm. It doesn't yet provide any 3D support hooks. Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
80b3334a4d
commit
c05ce0834a
@ -3,7 +3,7 @@
|
|||||||
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
|
# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
|
||||||
|
|
||||||
ccflags-y := -Iinclude/drm
|
ccflags-y := -Iinclude/drm
|
||||||
radeon-y := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o
|
radeon-y := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o r600_cp.o
|
||||||
|
|
||||||
radeon-$(CONFIG_COMPAT) += radeon_ioc32.o
|
radeon-$(CONFIG_COMPAT) += radeon_ioc32.o
|
||||||
|
|
||||||
|
2247
drivers/gpu/drm/radeon/r600_cp.c
Normal file
2247
drivers/gpu/drm/radeon/r600_cp.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -43,7 +43,7 @@
|
|||||||
static int radeon_do_cleanup_cp(struct drm_device * dev);
|
static int radeon_do_cleanup_cp(struct drm_device * dev);
|
||||||
static void radeon_do_cp_start(drm_radeon_private_t * dev_priv);
|
static void radeon_do_cp_start(drm_radeon_private_t * dev_priv);
|
||||||
|
|
||||||
static u32 radeon_read_ring_rptr(drm_radeon_private_t *dev_priv, u32 off)
|
u32 radeon_read_ring_rptr(drm_radeon_private_t *dev_priv, u32 off)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
@ -62,11 +62,15 @@ u32 radeon_get_ring_head(drm_radeon_private_t *dev_priv)
|
|||||||
{
|
{
|
||||||
if (dev_priv->writeback_works)
|
if (dev_priv->writeback_works)
|
||||||
return radeon_read_ring_rptr(dev_priv, 0);
|
return radeon_read_ring_rptr(dev_priv, 0);
|
||||||
else
|
else {
|
||||||
return RADEON_READ(RADEON_CP_RB_RPTR);
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
return RADEON_READ(R600_CP_RB_RPTR);
|
||||||
|
else
|
||||||
|
return RADEON_READ(RADEON_CP_RB_RPTR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void radeon_write_ring_rptr(drm_radeon_private_t *dev_priv, u32 off, u32 val)
|
void radeon_write_ring_rptr(drm_radeon_private_t *dev_priv, u32 off, u32 val)
|
||||||
{
|
{
|
||||||
if (dev_priv->flags & RADEON_IS_AGP)
|
if (dev_priv->flags & RADEON_IS_AGP)
|
||||||
DRM_WRITE32(dev_priv->ring_rptr, off, val);
|
DRM_WRITE32(dev_priv->ring_rptr, off, val);
|
||||||
@ -82,11 +86,19 @@ void radeon_set_ring_head(drm_radeon_private_t *dev_priv, u32 val)
|
|||||||
|
|
||||||
u32 radeon_get_scratch(drm_radeon_private_t *dev_priv, int index)
|
u32 radeon_get_scratch(drm_radeon_private_t *dev_priv, int index)
|
||||||
{
|
{
|
||||||
if (dev_priv->writeback_works)
|
if (dev_priv->writeback_works) {
|
||||||
return radeon_read_ring_rptr(dev_priv,
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
RADEON_SCRATCHOFF(index));
|
return radeon_read_ring_rptr(dev_priv,
|
||||||
else
|
R600_SCRATCHOFF(index));
|
||||||
return RADEON_READ(RADEON_SCRATCH_REG0 + 4*index);
|
else
|
||||||
|
return radeon_read_ring_rptr(dev_priv,
|
||||||
|
RADEON_SCRATCHOFF(index));
|
||||||
|
} else {
|
||||||
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
return RADEON_READ(R600_SCRATCH_REG0 + 4*index);
|
||||||
|
else
|
||||||
|
return RADEON_READ(RADEON_SCRATCH_REG0 + 4*index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 RADEON_READ_MM(drm_radeon_private_t *dev_priv, int addr)
|
u32 RADEON_READ_MM(drm_radeon_private_t *dev_priv, int addr)
|
||||||
@ -142,7 +154,11 @@ static u32 IGP_READ_MCIND(drm_radeon_private_t *dev_priv, int addr)
|
|||||||
u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv)
|
u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV770)
|
||||||
|
return RADEON_READ(R700_MC_VM_FB_LOCATION);
|
||||||
|
else if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
return RADEON_READ(R600_MC_VM_FB_LOCATION);
|
||||||
|
else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
|
||||||
return R500_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION);
|
return R500_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION);
|
||||||
else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) ||
|
else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) ||
|
||||||
((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740))
|
((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740))
|
||||||
@ -155,7 +171,11 @@ u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv)
|
|||||||
|
|
||||||
static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc)
|
static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc)
|
||||||
{
|
{
|
||||||
if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV770)
|
||||||
|
RADEON_WRITE(R700_MC_VM_FB_LOCATION, fb_loc);
|
||||||
|
else if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
RADEON_WRITE(R600_MC_VM_FB_LOCATION, fb_loc);
|
||||||
|
else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
|
||||||
R500_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc);
|
R500_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc);
|
||||||
else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) ||
|
else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) ||
|
||||||
((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740))
|
((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740))
|
||||||
@ -166,9 +186,16 @@ static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc)
|
|||||||
RADEON_WRITE(RADEON_MC_FB_LOCATION, fb_loc);
|
RADEON_WRITE(RADEON_MC_FB_LOCATION, fb_loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void radeon_write_agp_location(drm_radeon_private_t *dev_priv, u32 agp_loc)
|
void radeon_write_agp_location(drm_radeon_private_t *dev_priv, u32 agp_loc)
|
||||||
{
|
{
|
||||||
if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
|
/*R6xx/R7xx: AGP_TOP and BOT are actually 18 bits each */
|
||||||
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV770) {
|
||||||
|
RADEON_WRITE(R700_MC_VM_AGP_BOT, agp_loc & 0xffff); /* FIX ME */
|
||||||
|
RADEON_WRITE(R700_MC_VM_AGP_TOP, (agp_loc >> 16) & 0xffff);
|
||||||
|
} else if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600) {
|
||||||
|
RADEON_WRITE(R600_MC_VM_AGP_BOT, agp_loc & 0xffff); /* FIX ME */
|
||||||
|
RADEON_WRITE(R600_MC_VM_AGP_TOP, (agp_loc >> 16) & 0xffff);
|
||||||
|
} else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
|
||||||
R500_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc);
|
R500_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc);
|
||||||
else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) ||
|
else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) ||
|
||||||
((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740))
|
((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740))
|
||||||
@ -179,12 +206,18 @@ static void radeon_write_agp_location(drm_radeon_private_t *dev_priv, u32 agp_lo
|
|||||||
RADEON_WRITE(RADEON_MC_AGP_LOCATION, agp_loc);
|
RADEON_WRITE(RADEON_MC_AGP_LOCATION, agp_loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void radeon_write_agp_base(drm_radeon_private_t *dev_priv, u64 agp_base)
|
void radeon_write_agp_base(drm_radeon_private_t *dev_priv, u64 agp_base)
|
||||||
{
|
{
|
||||||
u32 agp_base_hi = upper_32_bits(agp_base);
|
u32 agp_base_hi = upper_32_bits(agp_base);
|
||||||
u32 agp_base_lo = agp_base & 0xffffffff;
|
u32 agp_base_lo = agp_base & 0xffffffff;
|
||||||
|
u32 r6xx_agp_base = (agp_base >> 22) & 0x3ffff;
|
||||||
|
|
||||||
if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) {
|
/* R6xx/R7xx must be aligned to a 4MB boundry */
|
||||||
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV770)
|
||||||
|
RADEON_WRITE(R700_MC_VM_AGP_BASE, r6xx_agp_base);
|
||||||
|
else if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
RADEON_WRITE(R600_MC_VM_AGP_BASE, r6xx_agp_base);
|
||||||
|
else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) {
|
||||||
R500_WRITE_MCIND(RV515_MC_AGP_BASE, agp_base_lo);
|
R500_WRITE_MCIND(RV515_MC_AGP_BASE, agp_base_lo);
|
||||||
R500_WRITE_MCIND(RV515_MC_AGP_BASE_2, agp_base_hi);
|
R500_WRITE_MCIND(RV515_MC_AGP_BASE_2, agp_base_hi);
|
||||||
} else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) ||
|
} else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) ||
|
||||||
@ -205,7 +238,7 @@ static void radeon_write_agp_base(drm_radeon_private_t *dev_priv, u64 agp_base)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void radeon_enable_bm(struct drm_radeon_private *dev_priv)
|
void radeon_enable_bm(struct drm_radeon_private *dev_priv)
|
||||||
{
|
{
|
||||||
u32 tmp;
|
u32 tmp;
|
||||||
/* Turn on bus mastering */
|
/* Turn on bus mastering */
|
||||||
@ -1440,6 +1473,7 @@ static int radeon_do_resume_cp(struct drm_device *dev, struct drm_file *file_pri
|
|||||||
|
|
||||||
int radeon_cp_init(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
int radeon_cp_init(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
|
drm_radeon_private_t *dev_priv = dev->dev_private;
|
||||||
drm_radeon_init_t *init = data;
|
drm_radeon_init_t *init = data;
|
||||||
|
|
||||||
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
||||||
@ -1452,8 +1486,13 @@ int radeon_cp_init(struct drm_device *dev, void *data, struct drm_file *file_pri
|
|||||||
case RADEON_INIT_R200_CP:
|
case RADEON_INIT_R200_CP:
|
||||||
case RADEON_INIT_R300_CP:
|
case RADEON_INIT_R300_CP:
|
||||||
return radeon_do_init_cp(dev, init, file_priv);
|
return radeon_do_init_cp(dev, init, file_priv);
|
||||||
|
case RADEON_INIT_R600_CP:
|
||||||
|
return r600_do_init_cp(dev, init, file_priv);
|
||||||
case RADEON_CLEANUP_CP:
|
case RADEON_CLEANUP_CP:
|
||||||
return radeon_do_cleanup_cp(dev);
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
return r600_do_cleanup_cp(dev);
|
||||||
|
else
|
||||||
|
return radeon_do_cleanup_cp(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1476,7 +1515,10 @@ int radeon_cp_start(struct drm_device *dev, void *data, struct drm_file *file_pr
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
radeon_do_cp_start(dev_priv);
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
r600_do_cp_start(dev_priv);
|
||||||
|
else
|
||||||
|
radeon_do_cp_start(dev_priv);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1507,7 +1549,10 @@ int radeon_cp_stop(struct drm_device *dev, void *data, struct drm_file *file_pri
|
|||||||
* code so that the DRM ioctl wrapper can try again.
|
* code so that the DRM ioctl wrapper can try again.
|
||||||
*/
|
*/
|
||||||
if (stop->idle) {
|
if (stop->idle) {
|
||||||
ret = radeon_do_cp_idle(dev_priv);
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
ret = r600_do_cp_idle(dev_priv);
|
||||||
|
else
|
||||||
|
ret = radeon_do_cp_idle(dev_priv);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1516,10 +1561,16 @@ int radeon_cp_stop(struct drm_device *dev, void *data, struct drm_file *file_pri
|
|||||||
* we will get some dropped triangles as they won't be fully
|
* we will get some dropped triangles as they won't be fully
|
||||||
* rendered before the CP is shut down.
|
* rendered before the CP is shut down.
|
||||||
*/
|
*/
|
||||||
radeon_do_cp_stop(dev_priv);
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
r600_do_cp_stop(dev_priv);
|
||||||
|
else
|
||||||
|
radeon_do_cp_stop(dev_priv);
|
||||||
|
|
||||||
/* Reset the engine */
|
/* Reset the engine */
|
||||||
radeon_do_engine_reset(dev);
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
r600_do_engine_reset(dev);
|
||||||
|
else
|
||||||
|
radeon_do_engine_reset(dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1532,29 +1583,47 @@ void radeon_do_release(struct drm_device * dev)
|
|||||||
if (dev_priv) {
|
if (dev_priv) {
|
||||||
if (dev_priv->cp_running) {
|
if (dev_priv->cp_running) {
|
||||||
/* Stop the cp */
|
/* Stop the cp */
|
||||||
while ((ret = radeon_do_cp_idle(dev_priv)) != 0) {
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) < CHIP_R600) {
|
||||||
DRM_DEBUG("radeon_do_cp_idle %d\n", ret);
|
while ((ret = r600_do_cp_idle(dev_priv)) != 0) {
|
||||||
|
DRM_DEBUG("radeon_do_cp_idle %d\n", ret);
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
schedule();
|
schedule();
|
||||||
#else
|
#else
|
||||||
tsleep(&ret, PZERO, "rdnrel", 1);
|
tsleep(&ret, PZERO, "rdnrel", 1);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while ((ret = radeon_do_cp_idle(dev_priv)) != 0) {
|
||||||
|
DRM_DEBUG("radeon_do_cp_idle %d\n", ret);
|
||||||
|
#ifdef __linux__
|
||||||
|
schedule();
|
||||||
|
#else
|
||||||
|
tsleep(&ret, PZERO, "rdnrel", 1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600) {
|
||||||
|
r600_do_cp_stop(dev_priv);
|
||||||
|
r600_do_engine_reset(dev);
|
||||||
|
} else {
|
||||||
|
radeon_do_cp_stop(dev_priv);
|
||||||
|
radeon_do_engine_reset(dev);
|
||||||
}
|
}
|
||||||
radeon_do_cp_stop(dev_priv);
|
|
||||||
radeon_do_engine_reset(dev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable *all* interrupts */
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) < CHIP_R600) {
|
||||||
if (dev_priv->mmio) /* remove this after permanent addmaps */
|
/* Disable *all* interrupts */
|
||||||
RADEON_WRITE(RADEON_GEN_INT_CNTL, 0);
|
if (dev_priv->mmio) /* remove this after permanent addmaps */
|
||||||
|
RADEON_WRITE(RADEON_GEN_INT_CNTL, 0);
|
||||||
|
|
||||||
if (dev_priv->mmio) { /* remove all surfaces */
|
if (dev_priv->mmio) { /* remove all surfaces */
|
||||||
for (i = 0; i < RADEON_MAX_SURFACES; i++) {
|
for (i = 0; i < RADEON_MAX_SURFACES; i++) {
|
||||||
RADEON_WRITE(RADEON_SURFACE0_INFO + 16 * i, 0);
|
RADEON_WRITE(RADEON_SURFACE0_INFO + 16 * i, 0);
|
||||||
RADEON_WRITE(RADEON_SURFACE0_LOWER_BOUND +
|
RADEON_WRITE(RADEON_SURFACE0_LOWER_BOUND +
|
||||||
16 * i, 0);
|
16 * i, 0);
|
||||||
RADEON_WRITE(RADEON_SURFACE0_UPPER_BOUND +
|
RADEON_WRITE(RADEON_SURFACE0_UPPER_BOUND +
|
||||||
16 * i, 0);
|
16 * i, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1563,7 +1632,10 @@ void radeon_do_release(struct drm_device * dev)
|
|||||||
radeon_mem_takedown(&(dev_priv->fb_heap));
|
radeon_mem_takedown(&(dev_priv->fb_heap));
|
||||||
|
|
||||||
/* deallocate kernel resources */
|
/* deallocate kernel resources */
|
||||||
radeon_do_cleanup_cp(dev);
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
r600_do_cleanup_cp(dev);
|
||||||
|
else
|
||||||
|
radeon_do_cleanup_cp(dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1581,7 +1653,10 @@ int radeon_cp_reset(struct drm_device *dev, void *data, struct drm_file *file_pr
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
radeon_do_cp_reset(dev_priv);
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
r600_do_cp_reset(dev_priv);
|
||||||
|
else
|
||||||
|
radeon_do_cp_reset(dev_priv);
|
||||||
|
|
||||||
/* The CP is no longer running after an engine reset */
|
/* The CP is no longer running after an engine reset */
|
||||||
dev_priv->cp_running = 0;
|
dev_priv->cp_running = 0;
|
||||||
@ -1596,23 +1671,36 @@ int radeon_cp_idle(struct drm_device *dev, void *data, struct drm_file *file_pri
|
|||||||
|
|
||||||
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
||||||
|
|
||||||
return radeon_do_cp_idle(dev_priv);
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
return r600_do_cp_idle(dev_priv);
|
||||||
|
else
|
||||||
|
return radeon_do_cp_idle(dev_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Added by Charl P. Botha to call radeon_do_resume_cp().
|
/* Added by Charl P. Botha to call radeon_do_resume_cp().
|
||||||
*/
|
*/
|
||||||
int radeon_cp_resume(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
int radeon_cp_resume(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
return radeon_do_resume_cp(dev, file_priv);
|
drm_radeon_private_t *dev_priv = dev->dev_private;
|
||||||
|
DRM_DEBUG("\n");
|
||||||
|
|
||||||
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
return r600_do_resume_cp(dev, file_priv);
|
||||||
|
else
|
||||||
|
return radeon_do_resume_cp(dev, file_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
int radeon_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
int radeon_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv)
|
||||||
{
|
{
|
||||||
|
drm_radeon_private_t *dev_priv = dev->dev_private;
|
||||||
DRM_DEBUG("\n");
|
DRM_DEBUG("\n");
|
||||||
|
|
||||||
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
LOCK_TEST_WITH_RETURN(dev, file_priv);
|
||||||
|
|
||||||
return radeon_do_engine_reset(dev);
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
return r600_do_engine_reset(dev);
|
||||||
|
else
|
||||||
|
return radeon_do_engine_reset(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================================
|
/* ================================================================
|
||||||
@ -1997,7 +2085,13 @@ void radeon_commit_ring(drm_radeon_private_t *dev_priv)
|
|||||||
DRM_MEMORYBARRIER();
|
DRM_MEMORYBARRIER();
|
||||||
GET_RING_HEAD( dev_priv );
|
GET_RING_HEAD( dev_priv );
|
||||||
|
|
||||||
RADEON_WRITE( RADEON_CP_RB_WPTR, dev_priv->ring.tail );
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600) {
|
||||||
/* read from PCI bus to ensure correct posting */
|
RADEON_WRITE(R600_CP_RB_WPTR, dev_priv->ring.tail);
|
||||||
RADEON_READ( RADEON_CP_RB_RPTR );
|
/* read from PCI bus to ensure correct posting */
|
||||||
|
RADEON_READ(R600_CP_RB_RPTR);
|
||||||
|
} else {
|
||||||
|
RADEON_WRITE(RADEON_CP_RB_WPTR, dev_priv->ring.tail);
|
||||||
|
/* read from PCI bus to ensure correct posting */
|
||||||
|
RADEON_READ(RADEON_CP_RB_RPTR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,6 +396,8 @@ extern int radeon_engine_reset(struct drm_device *dev, void *data, struct drm_fi
|
|||||||
extern int radeon_fullscreen(struct drm_device *dev, void *data, struct drm_file *file_priv);
|
extern int radeon_fullscreen(struct drm_device *dev, void *data, struct drm_file *file_priv);
|
||||||
extern int radeon_cp_buffers(struct drm_device *dev, void *data, struct drm_file *file_priv);
|
extern int radeon_cp_buffers(struct drm_device *dev, void *data, struct drm_file *file_priv);
|
||||||
extern u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv);
|
extern u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv);
|
||||||
|
extern void radeon_write_agp_location(drm_radeon_private_t *dev_priv, u32 agp_loc);
|
||||||
|
extern void radeon_write_agp_base(drm_radeon_private_t *dev_priv, u64 agp_base);
|
||||||
extern u32 RADEON_READ_MM(drm_radeon_private_t *dev_priv, int addr);
|
extern u32 RADEON_READ_MM(drm_radeon_private_t *dev_priv, int addr);
|
||||||
|
|
||||||
extern void radeon_freelist_reset(struct drm_device * dev);
|
extern void radeon_freelist_reset(struct drm_device * dev);
|
||||||
@ -416,6 +418,10 @@ extern void radeon_mem_takedown(struct mem_block **heap);
|
|||||||
extern void radeon_mem_release(struct drm_file *file_priv,
|
extern void radeon_mem_release(struct drm_file *file_priv,
|
||||||
struct mem_block *heap);
|
struct mem_block *heap);
|
||||||
|
|
||||||
|
extern void radeon_enable_bm(struct drm_radeon_private *dev_priv);
|
||||||
|
extern u32 radeon_read_ring_rptr(drm_radeon_private_t *dev_priv, u32 off);
|
||||||
|
extern void radeon_write_ring_rptr(drm_radeon_private_t *dev_priv, u32 off, u32 val);
|
||||||
|
|
||||||
/* radeon_irq.c */
|
/* radeon_irq.c */
|
||||||
extern void radeon_irq_set_state(struct drm_device *dev, u32 mask, int state);
|
extern void radeon_irq_set_state(struct drm_device *dev, u32 mask, int state);
|
||||||
extern int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *file_priv);
|
extern int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *file_priv);
|
||||||
@ -456,6 +462,19 @@ extern int r300_do_cp_cmdbuf(struct drm_device *dev,
|
|||||||
struct drm_file *file_priv,
|
struct drm_file *file_priv,
|
||||||
drm_radeon_kcmd_buffer_t *cmdbuf);
|
drm_radeon_kcmd_buffer_t *cmdbuf);
|
||||||
|
|
||||||
|
/* r600_cp.c */
|
||||||
|
extern int r600_do_engine_reset(struct drm_device *dev);
|
||||||
|
extern int r600_do_cleanup_cp(struct drm_device *dev);
|
||||||
|
extern int r600_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
|
||||||
|
struct drm_file *file_priv);
|
||||||
|
extern int r600_do_resume_cp(struct drm_device *dev, struct drm_file *file_priv);
|
||||||
|
extern int r600_do_cp_idle(drm_radeon_private_t *dev_priv);
|
||||||
|
extern void r600_do_cp_start(drm_radeon_private_t *dev_priv);
|
||||||
|
extern void r600_do_cp_reset(drm_radeon_private_t *dev_priv);
|
||||||
|
extern void r600_do_cp_stop(drm_radeon_private_t *dev_priv);
|
||||||
|
extern int r600_cp_dispatch_indirect(struct drm_device *dev,
|
||||||
|
struct drm_buf *buf, int start, int end);
|
||||||
|
|
||||||
/* Flags for stats.boxes
|
/* Flags for stats.boxes
|
||||||
*/
|
*/
|
||||||
#define RADEON_BOX_DMA_IDLE 0x1
|
#define RADEON_BOX_DMA_IDLE 0x1
|
||||||
@ -1832,7 +1851,11 @@ do { \
|
|||||||
struct drm_radeon_master_private *master_priv = file_priv->master->driver_priv; \
|
struct drm_radeon_master_private *master_priv = file_priv->master->driver_priv; \
|
||||||
drm_radeon_sarea_t *sarea_priv = master_priv->sarea_priv; \
|
drm_radeon_sarea_t *sarea_priv = master_priv->sarea_priv; \
|
||||||
if ( sarea_priv->last_dispatch >= RADEON_MAX_VB_AGE ) { \
|
if ( sarea_priv->last_dispatch >= RADEON_MAX_VB_AGE ) { \
|
||||||
int __ret = radeon_do_cp_idle( dev_priv ); \
|
int __ret; \
|
||||||
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600) \
|
||||||
|
__ret = r600_do_cp_idle(dev_priv); \
|
||||||
|
else \
|
||||||
|
__ret = radeon_do_cp_idle(dev_priv); \
|
||||||
if ( __ret ) return __ret; \
|
if ( __ret ) return __ret; \
|
||||||
sarea_priv->last_dispatch = 0; \
|
sarea_priv->last_dispatch = 0; \
|
||||||
radeon_freelist_reset( dev ); \
|
radeon_freelist_reset( dev ); \
|
||||||
|
@ -1556,9 +1556,15 @@ static void radeon_cp_discard_buffer(struct drm_device *dev, struct drm_master *
|
|||||||
buf_priv->age = ++master_priv->sarea_priv->last_dispatch;
|
buf_priv->age = ++master_priv->sarea_priv->last_dispatch;
|
||||||
|
|
||||||
/* Emit the vertex buffer age */
|
/* Emit the vertex buffer age */
|
||||||
BEGIN_RING(2);
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600) {
|
||||||
RADEON_DISPATCH_AGE(buf_priv->age);
|
BEGIN_RING(3);
|
||||||
ADVANCE_RING();
|
R600_DISPATCH_AGE(buf_priv->age);
|
||||||
|
ADVANCE_RING();
|
||||||
|
} else {
|
||||||
|
BEGIN_RING(2);
|
||||||
|
RADEON_DISPATCH_AGE(buf_priv->age);
|
||||||
|
ADVANCE_RING();
|
||||||
|
}
|
||||||
|
|
||||||
buf->pending = 1;
|
buf->pending = 1;
|
||||||
buf->used = 0;
|
buf->used = 0;
|
||||||
@ -2473,24 +2479,25 @@ static int radeon_cp_indirect(struct drm_device *dev, void *data, struct drm_fil
|
|||||||
|
|
||||||
buf->used = indirect->end;
|
buf->used = indirect->end;
|
||||||
|
|
||||||
/* Wait for the 3D stream to idle before the indirect buffer
|
|
||||||
* containing 2D acceleration commands is processed.
|
|
||||||
*/
|
|
||||||
BEGIN_RING(2);
|
|
||||||
|
|
||||||
RADEON_WAIT_UNTIL_3D_IDLE();
|
|
||||||
|
|
||||||
ADVANCE_RING();
|
|
||||||
|
|
||||||
/* Dispatch the indirect buffer full of commands from the
|
/* Dispatch the indirect buffer full of commands from the
|
||||||
* X server. This is insecure and is thus only available to
|
* X server. This is insecure and is thus only available to
|
||||||
* privileged clients.
|
* privileged clients.
|
||||||
*/
|
*/
|
||||||
radeon_cp_dispatch_indirect(dev, buf, indirect->start, indirect->end);
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
if (indirect->discard) {
|
r600_cp_dispatch_indirect(dev, buf, indirect->start, indirect->end);
|
||||||
radeon_cp_discard_buffer(dev, file_priv->master, buf);
|
else {
|
||||||
|
/* Wait for the 3D stream to idle before the indirect buffer
|
||||||
|
* containing 2D acceleration commands is processed.
|
||||||
|
*/
|
||||||
|
BEGIN_RING(2);
|
||||||
|
RADEON_WAIT_UNTIL_3D_IDLE();
|
||||||
|
ADVANCE_RING();
|
||||||
|
radeon_cp_dispatch_indirect(dev, buf, indirect->start, indirect->end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (indirect->discard)
|
||||||
|
radeon_cp_discard_buffer(dev, file_priv->master, buf);
|
||||||
|
|
||||||
COMMIT_RING();
|
COMMIT_RING();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3052,7 +3059,10 @@ static int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_fil
|
|||||||
case RADEON_PARAM_SCRATCH_OFFSET:
|
case RADEON_PARAM_SCRATCH_OFFSET:
|
||||||
if (!dev_priv->writeback_works)
|
if (!dev_priv->writeback_works)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
value = RADEON_SCRATCH_REG_OFFSET;
|
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
|
||||||
|
value = R600_SCRATCH_REG_OFFSET;
|
||||||
|
else
|
||||||
|
value = RADEON_SCRATCH_REG_OFFSET;
|
||||||
break;
|
break;
|
||||||
case RADEON_PARAM_CARD_TYPE:
|
case RADEON_PARAM_CARD_TYPE:
|
||||||
if (dev_priv->flags & RADEON_IS_PCIE)
|
if (dev_priv->flags & RADEON_IS_PCIE)
|
||||||
|
Loading…
Reference in New Issue
Block a user