diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2014-10-19 19:11:00 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2014-10-19 19:11:00 +0000 |
commit | 9b4c34afd70b0d24a4592f66d9b29226cc5a6b2d (patch) | |
tree | ba365fc0c77ffb4fd3005a136eb4bae8ec76d09e /driver/xf86-video-mga/src | |
parent | fb747bcfd2fb9b9d5a8755dcbf28461577fe1297 (diff) |
Update to xf86-video-mga 1.6.3
Diffstat (limited to 'driver/xf86-video-mga/src')
-rw-r--r-- | driver/xf86-video-mga/src/Makefile.am | 1 | ||||
-rw-r--r-- | driver/xf86-video-mga/src/Makefile.in | 21 | ||||
-rw-r--r-- | driver/xf86-video-mga/src/mga.h | 12 | ||||
-rw-r--r-- | driver/xf86-video-mga/src/mga_driver.c | 202 | ||||
-rw-r--r-- | driver/xf86-video-mga/src/mga_esc.c | 13 | ||||
-rw-r--r-- | driver/xf86-video-mga/src/mga_exa.c | 2 | ||||
-rw-r--r-- | driver/xf86-video-mga/src/mga_storm.c | 4 |
7 files changed, 172 insertions, 83 deletions
diff --git a/driver/xf86-video-mga/src/Makefile.am b/driver/xf86-video-mga/src/Makefile.am index 8227c0582..20fbdf6ab 100644 --- a/driver/xf86-video-mga/src/Makefile.am +++ b/driver/xf86-video-mga/src/Makefile.am @@ -39,7 +39,6 @@ mga_drv_la_SOURCES = \ mga_dga.c \ mga_dh.c \ mga_driver.c \ - mga_esc.c \ mga_g450pll.c \ mga.h \ mga_halmod.c \ diff --git a/driver/xf86-video-mga/src/Makefile.in b/driver/xf86-video-mga/src/Makefile.in index 20c70422e..7e320e29b 100644 --- a/driver/xf86-video-mga/src/Makefile.in +++ b/driver/xf86-video-mga/src/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -124,8 +124,8 @@ LTLIBRARIES = $(mga_drv_la_LTLIBRARIES) mga_drv_la_DEPENDENCIES = am__mga_drv_la_SOURCES_DIST = binding.h client.h mga_bios.c \ mga_common.h mga_dac3026.c mga_dacG.c mga_dga.c mga_dh.c \ - mga_driver.c mga_esc.c mga_g450pll.c mga.h mga_halmod.c \ - mga_hwcurs.c mga_macros.h mga_maven.h mga_merge.c mga_merge.h \ + mga_driver.c mga_g450pll.c mga.h mga_halmod.c mga_hwcurs.c \ + mga_macros.h mga_maven.h mga_merge.c mga_merge.h \ mgareg_flags.h mga_reg.h mga_sarea.h mga_shadow.c mga_ucode.h \ mga_vga.c mga_video.c mga_storm.c compat-api.h mga_dri.c \ mga_dri.h mga_dripriv.h mga_exa.c mga_arc.c @@ -133,7 +133,7 @@ am__mga_drv_la_SOURCES_DIST = binding.h client.h mga_bios.c \ @USE_EXA_TRUE@am__objects_2 = mga_exa.lo @XAA_TRUE@am__objects_3 = mga_arc.lo am_mga_drv_la_OBJECTS = mga_bios.lo mga_dac3026.lo mga_dacG.lo \ - mga_dga.lo mga_dh.lo mga_driver.lo mga_esc.lo mga_g450pll.lo \ + mga_dga.lo mga_dh.lo mga_driver.lo mga_g450pll.lo \ mga_halmod.lo mga_hwcurs.lo mga_merge.lo mga_shadow.lo \ mga_vga.lo mga_video.lo mga_storm.lo $(am__objects_1) \ $(am__objects_2) $(am__objects_3) @@ -269,6 +269,8 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ PCIACCESS_LIBS = @PCIACCESS_LIBS@ PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -345,11 +347,11 @@ mga_drv_ladir = @moduledir@/drivers mga_drv_la_LIBADD = $(noinst_LTLIBRARIES) mga_drv_la_SOURCES = binding.h client.h mga_bios.c mga_common.h \ mga_dac3026.c mga_dacG.c mga_dga.c mga_dh.c mga_driver.c \ - mga_esc.c mga_g450pll.c mga.h mga_halmod.c mga_hwcurs.c \ - mga_macros.h mga_maven.h mga_merge.c mga_merge.h \ - mgareg_flags.h mga_reg.h mga_sarea.h mga_shadow.c mga_ucode.h \ - mga_vga.c mga_video.c mga_storm.c compat-api.h $(am__append_1) \ - $(am__append_2) $(am__append_3) + mga_g450pll.c mga.h mga_halmod.c mga_hwcurs.c mga_macros.h \ + mga_maven.h mga_merge.c mga_merge.h mgareg_flags.h mga_reg.h \ + mga_sarea.h mga_shadow.c mga_ucode.h mga_vga.c mga_video.c \ + mga_storm.c compat-api.h $(am__append_1) $(am__append_2) \ + $(am__append_3) all: all-am .SUFFIXES: @@ -435,7 +437,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mga_dh.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mga_dri.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mga_driver.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mga_esc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mga_exa.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mga_g450pll.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mga_halmod.Plo@am__quote@ diff --git a/driver/xf86-video-mga/src/mga.h b/driver/xf86-video-mga/src/mga.h index 34695c1bc..988ba934d 100644 --- a/driver/xf86-video-mga/src/mga.h +++ b/driver/xf86-video-mga/src/mga.h @@ -343,6 +343,13 @@ typedef struct { int mastervideoRam; int slavevideoRam; Bool directRenderingEnabled; + + void * mappedIOBase; + int mappedIOUsage; + + void * mappedILOADBase; + int mappedILOADUsage; + ScrnInfoPtr pScrn_1; ScrnInfoPtr pScrn_2; } MGAEntRec, *MGAEntPtr; @@ -688,7 +695,12 @@ extern CARD32 MGAAtypeNoBLK[16]; #define NICE_DASH_PATTERN 0x00000020 #define TWO_PASS_COLOR_EXPAND 0x00000040 #define MGA_NO_PLANEMASK 0x00000080 +/* linear expansion doesn't work on BE due to wrong byte order */ +#if X_BYTE_ORDER == X_BIG_ENDIAN +#define USE_LINEAR_EXPANSION 0x00000000 +#else #define USE_LINEAR_EXPANSION 0x00000100 +#endif #define LARGE_ADDRESSES 0x00000200 #define MGAIOMAPSIZE 0x00004000 diff --git a/driver/xf86-video-mga/src/mga_driver.c b/driver/xf86-video-mga/src/mga_driver.c index 864f7743c..2b4a867b5 100644 --- a/driver/xf86-video-mga/src/mga_driver.c +++ b/driver/xf86-video-mga/src/mga_driver.c @@ -676,12 +676,22 @@ MGAPciProbe(DriverPtr drv, int entity_num, struct pci_device * dev, #endif if (pci_device_has_kernel_driver(dev)) { - xf86DrvMsg(0, X_ERROR, - "mga: The PCI device 0x%x at %2.2d@%2.2d:%2.2d:%1.1d has a kernel module claiming it.\n", - dev->device_id, dev->bus, dev->domain, dev->dev, dev->func); - xf86DrvMsg(0, X_ERROR, - "mga: This driver cannot operate until it has been unloaded.\n"); - return FALSE; + /* If it's a G200 server chip, it's probably on KMS, so bail; if not, + * it might be using matroxfb, which is ok. */ + switch (dev->device_id) { + case PCI_CHIP_MGAG200_SE_A_PCI: + case PCI_CHIP_MGAG200_SE_B_PCI: + case PCI_CHIP_MGAG200_EV_PCI: + case PCI_CHIP_MGAG200_ER_PCI: + case PCI_CHIP_MGAG200_WINBOND_PCI: + case PCI_CHIP_MGAG200_EH_PCI: + xf86DrvMsg(0, X_ERROR, + "mga: The PCI device 0x%x at %2.2d@%2.2d:%2.2d:%1.1d has a kernel module claiming it.\n", + dev->device_id, dev->bus, dev->domain, dev->dev, dev->func); + xf86DrvMsg(0, X_ERROR, + "mga: This driver cannot operate until it has been unloaded.\n"); + return FALSE; + } } /* Allocate a ScrnInfoRec and claim the slot */ @@ -1670,6 +1680,43 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } /* + * Disable HW cursor by default on G200 server chips as these + * chips are often used with a remote graphics link which cannot + * display the HW cursor. + */ + switch (pMga->Chipset) { + case PCI_CHIP_MGAG200_SE_A_PCI: + case PCI_CHIP_MGAG200_SE_B_PCI: + case PCI_CHIP_MGAG200_EV_PCI: + case PCI_CHIP_MGAG200_ER_PCI: + case PCI_CHIP_MGAG200_WINBOND_PCI: + case PCI_CHIP_MGAG200_EH_PCI: + pMga->HWCursor = FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "HW cursor is not supported with video redirection on" + "G200 server chips.\n If you don't intend to use video " + "redirection enable with Option \"HWCursor\" \"On\"\n"); + break; + default: + pMga->HWCursor = TRUE; + } + from = X_DEFAULT; + + /* + * The preferred method is to use the "hw cursor" option as a tri-state + * option, with the default set above. + */ + if (xf86GetOptValBool(pMga->Options, OPTION_HW_CURSOR, &pMga->HWCursor)) + from = X_CONFIG; + + /* For compatibility, accept this too (as an override) */ + if (xf86ReturnOptValBool(pMga->Options, OPTION_SW_CURSOR, FALSE)) { + from = X_CONFIG; + pMga->HWCursor = FALSE; + } + + pMga->SecondCrtc = FALSE; + /* * In case of DualHead, we need to determine if we are the 'master' head * or the 'slave' head. In order to do that, at the end of the first * initialisation, PrimInit is set as DONE to the shared entity. So that @@ -1681,13 +1728,12 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) if (xf86IsEntityShared(pScrn->entityList[0])) { /* dual-head mode */ if (!xf86IsPrimInitDone(pScrn->entityList[0])) { /* Is it the first initialisation? */ /* First CRTC */ - pMga->SecondCrtc = FALSE; - pMga->HWCursor = TRUE; pMgaEnt->pScrn_1 = pScrn; } else if (pMga->DualHeadEnabled) { /* Second CRTC */ pMga->SecondCrtc = TRUE; pMga->HWCursor = FALSE; + from = X_DEFAULT; pMgaEnt->pScrn_2 = pScrn; pScrn->AdjustFrame = MGAAdjustFrameCrtc2; /* @@ -1706,14 +1752,15 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } } + xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", + pMga->HWCursor ? "HW" : "SW"); + if (pMga->DualHeadEnabled) { #ifdef MGADRI pMga->GetQuiescence = MGAGetQuiescenceShared; #endif } else { /* single-head mode */ - pMga->SecondCrtc = FALSE; - pMga->HWCursor = TRUE; #ifdef MGADRI pMga->GetQuiescence = MGAGetQuiescence; #endif @@ -1977,24 +2024,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } #endif - from = X_DEFAULT; - - /* - * The preferred method is to use the "hw cursor" option as a tri-state - * option, with the default set above. - */ - if (xf86GetOptValBool(pMga->Options, OPTION_HW_CURSOR, &pMga->HWCursor)) { - from = X_CONFIG; - } - - /* For compatibility, accept this too (as an override) */ - if (xf86ReturnOptValBool(pMga->Options, OPTION_SW_CURSOR, FALSE)) { - from = X_CONFIG; - pMga->HWCursor = FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", - pMga->HWCursor ? "HW" : "SW"); - if (xf86ReturnOptValBool(pMga->Options, OPTION_NOACCEL, FALSE)) { pMga->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); @@ -2679,30 +2708,55 @@ MGAMapMem(ScrnInfoPtr pScrn) #ifdef XSERVER_LIBPCIACCESS struct pci_device *const dev = pMga->PciInfo; struct pci_mem_region *region; - void **memory[2]; int i, err; #endif if (!pMga->FBDev) { #ifdef XSERVER_LIBPCIACCESS - memory[pMga->io_bar] = &pMga->IOBase; - memory[pMga->framebuffer_bar] = &pMga->FbBase; + pciaddr_t fbaddr = pMga->FbAddress; + pciaddr_t fbsize = pMga->FbMapSize; + err = pci_device_map_range(dev, + fbaddr, fbsize, + PCI_DEV_MAP_FLAG_WRITABLE, + (void **)&pMga->FbBase); - for (i = 0; i < 2; i++) { - region = &dev->regions[i]; - err = pci_device_map_range(dev, - region->base_addr, region->size, - PCI_DEV_MAP_FLAG_WRITABLE, - memory[i]); + if (err) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Unable to map Framebuffer %08llX %llx. %s (%d)\n", + (long long)fbaddr, (long long)fbsize, + strerror(err), err); + return FALSE; + } + else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "MAPPED Framebuffer %08llX %llx to %08llX.\n", + (long long)fbaddr, (long long)fbsize, + (long long)pMga->FbBase); + + if(pMga->entityPrivate == NULL || pMga->entityPrivate->mappedIOUsage == 0) { + region = &dev->regions[pMga->io_bar]; + err = pci_device_map_range(dev, + region->base_addr, region->size, + PCI_DEV_MAP_FLAG_WRITABLE, + &pMga->IOBase); + + if (err) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Unable to map IO Region %i. %s (%d)\n", + pMga->io_bar, strerror(err), err); + return FALSE; + } + + if(pMga->entityPrivate != NULL) + pMga->entityPrivate->mappedIOBase = pMga->IOBase; + } + else + pMga->IOBase = pMga->entityPrivate->mappedIOBase; + + if(pMga->entityPrivate != NULL) + pMga->entityPrivate->mappedIOUsage ++; - if (err) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unable to map BAR %i. %s (%d)\n", - i, strerror(err), err); - return FALSE; - } - } #else /* * For Alpha, we need to map SPARSE memory, since we need @@ -2753,16 +2807,27 @@ MGAMapMem(ScrnInfoPtr pScrn) if (pMga->iload_bar != -1) { #ifdef XSERVER_LIBPCIACCESS region = &dev->regions[pMga->iload_bar]; - err = pci_device_map_range(dev, - region->base_addr, region->size, - PCI_DEV_MAP_FLAG_WRITABLE, - (void *) &pMga->ILOADBase); - if (err) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unable to map BAR 2 (ILOAD region). %s (%d)\n", - strerror(err), err); - return FALSE; + + if(pMga->entityPrivate == NULL || pMga->entityPrivate->mappedILOADUsage == 0) { + err = pci_device_map_range(dev, + region->base_addr, region->size, + PCI_DEV_MAP_FLAG_WRITABLE, + (void *) &pMga->ILOADBase); + if (err) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Unable to map BAR 2 (ILOAD region). %s (%d)\n", + strerror(err), err); + return FALSE; + } + + if(pMga->entityPrivate != NULL) + pMga->entityPrivate->mappedILOADBase = pMga->ILOADBase; } + else + pMga->ILOADBase = pMga->entityPrivate->mappedILOADBase; + + if(pMga->entityPrivate != NULL) + pMga->entityPrivate->mappedILOADUsage ++; #else pMga->ILOADBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO | VIDMEM_MMIO_32BIT | @@ -2792,10 +2857,20 @@ MGAUnmapMem(ScrnInfoPtr pScrn) if (!pMga->FBDev) { #ifdef XSERVER_LIBPCIACCESS - pci_device_unmap_range(dev, pMga->IOBase, - dev->regions[pMga->io_bar].size); + if(pMga->entityPrivate != NULL) + pMga->entityPrivate->mappedIOUsage--; + + if(pMga->entityPrivate == NULL || pMga->entityPrivate->mappedIOUsage == 0) { + pci_device_unmap_range(dev, pMga->IOBase, + dev->regions[pMga->io_bar].size); + + if(pMga->entityPrivate != NULL) + pMga->entityPrivate->mappedIOBase = NULL; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "UNMAPPING framebuffer 0x%08llX, 0x%llX.\n", (long long)pMga->FbBase, (long long)pMga->FbMapSize); pci_device_unmap_range(dev, pMga->FbBase, - dev->regions[pMga->framebuffer_bar].size); + pMga->FbMapSize); #else xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->IOBase, 0x4000); xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->FbBase, pMga->FbMapSize); @@ -2808,8 +2883,17 @@ MGAUnmapMem(ScrnInfoPtr pScrn) if ((pMga->iload_bar != -1) && (pMga->ILOADBase != NULL)) { #ifdef XSERVER_LIBPCIACCESS - pci_device_unmap_range(dev, pMga->ILOADBase, - dev->regions[pMga->iload_bar].size); + if(pMga->entityPrivate != NULL) + pMga->entityPrivate->mappedILOADUsage--; + + if(pMga->entityPrivate == NULL || pMga->entityPrivate->mappedILOADUsage == 0) { + pci_device_unmap_range(dev, pMga->ILOADBase, + dev->regions[pMga->iload_bar].size); + + if(pMga->entityPrivate != NULL) + pMga->entityPrivate->mappedILOADBase = NULL; + } + #else xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->ILOADBase, 0x800000); #endif @@ -3114,11 +3198,13 @@ MGACrtc2FillStrip(ScrnInfoPtr pScrn) (pScrn->bitsPerPixel >> 3) * pScrn->displayWidth * pScrn->virtualY); } else { xf86SetLastScrnFlag(pScrn->entityList[0], pScrn->scrnIndex); +#ifdef HAVE_XAA_H pMga->RestoreAccelState(pScrn); pMga->SetupForSolidFill(pScrn, 0, GXcopy, 0xFFFFFFFF); pMga->SubsequentSolidFillRect(pScrn, pScrn->virtualX, 0, pScrn->displayWidth - pScrn->virtualX, pScrn->virtualY); +#endif MGAStormSync(pScrn); } } diff --git a/driver/xf86-video-mga/src/mga_esc.c b/driver/xf86-video-mga/src/mga_esc.c deleted file mode 100644 index 41b734ac5..000000000 --- a/driver/xf86-video-mga/src/mga_esc.c +++ /dev/null @@ -1,13 +0,0 @@ -/**************************************************************************** -* mga_esc.c -* -* ESC call implementation -* -* (C) Matrox Graphics, Inc. -*****************************************************************************/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -int mga_foo; diff --git a/driver/xf86-video-mga/src/mga_exa.c b/driver/xf86-video-mga/src/mga_exa.c index 151d8e056..8bcc0c3ed 100644 --- a/driver/xf86-video-mga/src/mga_exa.c +++ b/driver/xf86-video-mga/src/mga_exa.c @@ -729,7 +729,7 @@ mgaDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, { PMGA(pSrc); - char *src = pSrc->devPrivate.ptr; + char *src = (char *) exaGetPixmapFirstPixel(pSrc); int src_pitch = exaGetPixmapPitch(pSrc); int cpp = (pSrc->drawable.bitsPerPixel + 7) / 8; diff --git a/driver/xf86-video-mga/src/mga_storm.c b/driver/xf86-video-mga/src/mga_storm.c index fb0e7be54..84a4c8c20 100644 --- a/driver/xf86-video-mga/src/mga_storm.c +++ b/driver/xf86-video-mga/src/mga_storm.c @@ -710,7 +710,11 @@ Bool mgaAccelInit( ScreenPtr pScreen ) /* screen to screen color expansion */ if(pMga->AccelFlags & USE_LINEAR_EXPANSION) { infoPtr->ScreenToScreenColorExpandFillFlags = +#if X_BYTE_ORDER == X_BIG_ENDIAN + BIT_ORDER_IN_BYTE_MSBFIRST; +#else BIT_ORDER_IN_BYTE_LSBFIRST; +#endif infoPtr->SetupForScreenToScreenColorExpandFill = mgaSetupForScreenToScreenColorExpandFill; infoPtr->SubsequentScreenToScreenColorExpandFill = |