Blame SOURCES/mesa-20.3.3-stable-fixes.patch

59f99b
diff --git a/src/amd/vulkan/radv_query.c b/src/amd/vulkan/radv_query.c
59f99b
index d49bc0f0564..90512d4f276 100644
59f99b
--- a/src/amd/vulkan/radv_query.c
59f99b
+++ b/src/amd/vulkan/radv_query.c
59f99b
@@ -1679,13 +1679,14 @@ static void emit_begin_query(struct radv_cmd_buffer *cmd_buffer,
59f99b
 
59f99b
 			va += 8 * idx;
59f99b
 
59f99b
-			si_cs_emit_write_event_eop(cs,
59f99b
-						   cmd_buffer->device->physical_device->rad_info.chip_class,
59f99b
-						   radv_cmd_buffer_uses_mec(cmd_buffer),
59f99b
-						   V_028A90_PS_DONE, 0,
59f99b
-						   EOP_DST_SEL_TC_L2,
59f99b
-						   EOP_DATA_SEL_GDS,
59f99b
-						   va, EOP_DATA_GDS(0, 1), 0);
59f99b
+			radeon_emit(cs, PKT3(PKT3_COPY_DATA, 4, 0));
59f99b
+			radeon_emit(cs, COPY_DATA_SRC_SEL(COPY_DATA_GDS) |
59f99b
+					COPY_DATA_DST_SEL(COPY_DATA_DST_MEM) |
59f99b
+					COPY_DATA_WR_CONFIRM);
59f99b
+			radeon_emit(cs, 0);
59f99b
+			radeon_emit(cs, 0);
59f99b
+			radeon_emit(cs, va);
59f99b
+			radeon_emit(cs, va >> 32);
59f99b
 
59f99b
 			/* Record that the command buffer needs GDS. */
59f99b
 			cmd_buffer->gds_needed = true;
59f99b
@@ -1769,13 +1770,14 @@ static void emit_end_query(struct radv_cmd_buffer *cmd_buffer,
59f99b
 
59f99b
 			va += 8 * idx;
59f99b
 
59f99b
-			si_cs_emit_write_event_eop(cs,
59f99b
-						   cmd_buffer->device->physical_device->rad_info.chip_class,
59f99b
-						   radv_cmd_buffer_uses_mec(cmd_buffer),
59f99b
-						   V_028A90_PS_DONE, 0,
59f99b
-						   EOP_DST_SEL_TC_L2,
59f99b
-						   EOP_DATA_SEL_GDS,
59f99b
-						   va, EOP_DATA_GDS(0, 1), 0);
59f99b
+			radeon_emit(cs, PKT3(PKT3_COPY_DATA, 4, 0));
59f99b
+			radeon_emit(cs, COPY_DATA_SRC_SEL(COPY_DATA_GDS) |
59f99b
+					COPY_DATA_DST_SEL(COPY_DATA_DST_MEM) |
59f99b
+					COPY_DATA_WR_CONFIRM);
59f99b
+			radeon_emit(cs, 0);
59f99b
+			radeon_emit(cs, 0);
59f99b
+			radeon_emit(cs, va);
59f99b
+			radeon_emit(cs, va >> 32);
59f99b
 
59f99b
 			cmd_buffer->state.active_pipeline_gds_queries--;
59f99b
 		}
59f99b
diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h
59f99b
index 9d9491d4361..2eb3ba4e64e 100644
59f99b
--- a/src/amd/vulkan/radv_shader.h
59f99b
+++ b/src/amd/vulkan/radv_shader.h
59f99b
@@ -573,9 +573,11 @@ get_tcs_num_patches(unsigned tcs_num_input_vertices,
59f99b
 	if (chip_class >= GFX7 && family != CHIP_STONEY)
59f99b
 		hardware_lds_size = 65536;
59f99b
 
59f99b
-	num_patches = MIN2(num_patches, hardware_lds_size / (input_patch_size + output_patch_size));
59f99b
+	if (input_patch_size + output_patch_size)
59f99b
+		num_patches = MIN2(num_patches, hardware_lds_size / (input_patch_size + output_patch_size));
59f99b
 	/* Make sure the output data fits in the offchip buffer */
59f99b
-	num_patches = MIN2(num_patches, (tess_offchip_block_dw_size * 4) / output_patch_size);
59f99b
+	if (output_patch_size)
59f99b
+		num_patches = MIN2(num_patches, (tess_offchip_block_dw_size * 4) / output_patch_size);
59f99b
 	/* Not necessary for correctness, but improves performance. The
59f99b
 	 * specific value is taken from the proprietary driver.
59f99b
 	 */
59f99b
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
59f99b
index 1eef6aac70c..a6a663d97a6 100644
59f99b
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
59f99b
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
59f99b
@@ -402,10 +402,13 @@ void cso_destroy_context( struct cso_context *ctx )
59f99b
                                                 PIPE_SHADER_CAP_MAX_SHADER_BUFFERS);
59f99b
             int maxcb = scr->get_shader_param(scr, sh,
59f99b
                                               PIPE_SHADER_CAP_MAX_CONST_BUFFERS);
59f99b
+            int maximg = scr->get_shader_param(scr, sh,
59f99b
+                                              PIPE_SHADER_CAP_MAX_SHADER_IMAGES);
59f99b
             assert(maxsam <= PIPE_MAX_SAMPLERS);
59f99b
             assert(maxview <= PIPE_MAX_SHADER_SAMPLER_VIEWS);
59f99b
             assert(maxssbo <= PIPE_MAX_SHADER_BUFFERS);
59f99b
             assert(maxcb <= PIPE_MAX_CONSTANT_BUFFERS);
59f99b
+            assert(maximg <= PIPE_MAX_SHADER_IMAGES);
59f99b
             if (maxsam > 0) {
59f99b
                ctx->pipe->bind_sampler_states(ctx->pipe, sh, 0, maxsam, zeros);
59f99b
             }
59f99b
@@ -415,6 +418,9 @@ void cso_destroy_context( struct cso_context *ctx )
59f99b
             if (maxssbo > 0) {
59f99b
                ctx->pipe->set_shader_buffers(ctx->pipe, sh, 0, maxssbo, ssbos, 0);
59f99b
             }
59f99b
+            if (maximg > 0) {
59f99b
+               ctx->pipe->set_shader_images(ctx->pipe, sh, 0, maximg, NULL);
59f99b
+            }
59f99b
             for (int i = 0; i < maxcb; i++) {
59f99b
                ctx->pipe->set_constant_buffer(ctx->pipe, sh, i, NULL);
59f99b
             }
59f99b
diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c
59f99b
index 8157e921850..971fc80b5ac 100644
59f99b
--- a/src/gallium/drivers/iris/iris_program.c
59f99b
+++ b/src/gallium/drivers/iris/iris_program.c
59f99b
@@ -2109,8 +2109,8 @@ iris_get_scratch_space(struct iris_context *ice,
59f99b
     * in the base configuration.
59f99b
     */
59f99b
    unsigned subslice_total = screen->subslice_total;
59f99b
-   if (devinfo->gen >= 12)
59f99b
-      subslice_total = devinfo->num_subslices[0];
59f99b
+   if (devinfo->gen == 12)
59f99b
+      subslice_total = (devinfo->is_dg1 || devinfo->gt == 2 ? 6 : 2);
59f99b
    else if (devinfo->gen == 11)
59f99b
       subslice_total = 8;
59f99b
    else if (devinfo->gen < 11)
59f99b
diff --git a/src/gallium/drivers/iris/iris_resolve.c b/src/gallium/drivers/iris/iris_resolve.c
59f99b
index 276ad62b1dd..045f43ed8c0 100644
59f99b
--- a/src/gallium/drivers/iris/iris_resolve.c
59f99b
+++ b/src/gallium/drivers/iris/iris_resolve.c
59f99b
@@ -793,7 +793,9 @@ iris_resource_set_aux_state(struct iris_context *ice,
59f99b
       if (res->aux.state[level][start_layer + a] != aux_state) {
59f99b
          res->aux.state[level][start_layer + a] = aux_state;
59f99b
          /* XXX: Need to track which bindings to make dirty */
59f99b
-         ice->state.dirty |= IRIS_DIRTY_RENDER_BUFFER;
59f99b
+         ice->state.dirty |= IRIS_DIRTY_RENDER_BUFFER |
59f99b
+                             IRIS_DIRTY_RENDER_RESOLVES_AND_FLUSHES |
59f99b
+                             IRIS_DIRTY_COMPUTE_RESOLVES_AND_FLUSHES;
59f99b
          ice->state.stage_dirty |= IRIS_ALL_STAGE_DIRTY_BINDINGS;
59f99b
       }
59f99b
    }
59f99b
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
59f99b
index 8747ef4aa8a..3b34e32cd21 100644
59f99b
--- a/src/gallium/drivers/iris/iris_resource.c
59f99b
+++ b/src/gallium/drivers/iris/iris_resource.c
59f99b
@@ -1125,6 +1125,20 @@ iris_flush_resource(struct pipe_context *ctx, struct pipe_resource *resource)
59f99b
                                 0, INTEL_REMAINING_LAYERS,
59f99b
                                 mod ? mod->aux_usage : ISL_AUX_USAGE_NONE,
59f99b
                                 mod ? mod->supports_clear_color : false);
59f99b
+
59f99b
+   if (!res->mod_info && res->aux.usage != ISL_AUX_USAGE_NONE) {
59f99b
+      /* flush_resource may be used to prepare an image for sharing external
59f99b
+       * to the driver (e.g. via eglCreateImage). To account for this, make
59f99b
+       * sure to get rid of any compression that a consumer wouldn't know how
59f99b
+       * to handle.
59f99b
+       */
59f99b
+      for (int i = 0; i < IRIS_BATCH_COUNT; i++) {
59f99b
+         if (iris_batch_references(&ice->batches[i], res->bo))
59f99b
+            iris_batch_flush(&ice->batches[i]);
59f99b
+      }
59f99b
+
59f99b
+      iris_resource_disable_aux(res);
59f99b
+   }
59f99b
 }
