From d56aa1353a0e0807f07b397ae9efcd75fbf4c8de Mon Sep 17 00:00:00 2001 From: Ren-Pei Zeng Date: Fri, 4 Oct 2024 07:26:53 +0000 Subject: [PATCH] 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 Tested-by: Ren-Pei Zeng Commit-Queue: Ren-Pei Zeng --- cros_gralloc/cros_gralloc_helpers.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cros_gralloc/cros_gralloc_helpers.cc b/cros_gralloc/cros_gralloc_helpers.cc index 4b40bfd..468f179 100644 --- a/cros_gralloc/cros_gralloc_helpers.cc +++ b/cros_gralloc/cros_gralloc_helpers.cc @@ -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; }