[Mesa-dev] [PATCH v2 24/37] panfrost: Cache GPU accesses to BOs
Alyssa Rosenzweig
alyssa at rosenzweig.io
Mon Sep 16 14:05:52 UTC 2019
> + /* If ->gpu_access is 0, the BO is idle, and if the WRITE flag
> + * is cleared, that means we only have readers.
> + */
> + if (!bo->gpu_access)
> + return true;
> + else if (!(access_type & PAN_BO_GPU_ACCESS_READ) &&
> + !(bo->gpu_access & PAN_BO_GPU_ACCESS_WRITE))
> + return true;
The second condition is a little confusing, though I think it's correct.
Not sure if there's any way to clarify what's meant but just thought I'd
comment, since inevitably future readers will squint too.
> + /* Update the BO access flags so that panfrost_bo_wait() knows
> + * about all pending accesses.
> + */
> + bo->gpu_access |= flags & (PAN_BO_GPU_ACCESS_RW);
This looks like black magic. Maybe just clarify in the comment why this
& is reasonable (relying on bit mask magic).
---
That aside, as I mentioned it would maybe make more sense to squash this
into the patch introduce the bo_wait ioctl() in the first place? If
that's too complicated with merge conflicts and stuff, don't sweat it,
though :)
More information about the mesa-dev
mailing list