Mesa (master): i965/blorp: Clarify why width/ height must be adjusted for Gen6 IMS surfaces.

Paul Berry stereotype441 at kemper.freedesktop.org
Wed Sep 12 21:50:09 UTC 2012


Module: Mesa
Branch: master
Commit: 32c7b2769cbe80ff56d1c73c4f9b62f13f577c8d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=32c7b2769cbe80ff56d1c73c4f9b62f13f577c8d

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Wed Aug 29 12:04:30 2012 -0700

i965/blorp: Clarify why width/height must be adjusted for Gen6 IMS surfaces.

Also add a clarifying comment for why the width/height doesn't need
adjustment for Gen7.

NOTE: This is a candidate for stable release branches.

Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/drivers/dri/i965/gen6_blorp.cpp |    6 +++++-
 src/mesa/drivers/dri/i965/gen7_blorp.cpp |    5 +++++
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
index 995b507..8a22fe3 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -415,7 +415,11 @@ gen6_blorp_emit_surface_state(struct brw_context *brw,
    uint32_t wm_surf_offset;
    uint32_t width, height;
    surface->get_miplevel_dims(&width, &height);
-   if (surface->num_samples > 1) { /* TODO: seems clumsy */
+   if (surface->num_samples > 1) {
+      /* Since gen6 uses INTEL_MSAA_LAYOUT_IMS, width and height are measured
+       * in samples.  But SURFACE_STATE wants them in pixels, so we need to
+       * divide them each by 2.
+       */
       width /= 2;
       height /= 2;
    }
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
index a65a975..e23868d 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
@@ -144,6 +144,11 @@ gen7_blorp_emit_surface_state(struct brw_context *brw,
    uint32_t wm_surf_offset;
    uint32_t width, height;
    surface->get_miplevel_dims(&width, &height);
+   /* Note: since gen7 uses INTEL_MSAA_LAYOUT_CMS or INTEL_MSAA_LAYOUT_UMS for
+    * color surfaces, width and height are measured in pixels; we don't need
+    * to divide them by 2 as we do for Gen6 (see
+    * gen6_blorp_emit_surface_state).
+    */
    if (surface->map_stencil_as_y_tiled) {
       width *= 2;
       height /= 2;




More information about the mesa-commit mailing list