From 72cfc797b51e59ecf8a2787c6a176838241cc94b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 14 Jun 2005 22:34:11 +0000 Subject: =?UTF-8?q?Adds=20support=20for=20PCI=20cards=20to=20MGA=20DRM=20T?= =?UTF-8?q?his=20patch=20adds=20serveral=20new=20ioctls=20and=20a=20new=20?= =?UTF-8?q?query=20to=20get=5Fparam=20query=20to=20=20=20=20=20support=20P?= =?UTF-8?q?CI=20MGA=20cards.=20Two=20ioctls=20were=20added=20to=20implemen?= =?UTF-8?q?t=20interrupt=20based=20waiting.=20With=20this=20=20=20=20=20ch?= =?UTF-8?q?ange,=20the=20client-side=20driver=20no=20longer=20needs=20to?= =?UTF-8?q?=20map=20the=20primary=20DMA=20=20=20=20=20region=20or=20the=20?= =?UTF-8?q?MMIO=20region.=20Previously,=20end-of-frame=20waiting=20was=20d?= =?UTF-8?q?one=20by=20=20=20=20=20busy=20waiting=20in=20the=20client-side?= =?UTF-8?q?=20driver=20until=20one=20of=20the=20MMIO=20registers=20=20=20?= =?UTF-8?q?=20=20(the=20current=20DMA=20pointer)=20matched=20a=20pointer?= =?UTF-8?q?=20to=20the=20end=20of=20primary=20DMA=20=20=20=20=20space.=20B?= =?UTF-8?q?y=20using=20interrupts,=20the=20busy=20waiting=20and=20the=20ex?= =?UTF-8?q?tra=20mappings=20are=20=20=20=20=20removed.=20A=20third=20ioctl?= =?UTF-8?q?=20was=20added=20to=20bootstrap=20DMA.=20This=20ioctl,=20which?= =?UTF-8?q?=20is=20used=20by=20the=20=20=20=20=20X-server,=20moves=20a=20*?= =?UTF-8?q?LOT*=20of=20code=20from=20the=20X-server=20into=20the=20kernel.?= =?UTF-8?q?=20This=20=20=20=20=20allows=20the=20kernel=20to=20do=20whateve?= =?UTF-8?q?r=20needs=20to=20be=20done=20to=20setup=20DMA=20buffers.=20=20?= =?UTF-8?q?=20=20=20The=20entire=20process=20and=20the=20locations=20of=20?= =?UTF-8?q?the=20buffers=20are=20hidden=20from=20=20=20=20=20user-mode.=20?= =?UTF-8?q?Additionally,=20a=20get=5Fparam=20query=20was=20added=20to=20di?= =?UTF-8?q?fferentiate=20between=20G4x0=20=20=20=20=20cards=20and=20G550?= =?UTF-8?q?=20cards.=20A=20gap=20was=20left=20in=20the=20numbering=20seque?= =?UTF-8?q?nce=20so=20that,=20=20=20=20=20if=20needed,=20G450=20cards=20co?= =?UTF-8?q?uld=20be=20distinguished=20from=20G400=20cards.=20According=20?= =?UTF-8?q?=20=20=20=20to=20Ville=20Syrj=C3=A4l=C3=A4,=20the=20G4x0=20card?= =?UTF-8?q?s=20and=20the=20G550=20cards=20handle=20=20=20=20=20anisotropic?= =?UTF-8?q?=20filtering=20differently.=20This=20seems=20the=20most=20compa?= =?UTF-8?q?tible=20way=20=20=20=20=20to=20let=20the=20client-side=20driver?= =?UTF-8?q?=20know=20which=20card=20it's=20own.=20Doing=20this=20very=20?= =?UTF-8?q?=20=20=20=20small=20change=20now=20eliminates=20the=20need=20to?= =?UTF-8?q?=20bump=20the=20DRM=20minor=20version=20=20=20=20=20twice.=20ht?= =?UTF-8?q?tp://marc.theaimsgroup.com/=3Fl=3Ddri-devel&m=3D106625815319773?= =?UTF-8?q?&w=3D2=20A=20number=20of=20ioctl=20handlers=20in=20linux-core?= =?UTF-8?q?=20were=20also=20modified=20so=20that=20they=20=20=20=20=20coul?= =?UTF-8?q?d=20be=20called=20in-kernel.=20In=20these=20cases,=20the=20in-k?= =?UTF-8?q?ernel=20callable=20=20=20=20=20version=20kept=20the=20existing?= =?UTF-8?q?=20name=20(e.g.,=20drm=5Fagp=5Facquire)=20and=20the=20ioctl=20?= =?UTF-8?q?=20=20=20=20handler=20added=20=5Fioctl=20to=20the=20name=20(e.g?= =?UTF-8?q?.,=20drm=5Fagp=5Facquire=5Fioctl).=20This=20patch=20also=20repl?= =?UTF-8?q?aces=20the=20drm=5Fagp=5Fdo=5Frelease=20function=20with=20=20?= =?UTF-8?q?=20=20=20drm=5Fagp=5Frelease.=20drm=5Fagp=5Frelease=20(drm=5Fco?= =?UTF-8?q?re=5Fagp=5Frelease=20in=20the=20previous=20=20=20=20=20patch)?= =?UTF-8?q?=20is=20very=20similar=20to=20drm=5Fagp=5Fdo=5Frelease,=20and?= =?UTF-8?q?=20I=20saw=20no=20reason=20to=20=20=20=20=20have=20both.=20This?= =?UTF-8?q?=20commit=20*breaks=20the=20build*=20on=20BSD.=20Eric=20said=20?= =?UTF-8?q?that=20he=20would=20make=20the=20=20=20=20=20required=20updates?= =?UTF-8?q?=20to=20the=20BSD=20side=20soon.=20Xorg=20bug:=203259=20Reviewe?= =?UTF-8?q?d=20by:=20Eric=20Anholt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shared-core/mga_drm.h | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) (limited to 'shared-core/mga_drm.h') diff --git a/shared-core/mga_drm.h b/shared-core/mga_drm.h index c3811fea..5b8f1564 100644 --- a/shared-core/mga_drm.h +++ b/shared-core/mga_drm.h @@ -73,6 +73,8 @@ #define MGA_CARD_TYPE_G200 1 #define MGA_CARD_TYPE_G400 2 +#define MGA_CARD_TYPE_G450 3 /* not currently used */ +#define MGA_CARD_TYPE_G550 4 #define MGA_FRONT 0x1 #define MGA_BACK 0x2 @@ -237,6 +239,14 @@ typedef struct _drm_mga_sarea { #define DRM_MGA_BLIT 0x08 #define DRM_MGA_GETPARAM 0x09 +/* 3.2: + * ioctls for operating on fences. + */ +#define DRM_MGA_SET_FENCE 0x0a +#define DRM_MGA_WAIT_FENCE 0x0b +#define DRM_MGA_DMA_BOOTSTRAP 0x0c + + #define DRM_IOCTL_MGA_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_INIT, drm_mga_init_t) #define DRM_IOCTL_MGA_FLUSH DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_FLUSH, drm_lock_t) #define DRM_IOCTL_MGA_RESET DRM_IO( DRM_COMMAND_BASE + DRM_MGA_RESET) @@ -247,6 +257,9 @@ typedef struct _drm_mga_sarea { #define DRM_IOCTL_MGA_ILOAD DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_ILOAD, drm_mga_iload_t) #define DRM_IOCTL_MGA_BLIT DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_BLIT, drm_mga_blit_t) #define DRM_IOCTL_MGA_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_GETPARAM, drm_mga_getparam_t) +#define DRM_IOCTL_MGA_SET_FENCE DRM_IOW( DRM_COMMAND_BASE + DRM_MGA_SET_FENCE, uint32_t) +#define DRM_IOCTL_MGA_WAIT_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_WAIT_FENCE, uint32_t) +#define DRM_IOCTL_MGA_DMA_BOOTSTRAP DRM_IOWR(DRM_COMMAND_BASE + DRM_MGA_DMA_BOOTSTRAP, drm_mga_dma_bootstrap_t) typedef struct _drm_mga_warp_index { int installed; @@ -285,6 +298,74 @@ typedef struct drm_mga_init { unsigned long buffers_offset; } drm_mga_init_t; + +typedef struct drm_mga_dma_bootstrap { + /** + * \name AGP texture region + * + * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, these fields will + * be filled in with the actual AGP texture settings. + * + * \warning + * If these fields are non-zero, but dma_mga_dma_bootstrap::agp_mode + * is zero, it means that PCI memory (most likely through the use of + * an IOMMU) is being used for "AGP" textures. + */ + /*@{*/ + drm_handle_t texture_handle; /**< Handle used to map AGP textures. */ + uint32_t texture_size; /**< Size of the AGP texture region. */ + /*@}*/ + + + /** + * Requested size of the primary DMA region. + * + * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be + * filled in with the actual AGP mode. If AGP was not available + */ + uint32_t primary_size; + + + /** + * Requested number of secondary DMA buffers. + * + * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be + * filled in with the actual number of secondary DMA buffers + * allocated. Particularly when PCI DMA is used, this may be + * (subtantially) less than the number requested. + */ + uint32_t secondary_bin_count; + + + /** + * Requested size of each secondary DMA buffer. + * + * While the kernel \b is free to reduce + * dma_mga_dma_bootstrap::secondary_bin_count, it is \b not allowed + * to reduce dma_mga_dma_bootstrap::secondary_bin_size. + */ + uint32_t secondary_bin_size; + + + /** + * Bit-wise mask of AGPSTAT2_* values. Currently only \c AGPSTAT2_1X, + * \c AGPSTAT2_2X, and \c AGPSTAT2_4X are supported. If this value is + * zero, it means that PCI DMA should be used, even if AGP is + * possible. + * + * On return from the DRM_MGA_DMA_BOOTSTRAP ioctl, this field will be + * filled in with the actual AGP mode. If AGP was not available + * (i.e., PCI DMA was used), this value will be zero. + */ + uint32_t agp_mode; + + + /** + * Desired AGP GART size, measured in megabytes. + */ + uint8_t agp_size; +} drm_mga_dma_bootstrap_t; + typedef struct drm_mga_clear { unsigned int flags; unsigned int clear_color; @@ -328,6 +409,14 @@ typedef struct _drm_mga_blit { */ #define MGA_PARAM_IRQ_NR 1 +/* 3.2: Query the actual card type. The DDX only distinguishes between + * G200 chips and non-G200 chips, which it calls G400. It turns out that + * there are some very sublte differences between the G4x0 chips and the G550 + * chips. Using this parameter query, a client-side driver can detect the + * difference between a G4x0 and a G550. + */ +#define MGA_PARAM_CARD_TYPE 2 + typedef struct drm_mga_getparam { int param; void __user *value; -- cgit v1.2.3