Skip to content

Commit

Permalink
hwc2: Add support to query display wb capabilities
Browse files Browse the repository at this point in the history
Virtual display uses hardware wb to get output data.
And output buffer format depends on wb hardware capabilities.

Change-Id: If06b9e36eeda630938b07933878fe2d148ea9bcb
  • Loading branch information
Ramakant Singh committed Aug 27, 2018
1 parent 5008dfc commit dbe738a
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 2 deletions.
7 changes: 7 additions & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ display_config_version := $(shell \
display_config_version := $(shell \
if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.3" ];\
then echo DISPLAY_CONFIG_1_3; fi)
display_config_version := $(shell \
if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.4" ];\
then echo DISPLAY_CONFIG_1_4; fi)
#Common C flags
common_flags := -Wno-missing-field-initializers
common_flags += -Wconversion -Wall -Werror -std=c++14
Expand All @@ -27,6 +30,10 @@ endif
ifeq ($(display_config_version), DISPLAY_CONFIG_1_3)
common_flags += -DDISPLAY_CONFIG_1_1 -DDISPLAY_CONFIG_1_2 -DDISPLAY_CONFIG_1_3
endif
ifeq ($(display_config_version), DISPLAY_CONFIG_1_4)
common_flags += -DDISPLAY_CONFIG_1_1 -DDISPLAY_CONFIG_1_2
common_flags += -DDISPLAY_CONFIG_1_3 -DDISPLAY_CONFIG_1_4
endif

ifeq ($(TARGET_USES_COLOR_METADATA), true)
common_flags += -DUSE_COLOR_METADATA
Expand Down
5 changes: 5 additions & 0 deletions libdisplayconfig/DisplayConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ struct DisplayHDRCapabilities {
float min_luminance = 0.0f;
};

struct WriteBackCapabilities {
bool isWbUbwcSupported;
};

//=============================================================================
// The functions below run in the client pocess and wherever necessary
// do a binder call to HWC to get/set data.
Expand All @@ -104,6 +108,7 @@ int setIdleTimeout(uint32_t value);
int getHDRCapabilities(int dpy, DisplayHDRCapabilities *caps);
int setCameraLaunchStatus(uint32_t on);
bool displayBWTransactionPending();
int32_t getWriteBackCapabilities( WriteBackCapabilities *caps);

} // namespace display

Expand Down
1 change: 1 addition & 0 deletions libdrmutils/drm_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ struct DRMConnectorInfo {
bool qsync_support;
// Connection status of this connector
bool is_connected;
bool is_wb_ubwc_supported;
};

// All DRM Connectors as map<Connector_id , connector_info>
Expand Down
1 change: 1 addition & 0 deletions sdm/include/core/core_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ struct HWDisplayInfo {
bool is_connected = false; //!< Connection status of the display.
bool is_primary = false; //!< True only if this is the main display of the
//!< device.
bool is_wb_ubwc_supported = true; //!< check hardware wb ubwc support
};

/*! @brief Information on all displays as a map with display_id as key.
Expand Down
1 change: 1 addition & 0 deletions sdm/libs/core/drm/hw_info_drm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ DisplayError HWInfoDRM::GetDisplaysStatus(HWDisplaysInfo *hw_displays_info) {
}
hw_info.is_connected = iter.second.is_connected ? 1 : 0;
hw_info.is_primary = iter.second.is_primary ? 1 : 0;
hw_info.is_wb_ubwc_supported = iter.second.is_wb_ubwc_supported;
if (hw_info.display_id >= 0) {
(*hw_displays_info)[hw_info.display_id] = hw_info;
}
Expand Down
6 changes: 6 additions & 0 deletions sdm/libs/hwc2/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ LOCAL_SHARED_LIBRARIES += [email protected]
LOCAL_SHARED_LIBRARIES += [email protected]
LOCAL_SHARED_LIBRARIES += [email protected]
endif
ifeq ($(display_config_version), DISPLAY_CONFIG_1_4)
LOCAL_SHARED_LIBRARIES += [email protected]
LOCAL_SHARED_LIBRARIES += [email protected]
LOCAL_SHARED_LIBRARIES += [email protected]
LOCAL_SHARED_LIBRARIES += [email protected]
endif

LOCAL_SRC_FILES := hwc_session.cpp \
hwc_session_services.cpp \
Expand Down
12 changes: 10 additions & 2 deletions sdm/libs/hwc2/hwc_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
#ifndef __HWC_SESSION_H__
#define __HWC_SESSION_H__

#ifdef DISPLAY_CONFIG_1_3
#ifdef DISPLAY_CONFIG_1_4
#include <vendor/display/config/1.4/IDisplayConfig.h>
#elif DISPLAY_CONFIG_1_3
#include <vendor/display/config/1.3/IDisplayConfig.h>
#elif DISPLAY_CONFIG_1_2
#include <vendor/display/config/1.2/IDisplayConfig.h>
Expand Down Expand Up @@ -49,7 +51,9 @@

namespace sdm {

#ifdef DISPLAY_CONFIG_1_3
#ifdef DISPLAY_CONFIG_1_4
using vendor::display::config::V1_4::IDisplayConfig;
#elif DISPLAY_CONFIG_1_3
using vendor::display::config::V1_3::IDisplayConfig;
#elif DISPLAY_CONFIG_1_2
using vendor::display::config::V1_2::IDisplayConfig;
Expand Down Expand Up @@ -249,6 +253,7 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
int32_t SetSecondaryDisplayStatus(int disp_id, HWCDisplay::DisplayStatus status);
int32_t GetPanelBrightness(int *level);
int32_t MinHdcpEncryptionLevelChanged(int disp_id, uint32_t min_enc_level);
int32_t IsWbUbwcSupported(int *value);

// service methods
void StartServices();
Expand Down Expand Up @@ -290,6 +295,9 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
#ifdef DISPLAY_CONFIG_1_3
Return<int32_t> controlIdlePowerCollapse(bool enable, bool synchronous) override;
#endif
#ifdef DISPLAY_CONFIG_1_4
Return<void> getWriteBackCapabilities(getWriteBackCapabilities_cb _hidl_cb) override;
#endif

// QClient methods
virtual android::status_t notifyCallback(uint32_t command, const android::Parcel *input_parcel,
Expand Down
30 changes: 30 additions & 0 deletions sdm/libs/hwc2/hwc_session_services.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,4 +633,34 @@ Return<int32_t> HWCSession::controlIdlePowerCollapse(bool enable, bool synchrono
}
#endif // DISPLAY_CONFIG_1_3


int32_t HWCSession::IsWbUbwcSupported(int *value) {
HWDisplaysInfo hw_displays_info = {};
DisplayError error = core_intf_->GetDisplaysStatus(&hw_displays_info);
if (error != kErrorNone) {
return -EINVAL;
}

for (auto &iter : hw_displays_info) {
auto &info = iter.second;
if (info.display_type == kVirtual && info.is_wb_ubwc_supported) {
*value = 1;
}
}

return error;
}

#ifdef DISPLAY_CONFIG_1_4
Return<void> HWCSession::getWriteBackCapabilities(getWriteBackCapabilities_cb _hidl_cb) {
int value = 0;
IDisplayConfig::WriteBackCapabilities wb_caps = {};
int32_t error = IsWbUbwcSupported(&value);
wb_caps.isWbUbwcSupported = value;
_hidl_cb(error, wb_caps);

return Void();
}
#endif // DISPLAY_CONFIG_1_4

} // namespace sdm

0 comments on commit dbe738a

Please sign in to comment.