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 #173

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions cros_gralloc/cros_gralloc_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,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);
handle_usage(&usage, GRALLOC_USAGE_PRIVATE_2, &use_flags, BO_USE_LOCAL_MEMORY);

if (usage) {
ALOGE("Unhandled gralloc usage: %llx", (unsigned long long)usage);
Expand Down
1 change: 1 addition & 0 deletions drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ extern "C" {
#define BO_USE_RENDERSCRIPT (1ull << 17)
#define BO_USE_GPU_DATA_BUFFER (1ull << 18)
#define BO_USE_SENSOR_DIRECT_DATA (1ull << 19)
#define BO_USE_LOCAL_MEMORY (1ull << 20)

#define BO_USE_ARC_SCREEN_CAP_PROBED (1ull << 63)

Expand Down
6 changes: 4 additions & 2 deletions drv_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,13 @@ struct backend {
// clang-format off
#define BO_USE_RENDER_MASK (BO_USE_LINEAR | BO_USE_RENDERING | BO_USE_RENDERSCRIPT | \
BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | \
BO_USE_SW_WRITE_RARELY | BO_USE_TEXTURE | BO_USE_FRONT_RENDERING)
BO_USE_SW_WRITE_RARELY | BO_USE_TEXTURE | BO_USE_FRONT_RENDERING | \
BO_USE_LOCAL_MEMORY)

#define BO_USE_TEXTURE_MASK (BO_USE_LINEAR | BO_USE_RENDERSCRIPT | BO_USE_SW_READ_OFTEN | \
BO_USE_SW_WRITE_OFTEN | BO_USE_SW_READ_RARELY | \
BO_USE_SW_WRITE_RARELY | BO_USE_TEXTURE | BO_USE_FRONT_RENDERING)
BO_USE_SW_WRITE_RARELY | BO_USE_TEXTURE | BO_USE_FRONT_RENDERING | \
BO_USE_LOCAL_MEMORY)

#define BO_USE_SW_MASK (BO_USE_SW_READ_OFTEN | BO_USE_SW_WRITE_OFTEN | \
BO_USE_SW_READ_RARELY | BO_USE_SW_WRITE_RARELY | BO_USE_FRONT_RENDERING)
Expand Down
10 changes: 6 additions & 4 deletions i915.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ static int i915_add_combinations(struct driver *drv)
const uint64_t scanout_and_render = BO_USE_RENDER_MASK | BO_USE_SCANOUT;
const uint64_t render = BO_USE_RENDER_MASK;
const uint64_t texture_only = BO_USE_TEXTURE_MASK;
uint64_t render_flags = BO_USE_RENDER_MASK;
uint64_t texture_flags = BO_USE_TEXTURE_MASK;
bool is_kvm = vm_type() & HYPERTYPE_TYPE_KVM;

Expand Down Expand Up @@ -915,14 +914,17 @@ static int i915_bo_compute_metadata(struct bo *bo, uint32_t width, uint32_t heig

static bool is_need_local(int64_t use_flags)
{
static bool local = true;
static bool local = false;

if (use_flags & BO_USE_LOCAL_MEMORY) {
local = true;
}

if (use_flags & BO_USE_SW_READ_RARELY || use_flags & BO_USE_SW_READ_OFTEN ||
use_flags & BO_USE_SW_WRITE_RARELY || use_flags & BO_USE_SW_WRITE_OFTEN) {
local = false;
} else {
local = true;
}

return local;
}

Expand Down
Loading