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

Composition with vpp #94

Open
wants to merge 4 commits into
base: celadon/u/mr0/master
Choose a base branch
from
Open
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
17 changes: 16 additions & 1 deletion Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,18 @@ cc_defaults {
"libsync",
"libui",
"libutils",
"libva",
"libva-android",
],

include_dirs: ["vendor/intel/external/drm-hwcomposer"],
include_dirs: [
"vendor/intel/external/drm-hwcomposer",
"vendor/intel/external/drm-hwcomposer/va",
"vendor/intel/external/drm-hwcomposer/include",
"hardware/intel/external/minigbm-intel/cros_gralloc",
"hardware/intel/external/libva",
"hardware/intel/external/drm-intel/android",
],

header_libs: [
"android.hardware.graphics.composer3-command-buffer",
Expand All @@ -68,6 +77,7 @@ cc_defaults {
"-DHWC2_USE_CPP11",
"-std=c++17",
"-DUSE_IMAPPER4_METADATA_API",
"-DUSE_GRALLOC1",
],

product_variables: {
Expand Down Expand Up @@ -111,6 +121,11 @@ filegroup {
"hwc2_device/HwcDisplayConfigs.cpp",
"hwc2_device/HwcLayer.cpp",
"hwc2_device/hwc2_device.cpp",

"va/varenderer.cpp",
"va/vautils.cpp",
"utils/autolock.cpp",
"gralloc1/gralloc1bufferhandler.cpp",
],
}

Expand Down
52 changes: 7 additions & 45 deletions backend/Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@ HWC2::Error Backend::ValidateDisplay(HwcDisplay *display, uint32_t *num_types,
std::tie(client_start, client_size) = GetClientLayers(display, layers);

MarkValidated(layers, client_start, client_size);

bool testing_needed = !(client_start == 0 && client_size == layers.size());

AtomicCommitArgs a_args = {.test_only = true};

if (testing_needed &&
display->CreateComposition(a_args) != HWC2::Error::None) {
++display->total_stats().failed_kms_validate_;
client_start = 0;
client_size = layers.size();
MarkValidated(layers, 0, client_size);
}
}

*num_types = client_size;
Expand All @@ -80,52 +68,23 @@ std::tuple<int, size_t> Backend::GetClientLayers(
int client_start = -1;
size_t client_size = 0;

int device_start = -1;
size_t device_size = 0;
for (size_t z_order = 0; z_order < layers.size(); ++z_order) {
if (IsClientLayer(display, layers[z_order])) {
if (client_start < 0)
client_start = (int)z_order;
client_size = (z_order - client_start) + 1;
}
if (IsVideoLayer(layers[z_order])) {
if (device_start < 0)
device_start = (int)z_order;
device_size = (z_order - device_start) + 1;
}
}
if (device_size == 0)
return GetExtraClientRange(display, layers, client_start, client_size);
else {
bool status = true;
MarkValidated(layers, client_start, client_size);
for (size_t z_order = 0; z_order < layers.size(); ++z_order) {
if (z_order >= client_start &&
z_order <= (client_start + client_size - 1) &&
IsVideoLayer(layers[z_order]))
status = false;

if (z_order >= device_start &&
z_order <= (device_start + device_size - 1) &&
layers[z_order]->GetValidatedType() == HWC2::Composition::Client)
status = false;
}
if (!status) {
ALOGE("status is abnormal");
return GetExtraClientRange(display, layers, client_start, client_size);
}
return GetExtraClientRange2(display, layers, client_start, client_size, device_start, device_size);
}

return std::make_tuple(client_start, client_size);
}

bool Backend::IsClientLayer(HwcDisplay *display, HwcLayer *layer) {
return !HardwareSupportsLayerType(layer->GetSfType()) ||
!layer->IsLayerUsableAsDevice() ||
display->color_transform_hint() != HAL_COLOR_TRANSFORM_IDENTITY ||
(layer->GetLayerData().pi.RequireScalingOrPhasing() &&
display->GetHwc2()->GetResMan().ForcedScalingWithGpu()) ||
(!display->IsInHeadlessMode() && display->GetPipe().device->IsIvshmDev());
display->GetHwc2()->GetResMan().ForcedScalingWithGpu());
}

bool Backend::IsVideoLayer(HwcLayer *layer) {
Expand Down Expand Up @@ -155,10 +114,13 @@ uint32_t Backend::CalcPixOps(const std::vector<HwcLayer *> &layers,
void Backend::MarkValidated(std::vector<HwcLayer *> &layers,
size_t client_first_z, size_t client_size) {
for (size_t z_order = 0; z_order < layers.size(); ++z_order) {
if (z_order >= client_first_z && z_order < client_first_z + client_size)
if (z_order >= client_first_z && z_order < client_first_z + client_size) {
layers[z_order]->SetValidatedType(HWC2::Composition::Client);
else
layers[z_order]->SetUseVPPCompose(false);
} else {
layers[z_order]->SetValidatedType(HWC2::Composition::Device);
layers[z_order]->SetUseVPPCompose(true);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions backend/Backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class Backend {
size_t first_z, size_t size);
static void MarkValidated(std::vector<HwcLayer *> &layers,
size_t client_first_z, size_t client_size);
static void vaMarkValidated(std::vector<HwcLayer *> &layers);
static std::tuple<int, int> GetExtraClientRange(
HwcDisplay *display, const std::vector<HwcLayer *> &layers,
int client_start, size_t client_size);
Expand Down
Loading
Loading