iris: Drop buffer support in resource_from_handle

The callers don't seem to pass targets of PIPE_BUFFER. Stop nesting an
if-else block by dropping support for this target.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6311>
This commit is contained in:
Nanley Chery
2020-07-27 10:05:07 -07:00
committed by Marge Bot
parent c54bb23967
commit 9d503b36ca

View File

@@ -979,6 +979,8 @@ iris_resource_from_handle(struct pipe_screen *pscreen,
struct winsys_handle *whandle, struct winsys_handle *whandle,
unsigned usage) unsigned usage)
{ {
assert(templ->target != PIPE_BUFFER);
struct iris_screen *screen = (struct iris_screen *)pscreen; struct iris_screen *screen = (struct iris_screen *)pscreen;
struct iris_bufmgr *bufmgr = screen->bufmgr; struct iris_bufmgr *bufmgr = screen->bufmgr;
struct iris_resource *res = iris_alloc_resource(pscreen, templ); struct iris_resource *res = iris_alloc_resource(pscreen, templ);
@@ -1003,9 +1005,6 @@ iris_resource_from_handle(struct pipe_screen *pscreen,
res->offset = whandle->offset; res->offset = whandle->offset;
res->external_format = whandle->format; res->external_format = whandle->format;
if (templ->target == PIPE_BUFFER) {
res->surf.tiling = ISL_TILING_LINEAR;
} else {
/* Create a surface for each plane specified by the external format. */ /* Create a surface for each plane specified by the external format. */
if (whandle->plane < util_format_get_num_planes(whandle->format)) { if (whandle->plane < util_format_get_num_planes(whandle->format)) {
@@ -1022,23 +1021,20 @@ iris_resource_from_handle(struct pipe_screen *pscreen,
UNUSED const bool ok = iris_resource_configure_aux(screen, res, true); UNUSED const bool ok = iris_resource_configure_aux(screen, res, true);
assert(ok); assert(ok);
/* The gallium dri layer will create a separate plane resource /* The gallium dri layer will create a separate plane resource for the
* for the aux image. iris_resource_finish_aux_import will * aux image. iris_resource_finish_aux_import will merge the separate aux
* merge the separate aux parameters back into a single * parameters back into a single iris_resource.
* iris_resource.
*/ */
} else { } else {
/* Save modifier import information to reconstruct later. After /* Save modifier import information to reconstruct later. After import,
* import, this will be available under a second image accessible * this will be available under a second image accessible from the main
* from the main image with res->base.next. See * image with res->base.next. See iris_resource_finish_aux_import.
* iris_resource_finish_aux_import.
*/ */
res->aux.surf.row_pitch_B = whandle->stride; res->aux.surf.row_pitch_B = whandle->stride;
res->aux.offset = whandle->offset; res->aux.offset = whandle->offset;
res->aux.bo = res->bo; res->aux.bo = res->bo;
res->bo = NULL; res->bo = NULL;
} }
}
return &res->base; return &res->base;