diff -ruN /usr/src/drm-merge/xdri/xc/xc/programs/Xserver/hw/xfree86/drivers/sis/./sis_common.h ./sis_common.h --- /usr/src/drm-merge/xdri/xc/xc/programs/Xserver/hw/xfree86/drivers/sis/./sis_common.h Wed Dec 31 16:00:00 1969 +++ ./sis_common.h Tue Aug 26 22:05:54 2003 @@ -0,0 +1,65 @@ +/* sis_common.h -- common header definitions for SiS 2D/3D/DRM suite + * Created: Sun Apr 9 18:16:28 2000 by kevin@precisioninsight.com + * + * Copyright 2003 Eric Anholt + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: + * Eric Anholt + * + * $XFree86$ + * + */ + +#ifndef _SIS_COMMON_H_ +#define _SIS_COMMON_H_ + +#define DRM_SIS_FB_ALLOC 0x04 +#define DRM_SIS_FB_FREE 0x05 +#define DRM_SIS_FLIP 0x08 +#define DRM_SIS_FLIP_INIT 0x09 +#define DRM_SIS_FLIP_FINAL 0x10 +#define DRM_SIS_AGP_INIT 0x13 +#define DRM_SIS_AGP_ALLOC 0x14 +#define DRM_SIS_AGP_FREE 0x15 +#define DRM_SIS_FB_INIT 0x16 + +typedef struct { + int context; + unsigned long offset; + unsigned long size; + void *free; +} drm_sis_mem_t; + +typedef struct { + unsigned long offset, size; +} drm_sis_agp_t; + +typedef struct { + unsigned long offset, size; +} drm_sis_fb_t; + +typedef struct { + unsigned int left, right; +} drm_sis_flip_t; + +#endif /* _SIS_COMMON_H_ */ diff -ruN /usr/src/drm-merge/xdri/xc/xc/programs/Xserver/hw/xfree86/drivers/sis/./sis_dri.c ./sis_dri.c --- /usr/src/drm-merge/xdri/xc/xc/programs/Xserver/hw/xfree86/drivers/sis/./sis_dri.c Thu Aug 28 19:08:46 2003 +++ ./sis_dri.c Thu Aug 28 19:08:46 2003 @@ -25,6 +25,10 @@ #include "xf86drmCompat.h" #endif +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0) +#include "sis_common.h" +#endif + /* Idle function for 300 series */ #define BR(x) (0x8200 | (x) << 2) #define SiSIdle \ @@ -202,9 +206,7 @@ SISPtr pSIS = SISPTR(pScrn); DRIInfoPtr pDRIInfo; SISDRIPtr pSISDRI; -#if 0 drmVersionPtr version; -#endif pSIS->cmdQueueLenPtrBackup = NULL; #ifdef SIS315DRI @@ -247,9 +249,18 @@ ((pciConfigPtr)pSIS->PciInfo->thisCard)->busnum, ((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum, ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum); + /* Hack to keep pre-4.3.0 DRI working -- those versions check for major==1 and + * minor==1. + */ +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0) + pDRIInfo->ddxDriverMajorVersion = SIS_MAJOR_VERSION; + pDRIInfo->ddxDriverMinorVersion = SIS_MINOR_VERSION; + pDRIInfo->ddxDriverPatchVersion = SIS_PATCHLEVEL; +#else pDRIInfo->ddxDriverMajorVersion = 0; pDRIInfo->ddxDriverMinorVersion = 1; pDRIInfo->ddxDriverPatchVersion = 0; +#endif pDRIInfo->frameBufferPhysicalAddress = pSIS->FbAddress; @@ -320,12 +331,11 @@ return FALSE; } -#if 0 - /* XXX Check DRM kernel version here */ - version = drmGetVersion(info->drmFD); + /* Check DRM kernel version */ + version = drmGetVersion(pSIS->drmSubFD); if (version) { if (version->version_major != 1 || - version->version_minor < 0) { + version->version_minor < 0) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] SISDRIScreenInit failed because of a version mismatch.\n" @@ -338,9 +348,21 @@ SISDRICloseScreen(pScreen); return FALSE; } +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0) + if (version->version_minor >= 1) { + /* Includes support for framebuffer memory allocation without sisfb */ + drm_sis_fb_t fb; + fb.offset = pSIS->DRIheapstart; + fb.size = pSIS->DRIheapend - pSIS->DRIheapstart; + drmCommandWrite(pSIS->drmSubFD, DRM_SIS_FB_INIT, &fb, sizeof(fb)); + xf86DrvMsg(pScreen->myNum, X_INFO, + "[drm] DRI memory heap: 0x%x to 0x%x (%dKB)\n", + pSIS->DRIheapstart, pSIS->DRIheapend, + (pSIS->DRIheapend - pSIS->DRIheapstart) >> 10); + } +#endif drmFreeVersion(version); } -#endif pSISDRI->regs.size = SISIOMAPSIZE; pSISDRI->regs.map = 0; @@ -360,6 +382,9 @@ pSIS->agpCmdBufSize = 0; pSISDRI->AGPCmdBufSize = 0; + if (!pSIS->IsAGPCard) + break; + if(drmAgpAcquire(pSIS->drmSubFD) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpAcquire failed\n"); break; diff -ruN /usr/src/drm-merge/xdri/xc/xc/programs/Xserver/hw/xfree86/drivers/sis/./sis_dri.h ./sis_dri.h --- /usr/src/drm-merge/xdri/xc/xc/programs/Xserver/hw/xfree86/drivers/sis/./sis_dri.h Tue Aug 26 22:05:55 2003 +++ ./sis_dri.h Tue Aug 26 22:48:27 2003 @@ -26,7 +26,7 @@ unsigned int AGPCmdBufSize; unsigned long AGPCmdBufNext; #endif -} SISSAREAPriv; +} SISSAREAPriv, *SISSAREAPrivPtr; #define AGPVtxBufNext AGPCmdBufNext @@ -45,19 +45,19 @@ int deviceID; int width; int height; - int mem; + int mem; /* unused in 4.1.0-4.3.x DRI */ int bytesPerPixel; - int priv1; - int priv2; - int fbOffset; - int backOffset; - int depthOffset; - int textureOffset; - int textureSize; + int priv1; /* unused in 4.1.0-4.3.x DRI */ + int priv2; /* unused in 4.1.0-4.3.x DRI */ + int fbOffset; /* unused in 4.1.0-4.3.x DRI */ + int backOffset; /* unused in 4.1.0-4.3.x DRI */ + int depthOffset; /* unused in 4.1.0-4.3.x DRI */ + int textureOffset; /* unused in 4.1.0-4.3.x DRI */ + int textureSize; /* unused in 4.1.0-4.3.x DRI */ unsigned int AGPCmdBufOffset; unsigned int AGPCmdBufSize; - int irqEnabled; - unsigned int scrnX, scrnY; + int irqEnabled; /* unused in 4.1.0-4.3.x DRI (SIS_STEREO) */ + unsigned int scrnX, scrnY; /* unused in 4.1.0-4.3.x DRI */ } SISDRIRec, *SISDRIPtr; #define AGPVtxBufOffset AGPCmdBufOffset