Merge "sdm: drm: Add user space to DRM driver struct conversion for gamut"
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
319f1e808e
@@ -135,6 +135,12 @@ enum struct DRMOps {
|
|||||||
* int * - Pointer to an integer that will hold the returned fence
|
* int * - Pointer to an integer that will hold the returned fence
|
||||||
*/
|
*/
|
||||||
CRTC_GET_RELEASE_FENCE,
|
CRTC_GET_RELEASE_FENCE,
|
||||||
|
/*
|
||||||
|
* Op: Sets PP feature
|
||||||
|
* Arg: uint32_t - CRTC ID
|
||||||
|
* DRMPPFeatureInfo * - PP feature data pointer
|
||||||
|
*/
|
||||||
|
CRTC_SET_POST_PROC,
|
||||||
/*
|
/*
|
||||||
* Op: Returns retire fence for this commit. Should be called after Commit() on
|
* Op: Returns retire fence for this commit. Should be called after Commit() on
|
||||||
* DRMAtomicReqInterface.
|
* DRMAtomicReqInterface.
|
||||||
@@ -262,6 +268,33 @@ struct DRMDisplayToken {
|
|||||||
uint32_t crtc_id;
|
uint32_t crtc_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum DRMPPFeatureID {
|
||||||
|
kFeaturePcc,
|
||||||
|
kFeatureIgc,
|
||||||
|
kFeaturePgc,
|
||||||
|
kFeatureMixerGc,
|
||||||
|
kFeaturePaV2,
|
||||||
|
kFeatureDither,
|
||||||
|
kFeatureGamut,
|
||||||
|
kFeaturePADither,
|
||||||
|
kPPFeaturesMax,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum DRMPPPropType {
|
||||||
|
kPropEnum,
|
||||||
|
kPropRange,
|
||||||
|
kPropBlob,
|
||||||
|
kPropTypeMax,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DRMPPFeatureInfo {
|
||||||
|
DRMPPFeatureID id;
|
||||||
|
DRMPPPropType type;
|
||||||
|
uint32_t version;
|
||||||
|
uint32_t payload_size;
|
||||||
|
void *payload;
|
||||||
|
};
|
||||||
|
|
||||||
/* DRM Atomic Request Property Set.
|
/* DRM Atomic Request Property Set.
|
||||||
*
|
*
|
||||||
* Helper class to create and populate atomic properties of DRM components
|
* Helper class to create and populate atomic properties of DRM components
|
||||||
@@ -330,6 +363,11 @@ class DRMManagerInterface {
|
|||||||
*/
|
*/
|
||||||
virtual void GetConnectorInfo(uint32_t conn_id, DRMConnectorInfo *info) = 0;
|
virtual void GetConnectorInfo(uint32_t conn_id, DRMConnectorInfo *info) = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Will query post propcessing feature info of a CRTC.
|
||||||
|
* [output]: DRMPPFeatureInfo: CRTC post processing feature info
|
||||||
|
*/
|
||||||
|
virtual void GetCrtcPPInfo(uint32_t crtc_id, DRMPPFeatureInfo &info) = 0;
|
||||||
/*
|
/*
|
||||||
* Register a logical display to receive a token.
|
* Register a logical display to receive a token.
|
||||||
* Each display pipeline in DRM is identified by its CRTC and Connector(s).
|
* Each display pipeline in DRM is identified by its CRTC and Connector(s).
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2015-2016, The Linux Foundataion. All rights reserved.
|
/* Copyright (c) 2015-2017, The Linux Foundataion. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
@@ -55,6 +55,26 @@ enum PendingAction {
|
|||||||
kNoAction = BITMAP(31),
|
kNoAction = BITMAP(31),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const uint32_t kOpsEnable = BITMAP(0);
|
||||||
|
static const uint32_t kOpsRead = BITMAP(1);
|
||||||
|
static const uint32_t kOpsWrite = BITMAP(2);
|
||||||
|
static const uint32_t kOpsDisable = BITMAP(3);
|
||||||
|
|
||||||
|
static const uint32_t kOpsGc8BitRoundEnable = BITMAP(4);
|
||||||
|
|
||||||
|
static const uint32_t kPaHueEnable = BITMAP(4);
|
||||||
|
static const uint32_t kPaSatEnable = BITMAP(5);
|
||||||
|
static const uint32_t kPaValEnable = BITMAP(6);
|
||||||
|
static const uint32_t kPaContEnable = BITMAP(7);
|
||||||
|
|
||||||
|
static const uint32_t kPaSixZoneEnable = BITMAP(8);
|
||||||
|
static const uint32_t kPaSkinEnable = BITMAP(9);
|
||||||
|
static const uint32_t kPaSkyEnable = BITMAP(10);
|
||||||
|
static const uint32_t kPaFoliageEnable = BITMAP(11);
|
||||||
|
|
||||||
|
static const uint32_t kLeftSplitMode = BITMAP(28); // 0x10000000
|
||||||
|
static const uint32_t kRightSplitMode = BITMAP(29); // 0x20000000
|
||||||
|
|
||||||
// ENUM to identify different Postprocessing feature block to program.
|
// ENUM to identify different Postprocessing feature block to program.
|
||||||
// Note: For each new entry added here, also need update hw_interface::GetPPFeaturesVersion<>
|
// Note: For each new entry added here, also need update hw_interface::GetPPFeaturesVersion<>
|
||||||
// AND HWPrimary::SetPPFeatures<>.
|
// AND HWPrimary::SetPPFeatures<>.
|
||||||
@@ -98,6 +118,7 @@ struct PPColorFillParams {
|
|||||||
|
|
||||||
struct PPFeatureVersion {
|
struct PPFeatureVersion {
|
||||||
// SDE ASIC versioning its PP block at each specific feature level.
|
// SDE ASIC versioning its PP block at each specific feature level.
|
||||||
|
static const uint32_t kSDEPpVersionInvalid = 0;
|
||||||
static const uint32_t kSDEIgcV17 = 1;
|
static const uint32_t kSDEIgcV17 = 1;
|
||||||
static const uint32_t kSDEPgcV17 = 5;
|
static const uint32_t kSDEPgcV17 = 5;
|
||||||
static const uint32_t kSDEDitherV17 = 7;
|
static const uint32_t kSDEDitherV17 = 7;
|
||||||
@@ -107,6 +128,7 @@ struct PPFeatureVersion {
|
|||||||
static const uint32_t kSDELegacyPP = 15;
|
static const uint32_t kSDELegacyPP = 15;
|
||||||
static const uint32_t kSDEPADitherV17 = 16;
|
static const uint32_t kSDEPADitherV17 = 16;
|
||||||
static const uint32_t kSDEIgcV30 = 17;
|
static const uint32_t kSDEIgcV30 = 17;
|
||||||
|
static const uint32_t kSDEGamutV4 = 18;
|
||||||
|
|
||||||
uint32_t version[kMaxNumPPFeatures];
|
uint32_t version[kMaxNumPPFeatures];
|
||||||
PPFeatureVersion() { memset(version, 0, sizeof(version)); }
|
PPFeatureVersion() { memset(version, 0, sizeof(version)); }
|
||||||
@@ -382,6 +404,7 @@ class SDEGamutCfgWrapper : private SDEGamutCfg {
|
|||||||
enum GamutMode {
|
enum GamutMode {
|
||||||
GAMUT_FINE_MODE = 0x01,
|
GAMUT_FINE_MODE = 0x01,
|
||||||
GAMUT_COARSE_MODE,
|
GAMUT_COARSE_MODE,
|
||||||
|
GAMUT_COARSE_MODE_13,
|
||||||
};
|
};
|
||||||
|
|
||||||
// This factory method will be used by libsdm-color.so data producer to be populated with
|
// This factory method will be used by libsdm-color.so data producer to be populated with
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ ifneq ($(TARGET_IS_HEADLESS), true)
|
|||||||
LOCAL_HW_INTF_PATH_2 := drm
|
LOCAL_HW_INTF_PATH_2 := drm
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_USES_DRM_PP),true)
|
||||||
|
LOCAL_CFLAGS += -DPP_DRM_ENABLE
|
||||||
|
endif
|
||||||
|
|
||||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) $(kernel_deps)
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) $(kernel_deps)
|
||||||
LOCAL_SRC_FILES := core_interface.cpp \
|
LOCAL_SRC_FILES := core_interface.cpp \
|
||||||
core_impl.cpp \
|
core_impl.cpp \
|
||||||
@@ -46,7 +50,8 @@ LOCAL_SRC_FILES := core_interface.cpp \
|
|||||||
ifneq ($(TARGET_IS_HEADLESS), true)
|
ifneq ($(TARGET_IS_HEADLESS), true)
|
||||||
LOCAL_SRC_FILES += $(LOCAL_HW_INTF_PATH_2)/hw_info_drm.cpp \
|
LOCAL_SRC_FILES += $(LOCAL_HW_INTF_PATH_2)/hw_info_drm.cpp \
|
||||||
$(LOCAL_HW_INTF_PATH_2)/hw_device_drm.cpp \
|
$(LOCAL_HW_INTF_PATH_2)/hw_device_drm.cpp \
|
||||||
$(LOCAL_HW_INTF_PATH_2)/hw_events_drm.cpp
|
$(LOCAL_HW_INTF_PATH_2)/hw_events_drm.cpp \
|
||||||
|
$(LOCAL_HW_INTF_PATH_2)/hw_color_manager_drm.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|||||||
243
sdm/libs/core/drm/hw_color_manager_drm.cpp
Normal file
243
sdm/libs/core/drm/hw_color_manager_drm.cpp
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 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
|
||||||
|
* met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above
|
||||||
|
* copyright notice, this list of conditions and the following
|
||||||
|
* disclaimer in the documentation and/or other materials provided
|
||||||
|
* with the distribution.
|
||||||
|
* * Neither the name of The Linux Foundation nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||||
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define __CLASS__ "HWColorManagerDRM"
|
||||||
|
|
||||||
|
#ifdef PP_DRM_ENABLE
|
||||||
|
#include <drm/msm_drm_pp.h>
|
||||||
|
#endif
|
||||||
|
#include <utils/debug.h>
|
||||||
|
#include "hw_color_manager_drm.h"
|
||||||
|
|
||||||
|
using sde_drm::kFeaturePcc;
|
||||||
|
using sde_drm::kFeatureIgc;
|
||||||
|
using sde_drm::kFeaturePgc;
|
||||||
|
using sde_drm::kFeatureMixerGc;
|
||||||
|
using sde_drm::kFeaturePaV2;
|
||||||
|
using sde_drm::kFeatureDither;
|
||||||
|
using sde_drm::kFeatureGamut;
|
||||||
|
using sde_drm::kFeaturePADither;
|
||||||
|
using sde_drm::kPPFeaturesMax;
|
||||||
|
|
||||||
|
namespace sdm {
|
||||||
|
|
||||||
|
DisplayError (*HWColorManagerDrm::GetDrmFeature[])(const PPFeatureInfo &, DRMPPFeatureInfo *) = {
|
||||||
|
[kGlobalColorFeaturePcc] = &HWColorManagerDrm::GetDrmPCC,
|
||||||
|
[kGlobalColorFeatureIgc] = &HWColorManagerDrm::GetDrmIGC,
|
||||||
|
[kGlobalColorFeaturePgc] = &HWColorManagerDrm::GetDrmPGC,
|
||||||
|
[kMixerColorFeatureGc] = &HWColorManagerDrm::GetDrmMixerGC,
|
||||||
|
[kGlobalColorFeaturePaV2] = &HWColorManagerDrm::GetDrmPAV2,
|
||||||
|
[kGlobalColorFeatureDither] = &HWColorManagerDrm::GetDrmDither,
|
||||||
|
[kGlobalColorFeatureGamut] = &HWColorManagerDrm::GetDrmGamut,
|
||||||
|
[kGlobalColorFeaturePADither] = &HWColorManagerDrm::GetDrmPADither,
|
||||||
|
};
|
||||||
|
|
||||||
|
void HWColorManagerDrm::FreeDrmFeatureData(DRMPPFeatureInfo *feature) {
|
||||||
|
if (feature->payload)
|
||||||
|
free(feature->payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t HWColorManagerDrm::GetFeatureVersion(DRMPPFeatureInfo &feature) {
|
||||||
|
uint32_t version = PPFeatureVersion::kSDEPpVersionInvalid;
|
||||||
|
|
||||||
|
switch (feature.id) {
|
||||||
|
case kFeaturePcc:
|
||||||
|
break;
|
||||||
|
case kFeatureIgc:
|
||||||
|
break;
|
||||||
|
case kFeaturePgc:
|
||||||
|
break;
|
||||||
|
case kFeatureMixerGc:
|
||||||
|
break;
|
||||||
|
case kFeaturePaV2:
|
||||||
|
break;
|
||||||
|
case kFeatureDither:
|
||||||
|
break;
|
||||||
|
case kFeatureGamut:
|
||||||
|
if (feature.version == 1)
|
||||||
|
version = PPFeatureVersion::kSDEGamutV17;
|
||||||
|
else if (feature.version == 4)
|
||||||
|
version = PPFeatureVersion::kSDEGamutV4;
|
||||||
|
break;
|
||||||
|
case kFeaturePADither:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
DRMPPFeatureID HWColorManagerDrm::ToDrmFeatureId(uint32_t id) {
|
||||||
|
DRMPPFeatureID ret = kPPFeaturesMax;
|
||||||
|
|
||||||
|
switch (id) {
|
||||||
|
case kGlobalColorFeaturePcc:
|
||||||
|
ret = kFeaturePcc;
|
||||||
|
break;
|
||||||
|
case kGlobalColorFeatureIgc:
|
||||||
|
ret = kFeatureIgc;
|
||||||
|
break;
|
||||||
|
case kGlobalColorFeaturePgc:
|
||||||
|
ret = kFeaturePgc;
|
||||||
|
break;
|
||||||
|
case kMixerColorFeatureGc:
|
||||||
|
ret = kFeatureMixerGc;
|
||||||
|
break;
|
||||||
|
case kGlobalColorFeaturePaV2:
|
||||||
|
ret = kFeaturePaV2;
|
||||||
|
break;
|
||||||
|
case kGlobalColorFeatureDither:
|
||||||
|
ret = kFeatureDither;
|
||||||
|
break;
|
||||||
|
case kGlobalColorFeatureGamut:
|
||||||
|
ret = kFeatureGamut;
|
||||||
|
break;
|
||||||
|
case kGlobalColorFeaturePADither:
|
||||||
|
ret = kFeaturePADither;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayError HWColorManagerDrm::GetDrmPCC(const PPFeatureInfo &in_data,
|
||||||
|
DRMPPFeatureInfo *out_data) {
|
||||||
|
DisplayError ret = kErrorNone;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayError HWColorManagerDrm::GetDrmIGC(const PPFeatureInfo &in_data,
|
||||||
|
DRMPPFeatureInfo *out_data) {
|
||||||
|
DisplayError ret = kErrorNone;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayError HWColorManagerDrm::GetDrmPGC(const PPFeatureInfo &in_data,
|
||||||
|
DRMPPFeatureInfo *out_data) {
|
||||||
|
DisplayError ret = kErrorNone;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayError HWColorManagerDrm::GetDrmMixerGC(const PPFeatureInfo &in_data,
|
||||||
|
DRMPPFeatureInfo *out_data) {
|
||||||
|
DisplayError ret = kErrorNone;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayError HWColorManagerDrm::GetDrmPAV2(const PPFeatureInfo &in_data,
|
||||||
|
DRMPPFeatureInfo *out_data) {
|
||||||
|
DisplayError ret = kErrorNone;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayError HWColorManagerDrm::GetDrmDither(const PPFeatureInfo &in_data,
|
||||||
|
DRMPPFeatureInfo *out_data) {
|
||||||
|
DisplayError ret = kErrorNone;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayError HWColorManagerDrm::GetDrmGamut(const PPFeatureInfo &in_data,
|
||||||
|
DRMPPFeatureInfo *out_data) {
|
||||||
|
DisplayError ret = kErrorNone;
|
||||||
|
#ifdef PP_DRM_ENABLE
|
||||||
|
struct SDEGamutCfg *sde_gamut = NULL;
|
||||||
|
struct drm_msm_3d_gamut *mdp_gamut = NULL;
|
||||||
|
uint32_t size = 0;
|
||||||
|
|
||||||
|
if (!out_data) {
|
||||||
|
DLOGE("Invalid input parameter for gamut");
|
||||||
|
return kErrorParameters;
|
||||||
|
}
|
||||||
|
sde_gamut = (struct SDEGamutCfg *)in_data.GetConfigData();
|
||||||
|
out_data->id = kFeatureGamut;
|
||||||
|
out_data->type = sde_drm::kPropBlob;
|
||||||
|
out_data->version = in_data.feature_version_;
|
||||||
|
out_data->payload_size = sizeof(struct drm_msm_3d_gamut);
|
||||||
|
if (in_data.enable_flags_ & kOpsDisable) {
|
||||||
|
/* feature disable case */
|
||||||
|
out_data->payload = NULL;
|
||||||
|
return ret;
|
||||||
|
} else if (!(in_data.enable_flags_ & kOpsEnable)) {
|
||||||
|
out_data->payload = NULL;
|
||||||
|
return kErrorParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
mdp_gamut = new drm_msm_3d_gamut();
|
||||||
|
if (!mdp_gamut) {
|
||||||
|
DLOGE("Failed to allocate memory for gamut");
|
||||||
|
return kErrorMemory;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sde_gamut->map_en)
|
||||||
|
mdp_gamut->flags = GAMUT_3D_MAP_EN;
|
||||||
|
else
|
||||||
|
mdp_gamut->flags = 0;
|
||||||
|
|
||||||
|
switch (sde_gamut->mode) {
|
||||||
|
case SDEGamutCfgWrapper::GAMUT_FINE_MODE:
|
||||||
|
mdp_gamut->mode = GAMUT_3D_MODE_17;
|
||||||
|
size = GAMUT_3D_MODE17_TBL_SZ;
|
||||||
|
break;
|
||||||
|
case SDEGamutCfgWrapper::GAMUT_COARSE_MODE:
|
||||||
|
mdp_gamut->mode = GAMUT_3D_MODE_5;
|
||||||
|
size = GAMUT_3D_MODE5_TBL_SZ;
|
||||||
|
break;
|
||||||
|
case SDEGamutCfgWrapper::GAMUT_COARSE_MODE_13:
|
||||||
|
mdp_gamut->mode = GAMUT_3D_MODE_13;
|
||||||
|
size = GAMUT_3D_MODE13_TBL_SZ;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
DLOGE("Invalid gamut mode %d", sde_gamut->mode);
|
||||||
|
free(mdp_gamut);
|
||||||
|
return kErrorParameters;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sde_gamut->map_en)
|
||||||
|
std::memcpy(mdp_gamut->scale_off, sde_gamut->scale_off_data,
|
||||||
|
sizeof(uint32_t) * GAMUT_3D_SCALE_OFF_SZ * GAMUT_3D_SCALE_OFF_TBL_NUM);
|
||||||
|
|
||||||
|
for (uint32_t row = 0; row < GAMUT_3D_TBL_NUM; row++) {
|
||||||
|
for (uint32_t col = 0; col < size; col++) {
|
||||||
|
mdp_gamut->col[row][col].c0 = sde_gamut->c0_data[row][col];
|
||||||
|
mdp_gamut->col[row][col].c2_c1 = sde_gamut->c1_c2_data[row][col];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out_data->payload = mdp_gamut;
|
||||||
|
#endif
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayError HWColorManagerDrm::GetDrmPADither(const PPFeatureInfo &in_data,
|
||||||
|
DRMPPFeatureInfo *out_data) {
|
||||||
|
DisplayError ret = kErrorNone;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace sdm
|
||||||
64
sdm/libs/core/drm/hw_color_manager_drm.h
Normal file
64
sdm/libs/core/drm/hw_color_manager_drm.h
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 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
|
||||||
|
* met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above
|
||||||
|
* copyright notice, this list of conditions and the following
|
||||||
|
* disclaimer in the documentation and/or other materials provided
|
||||||
|
* with the distribution.
|
||||||
|
* * Neither the name of The Linux Foundation nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||||
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __HW_COLOR_MANAGER_DRM_H__
|
||||||
|
#define __HW_COLOR_MANAGER_DRM_H__
|
||||||
|
|
||||||
|
#include <drm_interface.h>
|
||||||
|
#include <private/color_params.h>
|
||||||
|
|
||||||
|
using sde_drm::DRMPPFeatureID;
|
||||||
|
using sde_drm::DRMPPFeatureInfo;
|
||||||
|
|
||||||
|
namespace sdm {
|
||||||
|
|
||||||
|
class HWColorManagerDrm {
|
||||||
|
public:
|
||||||
|
static DisplayError (*GetDrmFeature[kMaxNumPPFeatures])(const PPFeatureInfo &in_data,
|
||||||
|
DRMPPFeatureInfo *out_data);
|
||||||
|
static void FreeDrmFeatureData(DRMPPFeatureInfo *feature);
|
||||||
|
static uint32_t GetFeatureVersion(DRMPPFeatureInfo &feature);
|
||||||
|
static DRMPPFeatureID ToDrmFeatureId(uint32_t id);
|
||||||
|
protected:
|
||||||
|
HWColorManagerDrm() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
static DisplayError GetDrmPCC(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
|
||||||
|
static DisplayError GetDrmIGC(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
|
||||||
|
static DisplayError GetDrmPGC(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
|
||||||
|
static DisplayError GetDrmMixerGC(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
|
||||||
|
static DisplayError GetDrmPAV2(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
|
||||||
|
static DisplayError GetDrmDither(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
|
||||||
|
static DisplayError GetDrmGamut(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
|
||||||
|
static DisplayError GetDrmPADither(const PPFeatureInfo &in_data, DRMPPFeatureInfo *out_data);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace sdm
|
||||||
|
|
||||||
|
#endif // __HW_COLOR_MANAGER_DRM_H__
|
||||||
@@ -46,6 +46,7 @@
|
|||||||
#include <utils/constants.h>
|
#include <utils/constants.h>
|
||||||
#include <utils/debug.h>
|
#include <utils/debug.h>
|
||||||
#include <utils/sys.h>
|
#include <utils/sys.h>
|
||||||
|
#include <private/color_params.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -54,6 +55,7 @@
|
|||||||
|
|
||||||
#include "hw_device_drm.h"
|
#include "hw_device_drm.h"
|
||||||
#include "hw_info_interface.h"
|
#include "hw_info_interface.h"
|
||||||
|
#include "hw_color_manager_drm.h"
|
||||||
|
|
||||||
#define __CLASS__ "HWDeviceDRM"
|
#define __CLASS__ "HWDeviceDRM"
|
||||||
|
|
||||||
@@ -68,6 +70,7 @@ using sde_drm::DestroyDRMManager;
|
|||||||
using sde_drm::DRMDisplayType;
|
using sde_drm::DRMDisplayType;
|
||||||
using sde_drm::DRMDisplayToken;
|
using sde_drm::DRMDisplayToken;
|
||||||
using sde_drm::DRMConnectorInfo;
|
using sde_drm::DRMConnectorInfo;
|
||||||
|
using sde_drm::DRMPPFeatureInfo;
|
||||||
using sde_drm::DRMRect;
|
using sde_drm::DRMRect;
|
||||||
using sde_drm::DRMBlendType;
|
using sde_drm::DRMBlendType;
|
||||||
using sde_drm::DRMOps;
|
using sde_drm::DRMOps;
|
||||||
@@ -585,11 +588,47 @@ DisplayError HWDeviceDRM::SetCursorPosition(HWLayers *hw_layers, int x, int y) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DisplayError HWDeviceDRM::GetPPFeaturesVersion(PPFeatureVersion *vers) {
|
DisplayError HWDeviceDRM::GetPPFeaturesVersion(PPFeatureVersion *vers) {
|
||||||
return kErrorNotSupported;
|
struct DRMPPFeatureInfo info = {};
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < kMaxNumPPFeatures; i++) {
|
||||||
|
memset(&info, 0, sizeof(struct DRMPPFeatureInfo));
|
||||||
|
info.id = HWColorManagerDrm::ToDrmFeatureId(i);
|
||||||
|
if (info.id >= sde_drm::kPPFeaturesMax)
|
||||||
|
continue;
|
||||||
|
// use crtc_id_ = 0 since PP features are same across all CRTCs
|
||||||
|
drm_mgr_intf_->GetCrtcPPInfo(0, info);
|
||||||
|
vers->version[i] = HWColorManagerDrm::GetFeatureVersion(info);
|
||||||
|
}
|
||||||
|
return kErrorNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayError HWDeviceDRM::SetPPFeatures(PPFeaturesConfig *feature_list) {
|
DisplayError HWDeviceDRM::SetPPFeatures(PPFeaturesConfig *feature_list) {
|
||||||
return kErrorNotSupported;
|
int ret = 0;
|
||||||
|
PPFeatureInfo *feature = NULL;
|
||||||
|
DRMPPFeatureInfo kernel_params = {};
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
ret = feature_list->RetrieveNextFeature(&feature);
|
||||||
|
if (ret)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (feature) {
|
||||||
|
DLOGV_IF(kTagDriverConfig, "feature_id = %d", feature->feature_id_);
|
||||||
|
if (!HWColorManagerDrm::GetDrmFeature[feature->feature_id_]) {
|
||||||
|
DLOGE("GetDrmFeature is not valid for feature %d", feature->feature_id_);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ret = HWColorManagerDrm::GetDrmFeature[feature->feature_id_](*feature, &kernel_params);
|
||||||
|
if (!ret)
|
||||||
|
drm_atomic_intf_->Perform(DRMOps::CRTC_SET_POST_PROC, token_.crtc_id, &kernel_params);
|
||||||
|
HWColorManagerDrm::FreeDrmFeatureData(&kernel_params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Once all features were consumed, then destroy all feature instance from feature_list,
|
||||||
|
feature_list->Reset();
|
||||||
|
|
||||||
|
return kErrorNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayError HWDeviceDRM::SetVSyncState(bool enable) {
|
DisplayError HWDeviceDRM::SetVSyncState(bool enable) {
|
||||||
|
|||||||
Reference in New Issue
Block a user