replace common qcom sources with samsung ones
This commit is contained in:
198
qcom/opensource/commonsys-intf/display/include/color_metadata.h
Normal file
198
qcom/opensource/commonsys-intf/display/include/color_metadata.h
Normal file
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2018, 2020 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 __COLOR_METADATA_H__
|
||||
#define __COLOR_METADATA_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#else
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
|
||||
typedef enum ColorRange {
|
||||
Range_Limited = 0,
|
||||
Range_Full = 1,
|
||||
Range_Extended = 2,
|
||||
Range_Max = 0xff,
|
||||
} ColorRange;
|
||||
|
||||
// The following values matches the HEVC spec
|
||||
typedef enum ColorPrimaries {
|
||||
// Unused = 0;
|
||||
ColorPrimaries_BT709_5 = 1, // ITU-R BT.709-5 or equivalent
|
||||
/* Unspecified = 2, Reserved = 3*/
|
||||
ColorPrimaries_BT470_6M = 4, // ITU-R BT.470-6 System M or equivalent
|
||||
ColorPrimaries_BT601_6_625 = 5, // ITU-R BT.601-6 625 or equivalent
|
||||
ColorPrimaries_BT601_6_525 = 6, // ITU-R BT.601-6 525 or equivalent
|
||||
ColorPrimaries_SMPTE_240M = 7, // SMPTE_240M
|
||||
ColorPrimaries_GenericFilm = 8, // Generic Film
|
||||
ColorPrimaries_BT2020 = 9, // ITU-R BT.2020 or equivalent
|
||||
ColorPrimaries_SMPTE_ST428 = 10, // SMPTE_240M
|
||||
ColorPrimaries_AdobeRGB = 11,
|
||||
ColorPrimaries_DCIP3 = 12,
|
||||
ColorPrimaries_EBU3213 = 22,
|
||||
ColorPrimaries_Max = 0xff,
|
||||
} ColorPrimaries;
|
||||
|
||||
typedef enum GammaTransfer {
|
||||
// Unused = 0;
|
||||
Transfer_sRGB = 1, // ITR-BT.709-5
|
||||
/* Unspecified = 2, Reserved = 3 */
|
||||
Transfer_Gamma2_2 = 4,
|
||||
Transfer_Gamma2_8 = 5,
|
||||
Transfer_SMPTE_170M = 6, // BT.601-6 525 or 625
|
||||
Transfer_SMPTE_240M = 7, // SMPTE_240M
|
||||
Transfer_Linear = 8,
|
||||
Transfer_Log = 9,
|
||||
Transfer_Log_Sqrt = 10,
|
||||
Transfer_XvYCC = 11, // IEC 61966-2-4
|
||||
Transfer_BT1361 = 12, // Rec.ITU-R BT.1361 extended gamut
|
||||
Transfer_sYCC = 13, // IEC 61966-2-1 sRGB or sYCC
|
||||
Transfer_BT2020_2_1 = 14, // Rec. ITU-R BT.2020-2 (same as the values 1, 6, and 15)
|
||||
Transfer_BT2020_2_2 = 15, // Rec. ITU-R BT.2020-2 (same as the values 1, 6, and 14)
|
||||
Transfer_SMPTE_ST2084 = 16, // 2084
|
||||
// transfers unlikely to be required by Android
|
||||
Transfer_ST_428 = 17, // SMPTE ST 428-1
|
||||
Transfer_HLG = 18, // ARIB STD-B67
|
||||
Transfer_Max = 0xff,
|
||||
} GammaTransfer;
|
||||
|
||||
typedef enum MatrixCoEfficients {
|
||||
MatrixCoEff_Identity = 0,
|
||||
MatrixCoEff_BT709_5 = 1,
|
||||
/* Unspecified = 2, Reserved = 3 */
|
||||
MatrixCoeff_FCC_73_682 = 4,
|
||||
MatrixCoEff_BT601_6_625 = 5,
|
||||
MatrixCoEff_BT601_6_525 = 6,
|
||||
MatrixCoEff_SMPTE240M = 7, // used with 601_525_Unadjusted
|
||||
MatrixCoEff_YCgCo = 8,
|
||||
MatrixCoEff_BT2020 = 9,
|
||||
MatrixCoEff_BT2020Constant = 10,
|
||||
MatrixCoEff_BT601_6_Unadjusted = 11, // Used with BT601_625(KR=0.222, KB=0.071)
|
||||
MatrixCoEff_DCIP3 = 12,
|
||||
MatrixCoEff_Chroma_NonConstant = 13,
|
||||
MatrixCoEff_Max = 0xff,
|
||||
} MatrixCoEfficients;
|
||||
|
||||
typedef struct Primaries {
|
||||
uint32_t rgbPrimaries[3][2]; // unit 1/50000;
|
||||
uint32_t whitePoint[2]; // unit 1/50000;
|
||||
} Primaries;
|
||||
|
||||
typedef struct MasteringDisplay {
|
||||
bool colorVolumeSEIEnabled;
|
||||
Primaries primaries;
|
||||
uint32_t maxDisplayLuminance; // unit: cd/m^2.
|
||||
uint32_t minDisplayLuminance; // unit: 1/10000 cd/m^2.
|
||||
} MasteringDisplay;
|
||||
|
||||
typedef struct ContentLightLevel {
|
||||
bool lightLevelSEIEnabled;
|
||||
uint32_t maxContentLightLevel; // unit: cd/m^2.
|
||||
uint32_t minPicAverageLightLevel; // unit: cd/m^2, will be DEPRECATED, use below
|
||||
uint32_t maxPicAverageLightLevel; // unit: cd/m^2, its same as maxFrameAvgLightLevel(CTA-861-G)
|
||||
} ContentLightLevel;
|
||||
|
||||
typedef struct ColorRemappingInfo {
|
||||
bool criEnabled;
|
||||
uint32_t crId;
|
||||
uint32_t crCancelFlag;
|
||||
uint32_t crPersistenceFlag;
|
||||
uint32_t crVideoSignalInfoPresentFlag;
|
||||
uint32_t crRange;
|
||||
ColorPrimaries crPrimaries;
|
||||
GammaTransfer crTransferFunction;
|
||||
MatrixCoEfficients crMatrixCoefficients;
|
||||
uint32_t crInputBitDepth;
|
||||
uint32_t crOutputBitDepth;
|
||||
uint32_t crPreLutNumValMinusOne[3];
|
||||
uint32_t crPreLutCodedValue[3*33];
|
||||
uint32_t crPreLutTargetValue[3*33];
|
||||
uint32_t crMatrixPresentFlag;
|
||||
uint32_t crLog2MatrixDenom;
|
||||
int32_t crCoefficients[3*3];
|
||||
uint32_t crPostLutNumValMinusOne[3];
|
||||
uint32_t crPostLutCodedValue[3*33];
|
||||
uint32_t crPostLutTargetValue[3*33];
|
||||
} ColorRemappingInfo;
|
||||
|
||||
#define HDR_DYNAMIC_META_DATA_SZ 1024
|
||||
typedef struct ColorMetaData {
|
||||
// Default values based on sRGB, needs to be overridden in gralloc
|
||||
// based on the format and size.
|
||||
ColorPrimaries colorPrimaries;
|
||||
ColorRange range;
|
||||
GammaTransfer transfer;
|
||||
MatrixCoEfficients matrixCoefficients;
|
||||
|
||||
MasteringDisplay masteringDisplayInfo;
|
||||
ContentLightLevel contentLightLevel;
|
||||
ColorRemappingInfo cRI;
|
||||
|
||||
// Dynamic meta data elements
|
||||
bool dynamicMetaDataValid;
|
||||
uint32_t dynamicMetaDataLen;
|
||||
uint8_t dynamicMetaDataPayload[HDR_DYNAMIC_META_DATA_SZ];
|
||||
} ColorMetaData;
|
||||
|
||||
typedef struct Color10Bit {
|
||||
uint32_t R: 10;
|
||||
uint32_t G: 10;
|
||||
uint32_t B: 10;
|
||||
uint32_t A: 2;
|
||||
} Color10Bit;
|
||||
|
||||
typedef struct Lut3d {
|
||||
uint16_t dim; // dimension of each side of LUT cube (ex: 13, 17)in lutEntries
|
||||
uint16_t gridSize; // number of elements in the gridEntries
|
||||
/* Matrix ordering convension
|
||||
for (b = 0; b < dim; b++) {
|
||||
for (g = 0; g < dim; g++) {
|
||||
for (r = 0; r < dim; r++) {
|
||||
read/write [mR mG mB] associated w/ 3DLUT[r][g][b] to/from file
|
||||
}
|
||||
}
|
||||
} */
|
||||
Color10Bit *lutEntries;
|
||||
bool validLutEntries; // Indicates if entries are valid and can be used.
|
||||
/*
|
||||
The grid is a 1D LUT for each of the R,G,B channels that can be
|
||||
used to apply an independent nonlinear transformation to each
|
||||
channel before it is used as a coordinate for addressing
|
||||
the uniform 3D LUT. This effectively creates a non-uniformly
|
||||
sampled 3D LUT. This is useful for having independent control
|
||||
of the sampling grid density along each dimension for greater
|
||||
precision in spite of having a relatively small number of samples.i
|
||||
*/
|
||||
Color10Bit *gridEntries;
|
||||
bool validGridEntries; // Indicates if entries are valid and can be used.
|
||||
} Lut3d;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __COLOR_METADATA_H__
|
||||
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2020, 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Changes from Qualcomm Innovation Center are provided under the following license:
|
||||
*
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the
|
||||
* disclaimer below) 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 Qualcomm Innovation Center, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
|
||||
* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
|
||||
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 __COMPOSER_EXTN_INTF_H__
|
||||
#define __COMPOSER_EXTN_INTF_H__
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include "frame_scheduler_intf.h"
|
||||
#include "display_extn_intf.h"
|
||||
#include "phase_offset_extn_intf.h"
|
||||
#include "smomo_interface.h"
|
||||
|
||||
#define COMPOSER_EXTN_REV_MAJOR (1)
|
||||
#define COMPOSER_EXTN_REV_MINOR (0)
|
||||
#define COMPOSER_EXTN_VERSION_TAG ((uint16_t) ((COMPOSER_EXTN_REV_MAJOR << 8) \
|
||||
| COMPOSER_EXTN_REV_MINOR))
|
||||
|
||||
namespace composer {
|
||||
|
||||
class ComposerExtnIntf {
|
||||
public:
|
||||
virtual int CreateFrameScheduler(FrameSchedulerIntf **intf) = 0;
|
||||
virtual void DestroyFrameScheduler(FrameSchedulerIntf *intf) = 0;
|
||||
virtual int CreateDisplayExtn(DisplayExtnIntf **intf) = 0;
|
||||
virtual void DestroyDisplayExtn(DisplayExtnIntf *intf) = 0;
|
||||
virtual int CreatePhaseOffsetExtn(PhaseOffsetExtnIntf **intf) = 0;
|
||||
virtual void DestroyPhaseOffsetExtn(PhaseOffsetExtnIntf *intf) = 0;
|
||||
virtual bool CreateSmomoExtn(smomo::SmomoIntf **intf, smomo::DisplayInfo info) = 0;
|
||||
virtual void DestroySmomoExtn(smomo::SmomoIntf *intf) = 0;
|
||||
protected:
|
||||
virtual ~ComposerExtnIntf() { }
|
||||
};
|
||||
|
||||
class ComposerExtnLib {
|
||||
public:
|
||||
static ComposerExtnIntf * GetInstance() {
|
||||
return g_composer_ext_lib_.composer_ext_intf_;
|
||||
}
|
||||
|
||||
private:
|
||||
const char *lib_name = "libcomposerextn.qti.so";
|
||||
|
||||
typedef int (*CreateComposerExtn)(uint16_t version, ComposerExtnIntf **intf);
|
||||
typedef void (*DestroyComposerExtn)(ComposerExtnIntf *intf);
|
||||
|
||||
ComposerExtnLib() {
|
||||
lib_obj_ = ::dlopen(lib_name, RTLD_NOW);
|
||||
if (!lib_obj_) {
|
||||
return;
|
||||
}
|
||||
|
||||
create_composer_ext_fn_ = reinterpret_cast<CreateComposerExtn>(
|
||||
::dlsym(lib_obj_, "CreateComposerExtn"));
|
||||
destroy_composer_ext_fn_ = reinterpret_cast<DestroyComposerExtn>(
|
||||
::dlsym(lib_obj_, "DestroyComposerExtn"));
|
||||
if (create_composer_ext_fn_ && destroy_composer_ext_fn_) {
|
||||
create_composer_ext_fn_(COMPOSER_EXTN_VERSION_TAG, &composer_ext_intf_);
|
||||
}
|
||||
}
|
||||
|
||||
~ComposerExtnLib() {
|
||||
if (composer_ext_intf_) {
|
||||
destroy_composer_ext_fn_(composer_ext_intf_);
|
||||
}
|
||||
|
||||
if (lib_obj_) {
|
||||
::dlclose(lib_obj_);
|
||||
}
|
||||
}
|
||||
|
||||
static ComposerExtnLib g_composer_ext_lib_;
|
||||
void *lib_obj_ = nullptr;
|
||||
CreateComposerExtn create_composer_ext_fn_ = nullptr;
|
||||
DestroyComposerExtn destroy_composer_ext_fn_ = nullptr;
|
||||
ComposerExtnIntf *composer_ext_intf_ = nullptr;
|
||||
};
|
||||
|
||||
} // namespace composer
|
||||
|
||||
#endif // __COMPOSER_EXTN_INTF_H__
|
||||
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2021, 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Changes from Qualcomm Innovation Center are provided under the following license:
|
||||
*
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the
|
||||
* disclaimer below) 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 Qualcomm Innovation Center, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
|
||||
* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
|
||||
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 __DISP_COLOR_PROCESSING_H__
|
||||
#define __DISP_COLOR_PROCESSING_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DISP_DE_LPF_BLEND
|
||||
#define LUT3D_ENTRIES_SIZE (17 * 17 * 17)
|
||||
#define LUT3D_GC_ENTRIES_SIZE 1024
|
||||
|
||||
struct rgb {
|
||||
uint32_t r;
|
||||
uint32_t g;
|
||||
uint32_t b;
|
||||
};
|
||||
|
||||
struct rgb_entry {
|
||||
struct rgb in;
|
||||
struct rgb out;
|
||||
};
|
||||
|
||||
/*
|
||||
struct lut3d_info
|
||||
flags -- Reserved
|
||||
lut3d_id -- Unique ID used to distinguish individual 3D Lut tables
|
||||
uniform -- Identifies if coefficients are uniform (1) or non-uniform (0)
|
||||
num_entries-- Identifies the number of lut values in the table
|
||||
entries -- Table buffer holding the lut values.
|
||||
|
||||
All coefficients are expected to be tightly packed in the
|
||||
structure, any unused buffer space shall exist at the end
|
||||
of the buffer.
|
||||
*/
|
||||
struct lut3d_info {
|
||||
uint32_t flags;
|
||||
uint32_t lut3d_id;
|
||||
uint32_t uniform;
|
||||
uint32_t num_entries;
|
||||
struct rgb_entry entries[LUT3D_ENTRIES_SIZE];
|
||||
};
|
||||
|
||||
/*
|
||||
struct lut1d_info
|
||||
flags -- Reserved
|
||||
bit_width -- Bit width of each entry
|
||||
num_entries -- Identifies the number of lut values in the table
|
||||
entries -- Table buffer holding the lut values
|
||||
*/
|
||||
#define LUT1D_ENTRIES_SIZE (256)
|
||||
struct lut1d_info {
|
||||
uint32_t flags;
|
||||
uint32_t bit_width;
|
||||
uint32_t strength;
|
||||
uint32_t num_entries;
|
||||
struct rgb entries[LUT1D_ENTRIES_SIZE];
|
||||
};
|
||||
|
||||
static const uint32_t kDeTuningFlagSharpFactor = 0x01;
|
||||
static const uint32_t kDeTuningFlagClip = 0x02;
|
||||
static const uint32_t kDeTuningFlagThrQuiet = 0x04;
|
||||
static const uint32_t kDeTuningFlagThrDieout = 0x08;
|
||||
static const uint32_t kDeTuningFlagThrLow = 0x10;
|
||||
static const uint32_t kDeTuningFlagThrHigh = 0x20;
|
||||
static const uint32_t kDeTuningFlagContentQualLevel = 0x40;
|
||||
static const uint32_t kDeTuningFlagDeBlend = 0x80;
|
||||
static const uint32_t kDeTuningFlagDeLpfBlend = 0x100;
|
||||
|
||||
typedef enum {
|
||||
kDeContentQualUnknown,
|
||||
kDeContentQualLow,
|
||||
kDeContentQualMedium,
|
||||
kDeContentQualHigh,
|
||||
kDeContentQualMax,
|
||||
} PPDEContentQualLevel;
|
||||
|
||||
typedef enum {
|
||||
kDeContentTypeUnknown,
|
||||
kDeContentTypeVideo,
|
||||
kDeContentTypeGraphics,
|
||||
kDeContentTypeMax,
|
||||
} PPDEContentType;
|
||||
|
||||
/*
|
||||
struct PPDETuningCfg
|
||||
*/
|
||||
struct PPDETuningCfg {
|
||||
uint32_t flags;
|
||||
int32_t sharp_factor;
|
||||
uint16_t thr_quiet;
|
||||
uint16_t thr_dieout;
|
||||
uint16_t thr_low;
|
||||
uint16_t thr_high;
|
||||
uint16_t clip;
|
||||
PPDEContentQualLevel quality;
|
||||
PPDEContentType content_type;
|
||||
uint32_t de_blend;
|
||||
uint32_t de_lpf_h;
|
||||
uint32_t de_lpf_m;
|
||||
uint32_t de_lpf_l;
|
||||
};
|
||||
|
||||
struct PPDETuningCfgData {
|
||||
uint32_t cfg_en;
|
||||
struct PPDETuningCfg params;
|
||||
bool cfg_pending;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // __DISP_COLOR_PROCESSING_H__
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021, 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Changes from Qualcomm Innovation Center are provided under the following license:
|
||||
*
|
||||
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
*/
|
||||
|
||||
#ifndef __DISP_EXTN_INTF_H__
|
||||
#define __DISP_EXTN_INTF_H__
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <ui/Fence.h>
|
||||
|
||||
#define EARLY_WAKEUP_FEATURE 1
|
||||
#define DYNAMIC_EARLY_WAKEUP_CONFIG 1
|
||||
#define PASS_COMPOSITOR_TID 1
|
||||
#define SMART_DISPLAY_CONFIG 1
|
||||
//#define FPS_MITIGATION_ENABLED 0
|
||||
#define UNIFIED_DRAW_EXT 1
|
||||
|
||||
namespace composer {
|
||||
|
||||
using FpsMitigationCallback = std::function<void(float)>;
|
||||
|
||||
struct LayerFlags {
|
||||
bool secure_camera = false;
|
||||
bool secure_video = false;
|
||||
bool secure_ui = false;
|
||||
bool compatible = false;
|
||||
bool blur = false;
|
||||
};
|
||||
|
||||
struct FBTLayerInfo {
|
||||
int32_t width = 0;
|
||||
int32_t height = 0;
|
||||
int32_t dataspace = 0;
|
||||
int32_t max_buffer_count = 3;
|
||||
bool secure = false;
|
||||
int32_t format = 0;
|
||||
|
||||
bool operator != (FBTLayerInfo &f) {
|
||||
return (width != f.width ||
|
||||
height != f.height ||
|
||||
dataspace != f.dataspace ||
|
||||
secure != f.secure ||
|
||||
format != f.format);
|
||||
}
|
||||
};
|
||||
|
||||
struct FBTSlotInfo {
|
||||
int index = -1;
|
||||
android::sp<android::Fence> fence = android::Fence::NO_FENCE;
|
||||
bool predicted = false;
|
||||
};
|
||||
|
||||
enum PerfHintType {
|
||||
kNone = 0,
|
||||
kSurfaceFlinger,
|
||||
kRenderEngine,
|
||||
};
|
||||
|
||||
class DisplayExtnIntf {
|
||||
public:
|
||||
virtual int SetContentFps(uint32_t fps) = 0;
|
||||
virtual void RegisterDisplay(uint32_t display_id) = 0;
|
||||
virtual void UnregisterDisplay(uint32_t display_id) = 0;
|
||||
virtual int SetActiveConfig(uint32_t display_id, uint32_t config_id) = 0;
|
||||
virtual void SetSupportedRefreshRates(std::vector<float> fps_list) = 0;
|
||||
virtual void NotifyDisplayUpdateImminent() = 0;
|
||||
virtual int NotifyEarlyWakeUp(bool gpu, bool display) = 0;
|
||||
virtual int NotifyDisplayEarlyWakeUp(uint32_t display_id) = 0;
|
||||
virtual int SetEarlyWakeUpConfig(uint32_t display_id, bool enable) = 0;
|
||||
virtual int TryUnifiedDraw(uint32_t display_id, int32_t max_frameBuffer) = 0;
|
||||
virtual int BeginDraw(uint32_t display_id, std::vector<LayerFlags> &layers,
|
||||
const FBTLayerInfo fbt_info, const FBTSlotInfo &fbt_current,
|
||||
FBTSlotInfo &fbt_future) = 0;
|
||||
virtual int EndDraw(uint32_t display_id, const FBTSlotInfo &fbt_current) = 0;
|
||||
virtual int SendCompositorTid(PerfHintType type, int tid) = 0;
|
||||
virtual bool IsSmartDisplayConfig(uint32_t display_id) = 0;
|
||||
virtual void SetFpsMitigationCallback(const FpsMitigationCallback callback,
|
||||
std::vector<float> fps_list) = 0;
|
||||
virtual void EndUnifiedDraw(uint32_t display_id) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~DisplayExtnIntf() { }
|
||||
};
|
||||
|
||||
} // namespace composer
|
||||
|
||||
#endif // __DISP_EXTN_INTF_H__
|
||||
102
qcom/opensource/commonsys-intf/display/include/frame_extn_intf.h
Normal file
102
qcom/opensource/commonsys-intf/display/include/frame_extn_intf.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (c) 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 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 __FRAME_EXTN_INTF_H__
|
||||
#define __FRAME_EXTN_INTF_H__
|
||||
|
||||
#include <utils/Timers.h>
|
||||
#include <sys/types.h>
|
||||
#include <string>
|
||||
|
||||
#define EXTENSION_LIBRARY_NAME "libframeextension.so"
|
||||
#define CREATE_FRAME_EXTN_INTERFACE "CreateFrameExtnInterface"
|
||||
#define DESTROY_FRAME_EXTN_INTERFACE "DestroyFrameExtnInterface"
|
||||
|
||||
namespace composer {
|
||||
|
||||
class FrameExtnIntf;
|
||||
|
||||
// Function addresses queried at runtime using ::dlsym()
|
||||
typedef bool (*CreateFrameExtnInterface)(FrameExtnIntf **interface);
|
||||
typedef bool (*DestroyFrameExtnInterface)(FrameExtnIntf *interface);
|
||||
|
||||
/*! @brief This structure defines extension version.
|
||||
|
||||
@details It is used to avoid any mismatch of versions between frameextension library
|
||||
implementation and its clients usage (like SurfaceFlinger).
|
||||
|
||||
@sa FrameInfo
|
||||
*/
|
||||
struct Version {
|
||||
uint8_t minor;
|
||||
uint8_t major;
|
||||
};
|
||||
|
||||
/*! @brief This structure defines the Frame info required by FrameExtnIntf.
|
||||
|
||||
@sa FrameExtnIntf::SetFrameInfo
|
||||
*/
|
||||
struct FrameInfo {
|
||||
Version version;
|
||||
bool transparent_region;
|
||||
int width;
|
||||
int height;
|
||||
int max_queued_frames;
|
||||
int num_idle;
|
||||
std::string max_queued_layer_name;
|
||||
std::string layer_name;
|
||||
nsecs_t current_timestamp;
|
||||
nsecs_t previous_timestamp;
|
||||
nsecs_t vsync_timestamp;
|
||||
nsecs_t refresh_timestamp;
|
||||
nsecs_t ref_latency;
|
||||
nsecs_t vsync_period;
|
||||
};
|
||||
|
||||
|
||||
/*! @brief This interface shall be implemented by frameextension library.
|
||||
|
||||
@details This class declares prototype for frameextension public interfaces which must be
|
||||
implemented by frameextension library.
|
||||
*/
|
||||
class FrameExtnIntf {
|
||||
public:
|
||||
/*! @brief Set the FrameInfo used by frameextension.
|
||||
|
||||
@details This function is called once per refresh cycle so that required frame info are
|
||||
feed to frameextension.
|
||||
|
||||
@param[in] frameInfo \link FrameInfo \endlink
|
||||
|
||||
@return \link int \endlink
|
||||
*/
|
||||
virtual int SetFrameInfo(FrameInfo &frameInfo) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~FrameExtnIntf() { };
|
||||
};
|
||||
|
||||
} // namespace composer
|
||||
|
||||
#endif // __FRAME_EXTN_INTF_H__
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 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
|
||||
* 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 __FRAME_SCHEDULER_INTF_H__
|
||||
#define __FRAME_SCHEDULER_INTF_H__
|
||||
|
||||
#include <utils/Timers.h>
|
||||
|
||||
namespace composer {
|
||||
|
||||
class FrameSchedulerIntf {
|
||||
public:
|
||||
virtual int UpdateFrameScheduling(int fenceFd, nsecs_t *timeStamp) = 0;
|
||||
protected:
|
||||
virtual ~FrameSchedulerIntf() { }
|
||||
};
|
||||
|
||||
} // namespace composer
|
||||
|
||||
#endif // __FRAME_SCHEDULER_INTF_H__
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 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
|
||||
* 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 __LAYER_EXTN_INTF_H__
|
||||
#define __LAYER_EXTN_INTF_H__
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace composer {
|
||||
|
||||
#define LAYER_EXTN_LIBRARY_NAME "liblayerext.qti.so"
|
||||
#define CREATE_LAYER_EXTN_INTERFACE "CreateLayerExtnInterface"
|
||||
#define DESTROY_LAYER_EXTN_INTERFACE "DestroyLayerExtnInterface"
|
||||
|
||||
#define LAYER_EXTN_REVISION_MAJOR (1)
|
||||
#define LAYER_EXTN_REVISION_MINOR (0)
|
||||
#define LAYER_EXTN_VERSION_TAG ((uint16_t) ((LAYER_EXTN_REVISION_MAJOR << 8) \
|
||||
| LAYER_EXTN_REVISION_MINOR))
|
||||
|
||||
class LayerExtnIntf {
|
||||
public:
|
||||
virtual ~LayerExtnIntf() = default;
|
||||
virtual int GetLayerClass(const std::string &name) = 0;
|
||||
virtual void UpdateLayerState(const std::vector<std::string> &layers, int num_layers) = 0;
|
||||
};
|
||||
|
||||
typedef bool (*CreateLayerExtnInterface)(uint16_t version, LayerExtnIntf **interface);
|
||||
typedef void (*DestroyLayerExtnInterface)(LayerExtnIntf *interface);
|
||||
|
||||
} // namespace composer
|
||||
|
||||
#endif // __LAYER_EXTN_INTF_H__
|
||||
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (c) 2020 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Changes from Qualcomm Innovation Center are provided under the following license:
|
||||
*
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted (subject to the limitations in the
|
||||
* disclaimer below) 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 Qualcomm Innovation Center, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
|
||||
* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
|
||||
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER 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 __PHASE_OFFSET_EXTN_INTF_H__
|
||||
#define __PHASE_OFFSET_EXTN_INTF_H__
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#define PHASE_OFFSET_EXTN 1
|
||||
#define DYNAMIC_APP_DURATIONS 1
|
||||
|
||||
namespace composer {
|
||||
|
||||
class PhaseOffsetExtnIntf {
|
||||
public:
|
||||
virtual int GetAdvancedSfOffsets(std::unordered_map<float, int64_t> *advancedSfOffsets) = 0;
|
||||
virtual int GetWorkDurationConfigs(std::unordered_map<float, std::pair<int64_t, int64_t>>
|
||||
*workDurationConfigs) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~PhaseOffsetExtnIntf() { }
|
||||
};
|
||||
|
||||
} // namespace composer
|
||||
|
||||
#endif // __PHASE_OFFSET_EXTN_INTF_H__
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 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 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.
|
||||
*/
|
||||
|
||||
/*! @file smomo_config.h
|
||||
@brief Interface file for the client of Smomo service, which provides tuning parameters of Smomo
|
||||
|
||||
@details Smomo clients use these interfaces to enable or disable Smomo, tune parameters to
|
||||
optimize the display performance.
|
||||
*/
|
||||
|
||||
#ifndef __SMOMO_CONFIG_H__
|
||||
#define __SMOMO_CONFIG_H__
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace smomoconfig {
|
||||
|
||||
int EnableSmomo(bool enable);
|
||||
|
||||
int GetSmomoMode(uint32_t *mode_idx);
|
||||
|
||||
int SetSmomoMode(uint32_t mode_idx);
|
||||
|
||||
} // namespace smomoconfig
|
||||
|
||||
#endif // __SMOMO_CONFIG_H__
|
||||
|
||||
281
qcom/opensource/commonsys-intf/display/include/smomo_interface.h
Normal file
281
qcom/opensource/commonsys-intf/display/include/smomo_interface.h
Normal file
@@ -0,0 +1,281 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2021, 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Changes from Qualcomm Innovation Center are provided under the following license:
|
||||
*
|
||||
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||
*/
|
||||
|
||||
/*! @file smomo.h
|
||||
@brief Interface file for SmoMo which defines the public interface exposed to SmoMo clients.
|
||||
|
||||
@details SmoMo clients use these interfaces to feed SmoMo required info like frame rate, refresh
|
||||
rate, these info are used to update SmoMo internal state.
|
||||
*/
|
||||
|
||||
#ifndef __SMOMO_INTERFACE_H__
|
||||
#define __SMOMO_INTERFACE_H__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <ui/Fence.h>
|
||||
#include <cutils/native_handle.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#define TIMED_RENDERING_METADATA_FEATURE 1
|
||||
#define FRC_FRAME_PACING_FEATURE 1
|
||||
|
||||
namespace smomo {
|
||||
|
||||
#define SMOMO_LIBRARY_NAME "libsmomo.qti.so"
|
||||
#define CREATE_SMOMO_INTERFACE_NAME "CreateSmomoInterface"
|
||||
#define DESTROY_SMOMO_INTERFACE_NAME "DestroySmomoInterface"
|
||||
|
||||
#define SMOMO_REVISION_MAJOR (2)
|
||||
#define SMOMO_REVISION_MINOR (0)
|
||||
#define SMOMO_VERSION_TAG ((uint16_t) ((SMOMO_REVISION_MAJOR << 8) \
|
||||
| SMOMO_REVISION_MINOR))
|
||||
|
||||
typedef int64_t nsecs_t;
|
||||
|
||||
/*! @brief This structure defines the layer stats required by SmoMo.
|
||||
|
||||
@sa SmomoIntf::updateSmomoState
|
||||
*/
|
||||
struct SmomoLayerStats {
|
||||
std::string name; // layer full name
|
||||
int32_t id; // layer ID
|
||||
};
|
||||
|
||||
/*! @brief This structure defines the buffer stats required by SmoMo.
|
||||
|
||||
@sa SmomoIntf::CollectLayerStats
|
||||
@sa SmomoIntf::ShouldPresentNow
|
||||
*/
|
||||
struct SmomoBufferStats {
|
||||
int32_t id; // layer ID
|
||||
int32_t queued_frames; // queued frame count of this layer
|
||||
bool auto_timestamp; // whether timestamp was generated automatically
|
||||
nsecs_t timestamp; // layer buffer's desired present timestamp
|
||||
nsecs_t dequeue_latency; // last dequeue duration
|
||||
int64_t key; // buffer identity
|
||||
buffer_handle_t buffer_hnd; // layer buffer handle
|
||||
uint64_t frame_number;
|
||||
};
|
||||
|
||||
enum DisplayType {
|
||||
kBuiltin,
|
||||
kPluggable,
|
||||
};
|
||||
|
||||
struct DisplayInfo {
|
||||
int32_t display_id;
|
||||
DisplayType type;
|
||||
bool is_primary;
|
||||
};
|
||||
|
||||
/*! @brief SmoMo interface implemented by SmoMo library.
|
||||
|
||||
@details This class declares prototype for SmoMo public interfaces which must be
|
||||
implemented by SmoMo library. SmoMo clients will use these methods to feed required
|
||||
info to SmoMo implementation.
|
||||
*/
|
||||
class SmomoIntf {
|
||||
public:
|
||||
virtual ~SmomoIntf() = default;
|
||||
|
||||
// 1.0 interface
|
||||
|
||||
/*! @brief Update SmoMo internal state.
|
||||
|
||||
@details This function is called once per each composition so that required layer info are feed
|
||||
to SmoMo, the SmoMo uses these info to update its internal state.
|
||||
|
||||
@param[in] layers \link SmomoLayerStats \endlink
|
||||
@param[in] refresh_rate current display refresh rate
|
||||
|
||||
@return \link void \endlink
|
||||
*/
|
||||
virtual void UpdateSmomoState(const std::vector<SmomoLayerStats> &layers,
|
||||
float refresh_rate) = 0;
|
||||
|
||||
/*! @brief Collect layer buffer stats.
|
||||
|
||||
@details This function is called once new buffer is ready for this layer. It's used to collect
|
||||
layer's buffer stats for SmoMo.
|
||||
|
||||
@param[in] \link SmomoBufferStats \endlink
|
||||
|
||||
@return \link void \endlink
|
||||
*/
|
||||
virtual void CollectLayerStats(const SmomoBufferStats &buffer_stats) = 0;
|
||||
|
||||
/*! @brief Is this layer buffer ready to present.
|
||||
|
||||
@details This function is called by SmoMo clients used to check whether this layer buffer is
|
||||
due to present.
|
||||
|
||||
@param[in] \link SmomoBufferStats \endlink
|
||||
@param[in] next_vsync_time When next VSYNC arrives
|
||||
|
||||
@return \link bool \endlink
|
||||
*/
|
||||
virtual bool ShouldPresentNow(const SmomoBufferStats &buffer_stats,
|
||||
const nsecs_t next_vsync_time) = 0;
|
||||
|
||||
/*! @brief Change refresh rate callback type definition.
|
||||
*/
|
||||
using ChangeRefreshRateCallback = std::function<void(int32_t)>;
|
||||
|
||||
/*! @brief Set the callback used by SmoMo to change display refresh rate.
|
||||
|
||||
@details This function is called by SmoMo clients used to set the refresh rate callback.
|
||||
|
||||
@param[in] callback \link ChangeRefreshRateCallback \endlink
|
||||
|
||||
@return \link void \endlink
|
||||
*/
|
||||
virtual void SetChangeRefreshRateCallback(
|
||||
const ChangeRefreshRateCallback& callback) = 0;
|
||||
|
||||
/*! @brief Set the refersh rates supported by display.
|
||||
|
||||
@details This function is called to tell SmoMo what refresh rates this display can suport.
|
||||
|
||||
@param[in] refresh_rates The refresh rates supported by the display
|
||||
|
||||
@return \link void \endlink
|
||||
*/
|
||||
virtual void SetDisplayRefreshRates(const std::vector<float> &refresh_rates) = 0;
|
||||
|
||||
/*! @brief Get the current frame rate from SmoMo.
|
||||
|
||||
@details This function is called by SmoMo client to query the current frame rate, which is
|
||||
based on the internal state of SmoMo. Client needs to call the UpdateSmomoState API before
|
||||
calling this function. SmoMo only returns a valid frame rate when it's settled to a state.
|
||||
|
||||
@return > 0 if valid, -1 if invalid.
|
||||
|
||||
@return \link int \endlink
|
||||
*/
|
||||
virtual int GetFrameRate() = 0;
|
||||
|
||||
// 2.0 interface
|
||||
|
||||
/*! @brief Set layer buffer's present timestamp.
|
||||
|
||||
@details This function is called by SmoMo clients used to indicate buffer has been presented.
|
||||
|
||||
@param[in] layer_id layer id
|
||||
@param[in] timestamp buffer's desired present timestamp
|
||||
|
||||
@return \link void \endlink
|
||||
*/
|
||||
virtual void SetPresentTime(const int32_t layer_id, const nsecs_t timestamp) = 0;
|
||||
|
||||
/*! @brief vsync listener.
|
||||
|
||||
@details This function is called by SmoMo clients used to notify Vsync events.
|
||||
|
||||
@param[in] timestamp vsync timestamp
|
||||
|
||||
@return \link void \endlink
|
||||
*/
|
||||
virtual void OnVsync(const nsecs_t timestamp) = 0;
|
||||
|
||||
/*! @brief Is this layer buffer early to present.
|
||||
|
||||
@details This function is called by SmoMo clients used to check whether this layer buffer is
|
||||
not ready to present.
|
||||
|
||||
@param[in] layer_id layer id
|
||||
@param[in] desired_present_time desired present time
|
||||
|
||||
@return \link bool \endlink
|
||||
*/
|
||||
virtual bool FrameIsEarly(const int32_t layer_id, const nsecs_t desired_present_time) = 0;
|
||||
|
||||
/*! @brief Is this layer buffer late to present.
|
||||
|
||||
@details This function is called by SmoMo clients used to check whether this layer buffer is
|
||||
late to present.
|
||||
|
||||
@param[in] layer_id layer id
|
||||
@param[in] next_vsync_time When next VSYNC arrives
|
||||
|
||||
@return \link bool \endlink
|
||||
*/
|
||||
virtual bool FrameIsLate(const int32_t layer_id, const nsecs_t next_vsync_time) = 0;
|
||||
|
||||
/*! @brief Sync to display hardware.
|
||||
|
||||
@details This function is called by SmoMo clients used to align with display hardware.
|
||||
|
||||
@param[in] fence present fence
|
||||
@param[out] timestamp present fence timestamp
|
||||
|
||||
@return \link bool \endlink
|
||||
*/
|
||||
virtual bool SyncToDisplay(const android::sp<android::Fence>& fence,
|
||||
nsecs_t *timestamp) = 0;
|
||||
|
||||
/*! @brief Low latency mode enaled or not.
|
||||
|
||||
@details This function is called by SmoMo clients used to check whether it's
|
||||
in low latency mode.
|
||||
|
||||
@return \link bool \endlink
|
||||
*/
|
||||
virtual bool LowLatencyMode() = 0;
|
||||
|
||||
/*! @brief Enable/Disable Refresh Rate change.
|
||||
|
||||
@details This function is called by SmoMo clients used to control
|
||||
refresh rate change.
|
||||
|
||||
@return \link void \endlink
|
||||
*/
|
||||
virtual void SetRefreshRateChangeStatus(bool enable) = 0;
|
||||
|
||||
/*! @brief Get SmoMo refresh rate votes for the tracked layers
|
||||
|
||||
@details This function is called by SmoMo clients
|
||||
to get the refresh rate votes for SmoMo tracked layers
|
||||
|
||||
@return \link void \endlink
|
||||
*/
|
||||
virtual void GetRefreshRateVote(std::map<int, int>& refresh_rate_votes) = 0;
|
||||
|
||||
};
|
||||
|
||||
typedef bool (*CreateSmomoInterface)(uint16_t version, SmomoIntf **interface);
|
||||
typedef void (*DestroySmomoInterface)(SmomoIntf *interface);
|
||||
|
||||
} // namespace smomo
|
||||
|
||||
#endif // __SMOMO_INTERFACE_H__
|
||||
Reference in New Issue
Block a user