59f99b
 
59f99b
 static void
59f99b
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
59f99b
index 59a63f7bbab..b9ddb863a16 100644
59f99b
--- a/src/gallium/drivers/iris/iris_state.c
59f99b
+++ b/src/gallium/drivers/iris/iris_state.c
59f99b
@@ -1666,6 +1666,8 @@ struct iris_rasterizer_state {
59f99b
    bool multisample;
59f99b
    bool force_persample_interp;
59f99b
    bool conservative_rasterization;
59f99b
+   bool fill_mode_point;
59f99b
+   bool fill_mode_line;
59f99b
    bool fill_mode_point_or_line;
59f99b
    enum pipe_sprite_coord_mode sprite_coord_mode; /* PIPE_SPRITE_* */
59f99b
    uint16_t sprite_coord_enable;
59f99b
@@ -1729,11 +1731,15 @@ iris_create_rasterizer_state(struct pipe_context *ctx,
59f99b
    cso->conservative_rasterization =
59f99b
       state->conservative_raster_mode == PIPE_CONSERVATIVE_RASTER_POST_SNAP;
59f99b
 
59f99b
-   cso->fill_mode_point_or_line =
59f99b
-      state->fill_front == PIPE_POLYGON_MODE_LINE ||
59f99b
+   cso->fill_mode_point =
59f99b
       state->fill_front == PIPE_POLYGON_MODE_POINT ||
59f99b
-      state->fill_back == PIPE_POLYGON_MODE_LINE ||
59f99b
       state->fill_back == PIPE_POLYGON_MODE_POINT;
59f99b
+   cso->fill_mode_line =
59f99b
+      state->fill_front == PIPE_POLYGON_MODE_LINE ||
59f99b
+      state->fill_back == PIPE_POLYGON_MODE_LINE;
59f99b
+   cso->fill_mode_point_or_line =
59f99b
+      cso->fill_mode_point ||
59f99b
+      cso->fill_mode_line;
59f99b
 
59f99b
    if (state->clip_plane_enable != 0)
59f99b
       cso->num_clip_plane_consts = util_logbase2(state->clip_plane_enable) + 1;
59f99b
@@ -4059,6 +4065,28 @@ iris_emit_sbe_swiz(struct iris_batch *batch,
59f99b
    }
59f99b
 }
59f99b
 
59f99b
+static bool
59f99b
+iris_is_drawing_points(const struct iris_context *ice)
59f99b
+{
59f99b
+   const struct iris_rasterizer_state *cso_rast = ice->state.cso_rast;
59f99b
+
59f99b
+   if (cso_rast->fill_mode_point) {
59f99b
+      return true;
59f99b
+   }
59f99b
+
59f99b
+   if (ice->shaders.prog[MESA_SHADER_GEOMETRY]) {
59f99b
+      const struct brw_gs_prog_data *gs_prog_data =
59f99b
+         (void *) ice->shaders.prog[MESA_SHADER_GEOMETRY]->prog_data;
59f99b
+      return gs_prog_data->output_topology == _3DPRIM_POINTLIST;
59f99b
+   } else if (ice->shaders.prog[MESA_SHADER_TESS_EVAL]) {
59f99b
+      const struct brw_tes_prog_data *tes_data =
59f99b
+         (void *) ice->shaders.prog[MESA_SHADER_TESS_EVAL]->prog_data;
59f99b
+      return tes_data->output_topology == BRW_TESS_OUTPUT_TOPOLOGY_POINT;
59f99b
+   } else {
59f99b
+      return ice->state.prim_mode == PIPE_PRIM_POINTS;
59f99b
+   }
59f99b
+}
59f99b
+
59f99b
 static unsigned
59f99b
 iris_calculate_point_sprite_overrides(const struct brw_wm_prog_data *prog_data,
59f99b
                                       const struct iris_rasterizer_state *cso)
59f99b
@@ -4093,7 +4121,8 @@ iris_emit_sbe(struct iris_batch *batch, const struct iris_context *ice)
59f99b
                                       &urb_read_offset, &urb_read_length);
59f99b
 
59f99b
    unsigned sprite_coord_overrides =
59f99b
-      iris_calculate_point_sprite_overrides(wm_prog_data, cso_rast);
59f99b
+      iris_is_drawing_points(ice) ?
59f99b
+      iris_calculate_point_sprite_overrides(wm_prog_data, cso_rast) : 0;
59f99b
 
