}
assert(mod_inf);
+ res->external_format = whandle->format;
res->mod_info = mod_inf;
isl_surf_usage_flags_t isl_usage = pipe_bind_to_isl_usage(templ->bind);
if (templ->target == PIPE_BUFFER) {
res->surf.tiling = ISL_TILING_LINEAR;
} else {
- if (whandle->modifier == DRM_FORMAT_MOD_INVALID || whandle->plane == 0) {
+ /* Create a surface for each plane specified by the external format. */
+ if (whandle->plane < util_format_get_num_planes(whandle->format)) {
UNUSED const bool isl_surf_created_successfully =
isl_surf_init(&screen->isl_dev, &res->surf,
.dim = target_to_isl_surf_dim(templ->target),
whandle->stride = res->surf.row_pitch_B;
bo = res->bo;
}
+
+ whandle->format = res->external_format;
whandle->modifier =
res->mod_info ? res->mod_info->modifier
: tiling_to_modifier(res->bo->tiling_mode);
uint16_t has_hiz;
} aux;
+ /**
+ * For external surfaces, this is format that was used to create or import
+ * the surface. For internal surfaces, this will always be
+ * PIPE_FORMAT_NONE.
+ */
+ enum pipe_format external_format;
+
/**
* For external surfaces, this is DRM format modifier that was used to
* create or import the surface. For internal surfaces, this will always