diff options
-rw-r--r-- | src/mesa/drivers/dri/i965/Makefile.sources | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_device_info.c | 97 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_device_info.h | 44 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_chipset.h | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_screen.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_screen.h | 4 |
6 files changed, 150 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/Makefile.sources b/src/mesa/drivers/dri/i965/Makefile.sources index 23d937d39d9..4e06ee2a55e 100644 --- a/src/mesa/drivers/dri/i965/Makefile.sources +++ b/src/mesa/drivers/dri/i965/Makefile.sources @@ -45,6 +45,7 @@ i965_FILES = \ brw_context.c \ brw_cubemap_normalize.cpp \ brw_curbe.c \ + brw_device_info.c \ brw_disasm.c \ brw_draw.c \ brw_draw_upload.c \ diff --git a/src/mesa/drivers/dri/i965/brw_device_info.c b/src/mesa/drivers/dri/i965/brw_device_info.c new file mode 100644 index 00000000000..3345d9cbe26 --- /dev/null +++ b/src/mesa/drivers/dri/i965/brw_device_info.c @@ -0,0 +1,97 @@ +/* + * Copyright © 2013 Intel Corporation + * + * 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 + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + */ + +#include <stdio.h> +#include <stdlib.h> +#include "brw_device_info.h" + +static const struct brw_device_info brw_device_info_i965 = { + .gen = 4, +}; + +static const struct brw_device_info brw_device_info_g4x = { + .gen = 4, + .is_g4x = true, +}; + +static const struct brw_device_info brw_device_info_ilk = { + .gen = 5, +}; + +static const struct brw_device_info brw_device_info_snb_gt1 = { + .gen = 6, + .gt = 2, + .has_hiz_and_separate_stencil = true, + .has_llc = true, +}; + +static const struct brw_device_info brw_device_info_snb_gt2 = { + .gen = 6, + .gt = 2, + .has_hiz_and_separate_stencil = true, + .has_llc = true, +}; + +#define GEN7_FEATURES \ + .gen = 7, \ + .has_hiz_and_separate_stencil = true, \ + .must_use_separate_stencil = true, \ + .has_llc = true + +static const struct brw_device_info brw_device_info_ivb_gt1 = { + GEN7_FEATURES, .is_ivybridge = true, .gt = 1, +}; + +static const struct brw_device_info brw_device_info_ivb_gt2 = { + GEN7_FEATURES, .is_ivybridge = true, .gt = 2, +}; + +static const struct brw_device_info brw_device_info_byt = { + GEN7_FEATURES, .is_baytrail = true, .gt = 1, + .has_llc = false, +}; + +static const struct brw_device_info brw_device_info_hsw_gt1 = { + GEN7_FEATURES, .is_haswell = true, .gt = 1, +}; + +static const struct brw_device_info brw_device_info_hsw_gt2 = { + GEN7_FEATURES, .is_haswell = true, .gt = 2, +}; + +static const struct brw_device_info brw_device_info_hsw_gt3 = { + GEN7_FEATURES, .is_haswell = true, .gt = 3, +}; + +const struct brw_device_info * +brw_get_device_info(int devid) +{ + switch (devid) { +#undef CHIPSET +#define CHIPSET(id, family, name) case id: return &brw_device_info_##family; +#include "pci_ids/i965_pci_ids.h" + default: + fprintf(stderr, "Unknown Intel device."); + abort(); + } +} diff --git a/src/mesa/drivers/dri/i965/brw_device_info.h b/src/mesa/drivers/dri/i965/brw_device_info.h new file mode 100644 index 00000000000..9c2fecba8a3 --- /dev/null +++ b/src/mesa/drivers/dri/i965/brw_device_info.h @@ -0,0 +1,44 @@ + /* + * Copyright © 2013 Intel Corporation + * + * 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 + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + */ + +#pragma once +#include <stdbool.h> + +struct brw_device_info +{ + int gen; /**< Generation number: 4, 5, 6, 7, ... */ + int gt; + + bool is_g4x; + bool is_ivybridge; + bool is_baytrail; + bool is_haswell; + + bool has_hiz_and_separate_stencil; + bool must_use_separate_stencil; + + bool has_llc; +}; + +const struct brw_device_info *brw_get_device_info(int devid); diff --git a/src/mesa/drivers/dri/i965/intel_chipset.h b/src/mesa/drivers/dri/i965/intel_chipset.h index 65cb50ed2e6..a760dee441c 100644 --- a/src/mesa/drivers/dri/i965/intel_chipset.h +++ b/src/mesa/drivers/dri/i965/intel_chipset.h @@ -25,6 +25,9 @@ * */ +#pragma once +#include <stdbool.h> + #define PCI_CHIP_IGD_GM 0xA011 #define PCI_CHIP_IGD_G 0xA001 diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 0d2c2edaa1d..7176c8a65be 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -1257,6 +1257,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp) return false; intelScreen->deviceID = drm_intel_bufmgr_gem_get_devid(intelScreen->bufmgr); + intelScreen->devinfo = brw_get_device_info(intelScreen->deviceID); if (IS_GEN7(intelScreen->deviceID)) { intelScreen->gen = 7; diff --git a/src/mesa/drivers/dri/i965/intel_screen.h b/src/mesa/drivers/dri/i965/intel_screen.h index fef17bcfb3c..ef69e95efe6 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.h +++ b/src/mesa/drivers/dri/i965/intel_screen.h @@ -32,12 +32,16 @@ #include <sys/time.h> #include "dri_util.h" #include "intel_bufmgr.h" +#include "intel_chipset.h" +#include "brw_device_info.h" #include "i915_drm.h" #include "xmlconfig.h" struct intel_screen { int deviceID; + const struct brw_device_info *devinfo; + int gen; __DRIscreen *driScrnPriv; |