iris: move some non-buffer case code in a bit
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 30 Nov 2018 06:23:34 +0000 (22:23 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:10 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_resource.c

index 1388033e6bc117d561c97296a6c89165d237eca7..fd83852ca40b1e875c4fe9aaa913ab41cf415561 100644 (file)
@@ -774,10 +774,6 @@ iris_map_direct(struct iris_transfer *map)
    struct pipe_transfer *xfer = &map->base;
    struct pipe_box *box = &xfer->box;
    struct iris_resource *res = (struct iris_resource *) xfer->resource;
-   struct isl_surf *surf = &res->surf;
-   const struct isl_format_layout *fmtl = isl_format_get_layout(surf->format);
-   const unsigned cpp = fmtl->bpb / 8;
-   unsigned x0_el, y0_el;
 
    void *ptr = iris_bo_map(map->dbg, res->bo, xfer->usage);
 
@@ -787,6 +783,12 @@ iris_map_direct(struct iris_transfer *map)
 
       map->ptr = ptr + box->x;
    } else {
+      struct isl_surf *surf = &res->surf;
+      const struct isl_format_layout *fmtl =
+         isl_format_get_layout(surf->format);
+      const unsigned cpp = fmtl->bpb / 8;
+      unsigned x0_el, y0_el;
+
       get_image_offset_el(surf, xfer->level, box->z, &x0_el, &y0_el);
 
       xfer->stride = isl_surf_get_row_pitch_B(surf);