iris: store modifier info in res
This commit is contained in:
@@ -476,16 +476,15 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen,
|
|||||||
const struct util_format_description *format_desc =
|
const struct util_format_description *format_desc =
|
||||||
util_format_description(templ->format);
|
util_format_description(templ->format);
|
||||||
const bool has_depth = util_format_has_depth(format_desc);
|
const bool has_depth = util_format_has_depth(format_desc);
|
||||||
const struct isl_drm_modifier_info *mod_info = NULL;
|
|
||||||
uint64_t modifier =
|
uint64_t modifier =
|
||||||
select_best_modifier(devinfo, modifiers, modifiers_count);
|
select_best_modifier(devinfo, modifiers, modifiers_count);
|
||||||
|
|
||||||
isl_tiling_flags_t tiling_flags = ISL_TILING_ANY_MASK;
|
isl_tiling_flags_t tiling_flags = ISL_TILING_ANY_MASK;
|
||||||
|
|
||||||
if (modifier != DRM_FORMAT_MOD_INVALID) {
|
if (modifier != DRM_FORMAT_MOD_INVALID) {
|
||||||
mod_info = isl_drm_modifier_get_info(modifier);
|
res->mod_info = isl_drm_modifier_get_info(modifier);
|
||||||
|
|
||||||
tiling_flags = 1 << mod_info->tiling;
|
tiling_flags = 1 << res->mod_info->tiling;
|
||||||
} else {
|
} else {
|
||||||
if (modifiers_count > 0) {
|
if (modifiers_count > 0) {
|
||||||
fprintf(stderr, "Unsupported modifier, resource creation failed.\n");
|
fprintf(stderr, "Unsupported modifier, resource creation failed.\n");
|
||||||
@@ -551,8 +550,8 @@ iris_resource_create_with_modifiers(struct pipe_screen *pscreen,
|
|||||||
.tiling_flags = tiling_flags);
|
.tiling_flags = tiling_flags);
|
||||||
assert(isl_surf_created_successfully);
|
assert(isl_surf_created_successfully);
|
||||||
|
|
||||||
if (mod_info) {
|
if (res->mod_info) {
|
||||||
res->aux.possible_usages |= 1 << mod_info->aux_usage;
|
res->aux.possible_usages |= 1 << res->mod_info->aux_usage;
|
||||||
} else if (has_depth) {
|
} else if (has_depth) {
|
||||||
res->aux.possible_usages |= 1 << ISL_AUX_USAGE_HIZ;
|
res->aux.possible_usages |= 1 << ISL_AUX_USAGE_HIZ;
|
||||||
} else if (supports_mcs(&res->surf)) {
|
} else if (supports_mcs(&res->surf)) {
|
||||||
@@ -683,9 +682,8 @@ iris_resource_from_handle(struct pipe_screen *pscreen,
|
|||||||
if (modifier == DRM_FORMAT_MOD_INVALID) {
|
if (modifier == DRM_FORMAT_MOD_INVALID) {
|
||||||
modifier = tiling_to_modifier(res->bo->tiling_mode);
|
modifier = tiling_to_modifier(res->bo->tiling_mode);
|
||||||
}
|
}
|
||||||
const struct isl_drm_modifier_info *mod_info =
|
res->mod_info = isl_drm_modifier_get_info(modifier);
|
||||||
isl_drm_modifier_get_info(modifier);
|
assert(res->mod_info);
|
||||||
assert(mod_info);
|
|
||||||
|
|
||||||
isl_surf_usage_flags_t isl_usage = pipe_bind_to_isl_usage(templ->bind);
|
isl_surf_usage_flags_t isl_usage = pipe_bind_to_isl_usage(templ->bind);
|
||||||
|
|
||||||
@@ -708,7 +706,7 @@ iris_resource_from_handle(struct pipe_screen *pscreen,
|
|||||||
.min_alignment_B = 0,
|
.min_alignment_B = 0,
|
||||||
.row_pitch_B = whandle->stride,
|
.row_pitch_B = whandle->stride,
|
||||||
.usage = isl_usage,
|
.usage = isl_usage,
|
||||||
.tiling_flags = 1 << mod_info->tiling);
|
.tiling_flags = 1 << res->mod_info->tiling);
|
||||||
|
|
||||||
assert(res->bo->tiling_mode ==
|
assert(res->bo->tiling_mode ==
|
||||||
isl_tiling_to_i915_tiling(res->surf.tiling));
|
isl_tiling_to_i915_tiling(res->surf.tiling));
|
||||||
|
@@ -112,6 +112,13 @@ struct iris_resource {
|
|||||||
*/
|
*/
|
||||||
enum isl_aux_state **state;
|
enum isl_aux_state **state;
|
||||||
} aux;
|
} aux;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For external surfaces, this is DRM format modifier that was used to
|
||||||
|
* create or import the surface. For internal surfaces, this will always
|
||||||
|
* be DRM_FORMAT_MOD_INVALID.
|
||||||
|
*/
|
||||||
|
const struct isl_drm_modifier_info *mod_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user