--- src/mesa/drivers/dri/i915/Makefile | 2 +- src/mesa/drivers/dri/i965/Makefile | 2 +- src/mesa/drivers/dri/intel/intel_screen.c | 96 +++++++++++++++++++++++------ 3 files changed, 80 insertions(+), 20 deletions(-)
diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile index 79e03f2..16f4316 100644 --- a/src/mesa/drivers/dri/i915/Makefile +++ b/src/mesa/drivers/dri/i915/Makefile @@ -58,7 +58,7 @@ C_SOURCES = \ ASM_SOURCES = -DRIVER_DEFINES = -I../intel -DI915 \ +DRIVER_DEFINES = -I../intel -I$(TOP)/include -DI915 \ $(shell pkg-config libdrm --atleast-version=2.3.1 \ && echo "-DDRM_VBLANK_FLIP=DRM_VBLANK_FLIP") diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index 44f28cd..ed1497b 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -128,7 +128,7 @@ CXX_SOURCES = \ ASM_SOURCES = -DRIVER_DEFINES = -I../intel +DRIVER_DEFINES = -I../intel -I$(TOP)/include INCLUDES += $(INTEL_CFLAGS) DRI_LIB_DEPS += $(INTEL_LIBS) diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index deca11d..9939b4d 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -432,6 +432,37 @@ intelDestroyBuffer(__DRIdrawable * driDrawPriv) * init-designated function to register chipids and createcontext * functions. */ + +struct intel_chipset { + int gen; +}; + +#define CHIPSET(id, name, info) { id, &intel_chipset_##info }, + + +struct intel_chipset_map { + int device_id; + const struct intel_chipset *chipset; +}; + +#ifdef I915 + +static const struct intel_chipset intel_chipset_i8xx = { + .gen = 2 +}; + +static const struct intel_chipset intel_chipset_i915 = { + .gen = 3 +}; + +static const struct intel_chipset intel_chipset_i945 = { + .gen = 3 +}; + +static const struct intel_chipset_map chipset_map[] = { +#include "pci_ids/i915_pci_ids.h" +}; + extern GLboolean i830CreateContext(const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); @@ -440,21 +471,58 @@ extern GLboolean i915CreateContext(int api, const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); + +#else + +static const struct intel_chipset intel_chipset_i965 = { + .gen = 4 +}; + +static const struct intel_chipset intel_chipset_g4x = { + .gen = 4 +}; + +static const struct intel_chipset intel_chipset_ilk = { + .gen = 5 +}; + +static const struct intel_chipset intel_chipset_snb_gt1 = { + .gen = 6 +}; + +static const struct intel_chipset intel_chipset_snb_gt2 = { + .gen = 6 +}; + +static const struct intel_chipset intel_chipset_ivb_gt1 = { + .gen = 7 +}; + +static const struct intel_chipset intel_chipset_ivb_gt2 = { + .gen = 7 +}; + +static const struct intel_chipset_map chipset_map[] = { +#include "pci_ids/i965_pci_ids.h" +}; + extern GLboolean brwCreateContext(int api, const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate); +#endif + static GLboolean intelCreateContext(gl_api api, const struct gl_config * mesaVis, __DRIcontext * driContextPriv, void *sharedContextPrivate) { +#ifdef I915 __DRIscreen *sPriv = driContextPriv->driScreenPriv; struct intel_screen *intelScreen = sPriv->private; -#ifdef I915 if (IS_9XX(intelScreen->deviceID)) { if (!IS_965(intelScreen->deviceID)) { return i915CreateContext(api, mesaVis, driContextPriv, @@ -465,12 +533,8 @@ intelCreateContext(gl_api api, return i830CreateContext(mesaVis, driContextPriv, sharedContextPrivate); } #else - if (IS_965(intelScreen->deviceID)) - return brwCreateContext(api, mesaVis, - driContextPriv, sharedContextPrivate); + return brwCreateContext(api, mesaVis, driContextPriv, sharedContextPrivate); #endif - fprintf(stderr, "Unrecognized deviceID 0x%x\n", intelScreen->deviceID); - return GL_FALSE; } static GLboolean @@ -520,6 +584,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp) GLenum fb_type[3]; unsigned int api_mask; char *devid_override; + int i; static const GLenum back_buffer_modes[] = { GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML @@ -556,18 +621,13 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp) intelScreen->deviceID = strtod(devid_override, NULL); } - if (IS_GEN7(intelScreen->deviceID)) { - intelScreen->gen = 7; - } else 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; + for (i = 0; i < Elements(chipset_map); i++) + if (chipset_map[i].device_id == intelScreen->deviceID) + intelScreen->gen = chipset_map[i].chipset->gen; + if (intelScreen->gen == 0) { + fprintf(stderr, "\nERROR! Unrecognized chipset:: 0x%04x\n", + intelScreen->deviceID); + return GL_FALSE; } api_mask = (1 << __DRI_API_OPENGL); -- 1.7.4.4 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx