i965: Replace some intel_screen fields with brw_device_info references.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 4 Jul 2013 19:35:22 +0000 (12:35 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Sun, 13 Oct 2013 07:10:43 +0000 (00:10 -0700)
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/intel_fbo.c
src/mesa/drivers/dri/i965/intel_screen.c
src/mesa/drivers/dri/i965/intel_screen.h

index 840a384ba214475a88c28975ecf4a75e5cee6aac..7319114f0541c91477d5cf6ab1e60c1c5aba880e 100644 (file)
@@ -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;
 }
 
@@ -342,6 +342,7 @@ brwCreateContext(gl_api 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;
 
@@ -356,31 +357,17 @@ brwCreateContext(gl_api 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 );
index 1692325903b0600f62019fa08751015ce74a75b7..ddecb2b98001e3ed30efbb9db220810f6db9519b 100644 (file)
@@ -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)
index 1cb297e53f2783e72b27181b063db449b673c351..1b5d8bd389df9764d3484368485fd210dc93cab4 100644 (file)
@@ -934,7 +934,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);
@@ -1049,6 +1049,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;
 
@@ -1067,7 +1068,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;
@@ -1123,7 +1124,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;
@@ -1141,9 +1142,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],
@@ -1171,7 +1172,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 = 32;
       psp->max_gl_compat_version = 30;
@@ -1234,26 +1235,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);
 
index ef69e95efe60166b764a4e471dd18a3a38dfcf01..0b75c6e6e718953c2bd16b2b6791af7f6c589898 100644 (file)
@@ -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;