Skip to content

Commit

Permalink
Merge "display: Set and handle default csc as BT709"
Browse files Browse the repository at this point in the history
  • Loading branch information
Linux Build Service Account authored and Gerrit - the friendly Code Review server committed Apr 7, 2018
2 parents 12a7468 + 0574622 commit 6a5d618
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
8 changes: 3 additions & 5 deletions gralloc/gr_buf_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,10 @@ Error BufferManager::AllocateBuffer(const BufferDescriptor &descriptor, buffer_h
hnd->base = 0;
hnd->base_metadata = 0;
hnd->layer_count = layer_count;
// set default csc as 709, but for video(yuv) its 601L
ColorSpace_t colorSpace = (buffer_type == BUFFER_TYPE_VIDEO) ? ITU_R_601 : ITU_R_709;
setMetaData(hnd, UPDATE_COLOR_SPACE, reinterpret_cast<void *>(&colorSpace));

if (buffer_type == BUFFER_TYPE_VIDEO) {
// set default csc to 601L for only video buffers
ColorSpace_t colorSpace = ITU_R_601;
setMetaData(hnd, UPDATE_COLOR_SPACE, reinterpret_cast<void *>(&colorSpace));
}
*handle = hnd;
RegisterHandleLocked(hnd, data.ion_handle, e_data.ion_handle);
ALOGD_IF(DEBUG, "Allocated buffer handle: %p id: %" PRIu64, hnd, hnd->id);
Expand Down
32 changes: 15 additions & 17 deletions sdm/libs/hwc2/hwc_layers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,22 @@ DisplayError SetCSC(const private_handle_t *pvt_handle, ColorMetaData *color_met
}

switch (csc) {
case ITU_R_601:
case ITU_R_601_FR:
// video and display driver uses 601_525
color_metadata->colorPrimaries = ColorPrimaries_BT601_6_525;
break;
case ITU_R_709:
color_metadata->colorPrimaries = ColorPrimaries_BT709_5;
break;
case ITU_R_2020:
case ITU_R_2020_FR:
color_metadata->colorPrimaries = ColorPrimaries_BT2020;
break;
default:
DLOGE("Unsupported CSC: %d", csc);
return kErrorNotSupported;
case ITU_R_601:
case ITU_R_601_FR:
// video and display driver uses 601_525
color_metadata->colorPrimaries = ColorPrimaries_BT601_6_525;
break;
case ITU_R_709:
color_metadata->colorPrimaries = ColorPrimaries_BT709_5;
break;
case ITU_R_2020:
case ITU_R_2020_FR:
color_metadata->colorPrimaries = ColorPrimaries_BT2020;
break;
default:
DLOGE("Unsupported CSC: %d", csc);
return kErrorNotSupported;
}
} else {
return kErrorNotSupported;
}
}

Expand Down

0 comments on commit 6a5d618

Please sign in to comment.