Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b15ec368 authored by Dave Airlie's avatar Dave Airlie
Browse files

drm: realign sosme radeon code with drm git tree



this applies some minor cleanups for the radeon driver, to use the
3D flush and reset the AGP flags on X recycle

Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent d40c8533
Loading
Loading
Loading
Loading
+12 −7
Original line number Original line Diff line number Diff line
@@ -1340,17 +1340,19 @@ static int radeon_do_init_cp(drm_device_t * dev, drm_radeon_init_t * init)
	DRM_DEBUG("\n");
	DRM_DEBUG("\n");


	/* if we require new memory map but we don't have it fail */
	/* if we require new memory map but we don't have it fail */
	if ((dev_priv->flags & CHIP_NEW_MEMMAP) && !dev_priv->new_memmap)
	if ((dev_priv->flags & CHIP_NEW_MEMMAP) && !dev_priv->new_memmap) {
	{
		DRM_ERROR("Cannot initialise DRM on this card\nThis card requires a new X.org DDX for 3D\n");
		DRM_ERROR("Cannot initialise DRM on this card\nThis card requires a new X.org DDX\n");
		radeon_do_cleanup_cp(dev);
		radeon_do_cleanup_cp(dev);
		return DRM_ERR(EINVAL);
		return DRM_ERR(EINVAL);
	}
	}


	if (init->is_pci && (dev_priv->flags & CHIP_IS_AGP))
	if (init->is_pci && (dev_priv->flags & CHIP_IS_AGP)) {
	{
		DRM_DEBUG("Forcing AGP card to PCI mode\n");
		DRM_DEBUG("Forcing AGP card to PCI mode\n");
		dev_priv->flags &= ~CHIP_IS_AGP;
		dev_priv->flags &= ~CHIP_IS_AGP;
	} else if (!(dev_priv->flags & (CHIP_IS_AGP | CHIP_IS_PCI | CHIP_IS_PCIE))
		   && !init->is_pci) {
		DRM_DEBUG("Restoring AGP flag\n");
		dev_priv->flags |= CHIP_IS_AGP;
	}
	}


	if ((!(dev_priv->flags & CHIP_IS_AGP)) && !dev->sg) {
	if ((!(dev_priv->flags & CHIP_IS_AGP)) && !dev->sg) {
@@ -2189,7 +2191,9 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags)
	case CHIP_RV200:
	case CHIP_RV200:
	case CHIP_R200:
	case CHIP_R200:
	case CHIP_R300:
	case CHIP_R300:
	case CHIP_R350:
	case CHIP_R420:
	case CHIP_R420:
	case CHIP_RV410:
		dev_priv->flags |= CHIP_HAS_HIERZ;
		dev_priv->flags |= CHIP_HAS_HIERZ;
		break;
		break;
	default:
	default:
@@ -2199,9 +2203,10 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags)


	if (drm_device_is_agp(dev))
	if (drm_device_is_agp(dev))
		dev_priv->flags |= CHIP_IS_AGP;
		dev_priv->flags |= CHIP_IS_AGP;

	else if (drm_device_is_pcie(dev))
	if (drm_device_is_pcie(dev))
		dev_priv->flags |= CHIP_IS_PCIE;
		dev_priv->flags |= CHIP_IS_PCIE;
	else
		dev_priv->flags |= CHIP_IS_PCI;


	DRM_DEBUG("%s card detected\n",
	DRM_DEBUG("%s card detected\n",
		  ((dev_priv->flags & CHIP_IS_AGP) ? "AGP" : (((dev_priv->flags & CHIP_IS_PCIE) ? "PCIE" : "PCI"))));
		  ((dev_priv->flags & CHIP_IS_AGP) ? "AGP" : (((dev_priv->flags & CHIP_IS_PCIE) ? "PCIE" : "PCI"))));
+3 −2
Original line number Original line Diff line number Diff line
@@ -142,6 +142,7 @@ enum radeon_chip_flags {
	CHIP_HAS_HIERZ = 0x00100000UL,
	CHIP_HAS_HIERZ = 0x00100000UL,
	CHIP_IS_PCIE = 0x00200000UL,
	CHIP_IS_PCIE = 0x00200000UL,
	CHIP_NEW_MEMMAP = 0x00400000UL,
	CHIP_NEW_MEMMAP = 0x00400000UL,
	CHIP_IS_PCI = 0x00800000UL,
};
};


#define GET_RING_HEAD(dev_priv)	(dev_priv->writeback_works ? \
#define GET_RING_HEAD(dev_priv)	(dev_priv->writeback_works ? \
@@ -993,12 +994,12 @@ do { \


#define RADEON_FLUSH_CACHE() do {					\
#define RADEON_FLUSH_CACHE() do {					\
	OUT_RING( CP_PACKET0( RADEON_RB3D_DSTCACHE_CTLSTAT, 0 ) );	\
	OUT_RING( CP_PACKET0( RADEON_RB3D_DSTCACHE_CTLSTAT, 0 ) );	\
	OUT_RING( RADEON_RB2D_DC_FLUSH );				\
	OUT_RING( RADEON_RB3D_DC_FLUSH );				\
} while (0)
} while (0)


#define RADEON_PURGE_CACHE() do {					\
#define RADEON_PURGE_CACHE() do {					\
	OUT_RING( CP_PACKET0( RADEON_RB3D_DSTCACHE_CTLSTAT, 0 ) );	\
	OUT_RING( CP_PACKET0( RADEON_RB3D_DSTCACHE_CTLSTAT, 0 ) );	\
	OUT_RING( RADEON_RB2D_DC_FLUSH_ALL );				\
	OUT_RING( RADEON_RB3D_DC_FLUSH_ALL );				\
} while (0)
} while (0)


#define RADEON_FLUSH_ZCACHE() do {					\
#define RADEON_FLUSH_ZCACHE() do {					\