59f99b
    iris_emit_cmd(batch, GENX(3DSTATE_SBE), sbe) {
59f99b
       sbe.AttributeSwizzleEnable = true;
59f99b
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
59f99b
index 8f688fa3650..ef35f86b05f 100644
59f99b
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
59f99b
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
59f99b
@@ -1482,11 +1482,12 @@ void si_update_needs_color_decompress_masks(struct si_context *sctx)
59f99b
 /* Reset descriptors of buffer resources after \p buf has been invalidated.
59f99b
  * If buf == NULL, reset all descriptors.
59f99b
  */
59f99b
-static void si_reset_buffer_resources(struct si_context *sctx, struct si_buffer_resources *buffers,
59f99b
+static bool si_reset_buffer_resources(struct si_context *sctx, struct si_buffer_resources *buffers,
59f99b
                                       unsigned descriptors_idx, uint64_t slot_mask,
59f99b
                                       struct pipe_resource *buf, enum radeon_bo_priority priority)
59f99b
 {
59f99b
    struct si_descriptors *descs = &sctx->descriptors[descriptors_idx];
59f99b
+   bool noop = true;
59f99b
    uint64_t mask = buffers->enabled_mask & slot_mask;
59f99b
 
59f99b
    while (mask) {
59f99b
@@ -1501,8 +1502,10 @@ static void si_reset_buffer_resources(struct si_context *sctx, struct si_buffer_
59f99b
             sctx, si_resource(buffer),
59f99b
             buffers->writable_mask & (1llu << i) ? RADEON_USAGE_READWRITE : RADEON_USAGE_READ,
59f99b
             priority, true);
59f99b
+         noop = false;
59f99b
       }
59f99b
    }
59f99b
+   return !noop;
59f99b
 }
59f99b
 
59f99b
 /* Update all buffer bindings where the buffer is bound, including
59f99b
@@ -1577,11 +1580,15 @@ void si_rebind_buffer(struct si_context *sctx, struct pipe_resource *buf)
59f99b
    }
59f99b
 
59f99b
    if (!buffer || buffer->bind_history & PIPE_BIND_SHADER_BUFFER) {
59f99b
-      for (shader = 0; shader < SI_NUM_SHADERS; shader++)
59f99b
-         si_reset_buffer_resources(sctx, &sctx->const_and_shader_buffers[shader],
59f99b
-                                   si_const_and_shader_buffer_descriptors_idx(shader),
59f99b
-                                   u_bit_consecutive64(0, SI_NUM_SHADER_BUFFERS), buf,
59f99b
-                                   sctx->const_and_shader_buffers[shader].priority);
59f99b
+      for (shader = 0; shader < SI_NUM_SHADERS; shader++) {
59f99b
+         if (si_reset_buffer_resources(sctx, &sctx->const_and_shader_buffers[shader],
59f99b
+                                       si_const_and_shader_buffer_descriptors_idx(shader),
59f99b
+                                       u_bit_consecutive64(0, SI_NUM_SHADER_BUFFERS), buf,
59f99b
+                                       sctx->const_and_shader_buffers[shader].priority) &&
59f99b
+             shader == PIPE_SHADER_COMPUTE) {
59f99b
+            sctx->compute_shaderbuf_sgprs_dirty = true;
59f99b
+         }
59f99b
+      }
59f99b
    }
59f99b
 
59f99b
    if (!buffer || buffer->bind_history & PIPE_BIND_SAMPLER_VIEW) {
59f99b
@@ -1633,6 +1640,9 @@ void si_rebind_buffer(struct si_context *sctx, struct pipe_resource *buf)
59f99b
                radeon_add_to_gfx_buffer_list_check_mem(sctx, si_resource(buffer),
59f99b
                                                        RADEON_USAGE_READWRITE,
59f99b
                                                        RADEON_PRIO_SAMPLER_BUFFER, true);
59f99b
+
59f99b
+               if (shader == PIPE_SHADER_COMPUTE)
59f99b
+                  sctx->compute_image_sgprs_dirty = true;
59f99b
             }
59f99b
          }
59f99b
       }
59f99b
diff --git a/src/gallium/frontends/dri/dri_helpers.c b/src/gallium/frontends/dri/dri_helpers.c
59f99b
index 01a1fb3d96c..5e87df35a55 100644
59f99b
--- a/src/gallium/frontends/dri/dri_helpers.c
59f99b
+++ b/src/gallium/frontends/dri/dri_helpers.c
59f99b
@@ -258,7 +258,9 @@ dri2_create_image_from_renderbuffer2(__DRIcontext *context,
59f99b
 				     int renderbuffer, void *loaderPrivate,
59f99b
                                      unsigned *error)
59f99b
 {
59f99b
-   struct gl_context *ctx = ((struct st_context *)dri_context(context)->st)->ctx;
59f99b
+   struct st_context *st_ctx = (struct st_context *)dri_context(context)->st;
59f99b
+   struct gl_context *ctx = st_ctx->ctx;
59f99b
+   struct pipe_context *p_ctx = st_ctx->pipe;
59f99b
    struct gl_renderbuffer *rb;
59f99b
    struct pipe_resource *tex;
59f99b
    __DRIimage *img;
59f99b
@@ -299,6 +301,13 @@ dri2_create_image_from_renderbuffer2(__DRIcontext *context,
59f99b
 
59f99b
    pipe_resource_reference(&img->texture, tex);
59f99b
 
59f99b
+   /* If the resource supports EGL_MESA_image_dma_buf_export, make sure that
59f99b
+    * it's in a shareable state. Do this now while we still have the access to
59f99b
+    * the context.
59f99b
+    */
59f99b
+   if (dri2_get_mapping_by_format(img->dri_format))
59f99b
+      p_ctx->flush_resource(p_ctx, tex);
59f99b
+
59f99b
    *error = __DRI_IMAGE_ERROR_SUCCESS;
59f99b
    return img;
59f99b
 }
59f99b
@@ -326,7 +335,9 @@ dri2_create_from_texture(__DRIcontext *context, int target, unsigned texture,
59f99b
                          void *loaderPrivate)
