if (aux_surf.size) {
image->aux_offset = surf.size;
image->aux_pitch = aux_surf.row_pitch;
+ image->aux_size = aux_surf.size;
}
return image;
return NULL;
}
+ image->aux_size = aux_surf.size;
+
const int end = image->aux_offset + aux_surf.size;
if (size < end)
size = end;
static __DRIimage *
intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate)
{
- int width, height, offset, stride, dri_format;
+ int width, height, offset, stride, size, dri_format;
__DRIimage *image;
if (parent == NULL)
int index = f->planes[plane].buffer_index;
offset = parent->offsets[index];
stride = parent->strides[index];
+ size = height * stride;
} else if (plane == 0) {
/* The only plane of a non-planar image: copy the parent definition
* directly. */
dri_format = parent->dri_format;
offset = parent->offset;
stride = parent->pitch;
+ size = height * stride;
} else if (plane == 1 && parent->modifier != DRM_FORMAT_MOD_INVALID &&
isl_drm_modifier_has_aux(parent->modifier)) {
/* Auxiliary plane */
dri_format = parent->dri_format;
offset = parent->aux_offset;
stride = parent->aux_pitch;
+ size = parent->aux_size;
} else {
return NULL;
}
- if (offset + height * stride > parent->bo->size) {
- _mesa_warning(NULL, "intel_create_sub_image: subimage out of bounds");
+ if (offset + size > parent->bo->size) {
+ _mesa_warning(NULL, "intel_from_planar: subimage out of bounds");
return NULL;
}