Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the special gralloc private 2 flag check #166

Open
wants to merge 1 commit into
base: celadon/u/mr0/master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions cros_gralloc/cros_gralloc_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,17 @@ static inline void handle_usage(uint64_t *gralloc_usage, uint64_t gralloc_mask,
}
}

static inline void unset_usage(uint64_t *gralloc_usage, uint64_t *bo_use_flags)
{
if ((*gralloc_usage) & GRALLOC_USAGE_PRIVATE_2) {
(*gralloc_usage) &= ~GRALLOC_USAGE_PRIVATE_2;
(*bo_use_flags) &= ~(BO_USE_SW_READ_RARELY | BO_USE_SW_READ_OFTEN |
BO_USE_SW_WRITE_RARELY | BO_USE_SW_WRITE_OFTEN);
} else {
(*bo_use_flags) |= BO_USE_SW_READ_OFTEN;
}
}

uint64_t cros_gralloc_convert_usage(uint64_t usage)
{
uint64_t use_flags = BO_USE_NONE;
Expand Down Expand Up @@ -160,6 +171,7 @@ uint64_t cros_gralloc_convert_usage(uint64_t usage)
BO_USE_SENSOR_DIRECT_DATA);
handle_usage(&usage, BUFFER_USAGE_GPU_DATA_BUFFER, &use_flags, BO_USE_GPU_DATA_BUFFER);
handle_usage(&usage, BUFFER_USAGE_FRONT_RENDERING_MASK, &use_flags, BO_USE_FRONT_RENDERING);
unset_usage(&usage, &use_flags);

if (usage) {
ALOGE("Unhandled gralloc usage: %llx", (unsigned long long)usage);
Expand Down