Mesa (master): intel: Set gen in intelInitScreen, just copy value in intelInitContext

Kristian Høgsberg krh at kemper.freedesktop.org
Tue Apr 26 10:28:32 PDT 2011


Module: Mesa
Branch: master
Commit: 7363088f9f9558b2bad3ac6da48947514a8cd790
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7363088f9f9558b2bad3ac6da48947514a8cd790

Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Mon Apr 25 09:49:09 2011 -0400

intel: Set gen in intelInitScreen, just copy value in intelInitContext

---

 src/mesa/drivers/dri/intel/intel_context.c |    6 +-----
 src/mesa/drivers/dri/intel/intel_screen.c  |   12 ++++++++++++
 src/mesa/drivers/dri/intel/intel_screen.h  |    1 +
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index ec08dd5..447fbe5 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -650,27 +650,23 @@ intelInitContext(struct intel_context *intel,
    intel->driFd = sPriv->fd;
 
    intel->has_xrgb_textures = GL_TRUE;
+   intel->gen = intelScreen->gen;
    if (IS_GEN6(intel->intelScreen->deviceID)) {
-      intel->gen = 6;
       intel->needs_ff_sync = GL_TRUE;
       intel->has_luminance_srgb = GL_TRUE;
    } else if (IS_GEN5(intel->intelScreen->deviceID)) {
-      intel->gen = 5;
       intel->needs_ff_sync = GL_TRUE;
       intel->has_luminance_srgb = GL_TRUE;
    } else if (IS_965(intel->intelScreen->deviceID)) {
-      intel->gen = 4;
       if (IS_G4X(intel->intelScreen->deviceID)) {
 	  intel->has_luminance_srgb = GL_TRUE;
 	  intel->is_g4x = GL_TRUE;
       }
    } else if (IS_9XX(intel->intelScreen->deviceID)) {
-      intel->gen = 3;
       if (IS_945(intel->intelScreen->deviceID)) {
 	 intel->is_945 = GL_TRUE;
       }
    } else {
-      intel->gen = 2;
       if (intel->intelScreen->deviceID == PCI_CHIP_I830_M ||
 	  intel->intelScreen->deviceID == PCI_CHIP_845_G) {
 	 intel->has_xrgb_textures = GL_FALSE;
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 8b3cb7c..bfbfec5 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -548,6 +548,18 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
       intelScreen->deviceID = strtod(devid_override, NULL);
    }
 
+   if (IS_GEN6(intelScreen->deviceID)) {
+      intelScreen->gen = 6;
+   } else if (IS_GEN5(intelScreen->deviceID)) {
+      intelScreen->gen = 5;
+   } else if (IS_965(intelScreen->deviceID)) {
+      intelScreen->gen = 4;
+   } else if (IS_9XX(intelScreen->deviceID)) {
+      intelScreen->gen = 3;
+   } else {
+      intelScreen->gen = 2;
+   }
+
    api_mask = (1 << __DRI_API_OPENGL);
 #if FEATURE_ES1
    api_mask |= (1 << __DRI_API_GLES);
diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h
index 0f0b5be..4613c98 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.h
+++ b/src/mesa/drivers/dri/intel/intel_screen.h
@@ -37,6 +37,7 @@
 struct intel_screen
 {
    int deviceID;
+   int gen;
 
    int logTextureGranularity;
 



More information about the mesa-commit mailing list