[Mesa-dev] [PATCH 01/16] isl: Make get_intratile_offset_el take the element size in bits

Jason Ekstrand jason at jlekstrand.net
Thu May 18 21:00:48 UTC 2017


---
 src/intel/isl/isl.c                    | 7 +++----
 src/intel/isl/isl.h                    | 6 ++----
 src/mesa/drivers/dri/i965/intel_blit.c | 2 +-
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index f89f351..86eaf61 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -1967,7 +1967,7 @@ isl_surf_get_image_offset_el(const struct isl_surf *surf,
 void
 isl_tiling_get_intratile_offset_el(const struct isl_device *dev,
                                    enum isl_tiling tiling,
-                                   uint8_t bs,
+                                   uint32_t bpb,
                                    uint32_t row_pitch,
                                    uint32_t total_x_offset_el,
                                    uint32_t total_y_offset_el,
@@ -1976,15 +1976,14 @@ isl_tiling_get_intratile_offset_el(const struct isl_device *dev,
                                    uint32_t *y_offset_el)
 {
    if (tiling == ISL_TILING_LINEAR) {
+      assert(bpb % 8 == 0);
       *base_address_offset = total_y_offset_el * row_pitch +
-                             total_x_offset_el * bs;
+                             total_x_offset_el * (bpb / 8);
       *x_offset_el = 0;
       *y_offset_el = 0;
       return;
    }
 
-   const uint32_t bpb = bs * 8;
-
    struct isl_tile_info tile_info;
    isl_tiling_get_info(dev, tiling, bpb, &tile_info);
 
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index 7778551..dae599c 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -1529,7 +1529,7 @@ isl_surf_get_image_offset_el(const struct isl_surf *surf,
 void
 isl_tiling_get_intratile_offset_el(const struct isl_device *dev,
                                    enum isl_tiling tiling,
-                                   uint8_t bs,
+                                   uint32_t bpb,
                                    uint32_t row_pitch,
                                    uint32_t total_x_offset_el,
                                    uint32_t total_y_offset_el,
@@ -1550,8 +1550,6 @@ isl_tiling_get_intratile_offset_sa(const struct isl_device *dev,
 {
    const struct isl_format_layout *fmtl = isl_format_get_layout(format);
 
-   assert(fmtl->bpb % 8 == 0);
-
    /* For computing the intratile offsets, we actually want a strange unit
     * which is samples for multisampled surfaces but elements for compressed
     * surfaces.
@@ -1561,7 +1559,7 @@ isl_tiling_get_intratile_offset_sa(const struct isl_device *dev,
    const uint32_t total_x_offset = total_x_offset_sa / fmtl->bw;
    const uint32_t total_y_offset = total_y_offset_sa / fmtl->bh;
 
-   isl_tiling_get_intratile_offset_el(dev, tiling, fmtl->bpb / 8, row_pitch,
+   isl_tiling_get_intratile_offset_el(dev, tiling, fmtl->bpb, row_pitch,
                                       total_x_offset, total_y_offset,
                                       base_address_offset,
                                       x_offset_sa, y_offset_sa);
diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c
index 568ed54..1089e8c 100644
--- a/src/mesa/drivers/dri/i965/intel_blit.c
+++ b/src/mesa/drivers/dri/i965/intel_blit.c
@@ -173,7 +173,7 @@ get_blit_intratile_offset_el(const struct brw_context *brw,
 {
    enum isl_tiling tiling = intel_miptree_get_isl_tiling(mt);
    isl_tiling_get_intratile_offset_el(&brw->isl_dev,
-                                      tiling, mt->cpp, mt->pitch,
+                                      tiling, mt->cpp * 8, mt->pitch,
                                       total_x_offset_el, total_y_offset_el,
                                       base_address_offset,
                                       x_offset_el, y_offset_el);
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list