i965/blorp: Configure SURFACE_STATE correctly for IMS surfaces.
authorPaul Berry <stereotype441@gmail.com>
Mon, 9 Jul 2012 19:50:31 +0000 (12:50 -0700)
committerPaul Berry <stereotype441@gmail.com>
Fri, 20 Jul 2012 16:35:38 +0000 (09:35 -0700)
This patch modifies gen7_set_surface_num_multisamples() to set up the
SURFACE_STATE appropriately for texturing from IMS format MSAA
surfaces (which are only used on Gen7 for depth and stencil buffers).
Since the function now sets more than just the number of multisamples,
it's been renamed to gen7_set_surface_msaa().

This will make it possible to remove some kludginess from the blorp
engine.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
src/mesa/drivers/dri/i965/brw_state.h
src/mesa/drivers/dri/i965/gen7_blorp.cpp
src/mesa/drivers/dri/i965/gen7_wm_surface_state.c

index 1c70db29e38088ad34909c8a768742042b6f87eb..68e92a8cd14a465e41370b586b5f646211c2a3ca 100644 (file)
@@ -39,6 +39,8 @@
 extern "C" {
 #endif
 
+enum intel_msaa_layout;
+
 extern const struct brw_tracked_state brw_blend_constant_color;
 extern const struct brw_tracked_state brw_cc_vp;
 extern const struct brw_tracked_state brw_cc_unit;
@@ -199,8 +201,9 @@ GLuint translate_tex_format(gl_format mesa_format,
 
 /* gen7_wm_surface_state.c */
 void gen7_set_surface_tiling(struct gen7_surface_state *surf, uint32_t tiling);
-void gen7_set_surface_num_multisamples(struct gen7_surface_state *surf,
-                                       unsigned num_samples);
+void gen7_set_surface_msaa(struct gen7_surface_state *surf,
+                           unsigned num_samples,
+                           enum intel_msaa_layout layout);
 void gen7_set_surface_mcs_info(struct brw_context *brw,
                                struct gen7_surface_state *surf,
                                uint32_t surf_offset,
index f087dbdc66abb1b6962ad540beeb8ec83fed651d..cc28d8c89517328cc9a345f0ef0abaebb26d72ee 100644 (file)
@@ -180,7 +180,7 @@ gen7_blorp_emit_surface_state(struct brw_context *brw,
       pitch_bytes *= 2;
    surf->ss3.pitch = pitch_bytes - 1;
 
-   gen7_set_surface_num_multisamples(surf, surface->num_samples);
+   gen7_set_surface_msaa(surf, surface->num_samples, surface->msaa_layout);
    if (surface->msaa_layout == INTEL_MSAA_LAYOUT_CMS) {
       gen7_set_surface_mcs_info(brw, surf, wm_surf_offset,
                                 surface->mt->mcs_mt, is_render_target);
index f0370268be8c383a278050cac38825114551a8d2..869f9431b9dd04b2552af8e261fe8ec0b7f6d0fb 100644 (file)
@@ -56,8 +56,8 @@ gen7_set_surface_tiling(struct gen7_surface_state *surf, uint32_t tiling)
 
 
 void
-gen7_set_surface_num_multisamples(struct gen7_surface_state *surf,
-                                  unsigned num_samples)
+gen7_set_surface_msaa(struct gen7_surface_state *surf, unsigned num_samples,
+                      enum intel_msaa_layout layout)
 {
    if (num_samples > 4)
       surf->ss4.num_multisamples = GEN7_SURFACE_MULTISAMPLECOUNT_8;
@@ -65,6 +65,11 @@ gen7_set_surface_num_multisamples(struct gen7_surface_state *surf,
       surf->ss4.num_multisamples = GEN7_SURFACE_MULTISAMPLECOUNT_4;
    else
       surf->ss4.num_multisamples = GEN7_SURFACE_MULTISAMPLECOUNT_1;
+
+   surf->ss4.multisampled_surface_storage_format =
+      layout == INTEL_MSAA_LAYOUT_IMS ?
+      GEN7_SURFACE_MSFMT_DEPTH_STENCIL :
+      GEN7_SURFACE_MSFMT_MSS;
 }
 
 
@@ -490,7 +495,7 @@ gen7_update_renderbuffer_surface(struct brw_context *brw,
    gen7_set_surface_tiling(surf, region->tiling);
    surf->ss3.pitch = (region->pitch * region->cpp) - 1;
 
-   gen7_set_surface_num_multisamples(surf, irb->mt->num_samples);
+   gen7_set_surface_msaa(surf, irb->mt->num_samples, irb->mt->msaa_layout);
 
    if (irb->mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS) {
       gen7_set_surface_mcs_info(brw, surf, brw->wm.surf_offset[unit],