[Mesa-dev] [PATCH 10/29] i965: Replace some intel_screen fields with brw_device_info references.
Kenneth Graunke
kenneth at whitecape.org
Fri Sep 27 16:45:49 PDT 2013
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_context.c | 39 +++++++++++---------------------
src/mesa/drivers/dri/i965/intel_fbo.c | 2 +-
src/mesa/drivers/dri/i965/intel_screen.c | 34 +++++++---------------------
src/mesa/drivers/dri/i965/intel_screen.h | 9 --------
4 files changed, 22 insertions(+), 62 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 6c68692..eec17fa 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -90,14 +90,14 @@ static void brwInitDriverFunctions(struct intel_screen *screen,
brwInitFragProgFuncs( functions );
brw_init_common_queryobj_functions(functions);
- if (screen->gen >= 6)
+ if (screen->devinfo->gen >= 6)
gen6_init_queryobj_functions(functions);
else
gen4_init_queryobj_functions(functions);
functions->QuerySamplesForFormat = brw_query_samples_for_format;
- if (screen->gen >= 7) {
+ if (screen->devinfo->gen >= 7) {
functions->BeginTransformFeedback = gen7_begin_transform_feedback;
functions->EndTransformFeedback = gen7_end_transform_feedback;
} else {
@@ -105,7 +105,7 @@ static void brwInitDriverFunctions(struct intel_screen *screen,
functions->EndTransformFeedback = brw_end_transform_feedback;
}
- if (screen->gen >= 6)
+ if (screen->devinfo->gen >= 6)
functions->GetSamplePosition = gen6_get_sample_position;
}
@@ -338,6 +338,7 @@ brwCreateContext(int api,
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
struct gl_context *shareCtx = (struct gl_context *) sharedContextPrivate;
struct intel_screen *screen = sPriv->driverPrivate;
+ const struct brw_device_info *devinfo = screen->devinfo;
struct dd_function_table functions;
struct gl_config visual;
@@ -352,31 +353,17 @@ brwCreateContext(int api,
brw->driContext = driContextPriv;
brw->intelScreen = screen;
brw->bufmgr = screen->bufmgr;
- brw->gen = screen->gen;
-
- const int devID = screen->deviceID;
- if (IS_SNB_GT1(devID) || IS_IVB_GT1(devID) || IS_HSW_GT1(devID))
- brw->gt = 1;
- else if (IS_SNB_GT2(devID) || IS_IVB_GT2(devID) || IS_HSW_GT2(devID))
- brw->gt = 2;
- else if (IS_HSW_GT3(devID))
- brw->gt = 3;
- else
- brw->gt = 0;
-
- if (IS_HASWELL(devID)) {
- brw->is_haswell = true;
- } else if (IS_BAYTRAIL(devID)) {
- brw->is_baytrail = true;
- brw->gt = 1;
- } else if (IS_G4X(devID)) {
- brw->is_g4x = true;
- }
- brw->has_separate_stencil = screen->hw_has_separate_stencil;
+ brw->gen = devinfo->gen;
+ brw->gt = devinfo->gt;
+ brw->is_g4x = devinfo->is_g4x;
+ brw->is_baytrail = devinfo->is_baytrail;
+ brw->is_haswell = devinfo->is_haswell;
+ brw->has_llc = devinfo->has_llc;
+ brw->has_hiz = devinfo->has_hiz_and_separate_stencil;
+ brw->has_separate_stencil = devinfo->has_hiz_and_separate_stencil;
+
brw->must_use_separate_stencil = screen->hw_must_use_separate_stencil;
- brw->has_hiz = brw->gen >= 6;
- brw->has_llc = screen->hw_has_llc;
brw->has_swizzling = screen->hw_has_swizzling;
brwInitVtbl( brw );
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c
index 1692325..ddecb2b 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
@@ -159,7 +159,7 @@ intel_unmap_renderbuffer(struct gl_context *ctx,
unsigned
intel_quantize_num_samples(struct intel_screen *intel, unsigned num_samples)
{
- switch (intel->gen) {
+ switch (intel->devinfo->gen) {
case 6:
/* Gen6 supports only 4x multisampling. */
if (num_samples > 0)
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index bbeb20a..7e1aa68 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -930,7 +930,7 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
if (mesaVis->depthBits == 24) {
assert(mesaVis->stencilBits == 8);
- if (screen->hw_has_separate_stencil) {
+ if (screen->devinfo->has_hiz_and_separate_stencil) {
rb = intel_create_private_renderbuffer(MESA_FORMAT_X8_Z24,
num_samples);
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base);
@@ -1045,6 +1045,7 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
static const uint8_t multisample_samples[2] = {4, 8};
struct intel_screen *screen = dri_screen->driverPrivate;
+ const struct brw_device_info *devinfo = screen->devinfo;
uint8_t depth_bits[4], stencil_bits[4];
__DRIconfig **configs = NULL;
@@ -1063,7 +1064,7 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
if (formats[i] == MESA_FORMAT_RGB565) {
depth_bits[1] = 16;
stencil_bits[1] = 0;
- if (screen->gen >= 6) {
+ if (devinfo->gen >= 6) {
depth_bits[2] = 24;
stencil_bits[2] = 8;
num_depth_stencil_bits = 3;
@@ -1119,7 +1120,7 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
* them.
*/
for (int i = 0; i < ARRAY_SIZE(formats); i++) {
- if (screen->gen < 6)
+ if (devinfo->gen < 6)
break;
__DRIconfig **new_configs;
@@ -1137,9 +1138,9 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
stencil_bits[1] = 8;
}
- if (screen->gen >= 7)
+ if (devinfo->gen >= 7)
num_msaa_modes = 2;
- else if (screen->gen == 6)
+ else if (devinfo->gen == 6)
num_msaa_modes = 1;
new_configs = driCreateConfigs(formats[i],
@@ -1167,7 +1168,7 @@ set_max_gl_versions(struct intel_screen *screen)
{
__DRIscreen *psp = screen->driScrnPriv;
- switch (screen->gen) {
+ switch (screen->devinfo->gen) {
case 7:
psp->max_gl_core_version = 31;
psp->max_gl_compat_version = 30;
@@ -1230,26 +1231,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
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;
- } else if (IS_GEN6(intelScreen->deviceID)) {
- intelScreen->gen = 6;
- } else if (IS_GEN5(intelScreen->deviceID)) {
- intelScreen->gen = 5;
- } else {
- intelScreen->gen = 4;
- }
-
- intelScreen->hw_has_separate_stencil = intelScreen->gen >= 6;
- intelScreen->hw_must_use_separate_stencil = intelScreen->gen >= 7;
-
- int has_llc = 0;
- bool success = intel_get_param(intelScreen->driScrnPriv, I915_PARAM_HAS_LLC,
- &has_llc);
- if (success && has_llc)
- intelScreen->hw_has_llc = true;
- else if (!success && intelScreen->gen >= 6)
- intelScreen->hw_has_llc = true;
+ intelScreen->hw_must_use_separate_stencil = intelScreen->devinfo->gen >= 7;
intelScreen->hw_has_swizzling = intel_detect_swizzling(intelScreen);
diff --git a/src/mesa/drivers/dri/i965/intel_screen.h b/src/mesa/drivers/dri/i965/intel_screen.h
index ef69e95..0b75c6e 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.h
+++ b/src/mesa/drivers/dri/i965/intel_screen.h
@@ -42,21 +42,12 @@ struct intel_screen
int deviceID;
const struct brw_device_info *devinfo;
- int gen;
-
__DRIscreen *driScrnPriv;
bool no_hw;
- /*
- * The hardware hiz and separate stencil fields are needed in intel_screen,
- * rather than solely in brw_context, because glXCreatePbuffer and
- * glXCreatePixmap are not passed a GLXContext.
- */
- bool hw_has_separate_stencil;
bool hw_must_use_separate_stencil;
- bool hw_has_llc;
bool hw_has_swizzling;
dri_bufmgr *bufmgr;
--
1.8.3.4
More information about the mesa-dev
mailing list