Skip to content

Commit

Permalink
hwc2: Implement display config 1.7 interfaces.
Browse files Browse the repository at this point in the history
Change-Id: I5d68407ed388e62d7900944c90d407549535c0da
CRs-Fixed: 2362214
Signed-off-by: Karthi Kandasamy <[email protected]>
  • Loading branch information
Dileep Marchya authored and Karthi Kandasamy committed Nov 22, 2019
1 parent fdfb51f commit 2ba7149
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 13 deletions.
10 changes: 10 additions & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ display_config_version := $(shell \
if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.1" ];\
then echo DISPLAY_CONFIG_1_1; fi)

display_config_version := $(shell \
if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.7" ];\
then echo DISPLAY_CONFIG_1_7; fi)

#Common C flags
common_flags := -DDEBUG_CALC_FPS -Wno-missing-field-initializers
common_flags += -Wconversion -Wall -Werror -std=c++14
Expand All @@ -16,6 +20,12 @@ ifeq ($(display_config_version), DISPLAY_CONFIG_1_1)
common_flags += -DDISPLAY_CONFIG_1_1
endif

ifeq ($(display_config_version), DISPLAY_CONFIG_1_7)
common_flags += -DDISPLAY_CONFIG_1_7 \
-DDISPLAY_CONFIG_1_6 -DDISPLAY_CONFIG_1_5 -DDISPLAY_CONFIG_1_4 \
-DDISPLAY_CONFIG_1_3 -DDISPLAY_CONFIG_1_2 -DDISPLAY_CONFIG_1_1
endif

ifeq ($(TARGET_USES_COLOR_METADATA), true)
common_flags += -DUSE_COLOR_METADATA
endif
Expand Down
7 changes: 6 additions & 1 deletion include/display_properties.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -91,6 +91,11 @@
#define DISABLE_HDR_LUT_GEN DISPLAY_PROP("disable_hdr_lut_gen")
#define ENABLE_DEFAULT_COLOR_MODE DISPLAY_PROP("enable_default_color_mode")
#define DISABLE_HDR DISPLAY_PROP("hwc_disable_hdr")
#define DISABLE_QTI_BSP DISPLAY_PROP("disable_qti_bsp")
#define UPDATE_VSYNC_ON_DOZE DISPLAY_PROP("update_vsync_on_doze")
#define PANEL_MOUNTFLIP DISPLAY_PROP("panel_mountflip")
#define VDS_ALLOW_HWC DISPLAY_PROP("vds_allow_hwc")
#define QDFRAMEWORK_LOGS DISPLAY_PROP("qdframework_logs")

#define HDR_CONFIG_PROP RO_DISPLAY_PROP("hdr.config")
#define QDCM_PCC_TRANS_PROP DISPLAY_PROP("qdcm.pcc_for_trans")
Expand Down
7 changes: 7 additions & 0 deletions sdm/libs/hwc2/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ ifeq ($(display_config_version), DISPLAY_CONFIG_1_1)
LOCAL_SHARED_LIBRARIES += [email protected]
endif

ifeq ($(display_config_version), DISPLAY_CONFIG_1_7)
LOCAL_SHARED_LIBRARIES += [email protected] \
[email protected] [email protected] \
[email protected] [email protected] \
[email protected] [email protected]
endif

LOCAL_SRC_FILES := hwc_session.cpp \
hwc_session_services.cpp \
hwc_display.cpp \
Expand Down
7 changes: 0 additions & 7 deletions sdm/libs/hwc2/hwc_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1720,13 +1720,6 @@ int HWCSession::CreateExternalDisplay(int disp, uint32_t primary_width,
}
}

#ifdef DISPLAY_CONFIG_1_1
// Methods from ::vendor::hardware::display::config::V1_1::IDisplayConfig follow.
Return<int32_t> HWCSession::setDisplayAnimating(uint64_t display_id, bool animating ) {
return CallDisplayFunction(static_cast<hwc2_device_t *>(this), display_id,
&HWCDisplay::SetDisplayAnimating, animating);
}
#endif

void HWCSession::CreateNullDisplay() {
auto hwc_display = &hwc_display_[HWC_DISPLAY_PRIMARY];
Expand Down
43 changes: 38 additions & 5 deletions sdm/libs/hwc2/hwc_session.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2017, 2018, 2019 The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2019 The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
Expand All @@ -20,7 +20,9 @@
#ifndef __HWC_SESSION_H__
#define __HWC_SESSION_H__

#ifdef DISPLAY_CONFIG_1_1
#ifdef DISPLAY_CONFIG_1_7
#include <vendor/display/config/1.7/IDisplayConfig.h>
#elif DISPLAY_CONFIG_1_1
#include <vendor/display/config/1.1/IDisplayConfig.h>
#else
#include <vendor/display/config/1.0/IDisplayConfig.h>
Expand All @@ -41,12 +43,15 @@

namespace sdm {

#ifdef DISPLAY_CONFIG_1_1
#ifdef DISPLAY_CONFIG_1_7
using vendor::display::config::V1_7::IDisplayConfig;
#elif DISPLAY_CONFIG_1_1
using vendor::display::config::V1_1::IDisplayConfig;
#else
using ::vendor::display::config::V1_0::IDisplayConfig;
using vendor::display::config::V1_0::IDisplayConfig;
#endif
using ::android::hardware::Return;
using ::android::hardware::hidl_string;

// Create a singleton uevent listener thread valid for life of hardware composer process.
// This thread blocks on uevents poll inside uevent library implementation. This poll exits
Expand Down Expand Up @@ -216,10 +221,38 @@ class HWCSession : hwc2_device_t, HWCUEventListener, IDisplayConfig, public qCli
Return<int32_t> setCameraLaunchStatus(uint32_t on) override;
Return<void> displayBWTransactionPending(displayBWTransactionPending_cb _hidl_cb) override;

// Methods from ::android::hardware::display::config::V1_1::IDisplayConfig follow.
// Methods from ::android::hardware::display::config::V1_7::IDisplayConfig follow.
#ifdef DISPLAY_CONFIG_1_1
Return<int32_t> setDisplayAnimating(uint64_t display_id, bool animating) override;
#endif
#ifdef DISPLAY_CONFIG_1_2
Return<int32_t> setDisplayIndex(IDisplayConfig::DisplayTypeExt disp_type,
uint32_t base, uint32_t count) override;
#endif
#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
#ifdef DISPLAY_CONFIG_1_5
Return<int32_t> SetDisplayDppsAdROI(uint32_t display_id, uint32_t h_start, uint32_t h_end,
uint32_t v_start, uint32_t v_end, uint32_t factor_in,
uint32_t factor_out) override;
#endif
#ifdef DISPLAY_CONFIG_1_6
Return<int32_t> updateVSyncSourceOnPowerModeOff() override;
Return<int32_t> updateVSyncSourceOnPowerModeDoze() override;
#endif
#ifdef DISPLAY_CONFIG_1_7
Return<int32_t> setPowerMode(uint32_t disp_id, PowerMode power_mode) override;
Return<bool> isPowerModeOverrideSupported(uint32_t disp_id) override;
Return<bool> isHDRSupported(uint32_t disp_id) override;
Return<bool> isWCGSupported(uint32_t disp_id) override;
Return<int32_t> setLayerAsMask(uint32_t disp_id, uint64_t layer_id) override;
Return<void> getDebugProperty(const hidl_string &prop_name,
getDebugProperty_cb _hidl_cb) override;
#endif

// QClient methods
virtual android::status_t notifyCallback(uint32_t command, const android::Parcel *input_parcel,
Expand Down
110 changes: 110 additions & 0 deletions sdm/libs/hwc2/hwc_session_services.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include "hwc_buffer_sync_handler.h"
#include "hwc_session.h"
#include "hwc_debugger.h"

#define __CLASS__ "HWCSession"

Expand Down Expand Up @@ -496,4 +497,113 @@ Return<void> HWCSession::displayBWTransactionPending(displayBWTransactionPending
return Void();
}

#ifdef DISPLAY_CONFIG_1_1
Return<int32_t> HWCSession::setDisplayAnimating(uint64_t display_id, bool animating ) {
return CallDisplayFunction(static_cast<hwc2_device_t *>(this), display_id,
&HWCDisplay::SetDisplayAnimating, animating);
}
#endif

#ifdef DISPLAY_CONFIG_1_2
Return<int32_t> HWCSession::setDisplayIndex(IDisplayConfig::DisplayTypeExt disp_type,
uint32_t base, uint32_t count) {
DLOGW("Not implemented.");
return 0;
}
#endif

#ifdef DISPLAY_CONFIG_1_3
Return<int32_t> HWCSession::controlIdlePowerCollapse(bool enable, bool synchronous) {
DLOGW("Not implemented.");
return 0;
}
#endif

#ifdef DISPLAY_CONFIG_1_4
Return<void> HWCSession::getWriteBackCapabilities(getWriteBackCapabilities_cb _hidl_cb) {
DLOGW("Not implemented.");
return Void();
}
#endif

#ifdef DISPLAY_CONFIG_1_5
Return<int32_t> HWCSession::SetDisplayDppsAdROI(uint32_t display_id, uint32_t h_start,
uint32_t h_end, uint32_t v_start, uint32_t v_end,
uint32_t factor_in, uint32_t factor_out) {
DLOGW("Not implemented.");
return 0;
}
#endif

#ifdef DISPLAY_CONFIG_1_6
Return<int32_t> HWCSession::updateVSyncSourceOnPowerModeOff() {
DLOGW("Not implemented.");
return 0;
}

Return<int32_t> HWCSession::updateVSyncSourceOnPowerModeDoze() {
DLOGW("Not implemented.");
return 0;
}
#endif

#ifdef DISPLAY_CONFIG_1_7
Return<int32_t> HWCSession::setPowerMode(uint32_t disp_id, PowerMode power_mode) {
return 0;
}

Return<bool> HWCSession::isPowerModeOverrideSupported(uint32_t disp_id) {
return false;
}

Return<bool> HWCSession::isHDRSupported(uint32_t disp_id) {
SEQUENCE_WAIT_SCOPE_LOCK(locker_[disp_id]);
HWCDisplay *hwc_display = hwc_display_[disp_id];
if (!hwc_display) {
DLOGW("Display = %d is not connected.", disp_id);
return false;
}

// query number of hdr types
uint32_t out_num_types = 0;
if (hwc_display->GetHdrCapabilities(&out_num_types, nullptr, nullptr, nullptr, nullptr)
!= HWC2::Error::None) {
return false;
}

if (!out_num_types) {
return false;
}

return true;
}

Return<bool> HWCSession::isWCGSupported(uint32_t disp_id) {
// todo(user): Query wcg from sdm. For now assume them same.
return isHDRSupported(disp_id);
}

Return<int32_t> HWCSession::setLayerAsMask(uint32_t disp_id, uint64_t layer_id) {
return 0;
}

Return<void> HWCSession::getDebugProperty(const hidl_string &prop_name,
getDebugProperty_cb _hidl_cb) {
std::string vendor_prop_name = DISP_PROP_PREFIX;
char value[64] = {};
hidl_string result = "";
int32_t error = -EINVAL;

vendor_prop_name += prop_name.c_str();
if (HWCDebugHandler::Get()->GetProperty(vendor_prop_name.c_str(), value) != kErrorNone) {
result = value;
error = 0;
}

_hidl_cb(result, error);

return Void();
}
#endif

} // namespace sdm

0 comments on commit 2ba7149

Please sign in to comment.