diff options
author | Nanley Chery <nanley.g.chery@intel.com> | 2019-11-15 09:17:23 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-12-11 15:49:41 -0800 |
commit | 58395e529331ec00bb3bfa40f4dc9f2ef9902e20 (patch) | |
tree | 0fdacc05050b2f2a512a40a194a105ce40d23bd6 | |
parent | ae06960627d5e7ac98fca320ad7d7e4f6c9621a1 (diff) | |
download | mesa-58395e529331ec00bb3bfa40f4dc9f2ef9902e20.tar.gz mesa-58395e529331ec00bb3bfa40f4dc9f2ef9902e20.tar.bz2 mesa-58395e529331ec00bb3bfa40f4dc9f2ef9902e20.zip |
iris: Fix import of multi-planar surfaces with modifiers
Multi-planar surfaces are allowed to have modifiers. Don't require
DRM_FORMAT_MOD_INVALID in order to create a surface for each plane
defined by the format.
Fixes: 246eebba4a8 ("iris: Export and import surfaces with modifiers that have aux data")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 21376cffb37018160ad3eef38b5a640ba1675a4f)
-rw-r--r-- | src/gallium/drivers/iris/iris_resource.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/iris/iris_resource.h | 7 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index c65fd51764a..a00c1455309 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -994,6 +994,7 @@ iris_resource_from_handle(struct pipe_screen *pscreen, } 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); @@ -1005,7 +1006,8 @@ iris_resource_from_handle(struct pipe_screen *pscreen, 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), @@ -1183,6 +1185,8 @@ iris_resource_get_handle(struct pipe_screen *pscreen, 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); diff --git a/src/gallium/drivers/iris/iris_resource.h b/src/gallium/drivers/iris/iris_resource.h index 39cbaba71e7..e8cc9ddb464 100644 --- a/src/gallium/drivers/iris/iris_resource.h +++ b/src/gallium/drivers/iris/iris_resource.h @@ -163,6 +163,13 @@ struct iris_resource { } 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 * be DRM_FORMAT_MOD_INVALID. |