radeon: refactor out the fb/agp location read/write.
Add a new get param to get the fb location into userspace. Mesa currently hits MMIO to do this, but this isn't always possible.main
parent
307fc3c92c
commit
a90510966e
|
@ -816,6 +816,21 @@ static const u32 R300_cp_microcode[][2] = {
|
|||
{ 0000000000, 0000000000 },
|
||||
};
|
||||
|
||||
u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv)
|
||||
{
|
||||
return RADEON_READ(RADEON_MC_FB_LOCATION);
|
||||
}
|
||||
|
||||
static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 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)
|
||||
{
|
||||
RADEON_WRITE(RADEON_MC_AGP_LOCATION, agp_loc);
|
||||
}
|
||||
|
||||
static int RADEON_READ_PLL(struct drm_device * dev, int addr)
|
||||
{
|
||||
drm_radeon_private_t *dev_priv = dev->dev_private;
|
||||
|
@ -1134,14 +1149,14 @@ static void radeon_cp_init_ring_buffer(struct drm_device * dev,
|
|||
* always appended to the fb which is not necessarily the case
|
||||
*/
|
||||
if (!dev_priv->new_memmap)
|
||||
RADEON_WRITE(RADEON_MC_FB_LOCATION,
|
||||
radeon_write_fb_location(dev_priv,
|
||||
((dev_priv->gart_vm_start - 1) & 0xffff0000)
|
||||
| (dev_priv->fb_location >> 16));
|
||||
|
||||
#if __OS_HAS_AGP
|
||||
if (dev_priv->flags & RADEON_IS_AGP) {
|
||||
RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev->agp->base);
|
||||
RADEON_WRITE(RADEON_MC_AGP_LOCATION,
|
||||
radeon_write_agp_location(dev_priv,
|
||||
(((dev_priv->gart_vm_start - 1 +
|
||||
dev_priv->gart_size) & 0xffff0000) |
|
||||
(dev_priv->gart_vm_start >> 16)));
|
||||
|
@ -1305,7 +1320,7 @@ static void radeon_set_igpgart(drm_radeon_private_t * dev_priv, int on)
|
|||
|
||||
RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev_priv->gart_vm_start);
|
||||
dev_priv->gart_size = 32*1024*1024;
|
||||
RADEON_WRITE(RADEON_MC_AGP_LOCATION,
|
||||
radeon_write_agp_location(dev_priv,
|
||||
(((dev_priv->gart_vm_start - 1 +
|
||||
dev_priv->gart_size) & 0xffff0000) |
|
||||
(dev_priv->gart_vm_start >> 16)));
|
||||
|
@ -1339,7 +1354,7 @@ static void radeon_set_pciegart(drm_radeon_private_t * dev_priv, int on)
|
|||
dev_priv->gart_vm_start +
|
||||
dev_priv->gart_size - 1);
|
||||
|
||||
RADEON_WRITE(RADEON_MC_AGP_LOCATION, 0xffffffc0); /* ?? */
|
||||
radeon_write_agp_location(dev_priv, 0xffffffc0); /* ?? */
|
||||
|
||||
RADEON_WRITE_PCIE(RADEON_PCIE_TX_GART_CNTL,
|
||||
RADEON_PCIE_TX_GART_EN);
|
||||
|
@ -1382,7 +1397,7 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on)
|
|||
|
||||
/* Turn off AGP aperture -- is this required for PCI GART?
|
||||
*/
|
||||
RADEON_WRITE(RADEON_MC_AGP_LOCATION, 0xffffffc0); /* ?? */
|
||||
radeon_write_agp_location(dev_priv, 0xffffffc0);
|
||||
RADEON_WRITE(RADEON_AGP_COMMAND, 0); /* clear AGP_COMMAND */
|
||||
} else {
|
||||
RADEON_WRITE(RADEON_AIC_CNTL,
|
||||
|
@ -1590,10 +1605,9 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
|
|||
dev->agp_buffer_map->handle);
|
||||
}
|
||||
|
||||
dev_priv->fb_location = (RADEON_READ(RADEON_MC_FB_LOCATION)
|
||||
& 0xffff) << 16;
|
||||
dev_priv->fb_location = (radeon_read_fb_location(dev_priv) & 0xffff) << 16;
|
||||
dev_priv->fb_size =
|
||||
((RADEON_READ(RADEON_MC_FB_LOCATION) & 0xffff0000u) + 0x10000)
|
||||
((radeon_read_fb_location(dev_priv) & 0xffff0000u) + 0x10000)
|
||||
- dev_priv->fb_location;
|
||||
|
||||
dev_priv->front_pitch_offset = (((dev_priv->front_pitch / 64) << 22) |
|
||||
|
|
|
@ -656,6 +656,7 @@ typedef struct drm_radeon_indirect {
|
|||
#define RADEON_PARAM_SCRATCH_OFFSET 11
|
||||
#define RADEON_PARAM_CARD_TYPE 12
|
||||
#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */
|
||||
#define RADEON_PARAM_FB_LOCATION 14 /* FB location */
|
||||
|
||||
typedef struct drm_radeon_getparam {
|
||||
int param;
|
||||
|
|
|
@ -345,6 +345,7 @@ extern int radeon_cp_resume(struct drm_device *dev, void *data, struct drm_file
|
|||
extern int radeon_engine_reset(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 u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv);
|
||||
|
||||
extern void radeon_freelist_reset(struct drm_device * dev);
|
||||
extern struct drm_buf *radeon_freelist_get(struct drm_device * dev);
|
||||
|
|
|
@ -3081,6 +3081,9 @@ static int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_fil
|
|||
case RADEON_PARAM_VBLANK_CRTC:
|
||||
value = radeon_vblank_crtc_get(dev);
|
||||
break;
|
||||
case RADEON_PARAM_FB_LOCATION:
|
||||
value = radeon_read_fb_location(dev_priv);
|
||||
break;
|
||||
default:
|
||||
DRM_DEBUG( "Invalid parameter %d\n", param->param );
|
||||
return -EINVAL;
|
||||
|
|
Loading…
Reference in New Issue