panfrost: Use a macro for checking for a shared bind type

PAN_BIND_SHARED_MASK is all binding flags that mean that a resource
might be shared and accessible by other contexts.

Don't replace the usage of this pattern in panfrost_should_afbc and
panfrost_should_tile in case a new binding is introduced that not all
layouts can support.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16966>
This commit is contained in:
Icecream95 2022-06-10 22:51:07 +12:00 committed by Marge Bot
parent cd04679a08
commit b538519bbc
3 changed files with 6 additions and 6 deletions

View File

@ -762,9 +762,7 @@ panfrost_batch_submit(struct panfrost_context *ctx,
/* Shared depth/stencil resources are not supported, and would
* break this optimisation. */
assert(!(z_rsrc->base.bind & (PIPE_BIND_SHARED |
PIPE_BIND_SCANOUT |
PIPE_BIND_DISPLAY_TARGET)));
assert(!(z_rsrc->base.bind & PAN_BIND_SHARED_MASK));
if (batch->clear & PIPE_CLEAR_STENCIL) {
z_rsrc->stencil_value = batch->clear_stencil;

View File

@ -619,8 +619,7 @@ panfrost_resource_create_with_modifier(struct pipe_screen *screen,
util_range_init(&so->valid_buffer_range);
if (template->bind & (PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT |
PIPE_BIND_SHARED)) {
if (template->bind & PAN_BIND_SHARED_MASK) {
/* For compatibility with older consumers that may not be
* modifiers aware, treat INVALID as LINEAR for shared
* resources.
@ -814,7 +813,7 @@ pan_alloc_staging(struct panfrost_context *ctx, struct panfrost_resource *rsc,
}
tmpl.last_level = 0;
tmpl.bind |= PIPE_BIND_LINEAR;
tmpl.bind &= ~(PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT | PIPE_BIND_SHARED);
tmpl.bind &= ~PAN_BIND_SHARED_MASK;
struct pipe_resource *pstaging =
pctx->screen->resource_create(pctx->screen, &tmpl);

View File

@ -35,6 +35,9 @@
#define LAYOUT_CONVERT_THRESHOLD 8
#define PAN_MAX_BATCHES 32
#define PAN_BIND_SHARED_MASK (PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT | \
PIPE_BIND_SHARED)
struct panfrost_resource {
struct pipe_resource base;
struct {