cros_gralloc: Fix gralloc -> gbm usage flag mapping

GRALLOC_USAGE_SW_READ_RARELY was incorrectly mapped to
BO_USE_SW_READ_OFTEN since GRALLOC_USAGE_SW_READ_OFTEN (== 3) contains
GRALLOC_USAGE_SW_READ_RARELY (== 2) in bit mask. Fix it by making the
flag check compare the full bit mask.

Same for the WRITE case.

BUG=None
TEST=CQ

Change-Id: I0c1e0e6f07978b6090472b2d470f5880ad231d0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/5907583
Reviewed-by: Jason Macnak <natsu@google.com>
Tested-by: Ren-Pei Zeng <kamesan@chromium.org>
Commit-Queue: Ren-Pei Zeng <kamesan@chromium.org>
This commit is contained in:
Ren-Pei Zeng 2024-10-04 07:26:53 +00:00 committed by Chromeos LUCI
parent eb0e5fa310
commit d56aa1353a

View file

@ -96,7 +96,7 @@ uint32_t cros_gralloc_convert_format(int format)
static inline void handle_usage(uint64_t *gralloc_usage, uint64_t gralloc_mask,
uint64_t *bo_use_flags, uint64_t bo_mask)
{
if ((*gralloc_usage) & gralloc_mask) {
if (((*gralloc_usage) & gralloc_mask) == gralloc_mask) {
(*gralloc_usage) &= ~gralloc_mask;
(*bo_use_flags) |= bo_mask;
}