59f99b
 {
59f99b
    __DRIimage *img;
59f99b
-   struct gl_context *ctx = ((struct st_context *)dri_context(context)->st)->ctx;
59f99b
+   struct st_context *st_ctx = (struct st_context *)dri_context(context)->st;
59f99b
+   struct gl_context *ctx = st_ctx->ctx;
59f99b
+   struct pipe_context *p_ctx = st_ctx->pipe;
59f99b
    struct gl_texture_object *obj;
59f99b
    struct pipe_resource *tex;
59f99b
    GLuint face = 0;
59f99b
@@ -376,6 +387,13 @@ dri2_create_from_texture(__DRIcontext *context, int target, unsigned texture,
59f99b
 
59f99b
    pipe_resource_reference(&img->texture, tex);
59f99b
 
59f99b
+   /* If the resource supports EGL_MESA_image_dma_buf_export, make sure that
59f99b
+    * it's in a shareable state. Do this now while we still have the access to
59f99b
+    * the context.
59f99b
+    */
59f99b
+   if (dri2_get_mapping_by_format(img->dri_format))
59f99b
+      p_ctx->flush_resource(p_ctx, tex);
59f99b
+
59f99b
    *error = __DRI_IMAGE_ERROR_SUCCESS;
59f99b
    return img;
59f99b
 }
59f99b
@@ -547,6 +565,9 @@ dri2_get_mapping_by_fourcc(int fourcc)
59f99b
 const struct dri2_format_mapping *
59f99b
 dri2_get_mapping_by_format(int format)
59f99b
 {
59f99b
+   if (format == __DRI_IMAGE_FORMAT_NONE)
59f99b
+      return NULL;
59f99b
+
59f99b
    for (unsigned i = 0; i < ARRAY_SIZE(dri2_format_table); i++) {
59f99b
       if (dri2_format_table[i].dri_format == format)
59f99b
          return &dri2_format_table[i];
59f99b
diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c
59f99b
index 45734f95880..187aecde1f8 100644
59f99b
--- a/src/gallium/frontends/lavapipe/lvp_device.c
59f99b
+++ b/src/gallium/frontends/lavapipe/lvp_device.c
59f99b
@@ -52,8 +52,6 @@ lvp_physical_device_init(struct lvp_physical_device *device,
59f99b
    if (!device->pscreen)
59f99b
       return vk_error(instance, VK_ERROR_OUT_OF_HOST_MEMORY);
59f99b
 
59f99b
-   fprintf(stderr, "WARNING: lavapipe is not a conformant vulkan implementation, testing use only.\n");
59f99b
-
59f99b
    device->max_images = device->pscreen->get_shader_param(device->pscreen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_MAX_SHADER_IMAGES);
59f99b
    lvp_physical_device_get_supported_extensions(device, &device->supported_extensions);
59f99b
    result = lvp_init_wsi(device);
59f99b
@@ -575,6 +573,19 @@ void lvp_GetPhysicalDeviceProperties2(
59f99b
    }
59f99b
 }
59f99b
 
59f99b
+static void lvp_get_physical_device_queue_family_properties(
59f99b
+   VkQueueFamilyProperties*                    pQueueFamilyProperties)
59f99b
+{
59f99b
+   *pQueueFamilyProperties = (VkQueueFamilyProperties) {
59f99b
+      .queueFlags = VK_QUEUE_GRAPHICS_BIT |
59f99b
+      VK_QUEUE_COMPUTE_BIT |
59f99b
+      VK_QUEUE_TRANSFER_BIT,
59f99b
+      .queueCount = 1,
59f99b
+      .timestampValidBits = 64,
59f99b
+      .minImageTransferGranularity = (VkExtent3D) { 1, 1, 1 },
59f99b
+   };
59f99b
+}
59f99b
+
59f99b
 void lvp_GetPhysicalDeviceQueueFamilyProperties(
59f99b
    VkPhysicalDevice                            physicalDevice,
59f99b
    uint32_t*                                   pCount,
59f99b
@@ -586,15 +597,21 @@ void lvp_GetPhysicalDeviceQueueFamilyProperties(
59f99b
    }
59f99b
 
59f99b
    assert(*pCount >= 1);
59f99b
+   lvp_get_physical_device_queue_family_properties(pQueueFamilyProperties);
59f99b
+}
59f99b
 
59f99b
-   *pQueueFamilyProperties = (VkQueueFamilyProperties) {
59f99b
-      .queueFlags = VK_QUEUE_GRAPHICS_BIT |
59f99b
-      VK_QUEUE_COMPUTE_BIT |
59f99b
-      VK_QUEUE_TRANSFER_BIT,
59f99b
-      .queueCount = 1,
59f99b
-      .timestampValidBits = 64,
59f99b
-      .minImageTransferGranularity = (VkExtent3D) { 1, 1, 1 },
59f99b
-   };
59f99b
+void lvp_GetPhysicalDeviceQueueFamilyProperties2(
59f99b
+   VkPhysicalDevice                            physicalDevice,
59f99b
+   uint32_t*                                   pCount,
59f99b
+   VkQueueFamilyProperties2                   *pQueueFamilyProperties)
59f99b
+{
59f99b
+   if (pQueueFamilyProperties == NULL) {
59f99b
+      *pCount = 1;
59f99b
+      return;
59f99b
+   }
59f99b
+
59f99b
+   assert(*pCount >= 1);
59f99b
+   lvp_get_physical_device_queue_family_properties(&pQueueFamilyProperties->queueFamilyProperties);
59f99b
 }
59f99b
 
59f99b
 void lvp_GetPhysicalDeviceMemoryProperties(
59f99b
@@ -617,6 +634,14 @@ void lvp_GetPhysicalDeviceMemoryProperties(
59f99b
    };
59f99b
 }
59f99b
 
59f99b
+void lvp_GetPhysicalDeviceMemoryProperties2(
59f99b
+   VkPhysicalDevice                            physicalDevice,
59f99b
+   VkPhysicalDeviceMemoryProperties2          *pMemoryProperties)
59f99b
+{
59f99b
+   lvp_GetPhysicalDeviceMemoryProperties(physicalDevice,
59f99b
+                                         &pMemoryProperties->memoryProperties);
59f99b
+}
59f99b
+
59f99b
 PFN_vkVoidFunction lvp_GetInstanceProcAddr(
59f99b
    VkInstance                                  _instance,
59f99b
    const char*                                 pName)
59f99b
@@ -822,6 +847,8 @@ VkResult lvp_CreateDevice(
59f99b
    const VkAllocationCallbacks*                pAllocator,
59f99b
    VkDevice*                                   pDevice)
59f99b
 {
59f99b
+   fprintf(stderr, "WARNING: lavapipe is not a conformant vulkan implementation, testing use only.\n");
59f99b
+
59f99b
    LVP_FROM_HANDLE(lvp_physical_device, physical_device, physicalDevice);
59f99b
    struct lvp_device *device;
59f99b
 
59f99b
diff --git a/src/glx/g_glxglvnddispatchfuncs.c b/src/glx/g_glxglvnddispatchfuncs.c
59f99b
index 0f02ed2d321..e0ea27c0b18 100644
59f99b
--- a/src/glx/g_glxglvnddispatchfuncs.c
59f99b
+++ b/src/glx/g_glxglvnddispatchfuncs.c
59f99b
@@ -87,6 +87,7 @@ const char * const __glXDispatchTableStrings[DI_LAST_INDEX] = {
59f99b
     __ATTRIB(SelectEventSGIX),
59f99b
     // glXSwapBuffers implemented by libglvnd
59f99b
     __ATTRIB(SwapBuffersMscOML),
59f99b
+    __ATTRIB(SwapIntervalEXT),
59f99b
     __ATTRIB(SwapIntervalMESA),
59f99b
     __ATTRIB(SwapIntervalSGI),
59f99b
     // glXUseXFont implemented by libglvnd
59f99b
@@ -893,6 +894,24 @@ static int dispatch_SwapIntervalMESA(unsigned int interval)
59f99b
 
59f99b
 
59f99b
 
59f99b
+static void dispatch_SwapIntervalEXT(Display *dpy, GLXDrawable drawable, int interval)
59f99b
+{
59f99b
+    PFNGLXSWAPINTERVALEXTPROC pSwapIntervalEXT;
59f99b
+    __GLXvendorInfo *dd;
59f99b
+
59f99b
+    dd = GetDispatchFromDrawable(dpy, drawable);
59f99b
+    if (dd == NULL)
59f99b
+        return;
59f99b
+
59f99b
+    __FETCH_FUNCTION_PTR(SwapIntervalEXT);
59f99b
+    if (pSwapIntervalEXT == NULL)
59f99b
+        return;
59f99b
+
59f99b
+    pSwapIntervalEXT(dpy, drawable, interval);
59f99b
+}
59f99b
+
59f99b
+
59f99b
+
59f99b
 static Bool dispatch_WaitForMscOML(Display *dpy, GLXDrawable drawable,
59f99b
                                       int64_t target_msc, int64_t divisor,
59f99b
                                       int64_t remainder, int64_t *ust,
59f99b
@@ -974,6 +993,7 @@ const void * const __glXDispatchFunctions[DI_LAST_INDEX + 1] = {
59f99b
     __ATTRIB(ReleaseTexImageEXT),
59f99b
     __ATTRIB(SelectEventSGIX),
59f99b
     __ATTRIB(SwapBuffersMscOML),
59f99b
+    __ATTRIB(SwapIntervalEXT),
59f99b
     __ATTRIB(SwapIntervalMESA),
59f99b
     __ATTRIB(SwapIntervalSGI),
59f99b
     __ATTRIB(WaitForMscOML),
59f99b
diff --git a/src/glx/g_glxglvnddispatchindices.h b/src/glx/g_glxglvnddispatchindices.h
59f99b
index 3ba50a74abb..b65d078098f 100644
59f99b
--- a/src/glx/g_glxglvnddispatchindices.h
59f99b
+++ b/src/glx/g_glxglvnddispatchindices.h
59f99b
@@ -79,6 +79,7 @@ typedef enum __GLXdispatchIndex {
59f99b
     DI_SelectEventSGIX,
59f99b
     // SwapBuffers implemented by libglvnd
59f99b
     DI_SwapBuffersMscOML,
59f99b
+    DI_SwapIntervalEXT,
59f99b
     DI_SwapIntervalMESA,
59f99b
     DI_SwapIntervalSGI,
59f99b
     // UseXFont implemented by libglvnd
59f99b
diff --git a/src/intel/common/gen_mi_builder.h b/src/intel/common/gen_mi_builder.h
59f99b
index ddd8459ef07..47fb98e99f7 100644
59f99b
--- a/src/intel/common/gen_mi_builder.h
59f99b
+++ b/src/intel/common/gen_mi_builder.h
59f99b
@@ -932,6 +932,13 @@ gen_mi_store_address(struct gen_mi_builder *b,
59f99b
 static inline void
59f99b
 gen_mi_self_mod_barrier(struct gen_mi_builder *b)
59f99b
 {
59f99b
+   /* First make sure all the memory writes from previous modifying commands
59f99b
+    * have landed. We want to do this before going through the CS cache,
59f99b
+    * otherwise we could be fetching memory that hasn't been written to yet.
59f99b
+    */
59f99b
+   gen_mi_builder_emit(b, GENX(PIPE_CONTROL), pc) {
59f99b
+      pc.CommandStreamerStallEnable = true;
59f99b
+   }
59f99b
    /* Documentation says Gen11+ should be able to invalidate the command cache
59f99b
     * but experiment show it doesn't work properly, so for now just get over
59f99b
     * the CS prefetch.
59f99b
diff --git a/src/intel/compiler/brw_fs_copy_propagation.cpp b/src/intel/compiler/brw_fs_copy_propagation.cpp
59f99b
index 917c3abfe9e..6896987055f 100644
59f99b
--- a/src/intel/compiler/brw_fs_copy_propagation.cpp
59f99b
+++ b/src/intel/compiler/brw_fs_copy_propagation.cpp
59f99b
@@ -437,6 +437,7 @@ instruction_requires_packed_data(fs_inst *inst)
59f99b
    case FS_OPCODE_DDX_COARSE:
59f99b
    case FS_OPCODE_DDY_FINE:
59f99b
    case FS_OPCODE_DDY_COARSE:
59f99b
+   case SHADER_OPCODE_QUAD_SWIZZLE:
59f99b
       return true;
59f99b
    default:
59f99b
       return false;
59f99b
diff --git a/src/intel/compiler/brw_ir_fs.h b/src/intel/compiler/brw_ir_fs.h
59f99b
index 6ba3a6ca97e..3a4acc1834a 100644
59f99b
--- a/src/intel/compiler/brw_ir_fs.h
59f99b
+++ b/src/intel/compiler/brw_ir_fs.h
59f99b
@@ -451,13 +451,15 @@ regs_written(const fs_inst *inst)
59f99b
  * Return the number of dataflow registers read by the instruction (either
59f99b
  * fully or partially) counted from 'floor(reg_offset(inst->src[i]) /
59f99b
  * register_size)'.  The somewhat arbitrary register size unit is 4B for the
59f99b
- * UNIFORM and IMM files and 32B for all other files.
59f99b
+ * UNIFORM files and 32B for all other files.
59f99b
  */
59f99b
 inline unsigned
59f99b
 regs_read(const fs_inst *inst, unsigned i)
59f99b
 {
59f99b
-   const unsigned reg_size =
59f99b
-      inst->src[i].file == UNIFORM || inst->src[i].file == IMM ? 4 : REG_SIZE;
59f99b
+   if (inst->src[i].file == IMM)
59f99b
+      return 1;
59f99b
+
59f99b
+   const unsigned reg_size = inst->src[i].file == UNIFORM ? 4 : REG_SIZE;
59f99b
    return DIV_ROUND_UP(reg_offset(inst->src[i]) % reg_size +
59f99b
                        inst->size_read(i) -
59f99b
                        MIN2(inst->size_read(i), reg_padding(inst->src[i])),
59f99b
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
59f99b
index 9007cd00e85..48811912e95 100644
59f99b
--- a/src/intel/vulkan/anv_allocator.c
59f99b
+++ b/src/intel/vulkan/anv_allocator.c
59f99b
@@ -1447,8 +1447,8 @@ anv_scratch_pool_alloc(struct anv_device *device, struct anv_scratch_pool *pool,
59f99b
     * For, Gen11+, scratch space allocation is based on the number of threads
59f99b
     * in the base configuration.
59f99b
     */
59f99b
-   if (devinfo->gen >= 12)
59f99b
-      subslices = devinfo->num_subslices[0];
59f99b
+   if (devinfo->gen == 12)
59f99b
+      subslices = (devinfo->is_dg1 || devinfo->gt == 2 ? 6 : 2);
59f99b
    else if (devinfo->gen == 11)
59f99b
       subslices = 8;
59f99b
    else if (devinfo->gen >= 9)
59f99b
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
59f99b
index 0290431f145..80307cd612f 100644
59f99b
--- a/src/intel/vulkan/anv_image.c
59f99b
+++ b/src/intel/vulkan/anv_image.c
59f99b
@@ -684,6 +684,25 @@ choose_drm_format_mod(const struct anv_physical_device *device,
59f99b
       return NULL;
59f99b
 }
59f99b
 
59f99b
+static VkImageUsageFlags
59f99b
+anv_image_create_usage(const VkImageCreateInfo *pCreateInfo,
59f99b
+                       VkImageUsageFlags usage)
59f99b
+{
59f99b
+   /* Add TRANSFER_SRC usage for multisample attachment images. This is
59f99b
+    * because we might internally use the TRANSFER_SRC layout on them for
59f99b
+    * blorp operations associated with resolving those into other attachments
59f99b
+    * at the end of a subpass.
59f99b
+    *
59f99b
+    * Without this additional usage, we compute an incorrect AUX state in
59f99b
+    * anv_layout_to_aux_state().
59f99b
+    */
59f99b
+   if (pCreateInfo->samples > VK_SAMPLE_COUNT_1_BIT &&
59f99b
+       (usage & (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
59f99b
+                 VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT)))
59f99b
+      usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
59f99b
+   return usage;
59f99b
+}
59f99b
+
59f99b
 VkResult
59f99b
 anv_image_create(VkDevice _device,
59f99b
                  const struct anv_image_create_info *create_info,
59f99b
@@ -732,7 +751,7 @@ anv_image_create(VkDevice _device,
59f99b
    image->levels = pCreateInfo->mipLevels;
59f99b
    image->array_size = pCreateInfo->arrayLayers;
59f99b
    image->samples = pCreateInfo->samples;
59f99b
-   image->usage = pCreateInfo->usage;
59f99b
+   image->usage = anv_image_create_usage(pCreateInfo, pCreateInfo->usage);
59f99b
    image->create_flags = pCreateInfo->flags;
59f99b
    image->tiling = pCreateInfo->tiling;
59f99b
    image->disjoint = pCreateInfo->flags & VK_IMAGE_CREATE_DISJOINT_BIT;
59f99b
@@ -745,8 +764,11 @@ anv_image_create(VkDevice _device,
59f99b
       const VkImageStencilUsageCreateInfoEXT *stencil_usage_info =
59f99b
          vk_find_struct_const(pCreateInfo->pNext,
59f99b
                               IMAGE_STENCIL_USAGE_CREATE_INFO_EXT);
59f99b
-      if (stencil_usage_info)
59f99b
-         image->stencil_usage = stencil_usage_info->stencilUsage;
59f99b
+      if (stencil_usage_info) {
59f99b
+         image->stencil_usage =
59f99b
+            anv_image_create_usage(pCreateInfo,
59f99b
+                                   stencil_usage_info->stencilUsage);
59f99b
+      }
59f99b
    }
59f99b
 
59f99b
    /* In case of external format, We don't know format yet,
59f99b
diff --git a/src/intel/vulkan/anv_pass.c b/src/intel/vulkan/anv_pass.c
59f99b
index af23b87969d..1818f6c587b 100644
59f99b
--- a/src/intel/vulkan/anv_pass.c
59f99b
+++ b/src/intel/vulkan/anv_pass.c
59f99b
@@ -23,6 +23,7 @@
59f99b
 
59f99b
 #include "anv_private.h"
59f99b
 
59f99b
+#include "vk_format_info.h"
59f99b
 #include "vk_util.h"
59f99b
 
59f99b
 static void
59f99b
@@ -406,6 +407,70 @@ num_subpass_attachments2(const VkSubpassDescription2KHR *desc)
59f99b
           (ds_resolve && ds_resolve->pDepthStencilResolveAttachment);
59f99b
 }
59f99b
 
59f99b
+static bool
59f99b
+vk_image_layout_depth_only(VkImageLayout layout)
59f99b
+{
59f99b
+   switch (layout) {
59f99b
+   case VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL:
59f99b
+   case VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL:
59f99b
+      return true;
59f99b
+
59f99b
+   default:
59f99b
+      return false;
59f99b
+   }
59f99b
+}
59f99b
+
59f99b
+/* From the Vulkan Specification 1.2.166 - VkAttachmentReference2:
59f99b
+ *
59f99b
+ *   "If layout only specifies the layout of the depth aspect of the
59f99b
+ *    attachment, the layout of the stencil aspect is specified by the
59f99b
+ *    stencilLayout member of a VkAttachmentReferenceStencilLayout structure
59f99b
+ *    included in the pNext chain. Otherwise, layout describes the layout for
59f99b
+ *    all relevant image aspects."
59f99b
+ */
59f99b
+static VkImageLayout
59f99b
+stencil_ref_layout(const VkAttachmentReference2KHR *att_ref)
59f99b
+{
59f99b
+   if (!vk_image_layout_depth_only(att_ref->layout))
59f99b
+      return att_ref->layout;
59f99b
+
59f99b
+   const VkAttachmentReferenceStencilLayoutKHR *stencil_ref =
59f99b
+      vk_find_struct_const(att_ref->pNext,
59f99b
+                           ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR);
59f99b
+   if (!stencil_ref)
59f99b
+      return VK_IMAGE_LAYOUT_UNDEFINED;
59f99b
+   return stencil_ref->stencilLayout;
59f99b
+}
59f99b
+
59f99b
+/* From the Vulkan Specification 1.2.166 - VkAttachmentDescription2:
59f99b
+ *
59f99b
+ *   "If format is a depth/stencil format, and initialLayout only specifies
59f99b
+ *    the initial layout of the depth aspect of the attachment, the initial
59f99b
+ *    layout of the stencil aspect is specified by the stencilInitialLayout
59f99b
+ *    member of a VkAttachmentDescriptionStencilLayout structure included in
59f99b
+ *    the pNext chain. Otherwise, initialLayout describes the initial layout
59f99b
+ *    for all relevant image aspects."
59f99b
+ */
59f99b
+static VkImageLayout
59f99b
+stencil_desc_layout(const VkAttachmentDescription2KHR *att_desc, bool final)
59f99b
+{
59f99b
+   if (!vk_format_has_stencil(att_desc->format))
59f99b
+      return VK_IMAGE_LAYOUT_UNDEFINED;
59f99b
+
59f99b
+   const VkImageLayout main_layout =
59f99b
+      final ? att_desc->finalLayout : att_desc->initialLayout;
59f99b
+   if (!vk_image_layout_depth_only(main_layout))
59f99b
+      return main_layout;
59f99b
+
59f99b
+   const VkAttachmentDescriptionStencilLayoutKHR *stencil_desc =
59f99b
+      vk_find_struct_const(att_desc->pNext,
59f99b
+                           ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT_KHR);
59f99b
+   assert(stencil_desc);
59f99b
+   return final ?
59f99b
+      stencil_desc->stencilFinalLayout :
59f99b
+      stencil_desc->stencilInitialLayout;
59f99b
+}
59f99b
+
59f99b
 VkResult anv_CreateRenderPass2(
59f99b
     VkDevice                                    _device,
59f99b
     const VkRenderPassCreateInfo2KHR*           pCreateInfo,
59f99b
@@ -450,10 +515,6 @@ VkResult anv_CreateRenderPass2(
59f99b
    pass->subpass_flushes = subpass_flushes;
59f99b
 
59f99b
    for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) {
59f99b
-      const VkAttachmentDescriptionStencilLayoutKHR *stencil_layout =
59f99b
-         vk_find_struct_const(pCreateInfo->pAttachments[i].pNext,
59f99b
-                              ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT_KHR);
59f99b
-
59f99b
       pass->attachments[i] = (struct anv_render_pass_attachment) {
59f99b
          .format                 = pCreateInfo->pAttachments[i].format,
59f99b
          .samples                = pCreateInfo->pAttachments[i].samples,
59f99b
@@ -463,12 +524,10 @@ VkResult anv_CreateRenderPass2(
59f99b
          .initial_layout         = pCreateInfo->pAttachments[i].initialLayout,
59f99b
          .final_layout           = pCreateInfo->pAttachments[i].finalLayout,
59f99b
 
59f99b
-         .stencil_initial_layout = (stencil_layout ?
59f99b
-                                    stencil_layout->stencilInitialLayout :
59f99b
-                                    pCreateInfo->pAttachments[i].initialLayout),
59f99b
-         .stencil_final_layout   = (stencil_layout ?
59f99b
-                                    stencil_layout->stencilFinalLayout :
59f99b
-                                    pCreateInfo->pAttachments[i].finalLayout),
59f99b
+         .stencil_initial_layout = stencil_desc_layout(&pCreateInfo->pAttachments[i],
59f99b
+                                                       false),
59f99b
+         .stencil_final_layout   = stencil_desc_layout(&pCreateInfo->pAttachments[i],
59f99b
+                                                       true),
59f99b
       };
59f99b
    }
59f99b
 
59f99b
@@ -487,17 +546,11 @@ VkResult anv_CreateRenderPass2(
59f99b
          subpass_attachments += desc->inputAttachmentCount;
59f99b
 
59f99b
          for (uint32_t j = 0; j < desc->inputAttachmentCount; j++) {
59f99b
-            const VkAttachmentReferenceStencilLayoutKHR *stencil_layout =
59f99b
-               vk_find_struct_const(desc->pInputAttachments[j].pNext,
59f99b
-                                    ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR);
59f99b
-
59f99b
             subpass->input_attachments[j] = (struct anv_subpass_attachment) {
59f99b
                .usage =          VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT,
59f99b
                .attachment =     desc->pInputAttachments[j].attachment,
59f99b
                .layout =         desc->pInputAttachments[j].layout,
59f99b
-               .stencil_layout = (stencil_layout ?
59f99b
-                                  stencil_layout->stencilLayout :
59f99b
-                                  desc->pInputAttachments[j].layout),
59f99b
+               .stencil_layout = stencil_ref_layout(&desc->pInputAttachments[j]),
59f99b
             };
59f99b
          }
59f99b
       }
59f99b
@@ -531,17 +584,11 @@ VkResult anv_CreateRenderPass2(
59f99b
       if (desc->pDepthStencilAttachment) {
59f99b
          subpass->depth_stencil_attachment = subpass_attachments++;
59f99b
 
59f99b
-         const VkAttachmentReferenceStencilLayoutKHR *stencil_attachment =
59f99b
-            vk_find_struct_const(desc->pDepthStencilAttachment->pNext,
59f99b
-                                 ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR);
59f99b
-
59f99b
          *subpass->depth_stencil_attachment = (struct anv_subpass_attachment) {
59f99b
             .usage =          VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
59f99b
             .attachment =     desc->pDepthStencilAttachment->attachment,
59f99b
             .layout =         desc->pDepthStencilAttachment->layout,
59f99b
-            .stencil_layout = stencil_attachment ?
59f99b
-                              stencil_attachment->stencilLayout :
59f99b
-                              desc->pDepthStencilAttachment->layout,
59f99b
+            .stencil_layout = stencil_ref_layout(desc->pDepthStencilAttachment),
59f99b
          };
59f99b
       }
59f99b
 
59f99b
@@ -552,17 +599,11 @@ VkResult anv_CreateRenderPass2(
59f99b
       if (ds_resolve && ds_resolve->pDepthStencilResolveAttachment) {
59f99b
          subpass->ds_resolve_attachment = subpass_attachments++;
59f99b
 
59f99b
-         const VkAttachmentReferenceStencilLayoutKHR *stencil_resolve_attachment =
59f99b
-            vk_find_struct_const(ds_resolve->pDepthStencilResolveAttachment->pNext,
59f99b
-                                 ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR);
59f99b
-
59f99b
          *subpass->ds_resolve_attachment = (struct anv_subpass_attachment) {
59f99b
             .usage =          VK_IMAGE_USAGE_TRANSFER_DST_BIT,
59f99b
             .attachment =     ds_resolve->pDepthStencilResolveAttachment->attachment,
59f99b
             .layout =         ds_resolve->pDepthStencilResolveAttachment->layout,
59f99b
-            .stencil_layout = stencil_resolve_attachment ?
59f99b
-                              stencil_resolve_attachment->stencilLayout :
59f99b
-                              ds_resolve->pDepthStencilResolveAttachment->layout,
59f99b
+            .stencil_layout = stencil_ref_layout(ds_resolve->pDepthStencilResolveAttachment),
59f99b
          };
59f99b
          subpass->depth_resolve_mode = ds_resolve->depthResolveMode;
59f99b
          subpass->stencil_resolve_mode = ds_resolve->stencilResolveMode;
59f99b
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
59f99b
index a9c49e0f592..e3eb376fa5a 100644
59f99b
--- a/src/intel/vulkan/genX_cmd_buffer.c
59f99b
+++ b/src/intel/vulkan/genX_cmd_buffer.c
59f99b
@@ -462,8 +462,10 @@ anv_image_init_aux_tt(struct anv_cmd_buffer *cmd_buffer,
59f99b
 {
59f99b
    uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
59f99b
 
59f99b
+   const struct anv_surface *surface = &image->planes[plane].surface;
59f99b
    uint64_t base_address =
59f99b
-      anv_address_physical(image->planes[plane].address);
59f99b
+      anv_address_physical(anv_address_add(image->planes[plane].address,
59f99b
+                                           surface->offset));
59f99b
 
59f99b
    const struct isl_surf *isl_surf = &image->planes[plane].surface.isl;
59f99b
    uint64_t format_bits = gen_aux_map_format_bits_for_isl_surf(isl_surf);
59f99b
@@ -1231,6 +1233,17 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
59f99b
             uint32_t level_layer_count =
59f99b
                MIN2(layer_count, aux_layers - base_layer);
59f99b
 
59f99b
+            /* If will_full_fast_clear is set, the caller promises to
59f99b
+             * fast-clear the largest portion of the specified range as it can.
59f99b
+             * For color images, that means only the first LOD and array slice.
59f99b
+             */
59f99b
+            if (level == 0 && base_layer == 0 && will_full_fast_clear) {
59f99b
+               base_layer++;
59f99b
+               level_layer_count--;
59f99b
+               if (level_layer_count == 0)
59f99b
+                  continue;
59f99b
+            }
59f99b
+
59f99b
             anv_image_ccs_op(cmd_buffer, image,
59f99b
                              image->planes[plane].surface.isl.format,
59f99b
                              ISL_SWIZZLE_IDENTITY,
59f99b
@@ -1250,6 +1263,12 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
59f99b
                           "define an MCS buffer.");
59f99b
          }
59f99b
 
59f99b
+         /* If will_full_fast_clear is set, the caller promises to fast-clear
59f99b
+          * the largest portion of the specified range as it can.
59f99b
+          */
59f99b
+         if (will_full_fast_clear)
59f99b
+            return;
59f99b
+
59f99b
          assert(base_level == 0 && level_count == 1);
59f99b
          anv_image_mcs_op(cmd_buffer, image,
59f99b
                           image->planes[plane].surface.isl.format,
59f99b
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
59f99b
index 205e8677f19..33f071019b7 100644
59f99b
--- a/src/intel/vulkan/genX_pipeline.c
59f99b
+++ b/src/intel/vulkan/genX_pipeline.c
59f99b
@@ -1180,7 +1180,22 @@ emit_cb_state(struct anv_graphics_pipeline *pipeline,
59f99b
 #endif
59f99b
          .LogicOpEnable = info->logicOpEnable,
59f99b
          .LogicOpFunction = vk_to_gen_logic_op[info->logicOp],
59f99b
-         .ColorBufferBlendEnable = a->blendEnable,
59f99b
+         /* Vulkan specification 1.2.168, VkLogicOp:
59f99b
+          *
59f99b
+          *   "Logical operations are controlled by the logicOpEnable and
59f99b
+          *    logicOp members of VkPipelineColorBlendStateCreateInfo. If
59f99b
+          *    logicOpEnable is VK_TRUE, then a logical operation selected by
59f99b
+          *    logicOp is applied between each color attachment and the
59f99b
+          *    fragment’s corresponding output value, and blending of all
59f99b
+          *    attachments is treated as if it were disabled."
59f99b
+          *
59f99b
+          * From the Broadwell PRM Volume 2d: Command Reference: Structures:
59f99b
+          * BLEND_STATE_ENTRY:
59f99b
+          *
59f99b
+          *   "Enabling LogicOp and Color Buffer Blending at the same time is
59f99b
+          *    UNDEFINED"
59f99b
+          */
59f99b
+         .ColorBufferBlendEnable = !info->logicOpEnable && a->blendEnable,
59f99b
          .ColorClampRange = COLORCLAMP_RTFORMAT,
59f99b
          .PreBlendColorClampEnable = true,
59f99b
          .PostBlendColorClampEnable = true,
59f99b
diff --git a/src/intel/vulkan/vk_format_info.h b/src/intel/vulkan/vk_format_info.h
59f99b
index 006e1f4a6ad..4e72c244742 100644
59f99b
--- a/src/intel/vulkan/vk_format_info.h
59f99b
+++ b/src/intel/vulkan/vk_format_info.h
59f99b
@@ -164,4 +164,11 @@ vk_format_has_depth(VkFormat format)
59f99b
    return aspects & VK_IMAGE_ASPECT_DEPTH_BIT;
59f99b
 }
59f99b
 
59f99b
+static inline bool
59f99b
+vk_format_has_stencil(VkFormat format)
59f99b
+{
59f99b
+   const VkImageAspectFlags aspects = vk_format_aspects(format);
59f99b
+   return aspects & VK_IMAGE_ASPECT_STENCIL_BIT;
59f99b
+}
59f99b
+
59f99b
 #endif /* VK_FORMAT_INFO_H */
59f99b
diff --git a/src/mesa/state_tracker/st_pbo.c b/src/mesa/state_tracker/st_pbo.c
59f99b
index 65a1ce8862a..b03921c1be6 100644
59f99b
--- a/src/mesa/state_tracker/st_pbo.c
59f99b
+++ b/src/mesa/state_tracker/st_pbo.c
59f99b
@@ -431,16 +431,21 @@ create_fs(struct st_context *st, bool download,
59f99b
    nir_ssa_def *coord = nir_load_var(&b, fragcoord);
59f99b
 
59f99b
    nir_ssa_def *layer = NULL;
59f99b
-   if (st->pbo.layers && need_layer && (!download || target == PIPE_TEXTURE_1D_ARRAY ||
59f99b
-                                                     target == PIPE_TEXTURE_2D_ARRAY ||
59f99b
-                                                     target == PIPE_TEXTURE_3D ||
59f99b
-                                                     target == PIPE_TEXTURE_CUBE ||
59f99b
-                                                     target == PIPE_TEXTURE_CUBE_ARRAY)) {
59f99b
-      nir_variable *var = nir_variable_create(b.shader, nir_var_shader_in,
59f99b
-                                              glsl_int_type(), "gl_Layer");
59f99b
-      var->data.location = VARYING_SLOT_LAYER;
59f99b
-      var->data.interpolation = INTERP_MODE_FLAT;
59f99b
-      layer = nir_load_var(&b, var);
59f99b
+   if (st->pbo.layers && (!download || target == PIPE_TEXTURE_1D_ARRAY ||
59f99b
+                                       target == PIPE_TEXTURE_2D_ARRAY ||
59f99b
+                                       target == PIPE_TEXTURE_3D ||
59f99b
+                                       target == PIPE_TEXTURE_CUBE ||
59f99b
+                                       target == PIPE_TEXTURE_CUBE_ARRAY)) {
59f99b
+      if (need_layer) {
59f99b
+         nir_variable *var = nir_variable_create(b.shader, nir_var_shader_in,
59f99b
+                                                glsl_int_type(), "gl_Layer");
59f99b
+         var->data.location = VARYING_SLOT_LAYER;
59f99b
+         var->data.interpolation = INTERP_MODE_FLAT;
59f99b
+         layer = nir_load_var(&b, var);
59f99b
+      }
59f99b
+      else {
59f99b
+         layer = zero;
59f99b
+      }
59f99b
    }
59f99b
 
59f99b
    /* offset_pos = param.xy + f2i(coord.xy) */
59f99b
diff --git a/src/util/format/u_format.csv b/src/util/format/u_format.csv
59f99b
index 8acfb869bdb..237c4c95475 100644
59f99b
--- a/src/util/format/u_format.csv
59f99b
+++ b/src/util/format/u_format.csv
59f99b
@@ -500,7 +500,7 @@ PIPE_FORMAT_R4G4B4A4_UINT           , plain, 1, 1, 1, up4 , up4 , up4 , up4 , xy
59f99b
 PIPE_FORMAT_B4G4R4A4_UINT           , plain, 1, 1, 1, up4 , up4 , up4 , up4 , zyxw, rgb, up4 , up4 , up4 , up4 , yzwx
59f99b
 PIPE_FORMAT_A4R4G4B4_UINT           , plain, 1, 1, 1, up4 , up4 , up4 , up4 , yzwx, rgb, up4 , up4 , up4 , up4 , zyxw
59f99b
 PIPE_FORMAT_A4B4G4R4_UINT           , plain, 1, 1, 1, up4 , up4 , up4 , up4 , wzyx, rgb, up4 , up4 , up4 , up4 , xyzw
59f99b
-PIPE_FORMAT_A1R5G5B5_UINT           , plain, 1, 1, 1, up1 , up5 , up5 , up5 , wzyx, rgb, up5 , up5 , up5 , up1 , zyxw
59f99b
+PIPE_FORMAT_A1R5G5B5_UINT           , plain, 1, 1, 1, up1 , up5 , up5 , up5 , yzwx, rgb, up5 , up5 , up5 , up1 , zyxw
59f99b
 PIPE_FORMAT_A1B5G5R5_UINT           , plain, 1, 1, 1, up1 , up5 , up5 , up5 , wzyx, rgb, up5 , up5 , up5 , up1 , xyzw
59f99b
 PIPE_FORMAT_R5G5B5A1_UINT           , plain, 1, 1, 1, up5 , up5 , up5 , up1 , xyzw, rgb, up5 , up5 , up5 , up1 , wzyx
59f99b
 PIPE_FORMAT_B5G5R5A1_UINT           , plain, 1, 1, 1, up5 , up5 , up5 , up1 , zyxw, rgb, up1 , up5 , up5 , up5 , yzwx
59f99b
diff --git a/src/vulkan/device-select-layer/VkLayer_MESA_device_select.json b/src/vulkan/device-select-layer/VkLayer_MESA_device_select.json
59f99b
index 1d5fffd0135..361ae9fe74e 100644
59f99b
--- a/src/vulkan/device-select-layer/VkLayer_MESA_device_select.json
59f99b
+++ b/src/vulkan/device-select-layer/VkLayer_MESA_device_select.json
59f99b
@@ -4,7 +4,7 @@
59f99b
     "name": "VK_LAYER_MESA_device_select",
59f99b
     "type": "GLOBAL",
59f99b
     "library_path": "libVkLayer_MESA_device_select.so",
59f99b
-    "api_version": "1.1.73",
59f99b
+    "api_version": "1.2.73",
59f99b
     "implementation_version": "1",
59f99b
     "description": "Linux device selection layer",
59f99b
     "functions": {