From 780e90e4a265532cf96c887267b80c691f016996 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 29 Dec 2005 00:17:51 +0000 Subject: [PATCH] add radeon card type get param so userspace can avoid walking PCI --- shared-core/radeon_drm.h | 6 ++++++ shared-core/radeon_drv.h | 5 +++-- shared-core/radeon_state.c | 9 +++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/shared-core/radeon_drm.h b/shared-core/radeon_drm.h index e9a1f9b4..78492e78 100644 --- a/shared-core/radeon_drm.h +++ b/shared-core/radeon_drm.h @@ -624,6 +624,11 @@ typedef struct drm_radeon_indirect { int discard; } drm_radeon_indirect_t; +/* enum for card type parameters */ +#define RADEON_CARD_PCI 0 +#define RADEON_CARD_AGP 1 +#define RADEON_CARD_PCIE 2 + /* 1.3: An ioctl to get parameters that aren't available to the 3d * client any other way. */ @@ -640,6 +645,7 @@ typedef struct drm_radeon_indirect { #define RADEON_PARAM_SAREA_HANDLE 9 #define RADEON_PARAM_GART_TEX_HANDLE 10 #define RADEON_PARAM_SCRATCH_OFFSET 11 +#define RADEON_PARAM_CARD_TYPE 12 typedef struct drm_radeon_getparam { int param; diff --git a/shared-core/radeon_drv.h b/shared-core/radeon_drv.h index ab368262..615afc78 100644 --- a/shared-core/radeon_drv.h +++ b/shared-core/radeon_drv.h @@ -38,7 +38,7 @@ #define DRIVER_NAME "radeon" #define DRIVER_DESC "ATI Radeon" -#define DRIVER_DATE "20050911" +#define DRIVER_DATE "20051229" /* Interface history: * @@ -88,10 +88,11 @@ and R200_EMIT_ATF_TFACTOR (replaces R200_EMIT_TFACTOR_0 (8 consts instead of 6) * 1.19- Add support for gart table in FB memory and PCIE r300 * 1.20- Add support for r300 texrect + * 1.21- Add support for card type getparam */ #define DRIVER_MAJOR 1 -#define DRIVER_MINOR 20 +#define DRIVER_MINOR 21 #define DRIVER_PATCHLEVEL 0 enum radeon_family { diff --git a/shared-core/radeon_state.c b/shared-core/radeon_state.c index 670f6172..3682c68c 100644 --- a/shared-core/radeon_state.c +++ b/shared-core/radeon_state.c @@ -2952,6 +2952,15 @@ static int radeon_cp_getparam(DRM_IOCTL_ARGS) case RADEON_PARAM_GART_TEX_HANDLE: value = dev_priv->gart_textures_offset; break; + + case RADEON_PARAM_CARD_TYPE: + if (dev_priv->flags & CHIP_IS_PCIE) + value = RADEON_CARD_PCIE; + else if (dev_priv->flags & CHIP_IS_AGP) + value = RADEON_CARD_AGP; + else + value = RADEON_CARD_PCI; + break; default: return DRM_ERR(EINVAL); }