The SiS and Unichrome drivers assume that the handle to the
authorThomas Hellström <thomas@tungstengraphics.com>
Mon, 10 Jul 2006 12:20:24 +0000 (12:20 +0000)
committerThomas Hellström <thomas@tungstengraphics.com>
Mon, 10 Jul 2006 12:20:24 +0000 (12:20 +0000)
AGP map is equivalent to the AGP physical address. Fix this.

src/mesa/drivers/dri/sis/sis_context.c
src/mesa/drivers/dri/sis/sis_dd.c
src/mesa/drivers/dri/sis/sis_screen.c
src/mesa/drivers/dri/sis/sis_screen.h
src/mesa/drivers/dri/unichrome/via_context.c
src/mesa/drivers/dri/unichrome/via_screen.c

index 7e86c1127cb39fb1d295fe6679f95394bb48c847..a300a080ec05d44ff8266d396bb26dcf3c69ce50 100644 (file)
@@ -272,7 +272,7 @@ sisCreateContext( const __GLcontextModes *glVisual,
    /* set AGP */
    smesa->AGPSize = sisScreen->agp.size;
    smesa->AGPBase = sisScreen->agp.map;
-   smesa->AGPAddr = sisScreen->agp.handle;
+   smesa->AGPAddr = sisScreen->agpBaseOffset;
 
    /* Create AGP command buffer */
    if (smesa->AGPSize != 0 && 
index 39c00a18af629abbe01c3f778f16a64286fb94ff..8fc7896b8774e2ba65f0a061fe6e21d8995172f0 100644 (file)
@@ -47,7 +47,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 #include "utils.h"
 
-#define DRIVER_DATE    "20051023"
+#define DRIVER_DATE    "20060710"
 
 /* Return the width and height of the given buffer.
  */
index d4395a9cddfaee694db18a240b58ac41db876735..a721a724ac48192d27bd44383c8254439f7c476a 100644 (file)
@@ -163,6 +163,7 @@ sisCreateScreen( __DRIscreenPrivate *sPriv )
 
    if (sisDRIPriv->agp.size) {
       sisScreen->agp.handle = sisDRIPriv->agp.handle;
+      sisScreen->agpBaseOffset = drmAgpBase(sPriv->fd);
       sisScreen->agp.size   = sisDRIPriv->agp.size;
       if ( drmMap( sPriv->fd, sisScreen->agp.handle, sisScreen->agp.size,
                    &sisScreen->agp.map ) )
@@ -349,15 +350,37 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn,
    static const __DRIversion ddx_expected = {0, 8, 0};
    static const __DRIversion dri_expected = {4, 0, 0};
    static const __DRIversion drm_expected = {1, 0, 0};
-
+   static const __DRIversion drm_compat = {2, 0, 0};
+   static const char *driver_name = "SiS";
    dri_interface = interface;
 
-   if (!driCheckDriDdxDrmVersions2("SiS", dri_version, &dri_expected,
+   /*
+    * Check ddx and dri only.
+    */
+
+   if (!driCheckDriDdxDrmVersions2(driver_name, dri_version, &dri_expected,
                                   ddx_version, &ddx_expected,
-                                  drm_version, &drm_expected)) {
+                                  drm_version, drm_version)) {
+      return NULL;
+   }
+
+   /*
+    * Check drm version with major versioning span.
+    */
+
+   if (((drm_version->major < drm_expected.major) ||
+       (drm_version->major > drm_compat.major)) ||
+       ((drm_version->major == drm_expected.major) &&
+       (drm_version->minor < drm_expected.minor))) {
+
+      fprintf(stderr, "%s DRI driver expected DRM version %d.%d.x - %d.x.x "
+             "but got version %d.%d.%d\n", driver_name,
+             drm_expected.major, drm_expected.minor, drm_compat.major,
+             drm_version->major, drm_version->minor, drm_version->patch);
       return NULL;
    }
 
+
    psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
                                  ddx_version, dri_version, drm_version,
                                  frame_buffer, pSAREA, fd,
index c3e9ef48764520599715b9f725c874d3ad5b5bbf..d5b2101e980409adbe2013ab52d890fa465dab2a 100644 (file)
@@ -41,6 +41,7 @@ typedef struct {
 typedef struct {
    sisRegionRec2 mmio;
    sisRegionRec2 agp;
+   unsigned long agpBaseOffset;
 
    unsigned int AGPCmdBufOffset;
    unsigned int AGPCmdBufSize;
index dabb233fc026932f169f6e5cc97d667c7172319c..ffde1b66b766c84fe0ed3cb60033fb3761ed63e0 100644 (file)
@@ -68,7 +68,7 @@
 #define need_GL_EXT_secondary_color
 #include "extension_helper.h"
 
-#define DRIVER_DATE    "20050526"
+#define DRIVER_DATE    "20060710"
 
 #include "vblank.h"
 #include "utils.h"
index 24c62198ac6e89fe2f258fc75f23af701fd57bb1..18cbbb35177a6e0accb626b1d2e67751c8a0a839 100644 (file)
@@ -169,13 +169,8 @@ viaInitDriver(__DRIscreenPrivate *sPriv)
            __driUtilMessage("viaInitDriver: drmMap agp failed");
            return GL_FALSE;
        }
-           
-       /*
-        * FIXME: This is an invalid assumption that works until handle is
-        * changed to mean something else than the 32-bit physical AGP address.
-        */
 
-       viaScreen->agpBase = gDRIPriv->agp.handle;
+       viaScreen->agpBase = drmAgpBase(sPriv->fd);
     } else
        viaScreen->agpLinearStart = 0;
 
@@ -440,16 +435,38 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn,
                                               VIA_DRIDDX_VERSION_PATCH };
    static const __DRIversion dri_expected = { 4, 0, 0 };
    static const __DRIversion drm_expected = { 2, 3, 0 };
+   static const __DRIversion drm_compat = {3, 0, 0};
+   static const char *driver_name = "Unichrome";
 
    dri_interface = interface;
 
-   if ( ! driCheckDriDdxDrmVersions2( "Unichrome",
+   /*
+    * Check ddx and dri only.
+    */
+
+   if ( ! driCheckDriDdxDrmVersions2( driver_name,
                                      dri_version, & dri_expected,
                                      ddx_version, & ddx_expected,
-                                     drm_version, & drm_expected ) ) {
+                                     drm_version, drm_version) ) {
       return NULL;
    }
       
+   /*
+    * Check drm version with major versioning span.
+    */
+
+   if (((drm_version->major < drm_expected.major) ||
+       (drm_version->major > drm_compat.major)) ||
+       ((drm_version->major == drm_expected.major) &&
+       (drm_version->minor < drm_expected.minor))) {
+
+      fprintf(stderr, "%s DRI driver expected DRM version %d.%d.x - %d.x.x "
+             "but got version %d.%d.%d\n", driver_name,
+             drm_expected.major, drm_expected.minor, drm_compat.major,
+             drm_version->major, drm_version->minor, drm_version->patch);
+      return NULL;
+   }
+
    psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
                                  ddx_version, dri_version, drm_version,
                                  frame_buffer, pSAREA, fd,
@@ -470,7 +487,6 @@ void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn,
       driInitExtensions( NULL, card_extensions, GL_FALSE );
    }
 
-   fprintf(stderr, "%s - succeeded\n", __FUNCTION__);
    return (void *) psp;
 }