diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 57a57b43f9e..73e4a8e1eaf 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -1325,8 +1325,15 @@ iris_resource_from_handle(struct pipe_screen *pscreen, assert(!devinfo->has_flat_ccs); assert(plane_res->bo->size >= plane_res->offset + main_res->aux.surf.size_B); - assert(main_res->aux.surf.row_pitch_B == - plane_res->surf.row_pitch_B); + + if (devinfo->has_aux_map) { + assert(plane_res->surf.row_pitch_B == + main_res->surf.row_pitch_B / + INTEL_AUX_MAP_MAIN_PITCH_SCALEDOWN); + } else { + assert(plane_res->surf.row_pitch_B == + main_res->aux.surf.row_pitch_B); + } iris_bo_reference(plane_res->bo); main_res->aux.bo = plane_res->bo; @@ -1670,8 +1677,15 @@ iris_resource_get_param(struct pipe_screen *pscreen, } return true; case PIPE_RESOURCE_PARAM_STRIDE: - *value = wants_cc ? ISL_DRM_CC_PLANE_PITCH_B : - wants_aux ? res->aux.surf.row_pitch_B : res->surf.row_pitch_B; + if (wants_cc) { + *value = ISL_DRM_CC_PLANE_PITCH_B; + } else if (wants_aux) { + *value = screen->devinfo->has_aux_map ? + res->surf.row_pitch_B / INTEL_AUX_MAP_MAIN_PITCH_SCALEDOWN : + res->aux.surf.row_pitch_B; + } else { + *value = res->surf.row_pitch_B; + } /* Mesa's implementation of eglCreateImage rejects strides of zero (see * dri2_check_dma_buf_attribs). Ensure we return a non-zero stride as diff --git a/src/intel/common/intel_aux_map.h b/src/intel/common/intel_aux_map.h index 26f402c3123..acf5b574ca3 100644 --- a/src/intel/common/intel_aux_map.h +++ b/src/intel/common/intel_aux_map.h @@ -45,6 +45,16 @@ struct intel_device_info; #define INTEL_AUX_MAP_ENTRY_VALID_BIT 0x1ull +/** + * The ratio between the granularity of main surface pitch and AUX data pitch + * (when viewed as a surface). + * + * In agreement with Bspec 44930, the kernel expects that every 512B of the + * main surface pitch maps to 64B of the AUX data pitch. This is not + * documented in drm_fourcc.h. + */ +#define INTEL_AUX_MAP_MAIN_PITCH_SCALEDOWN (512 / 64) + struct intel_aux_map_context * intel_aux_map_init(void *driver_ctx, struct intel_mapped_pinned_buffer_alloc *buffer_alloc, diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 8155ef38eed..0c67bac22f5 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -2601,7 +2601,8 @@ anv_get_image_subresource_layout(const struct anv_image *image, assert(isl_drm_modifier_has_aux(image->vk.drm_format_mod)); mem_range = &image->planes[0].compr_ctrl_memory_range; - row_pitch_B = image->planes[0].aux_surface.isl.row_pitch_B; + row_pitch_B = image->planes[0].primary_surface.isl.row_pitch_B / + INTEL_AUX_MAP_MAIN_PITCH_SCALEDOWN; } else if (mem_plane == 1 && image->planes[0].aux_surface.memory_range.size > 0) { assert(image->n_planes == 1);