Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

HDR enable #701

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

HDR enable #701

wants to merge 1 commit into from

Conversation

yuanzhel
Copy link
Contributor

@yuanzhel yuanzhel commented Aug 31, 2020

Copy link
Contributor

@shuangwan01 shuangwan01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -782,10 +861,29 @@ bool DrmDisplay::Commit(
display_queue_->ResetPlanes(pset.get());

if (display_state_ & kNeedsModeset) {
/* KK: Put to check only if input layer is a hdr */
for (const DisplayPlaneState &comp_plane : composition_planes) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check if the layer is HDR layer, otherwise no need to apply HDR drm mode set

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also need check if the display supports HDR here, for example check display_hdrMd

if (!ApplyPendingModeset(pset.get())) {
ETRACE("Failed to Modeset.");
return false;
}

if (!ApplyPendingHdr(pset.get(), &color_state)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct hdr_metadata final_hdr_metadata, layer_metadata

target->hdr_md_blob_id) < 0 ||
drmModeAtomicAddProperty(property_set, connector_, colorspace_op_prop_,
to_kernel_colorspace(color_state.o_cs)) < 0;
if (ret) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before return, need to call drmModeDestroyPropertyBlob to avoid memory leak.

*outMinLuminance = float(outminluminance);
}

return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be always true, no matter if (display_hdrMd), should be wrong.

float *outMaxLuminance,
float *outMaxAverageLuminance,
float *outMinLuminance) {
return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default shall be false.

float *outMaxLuminance,
float *outMaxAverageLuminance,
float *outMinLuminance) {
return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default shall be false.

float *outMaxLuminance,
float *outMaxAverageLuminance,
float *outMinLuminance) {
return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default shall be false.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with Mosaic and logic

float *outMaxLuminance,
float *outMaxAverageLuminance,
float *outMinLuminance) {
return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default shall be false.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with mosaic and logic

return;
}

display_hdrMd = (struct drm_edid_hdr_metadata_static *)malloc(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't see where display_hdrMd is freed?

@@ -111,6 +111,19 @@ class LogicalDisplay : public NativeDisplay {
void GetDisplayCapabilities(uint32_t *numCapabilities,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does HDR only work on DrmDisplay?
if yes, no need to add this method into Logic and Mosaic display.
you can add a default method on Native display and return false.

@@ -316,6 +324,9 @@ struct OverlayLayer {
LayerComposition supported_composition_ = kAll;
LayerComposition actual_composition_ = kAll;
HWCLayerType type_ = kLayerNormal;

struct hdr_metadata hdrmetadata;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

property should be named with "_" at the end to be different with variable in method

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hdr_metadata_
color_space_

float *outMaxLuminance,
float *outMaxAverageLuminance,
float *outMinLuminance) {
return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with Mosaic and logic

@@ -83,6 +83,18 @@ class VirtualDisplay : public NativeDisplay {
void GetDisplayCapabilities(uint32_t *numCapabilities,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with mosaic and logic

float *outMaxLuminance,
float *outMaxAverageLuminance,
float *outMinLuminance) {
return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with mosaic and logic

#include <platformdefines.h>
#include "hdr_metadata_defs.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hdr_metadata_defs.h is also in public folder as same as hwcdefs.h
it is better to use <hdr_metadata_defs.h>

@@ -347,6 +444,9 @@ struct HwcLayer {
uint32_t solid_color_ = 0xff;
bool use_for_mosaic_ = false;

struct hdr_metadata hdr_mdata;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hdr_mdata_
colorspace_

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and need to initialize with null and 0

@@ -0,0 +1,657 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests is not updated for a long time, did you ever try to run this test?

@@ -15,6 +15,7 @@
*/

#include "drmdisplay.h"
#include "hdr_metadata_defs.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a public header file, use <>

#include <algorithm>
#include <sstream>
#include <string>

#include "displayplanemanager.h"
#include "displayqueue.h"
#include "drmdisplaymanager.h"
#include "hdr_metadata_defs.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why it is included twice?


bool DrmDisplay::GetPerFrameMetadataKeys(uint32_t *outNumKeys,
int32_t *outKeys) {
*outNumKeys = KEY_NUM_PER_FRAME_METADATA_KEYS;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KEY_NUM_PER_FRAME_METADATA_KEYS is a enum, and not assigned with a value explicitly

return true;
for (int i = 0; i < KEY_NUM_PER_FRAME_METADATA_KEYS; i++) {
*(outKeys + i) = i;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outKey[i] = i;

@Shao-Feng
Copy link
Contributor

In original coding style, we use "_" in parameter name, instead of Upcase

@@ -205,7 +307,18 @@ class DrmDisplay : public PhysicalDisplay {
bool first_commit_ = false;
uint32_t prefer_display_mode_ = 0;
uint32_t perf_display_mode_ = 0;
std::string display_name_ = "";
std::string display_name_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not initialize display_name_

std::vector<int32_t> current_color_mode_ = {HAL_COLOR_MODE_NATIVE};

/* Display's static HDR metadata */
struct drm_edid_hdr_metadata_static *display_hdrMd;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need end with "_" for all propertys

implement vsync2.4 callback, setactiveconfigwithconstraints
and getdisplayvsyncperiod.

Add an empty SetDisplayBrightness to resolove boot problem

Set the ALL_EDID_FLAG_PROPERTY to send SF all available modes.

Tracked-On: OAM-92711
Signed-Off-By: Liu, Yuanzhe <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants