Skip to content

Commit

Permalink
Set the dest layer as Video when the format is AB24
Browse files Browse the repository at this point in the history
After create the layer surface with format AB24 for video or protected
layer. need to re-set the layer as Video.
also do not use RBC once the preferred modifier is 0.

Change-Id: Ic01b7069186d847d923af77ea257fb886f5429bb
Tests: Work well on Android Q
Tracked-On: https://jira.devtools.intel.com/browse/OAM-82976
Signed-off-by: Shaofeng Tang <shaofeng.tang@intel.com>
  • Loading branch information
Shao-Feng committed Jul 15, 2019
1 parent 86a4c73 commit 4f6f697
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
13 changes: 6 additions & 7 deletions common/display/displayplanemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,12 +749,11 @@ void DisplayPlaneManager::EnsureOffScreenTarget(DisplayPlaneState &plane) {
int dest_x = plane.GetDisplayFrame().left;
int dest_w = plane.GetDisplayFrame().right - dest_x;

bool video_separate = plane.IsVideoPlane() &&
(plane.GetSourceLayers().size() == 1) &&
!(dest_w % 2 || dest_x % 2);
bool video_separate =
plane.IsVideoPlane() && (plane.GetSourceLayers().size() == 1);
uint32_t preferred_format = 0;
uint32_t usage = hwcomposer::kLayerNormal;
if (video_separate) {
if (video_separate && !(dest_w % 2 || dest_x % 2)) {
preferred_format = plane.GetDisplayPlane()->GetPreferredVideoFormat();
} else {
preferred_format = plane.GetDisplayPlane()->GetPreferredFormat();
Expand All @@ -781,16 +780,16 @@ void DisplayPlaneManager::EnsureOffScreenTarget(DisplayPlaneState &plane) {
NativeSurface *new_surface = NULL;
if (video_separate) {
new_surface = CreateVideoSurface(width_, height_);
usage = hwcomposer::kLayerVideo;
} else {
new_surface = Create3DSurface(width_, height_);
}

if (plane.IsVideoPlane() && (plane.GetSourceLayers().size() == 1))
usage = hwcomposer::kLayerVideo;

bool modifer_succeeded = false;
new_surface->Init(resource_manager_, preferred_format, usage, modifier,
&modifer_succeeded);
if (video_separate)
new_surface->GetLayer()->SetVideoLayer(true);

if (modifer_succeeded) {
plane.GetDisplayPlane()->PreferredFormatModifierValidated();
Expand Down
21 changes: 13 additions & 8 deletions os/android/gralloc1bufferhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,21 @@ bool Gralloc1BufferHandler::CreateBuffer(uint32_t w, uint32_t h, int format,

set_format_(gralloc1_dvc, temp->gralloc1_buffer_descriptor_t_, pixel_format);
#ifdef ENABLE_RBC
uint64_t modifier = 0;
if (set_modifier_) {
if (preferred_modifier != -1) {
modifier = preferred_modifier;
if (preferred_modifier != 0) {
uint64_t modifier = 0;
if (set_modifier_) {
if (preferred_modifier != -1) {
modifier = preferred_modifier;
}
set_modifier_(gralloc1_dvc, temp->gralloc1_buffer_descriptor_t_,
modifier);
}
set_modifier_(gralloc1_dvc, temp->gralloc1_buffer_descriptor_t_, modifier);
}

if (modifier_used && modifier != DRM_FORMAT_MOD_NONE) {
*modifier_used = true;
if (modifier_used && modifier != DRM_FORMAT_MOD_NONE) {
*modifier_used = true;
}
} else {
*modifier_used = false;
}
#else
if (modifier_used) {
Expand Down

0 comments on commit 4f6f697

Please sign in to comment.