intel/isl: Make get_intratile_offset_el take the element size in bits
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 18 May 2017 21:00:48 +0000 (14:00 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 1 Jun 2017 22:33:56 +0000 (15:33 -0700)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/intel/isl/isl.c
src/intel/isl/isl.h
src/mesa/drivers/dri/i965/intel_blit.c

index 1227238b186f999d1f618ae7fa9c80b358394448..fb4e170bfc090c0029932ecf2f755ffe65805c9b 100644 (file)
@@ -2147,7 +2147,7 @@ isl_surf_get_image_offset_el(const struct isl_surf *surf,
 
 void
 isl_tiling_get_intratile_offset_el(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,
@@ -2156,15 +2156,14 @@ isl_tiling_get_intratile_offset_el(enum isl_tiling tiling,
                                    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(tiling, bpb, &tile_info);
 
index 4bb3de789737026d7fd44aa0a2aa28c590d1cb05..8b2d264f8b242d1a445817779b28efd71bf10161 100644 (file)
@@ -1601,7 +1601,7 @@ isl_surf_get_image_offset_el(const struct isl_surf *surf,
  */
 void
 isl_tiling_get_intratile_offset_el(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,
@@ -1621,8 +1621,6 @@ isl_tiling_get_intratile_offset_sa(enum isl_tiling tiling,
 {
    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.
@@ -1632,7 +1630,7 @@ isl_tiling_get_intratile_offset_sa(enum isl_tiling tiling,
    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(tiling, fmtl->bpb / 8, row_pitch,
+   isl_tiling_get_intratile_offset_el(tiling, fmtl->bpb, row_pitch,
                                       total_x_offset, total_y_offset,
                                       base_address_offset,
                                       x_offset_sa, y_offset_sa);
index 21f0271a04ba2e9b00052d84882028052c443097..61764fbe965af65619023a3bf71959e2796eb969 100644 (file)
@@ -172,7 +172,7 @@ get_blit_intratile_offset_el(const struct brw_context *brw,
                              uint32_t *y_offset_el)
 {
    enum isl_tiling tiling = intel_miptree_get_isl_tiling(mt);
-   isl_tiling_get_intratile_offset_el(tiling, mt->cpp, mt->pitch,
+   isl_tiling_get_intratile_offset_el(tiling, mt->cpp * 8, mt->pitch,
                                       total_x_offset_el, total_y_offset_el,
                                       base_address_offset,
                                       x_offset_el, y_offset_el);