replace common qcom sources with samsung ones

This commit is contained in:
SaschaNes
2025-08-12 22:13:00 +02:00
parent ba24dcded9
commit 6f7753de11
5682 changed files with 2450203 additions and 103634 deletions

View File

@@ -0,0 +1,26 @@
cc_library_headers {
name: "common_interface_headers",
vendor: true,
export_include_dirs : [
"common",
],
}
cc_library_headers {
name: "snapalloc_interface_headers",
vendor: true,
export_include_dirs : [
"snapalloc",
],
}
cc_library_headers {
name: "sdmclient_interface_headers",
vendor: true,
export_include_dirs : [
"sdmclient",
],
header_libs: [
"snapalloc_interface_headers",
],
}

View File

@@ -0,0 +1,15 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_ADDRESS_H__
#define __COMMON_ADDRESS_H__
#include <cstdint>
typedef struct vendor_qti_hardware_display_common_Address {
// Pointer address
// Use utility function to access pointer
uint64_t addressPointer;
} vendor_qti_hardware_display_common_Address;
#endif // __COMMON_ADDRESS_H__

View File

@@ -0,0 +1,15 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_BLENDMODE_H__
#define __COMMON_BLENDMODE_H__
typedef enum vendor_qti_hardware_display_common_BlendMode {
BLEND_MODE_INVALID = 0,
BLEND_MODE_NONE = 1,
BLEND_MODE_PREMULTIPLIED = 2,
BLEND_MODE_COVERAGE = 3,
BLEND_MODE_MAX = 0xFF,
} vendor_qti_hardware_display_common_BlendMode;
#endif // __COMMON_BLENDMODE_H__

View File

@@ -0,0 +1,15 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_BUFFERCLIENT_H__
#define __COMMON_BUFFERCLIENT_H__
typedef enum vendor_qti_hardware_display_common_BufferClient {
BUFFERCLIENT_INVALID = -1,
BUFFERCLIENT_DPU = 0,
BUFFERCLIENT_UNTRUSTED_VM = 1,
BUFFERCLIENT_TRUSTED_VM = 2,
BUFFERCLIENT_MAX = 3,
} vendor_qti_hardware_display_common_BufferClient;
#endif // __COMMON_BUFFERCLIENT_H__

View File

@@ -0,0 +1,38 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_BUFFERLAYOUT_H__
#define __COMMON_BUFFERLAYOUT_H__
#include "PlaneLayout.h"
#define QTI_MAX_NUM_PLANES 8
typedef struct vendor_qti_hardware_display_common_BufferLayout {
/**
* Layout for each plane
*/
vendor_qti_hardware_display_common_PlaneLayout planes[QTI_MAX_NUM_PLANES];
/**
* Number of planes in the buffer
*/
int plane_count;
/**
* Overall buffer size in bytes, including padding.
*/
int size_in_bytes;
/**
* Bytes per pixel
*/
int bpp;
/**
* Aligned width (in bytes) of buffer
*/
int aligned_width_in_bytes;
/**
* Aligned height (in number of rows) of buffer
*/
int aligned_height;
} vendor_qti_hardware_display_common_BufferLayout;
#endif // __COMMON_BUFFERLAYOUT_H__

View File

@@ -0,0 +1,16 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_BUFFERPERMIISSION_H__
#define __COMMON_BUFFERPERMIISSION_H__
union vendor_qti_hardware_display_common_BufferPermission {
struct {
uint8_t read : 1;
uint8_t write : 1;
uint8_t execute : 1;
};
uint8_t permission;
};
#endif // __COMMON_BUFFERPERMIISSION_H__

View File

@@ -0,0 +1,149 @@
// Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_BUFFERUSAGE_H__
#define __COMMON_BUFFERUSAGE_H__
#include <cstdint>
typedef enum vendor_qti_hardware_display_common_BufferUsage : uint64_t {
/** Bit 0-3 is an enum */
CPU_READ_MASK = 0xf,
/** Buffer is never read by CPU */
CPU_READ_NEVER = 0,
/** Buffer is rarely read by CPU */
CPU_READ_RARELY = 2,
/** Buffer is often read by CPU */
CPU_READ_OFTEN = 3,
/** Bit 4-7 is an enum */
CPU_WRITE_MASK = 0xf << 4,
/** Buffer is never written by CPU */
CPU_WRITE_NEVER = 0 << 4,
/** Buffer is rarely written by CPU */
CPU_WRITE_RARELY = 2 << 4,
/** Buffer is often written by CPU */
CPU_WRITE_OFTEN = 3 << 4,
/** Buffer is used as a GPU texture */
GPU_TEXTURE = 1 << 8,
/** Buffer is used as a GPU render target */
GPU_RENDER_TARGET = 1 << 9,
/** bit 10 must be zero */
/** Buffer is used as a composer overlay layer */
COMPOSER_OVERLAY = 1 << 11,
/** Buffer is used as a composer client layer */
COMPOSER_CLIENT_TARGET = 1 << 12,
/** bit 13 must be zero */
/** Buffer has protected content */
PROTECTED = 1 << 14,
/** Buffer is used as composer cursor layer */
COMPOSER_CURSOR = 1 << 15,
/** Buffer is used as video encoder input */
VIDEO_ENCODER = 1 << 16,
/** Buffer is used as camera output */
CAMERA_OUTPUT = 1 << 17,
/** Buffer is used as camera input */
CAMERA_INPUT = 1 << 18,
/** bit 19 must be zero */
/** Buffer is used as a renderscript allocation */
RENDERSCRIPT = 1 << 20,
/** bit 21 must be zero */
/** Buffer is used as video decoder output */
VIDEO_DECODER = 1 << 22,
/** Buffer is used as a sensor direct report output */
SENSOR_DIRECT_DATA = 1 << 23,
/**
* Buffer is used as as an OpenGL shader storage or uniform
* buffer object
*/
GPU_DATA_BUFFER = 1 << 24,
/** Buffer is used as a cube map texture */
GPU_CUBE_MAP = 1 << 25,
/** Buffer contains a complete mipmap hierarchy */
GPU_MIPMAP_COMPLETE = 1 << 26,
/** Buffer is used as input for HEIC encoder */
HW_IMAGE_ENCODER = 1 << 27,
/* Non linear, Universal Bandwidth Compression */
QTI_ALLOC_UBWC = 1 << 28,
/**
* Buffer is allocated with uncached memory (using O_DSYNC),
* cannot be used with noncontiguous heaps
*/
QTI_PRIVATE_UNCACHED = 1 << 29,
/* Buffer has a 10 bit format if format is implementation defined */
QTI_PRIVATE_10BIT = 1 << 30,
/* Buffer is used for secure display */
QTI_PRIVATE_SECURE_DISPLAY = 1ULL << 31,
/* Buffer is used for front-buffer rendering */
FRONT_BUFFER = 1ULL << 32,
/* Buffer is used for Samsung Fingerprint Mask View */
QTI_PRIVATE_FINGERPRINT_MASK_BUFFER = 1L << 34,
/* Bits 33-47 must be zero and are reserved for future versions
* Bits 48-63 are reserved for vendor extensions
*/
/* This flag is used to indicate video NV21 format */
QTI_PRIVATE_VIDEO_NV21_ENCODER = 1ULL << 48,
/* Buffer uses PI format */
QTI_PRIVATE_ALLOC_UBWC_PI = 1ULL << 49,
/* Buffer is accessed by CDSP */
QTI_PRIVATE_CDSP = 1ULL << 50,
/* Buffer is used for WFD */
QTI_PRIVATE_WFD = 1ULL << 51,
/* Buffer uses video HW use case */
QTI_PRIVATE_VIDEO_HW = 1ULL << 52,
/* Buffer used for trusted VM use case */
QTI_PRIVATE_TRUSTED_VM = 1ULL << 53,
/* UBWC - NV12 4R */
QTI_ALLOC_UBWC_4R = 1ULL << 55,
/* UBWC - 8:5 compression ratio */
QTI_ALLOC_UBWC_L_8_TO_5 = 1ULL << 56,
/* UBWC - 2:1 compression ratio */
QTI_ALLOC_UBWC_L_2_TO_1 = 1ULL << 57,
/* This flag is used to indicate multiview use case */
QTI_PRIVATE_MULTI_VIEW_INFO = 1ULL << 58,
} vendor_qti_hardware_display_common_BufferUsage;
inline vendor_qti_hardware_display_common_BufferUsage operator|(
vendor_qti_hardware_display_common_BufferUsage lhs,
vendor_qti_hardware_display_common_BufferUsage rhs) {
return static_cast<vendor_qti_hardware_display_common_BufferUsage>(static_cast<uint64_t>(lhs) |
static_cast<uint64_t>(rhs));
}
inline vendor_qti_hardware_display_common_BufferUsage operator&(
vendor_qti_hardware_display_common_BufferUsage lhs,
vendor_qti_hardware_display_common_BufferUsage rhs) {
return static_cast<vendor_qti_hardware_display_common_BufferUsage>(static_cast<uint64_t>(lhs) &
static_cast<uint64_t>(rhs));
}
inline vendor_qti_hardware_display_common_BufferUsage operator&=(
vendor_qti_hardware_display_common_BufferUsage &lhs,
vendor_qti_hardware_display_common_BufferUsage rhs) {
lhs = lhs & rhs;
return lhs;
}
inline vendor_qti_hardware_display_common_BufferUsage operator|=(
vendor_qti_hardware_display_common_BufferUsage &lhs,
vendor_qti_hardware_display_common_BufferUsage rhs) {
lhs = lhs | rhs;
return lhs;
}
#endif // __COMMON_BUFFERUSAGE_H__

View File

@@ -0,0 +1,35 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_CVPMETADATA_H__
#define __COMMON_CVPMETADATA_H__
#include <cstdint>
#define QTI_CVP_METADATA_SIZE 1024
typedef enum vendor_qti_hardware_display_common_CVPMetadataFlags {
/* bit wise flags */
QTI_CVP_METADATA_FLAG_NONE = 0x00000000,
QTI_CVP_METADATA_FLAG_REPEAT = 0x00000001,
} vendor_qti_hardware_display_common_CVPMetadataFlags;
typedef struct vendor_qti_hardware_display_common_CVPMetadata {
/** Payload size in bytes */
uint32_t size;
uint8_t payload[QTI_CVP_METADATA_SIZE];
uint32_t capture_frame_rate;
/** Frame rate in Q16 format.
* Eg: fps = 7.5, then
* capture_frame_rate = 7 << 16 --> Upper 16 bits to represent 7
* capture_frame_rate |= 5 -------> Lower 16 bits to represent 5
*
* If size > 0, framerate is valid
* If size = 0, invalid data, so ignore all parameters
*/
uint32_t cvp_frame_rate;
vendor_qti_hardware_display_common_CVPMetadataFlags flags;
uint32_t reserved[8];
} vendor_qti_hardware_display_common_CVPMetadata;
#endif // __COMMON_CVPMETADATA_H__

View File

@@ -0,0 +1,14 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_CHROMASITING_H__
#define __COMMON_CHROMASITING_H__
typedef enum vendor_qti_hardware_display_common_ChromaSiting {
CHROMA_SITING_NONE = 0,
CHROMA_SITING_UNKNOWN = 1,
CHROMA_SITING_SITED_INTERSTITIAL = 2,
CHROMA_SITING_COSITED_HORIZONTAL = 3,
} vendor_qti_hardware_display_common_ChromaSiting;
#endif // __COMMON_CHROMASITING_H__

View File

@@ -0,0 +1,16 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_COMPRESSION_H__
#define __COMMON_COMPRESSION_H__
typedef enum vendor_qti_hardware_display_common_Compression {
COMPRESSION_NONE = 0,
DISPLAY_STREAM_COMPRESSION = 1,
QTI_COMPRESSION_UBWC = 10,
QTI_COMPRESSION_UBWC_LOSSY_8_TO_5 = 11,
QTI_COMPRESSION_UBWC_LOSSY_2_TO_1 = 12,
COMPRESSION_MAX = 0xFF,
} vendor_qti_hardware_display_common_Compression;
#endif // __COMMON_COMPRESSION_H__

View File

@@ -0,0 +1,20 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_CUSTOMCONTENTMETADATA_H__
#define __COMMON_CUSTOMCONTENTMETADATA_H__
#include <cstdint>
#define QTI_CUSTOM_METADATA_SIZE_BYTES 1024 * 42
/*
* Dynamic metadata separate from QtiDynamicMetadata.
* Used in limited cases.
*/
typedef struct vendor_qti_hardware_display_common_CustomContentMetadata {
uint64_t size;
uint8_t metadataPayload[QTI_CUSTOM_METADATA_SIZE_BYTES];
} vendor_qti_hardware_display_common_CustomContentMetadata;
#endif // __COMMON_CUSTOMCONTENTMETADATA_H__

View File

@@ -0,0 +1,26 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_DATASPACE_H__
#define __COMMON_DATASPACE_H__
#include <cstdint>
#include "QtiColorPrimaries.h"
#include "QtiColorRange.h"
#include "QtiGammaTransfer.h"
/**
* Dataspace defines how color should be interpreted,
* using three components - color primaries, range, and transfer.
* See vendor.qti.hardware.display.common.QtiColorPrimaries,
* vendor.qti.hardware.display.common.QtiColorRange, and
* vendor.qti.hardware.display.common.QtiGammaTransfer for definitions.
*/
typedef struct vendor_qti_hardware_display_common_Dataspace {
vendor_qti_hardware_display_common_QtiColorPrimaries colorPrimaries;
vendor_qti_hardware_display_common_QtiColorRange range;
vendor_qti_hardware_display_common_QtiGammaTransfer transfer;
} vendor_qti_hardware_display_common_Dataspace;
#endif // __COMMON_DATASPACE_H__

View File

@@ -0,0 +1,13 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_FENCE_H__
#define __COMMON_FENCE_H__
#include <memory>
typedef struct vendor_qti_hardware_display_common_Fence {
int fence_fd;
} vendor_qti_hardware_display_common_Fence;
#endif // __COMMON_FENCE_H__

View File

@@ -0,0 +1,20 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_GRAPHICSMETADATA_H__
#define __COMMON_GRAPHICSMETADATA_H__
#include <cstdint>
#define QTI_GRAPHICS_METADATA_SIZE 4096
#define QTI_GRAPHICS_METADATA_SIZE_BYTES = (GRAPHICS_METADATA_SIZE * sizeof(uint32_t));
/**
* Graphics surface metadata.
*/
typedef struct vendor_qti_hardware_display_common_GraphicsMetadata {
uint32_t size; // TODO: get graphics to remove this to avoid "Metadata has bad signature" error
uint32_t data[QTI_GRAPHICS_METADATA_SIZE];
} vendor_qti_hardware_display_common_GraphicsMetadata;
#endif // __COMMON_GRAPHICSMETADATA_H__

View File

@@ -0,0 +1,28 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_INTERLACED_H__
#define __COMMON_INTERLACED_H__
/**
* Describes how buffer's planes are interlaced.
*/
typedef enum vendor_qti_hardware_display_common_Interlaced {
INTERLACED_NONE = 0,
/*
* Horizontal interlacing
* Height of interlaced plane = 1/2 of buffer height
*/
TOP_BOTTOM = 1,
/*
* Vertical interlacing
* Width of interlaced plane = 1/2 of buffer width
*/
RIGHT_LEFT = 2,
/**
* Qualcomm interlaced definition
*/
QTI_INTERLACED = 10,
} vendor_qti_hardware_display_common_Interlaced;
#endif // __COMMON_INTERLACED_H__

View File

@@ -0,0 +1,15 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_KEYVALUEPAIR_H__
#define __COMMON_KEYVALUEPAIR_H__
#include <cstdint>
#include <string>
typedef struct vendor_qti_hardware_display_common_KeyValuePair {
char key[256];
uint64_t value;
} vendor_qti_hardware_display_common_KeyValuePair;
#endif // __COMMON_KEYVALUEPAIR_H__

View File

@@ -0,0 +1,32 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_METADATASTATUS_H__
#define __COMMON_METADATASTATUS_H__
#include "MetadataType.h"
#define IS_VENDOR_METADATA_TYPE(x) (x >= QTI_VT_TIMESTAMP)
#define GET_STANDARD_METADATA_STATUS_INDEX(x) x
#define GET_VENDOR_METADATA_STATUS_INDEX(x) x - QTI_VT_TIMESTAMP
#define METADATA_SET_SIZE 512
typedef struct vendor_qti_hardware_display_common_MetadataStatus {
/** isStandardMetadataSet will return true for a given
* vendor.qti.hardware.display.common.MetadataType if
* it has been explicitly set via ISnapMapper query.
* If it is false, the metadata has not been set
* and should be treated as a default value.
*/
bool isStandardMetadataSet[METADATA_SET_SIZE];
/**
* isVendorMetadataSet uses
* vendor.qti.hardware.display.common.MetadataType - 10000
* as an index.
*/
bool isVendorMetadataSet[METADATA_SET_SIZE];
} vendor_qti_hardware_display_common_MetadataStatus;
#endif // __COMMON_METADATASTATUS_H__

View File

@@ -0,0 +1,379 @@
// Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_METADATATYPE_H__
#define __COMMON_METADATATYPE_H__
typedef enum vendor_qti_hardware_display_common_MetadataType {
METADATA_TYPE_INVALID = 0,
/**
* ID of buffer, used for debug only.
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
BUFFER_ID = 1,
/**
* Name of buffer passed in at allocation time, used for debug.
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
NAME = 2,
/**
* Width of buffer in pixels, requested at allocation time.
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
WIDTH = 3,
/**
* Height of buffer in pixels, requested at at allocation time.
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
HEIGHT = 4,
/**
* Number of layers in the buffer, requested at allocation time.
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
LAYER_COUNT = 5,
/**
* Format of the buffer, requested at allocation time.
* This returns the type vendor_qti_hardware_display_common_PixelFormat
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
PIXEL_FORMAT_REQUESTED = 6,
/**
* Fourcc code for the format of the buffer.
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
PIXEL_FORMAT_FOURCC = 7,
/**
* Modifier used with fourcc format of the buffer.
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
DRM_PIXEL_FORMAT_MODIFIER = 8,
/**
* Usage of the buffer requested at allocation time.
* This is a bitmask with definitions in
* vendor_qti_hardware_display_common_BufferUsage This does not change for the
* lifetime of the buffer.
* Functions supported: getMetadata
*/
USAGE = 9,
/**
* Size in bytes of memory allocated for buffer, including metadata and
* padding. This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
ALLOCATION_SIZE = 10,
/**
* Returns true if buffer has protected content.
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
PROTECTED_CONTENT = 11,
/**
* Compression strategy of the buffer.
* Values are defined in vendor_qti_hardware_display_common_Compression
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
COMPRESSION = 12,
/**
* How buffer's planes are interlaced.
* Values are defined in vendor_qti_hardware_display_common_Interlaced
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
INTERLACED = 13,
/**
* Chroma siting of the buffer.
* Values are defined in vendor_qti_hardware_display_common_ChromaSiting
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
CHROMA_SITING = 14,
/**
* Layout of the buffer's planes.
* This returns vendor_qti_hardware_display_common_BufferLayout
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
PLANE_LAYOUTS = 15,
/**
* Crop region in pixels of the buffer.
* Crop is stored as vendor_qti_hardware_display_common_Rect
* Functions supported: getMetadata, setMetadata
*/
CROP = 16,
/**
* Dataspace of the buffer.
* Values are defined in vendor_qti_hardware_display_common_Dataspace
* Functions supported: getMetadata, setMetadata
*/
DATASPACE = 17,
/**
* Blend mode of the buffer,
* as defined in vendor_qti_hardware_display_common_BlendMode
* Functions supported: getMetadata, setMetadata
*/
BLEND_MODE = 18,
/**
* Aligned width of allocated buffer in pixels.
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
STRIDE = 23,
// Qti defined metadata types - start from 10000
/**
* Per frame VT timestamp used by camera.
* Functions supported: getMetadata, setMetadata
*/
VT_TIMESTAMP = 10000,
/**
* Interlaced strategy defined by video.
* Functions supported: getMetadata, setMetadata
*/
PP_PARAM_INTERLACED = 10002,
/**
* Set by camera to indicate buffer will be used for high performance video
* use case.
* Functions supported: getMetadata, setMetadata
*/
VIDEO_PERF_MODE = 10003,
/**
* Graphics surface metadata,
* as defined in vendor_qti_hardware_display_common_GraphicsMetadata
* Functions supported: getMetadata, setMetadata
*/
GRAPHICS_METADATA = 10004,
/**
* UBWC CR stats,
* as defined in vendor_qti_hardware_display_common_UBWCStats
* Functions supported: getMetadata, setMetadata
*/
UBWC_CR_STATS_INFO = 10005,
/**
* Frame rate, as a float.
* Functions supported: getMetadata, setMetadata
*/
REFRESH_RATE = 10006,
/**
* Used for GPU post processing to determine when to map secure buffer.
* Functions supported: getMetadata, setMetadata
*/
MAP_SECURE_BUFFER = 10007,
/**
* Used if VENUS output buffer is linear for UBWC interlaced video.
* Functions supported: getMetadata, setMetadata
*/
LINEAR_FORMAT = 10008,
/**
* Set by graphics to indicate that this buffer will be written to but not
* swapped out.
* Functions supported: getMetadata, setMetadata
*/
SINGLE_BUFFER_MODE = 10009,
/**
* CVP metadata set by camera and read by video,
* as defined in vendor_qti_hardware_display_common_CVPMetadata
* Functions supported: getMetadata, setMetadata
*/
CVP_METADATA = 10010,
/**
* Video histogram stats populated by video decoder,
* as defined in vendor_qti_hardware_display_common_VideoHistogramMetadata
* Functions supported: getMetadata, setMetadata
*/
VIDEO_HISTOGRAM_STATS = 10011,
/**
* File descriptor for buffer data, returned as an int.
* Functions supported: getMetadata
*/
FD = 10012,
/**
* Aligned width of allocated buffer in pixels.
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
ALIGNED_WIDTH_IN_PIXELS = 10014,
/**
* Aligned height of allocated buffer in pixels.
* This does not change for the lifetime of the buffer.
* Functions supported: getMetadata
*/
ALIGNED_HEIGHT_IN_PIXELS = 10015,
/**
* Used to track if metadata type has been set for the buffer.
* Functions supported: getMetadata
*/
STANDARD_METADATA_STATUS = 10016,
VENDOR_METADATA_STATUS = 10017,
/**
* Returns 1 for YUV, 0 otherwise.
* Functions supported: getMetadata
*/
BUFFER_TYPE = 10018,
/**
* Video timestamp info,
* as defined in vendor_qti_hardware_display_common_VideoTimestampInfo
* Functions supported: getMetadata, setMetadata
*/
VIDEO_TS_INFO = 10019,
/**
* Custom dimensions returns custom width of buffer with crop factored in (if
* crop is set) or interlaced height factored in for UBWC formats.
* Functions supported: getMetadata
*/
CUSTOM_DIMENSIONS_STRIDE = 10021,
CUSTOM_DIMENSIONS_HEIGHT = 10022,
/**
* Returns base address for RGB buffers,
* with offset for UBWC metadata factored in for UBWC buffer.
* If this is a linear buffer, result is the same as BASE_ADDRESS.
* Functions supported: getMetadata
*/
RGB_DATA_ADDRESS = 10023,
/**
* Indicates buffer access permission for a client,
* where permissions are defined in
* vendor_qti_hardware_display_common_BufferPermission and clients are defined
* in vendor_qti_hardware_display_common_BufferClient
* Functions supported: getMetadata, setMetadata
*/
BUFFER_PERMISSION = 10026,
/**
* Unique identifier updated by memory module
* to interpret the underlying memory by each VM.
* Functions supported: getMetadata, setMetadata
*/
MEM_HANDLE = 10027,
/**
* Set by clients to indicate that timed rendering will be
* enabled or disabled for this buffer
* Functions supported: getMetadata, setMetadata
*/
TIMED_RENDERING = 10028,
/**
* Dynamic metadata used for limited use cases.
* Functions supported: getMetadata, setMetadata
*/
CUSTOM_CONTENT_METADATA = 10029,
/**
* Video transcode stats populated by video decoder.
* Functions supported: getMetadata, setMetadata
*/
VIDEO_TRANSCODE_STATS = 10030,
/**
* Early notify line count, used by video.
* Functions supported: getMetadata, setMetadata
*/
EARLYNOTIFY_LINECOUNT = 10031,
/**
* Additional shared memory in buffer, outside of content and metadata,
* for client use. Defined in
* vendor_qti_hardware_display_common_ReservedRegion
* Functions supported: getMetadata
*/
RESERVED_REGION = 10032,
/**
* Used in combination with vendor_qti_hardware_display_common_PixelFormat
* to describe variants of standard pixel formats.
* Variants may have different alignment requirements.
* Definitions are in vendor_qti_hardware_display_common_PixelFormatModifier
* Functions supported: getMetadata
*/
FORMAT_MODIFIER = 10033,
/**
* Mastering display metadata,
* defined in vendor_qti_hardware_display_common_QtiMasteringDisplay
* Functions supported: getMetadata, setMetadata
*/
MASTERING_DISPLAY = 10034,
/**
* Content light level metadata,
* defined in vendor_qti_hardware_display_common_QtiContentLightLevel
* Functions supported: getMetadata, setMetadata
*/
CONTENT_LIGHT_LEVEL = 10035,
/**
* Dynamic HDR metadata,
* defined in vendor_qti_hardware_display_common_QtiDynamicMetadata
* Functions supported: getMetadata, setMetadata
*/
DYNAMIC_METADATA = 10036,
/**
* Matrix coefficients,
* defined in vendor_qti_hardware_display_common_QtiMatrixCoefficients
* Functions supported: getMetadata, setMetadata
*/
MATRIX_COEFFICIENTS = 10037,
/**
* Color remapping info,
* defined in vendor_qti_hardware_display_common_QtiColorRemappingInfo
* Functions supported: getMetadata, setMetadata
*/
COLOR_REMAPPING_INFO = 10038,
/**
* Base address of buffer data.
* This does not account for UBWC meta planes.
* Functions supported: getMetadata
*/
BASE_ADDRESS = 10039,
/**
* Indicates if buffer was allocated as UBWC.
* Functions supported: getMetadata
*/
IS_UBWC = 10040,
/**
* Indicates if buffer was allocated as tile rendered.
* Functions supported: getMetadata
*/
IS_TILE_RENDERED = 10041,
/**
* Indicates if buffer was allocated as cached.
* Functions supported: getMetadata
*/
IS_CACHED = 10042,
/**
* Name of heap used for allocation.
* Functions supported: getMetadata
*/
HEAP_NAME = 10043,
/**
* Pixel format post allocation.
* Functions supported: getMetadata
*/
PIXEL_FORMAT_ALLOCATED = 10044,
/**
* Last buffer dequeue duration.
* Functions supported: getMetadata, setMetadata
*/
BUFFER_DEQUEUE_DURATION = 10045,
/**
* Anamorphic compression related information for the buffer.
* Functions supported: getMetadata, setMetadata
*/
ANAMORPHIC_COMPRESSION_METADATA = 10046,
/**
* Default view for multi-view buffer
* Functions supported: getMetadata
*/
BASE_VIEW = 10047,
/**
* All available views for multi-view buffer
* Functions supported: getMetadata
*/
MULTI_VIEW_INFO = 10048,
/**
* Three Dimensional Reference Display Info
* Functions supported: getMetadata, setMetadata
*/
THREE_DIMENSIONAL_REF_INFO = 10049,
} vendor_qti_hardware_display_common_MetadataType;
#endif // __COMMON_METADATATYPE_H__

View File

@@ -0,0 +1,370 @@
/*
* 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) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __COMMON_PIXELFORMAT_H__
#define __COMMON_PIXELFORMAT_H__
#include <cstdint>
typedef enum vendor_qti_hardware_display_common_PixelFormat : uint32_t {
// Range is 0x0 to 0x100 except for formats where fourcc code is used
PIXEL_FORMAT_UNSPECIFIED = 0,
/**
* RGBA_8888 format:
* Contains 1 plane in the following order -
* (A) RGBA plane
*
* <-------- RGB_Stride -------->
* <------- Width ------->
* R G B A R G B A R G B A . . . . ^ ^
* R G B A R G B A R G B A . . . . | |
* R G B A R G B A R G B A . . . . Height |
* R G B A R G B A R G B A . . . . | RGB_Scanlines
* R G B A R G B A R G B A . . . . | |
* R G B A R G B A R G B A . . . . | |
* R G B A R G B A R G B A . . . . | |
* R G B A R G B A R G B A . . . . V |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . V
*/
RGBA_8888 = 0x1,
/**
* RGBX_8888 format:
* Contains 1 plane in the following order -
* (A) RGBX plane, where X is an unused component
*
* <-------- RGB_Stride -------->
* <------- Width ------->
* R G B X R G B X R G B X . . . . ^ ^
* R G B X R G B X R G B X . . . . | |
* R G B X R G B X R G B X . . . . Height |
* R G B X R G B X R G B X . . . . | RGB_Scanlines
* R G B X R G B X R G B X . . . . | |
* R G B X R G B X R G B X . . . . | |
* R G B X R G B X R G B X . . . . | |
* R G B X R G B X R G B X . . . . V |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . V
*/
RGBX_8888 = 0x2,
/**
* RGB_888 format:
* Contains 1 plane in the following order -
* (A) RGB plane
*
* <-------- RGB_Stride -------->
* <------- Width ------->
* R G B R G B R G B R G B . . . . ^ ^
* R G B R G B R G B R G B . . . . | |
* R G B R G B R G B R G B . . . . Height |
* R G B R G B R G B R G B . . . . | RGB_Scanlines
* R G B R G B R G B R G B . . . . | |
* R G B R G B R G B R G B . . . . | |
* R G B R G B R G B R G B . . . . | |
* R G B R G B R G B R G B . . . . V |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . V
*/
RGB_888 = 0x3,
/**
* RGB_565 format:
* Contains 1 plane in the following order -
* (A) RGB plane
*
* <-------- RGB_Stride -------->
* <------- Width ------->
* R G B R G B R G B R G B . . . . ^ ^
* R G B R G B R G B R G B . . . . | |
* R G B R G B R G B R G B . . . . Height |
* R G B R G B R G B R G B . . . . | RGB_Scanlines
* R G B R G B R G B R G B . . . . | |
* R G B R G B R G B R G B . . . . | |
* R G B R G B R G B R G B . . . . | |
* R G B R G B R G B R G B . . . . V |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . V
*/
RGB_565 = 0x4,
/**
* BGRA_8888 format:
* Contains 1 plane in the following order -
* (A) BGRA plane
*
* <-------- RGB_Stride -------->
* <------- Width ------->
* B G R A B G R A B G R A . . . . ^ ^
* B G R A B G R A B G R A . . . . | |
* B G R A B G R A B G R A . . . . Height |
* B G R A B G R A B G R A . . . . | RGB_Scanlines
* B G R A B G R A B G R A . . . . | |
* B G R A B G R A B G R A . . . . | |
* B G R A B G R A B G R A . . . . | |
* B G R A B G R A B G R A . . . . V |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . V
*/
BGRA_8888 = 0x5,
YCBCR_422_SP = 0x10, // NV16
/**
* YCrCb_420_SP format:
* YUV 4:2:0 image with a plane of 8 bit Y samples followed
* by an interleaved V/U plane containing 8 bit 2x2 subsampled
* colour difference samples.
*
* <-------- Y/UV_Stride -------->
* <------- Width ------->
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height |
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . V |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . V
* V U V U V U V U V U V U . . . . ^
* V U V U V U V U V U V U . . . . |
* V U V U V U V U V U V U . . . . |
* V U V U V U V U V U V U . . . . UV_Scanlines
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . V
* . . . . . . . . . . . . . . . . --> Padding & Buffer size alignment
*
*/
YCrCb_420_SP = 0x11, // NV21
YCBCR_422_I = 0x14, // YUY2
RGBA_FP16 = 0x16,
RAW16 = 0x20,
BLOB = 0x21,
IMPLEMENTATION_DEFINED = 0x22,
YCBCR_420_888 = 0x23,
RAW_OPAQUE = 0x24,
RAW10 = 0x25,
RAW12 = 0x26,
RAW14 = 0x144,
RGBA_1010102 = 0x2B,
Y8 = 0x20203859,
Y16 = 0x20363159,
YV12 = 0x32315659, // YCrCb 4:2:0 Planar
DEPTH_16 = 0x30,
DEPTH_24 = 0x31,
DEPTH_24_STENCIL_8 = 0x32,
DEPTH_32F = 0x33,
DEPTH_32F_STENCIL_8 = 0x34,
STENCIL_8 = 0x35,
/**
* YCBCR_P010 format:
* YUV 4:2:0 image with a plane of 10 bit Y samples followed
* by an interleaved U/V plane containing 10 bit 2x2 subsampled
* colour difference samples.
*
* <-------- Y/UV_Stride -------->
* <------- Width ------->
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height |
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . V |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . V
* U V U V U V U V U V U V . . . . ^
* U V U V U V U V U V U V . . . . |
* U V U V U V U V U V U V . . . . |
* U V U V U V U V U V U V . . . . UV_Scanlines
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . V
* . . . . . . . . . . . . . . . . --> Buffer size alignment
*
*/
YCBCR_P010 = 0x36,
HSV_888 = 0x37,
/* R8 format:
* Contains 1 plane in the following order -
* (A) R plane
*
* <-------- RGB_Stride -------->
* <------- Width ------->
* R R R R R R R R R R R R . . . . ^ ^
* R R R R R R R R R R R R . . . . | |
* R R R R R R R R R R R R . . . . Height |
* R R R R R R R R R R R R . . . . | RGB_Scanlines
* R R R R R R R R R R R R . . . . | |
* R R R R R R R R R R R R . . . . | |
* R R R R R R R R R R R R . . . . | |
* R R R R R R R R R R R R . . . . V |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . V
*
*/
R_8 = 0x38,
RGBA_5551 = 0x6,
RGBA_4444 = 0x7,
/**
* YCbCr_420_SP format:
* YUV 4:2:0 image with a plane of 8 bit Y samples followed
* by an interleaved U/V plane containing 8 bit 2x2 subsampled
* colour difference samples.
*
* <-------- Y/UV_Stride -------->
* <------- Width ------->
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . ^ ^
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . Height |
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | Y_Scanlines
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . | |
* Y Y Y Y Y Y Y Y Y Y Y Y . . . . V |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . V
* U V U V U V U V U V U V . . . . ^
* U V U V U V U V U V U V . . . . |
* U V U V U V U V U V U V . . . . |
* U V U V U V U V U V U V . . . . UV_Scanlines
* . . . . . . . . . . . . . . . . |
* . . . . . . . . . . . . . . . . V
* . . . . . . . . . . . . . . . . --> Padding & Buffer size alignment
*
*/
YCbCr_420_SP = 0x109,
YCrCb_422_SP = 0x10B,
RG_88 = 0x10E,
YCbCr_444_SP = 0x10F,
YCrCb_444_SP = 0x110,
YCrCb_422_I = 0x111,
BGRX_8888 = 0x112,
NV21_ZSL = 0x113,
BGR_565 = 0x115,
RAW8 = 0x123,
// 10 bit
ARGB_2101010 = 0x117,
RGBX_1010102 = 0x118,
XRGB_2101010 = 0x119,
BGRA_1010102 = 0x11A,
ABGR_2101010 = 0x11B,
BGRX_1010102 = 0x11C,
XBGR_2101010 = 0x11D,
TP10 = 0x7FA30C09,
CbYCrY_422_I = 0x120,
BGR_888 = 0x121,
// Camera utils format
MULTIPLANAR_FLEX = 0x127,
// Khronos ASTC formats
COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0,
COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1,
COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2,
COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3,
COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4,
COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5,
COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6,
COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7,
COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8,
COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9,
COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA,
COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB,
COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC,
COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD,
COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0,
COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1,
COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2,
COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3,
COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4,
COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5,
COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6,
COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB,
COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC,
COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD,
/* Legacy formats/currently unsupported
* R_16_UINT
* RG_1616_UINT
* RGBA_10101010
* RGB888_UBWC_FSC
* RGB101010_UBWC_FSC
* YCbCr_422_I_10BIT
* YCbCr_422_I_10BIT_COMPRESSED
* YCbCr_420_SP_4R_UBWC
**/
/* Explicit UBWC formats are removed - set UBWC flag with corresponding linear
*format YCbCr_420_SP_VENUS_UBWC YCbCr_420_P010_UBWC YCbCr_420_TP10_UBWC
**/
/* To be deprecated when ExtenableTypes are plumbed */
NV12_ENCODEABLE = 0x102,
NV21_ENCODEABLE = 0x7FA30C00,
YCbCr_420_SP_VENUS = 0x7FA30C04,
YCbCr_420_SP_TILED = 0x7FA30C03,
YCrCb_420_SP_ADRENO = 0x7FA30C01,
YCrCb_420_SP_VENUS = 0x114,
YCbCr_420_P010_VENUS = 0x7FA30C0A,
NV12_HEIF = 0x116,
NV12_LINEAR_FLEX = 0x125,
NV12_UBWC_FLEX = 0x126,
NV12_UBWC_FLEX_2_BATCH = 0x128,
NV12_UBWC_FLEX_4_BATCH = 0x129,
NV12_UBWC_FLEX_8_BATCH = 0x130,
/* --------------------------------------------------------------------------------*/
} vendor_qti_hardware_display_common_PixelFormat;
#endif // __COMMON_PIXELFORMAT_H__

View File

@@ -0,0 +1,24 @@
// Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_PIXELFORMATMODIFIER_H__
#define __COMMON_PIXELFORMATMODIFIER_H__
typedef enum vendor_qti_hardware_display_common_PixelFormatModifier {
PIXEL_FORMAT_MODIFIER_NONE = 0,
PIXEL_FORMAT_MODIFIER_VENUS = 1,
PIXEL_FORMAT_MODIFIER_ADRENO = 2,
PIXEL_FORMAT_MODIFIER_FLEX = 3,
PIXEL_FORMAT_MODIFIER_LINEAR_FLEX = 4,
PIXEL_FORMAT_MODIFIER_UBWC_FLEX = 5,
PIXEL_FORMAT_MODIFIER_UBWC_FLEX_2_BATCH = 6,
PIXEL_FORMAT_MODIFIER_UBWC_FLEX_4_BATCH = 7,
PIXEL_FORMAT_MODIFIER_UBWC_FLEX_8_BATCH = 8,
PIXEL_FORMAT_MODIFIER_TILED = 9,
PIXEL_FORMAT_MODIFIER_ENCODEABLE = 10,
PIXEL_FORMAT_MODIFIER_HEIF = 11,
PIXEL_FORMAT_MODIFIER_4R = 12,
PIXEL_FORMAT_MODIFIER_EXPLICIT_UBWC = 13
} vendor_qti_hardware_display_common_PixelFormatModifier;
#endif // __COMMON_PIXELFORMATMODIFIER_H__

View File

@@ -0,0 +1,58 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_PLANELAYOUT_H__
#define __COMMON_PLANELAYOUT_H__
#include "PlaneLayoutComponent.h"
#define QTI_MAX_NUM_COMPONENTS 5
typedef struct vendor_qti_hardware_display_common_PlaneLayout {
/**
* Offset of the plane, relative to the start of the buffer layout.
*/
int offset_in_bytes;
/**
* A sample contains all the components in a plane.
* For example, a buffer with semiplanar YUV format has
* one plane with a sample of Y and another plane with a sample of
* CbCr.
*
* The sample size is distance in bits between samples in the same row.
*/
int sample_increment_bits;
/**
* Components describe the subpixel, or channels of a pixel.
* This array contains the types of components in the plane.
*/
vendor_qti_hardware_display_common_PlaneLayoutComponent components[QTI_MAX_NUM_COMPONENTS];
/**
* Number of components in the array.
*/
int component_count;
/**
* The number of bytes between two consecutive rows.
*/
int horizontal_stride_in_bytes;
/**
* The number of rows in a plane.
*/
int scanlines;
/**
* Overall size in bytes of the plane, including padding.
*/
int size_in_bytes;
/**
* Number of horizontally adjacent pixels using the same pixel data.
* Must be a poisitive power of 2. A value of 1 indicates no subsampling.
*/
int horizontal_subsampling;
/**
* Number of vertically adjacent pixels using the same pixel data.
* Must be a poisitive power of 2. A value of 1 indicates no subsampling.
*/
int vertical_subsampling;
} vendor_qti_hardware_display_common_PlaneLayout;
#endif // __COMMON_PLANELAYOUT_H__

View File

@@ -0,0 +1,27 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_PLANELAYOUTCOMPONENT_H__
#define __COMMON_PLANELAYOUTCOMPONENT_H__
#include "PlaneLayoutComponentType.h"
/**
* PlaneLayoutComponent describes a subpixel, or channel of a pixel.
* For example, RGB has 3 components - red, green, and blue.
*/
typedef struct vendor_qti_hardware_display_common_PlaneLayoutComponent {
vendor_qti_hardware_display_common_PlaneLayoutComponentType type;
/**
* Offsets in bits from start of plane to first instance of component.
* This can be used with the plane offset to determine exact location
* of the first instance of this commponent.
*/
int offset_in_bits;
/**
* Size in bits of component.
*/
int size_in_bits;
} vendor_qti_hardware_display_common_PlaneLayoutComponent;
#endif // __COMMON_PLANELAYOUTCOMPONENT_H__

View File

@@ -0,0 +1,38 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_PLANELAYOUTCOMPONENTTYPE_H__
#define __COMMON_PLANELAYOUTCOMPONENTTYPE_H__
#include <string>
#include <unordered_map>
typedef enum vendor_qti_hardware_display_common_PlaneLayoutComponentType {
/* Luma */
PLANE_LAYOUT_COMPONENT_TYPE_Y = 1 << 0,
/* Chroma blue */
PLANE_LAYOUT_COMPONENT_TYPE_CB = 1 << 1,
/* Chroma red */
PLANE_LAYOUT_COMPONENT_TYPE_CR = 1 << 2,
/* Red */
PLANE_LAYOUT_COMPONENT_TYPE_R = 1 << 10,
/* Green */
PLANE_LAYOUT_COMPONENT_TYPE_G = 1 << 11,
/* Blue */
PLANE_LAYOUT_COMPONENT_TYPE_B = 1 << 12,
/* Raw */
PLANE_LAYOUT_COMPONENT_TYPE_RAW = 1 << 20,
/* Blob */
PLANE_LAYOUT_COMPONENT_TYPE_BLOB = 1 << 29,
/* Alpha */
PLANE_LAYOUT_COMPONENT_TYPE_A = 1 << 30,
/* Meta */
PLANE_LAYOUT_COMPONENT_TYPE_META = 1 << 31,
} vendor_qti_hardware_display_common_PlaneLayoutComponentType;
#endif // __COMMON_PLANELAYOUTCOMPONENTTYPE_H__

View File

@@ -0,0 +1,29 @@
// Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_QTIANAMORPHICMETADATA_H__
#define __COMMON_QTIANAMORPHICMETADATA_H__
#include <cstdint>
#include <cfloat>
typedef struct vendor_qti_hardware_display_common_QtiAnamorphicMetadataPerEye {
double leftCR = 0; /* Horizontal left compression ratio. Needs to be > 1 */
double rightCR = 0; /* Horizontal right compression ratio. Needs to be > 1 */
double topCR = 0; /* Vertical top compression ratio. Needs to be > 1 */
double bottomCR = 0; /* Vertical bottom compression ratio. Needs to be > 1 */
uint32_t foveaX = 0; /* X position of the fovea region */
uint32_t foveaY = 0; /* Y position of the fovea region */
uint32_t foveaWidth = 0; /* Width of the fovea region */
uint32_t foveaHeight = 0; /* Height of the fovea region */
} vendor_qti_hardware_display_common_QtiAnamorphicMetadataPerEye;
typedef struct vendor_qti_hardware_display_common_QtiAnamorphicMetadata {
bool leftEyeDataValid = false;
bool rightEyeDataValid = false;
vendor_qti_hardware_display_common_QtiAnamorphicMetadataPerEye leftEyeParams; /* Left Eye */
vendor_qti_hardware_display_common_QtiAnamorphicMetadataPerEye rightEyeParams; /* Right Eye */
} vendor_qti_hardware_display_common_QtiAnamorphicMetadata;
#endif // __COMMON_QTIANAMORPHICMETADATA_H___

View File

@@ -0,0 +1,25 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_QTICOLORPRIMARIES_H__
#define __COMMON_QTICOLORPRIMARIES_H__
// Based loosely on BT.2380 / H.265 specifications
typedef enum vendor_qti_hardware_display_common_QtiColorPrimaries {
// Unused = 0;
QtiColorPrimaries_BT709_5 = 1, /* ITU-R BT.709-5 or equivalent */
// Unspecified = 2, Reserved = 3
QtiColorPrimaries_BT470_6M = 4, /* ITU-R BT.470-6 System M or equivalent */
QtiColorPrimaries_BT601_6_625 = 5, /* ITU-R BT.601-6 625 or equivalent */
QtiColorPrimaries_BT601_6_525 = 6, /* ITU-R BT.601-6 525 or equivalent */
QtiColorPrimaries_SMPTE_240M = 7, /* SMPTE_240M */
QtiColorPrimaries_GenericFilm = 8, /* Generic Film */
QtiColorPrimaries_BT2020 = 9, /* ITU-R BT.2020 or equivalent */
QtiColorPrimaries_SMPTE_ST428 = 10, /* SMPTE_240M */
QtiColorPrimaries_AdobeRGB = 11, /* Adobe RGB */
QtiColorPrimaries_DCIP3 = 12, /* DCI-P3 */
QtiColorPrimaries_EBU3213 = 22, /* EBU 3213 */
QtiColorPrimaries_Max = 0xffff,
} vendor_qti_hardware_display_common_QtiColorPrimaries;
#endif // __COMMON_QTICOLORPRIMARIES_H__

View File

@@ -0,0 +1,14 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_QTICOLORRANGE_H__
#define __COMMON_QTICOLORRANGE_H__
typedef enum vendor_qti_hardware_display_common_QtiColorRange {
QtiRange_Limited = 0,
QtiRange_Full = 1,
QtiRange_Extended = 2,
QtiRange_Max = 0xffff,
} vendor_qti_hardware_display_common_QtiColorRange;
#endif // __COMMON_QTICOLORRANGE_H__

View File

@@ -0,0 +1,34 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_QTICOLORREMAPPINGINFO_H__
#define __COMMON_QTICOLORREMAPPINGINFO_H__
#include "QtiColorPrimaries.h"
#include "QtiGammaTransfer.h"
#include "QtiMatrixCoEfficients.h"
typedef struct vendor_qti_hardware_display_common_QtiColorRemappingInfo {
bool criEnabled;
uint32_t crId;
uint32_t crCancelFlag;
uint32_t crPersistenceFlag;
uint32_t crVideoSignalInfoPresentFlag;
uint32_t crRange;
vendor_qti_hardware_display_common_QtiColorPrimaries crPrimaries;
vendor_qti_hardware_display_common_QtiGammaTransfer crTransferFunction;
vendor_qti_hardware_display_common_QtiMatrixCoEfficients 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];
} vendor_qti_hardware_display_common_QtiColorRemappingInfo;
#endif // __COMMON_QTICOLORREMAPPINGINFO_H__

View File

@@ -0,0 +1,19 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_QTICONTENTLIGHTLEVEL_H__
#define __COMMON_QTICONTENTLIGHTLEVEL_H__
#include <cstdint>
typedef struct vendor_qti_hardware_display_common_QtiContentLightLevel {
/**
* Light level SEI (Supplement Enhancement Information).
* Indicates if QtiContentLightLevel info should be used.
*/
bool lightLevelSEIEnabled;
uint32_t maxContentLightLevel; /* Unit: candelas per square meter */
uint32_t maxFrameAverageLightLevel; /* Unit: candelas per square meter */
} vendor_qti_hardware_display_common_QtiContentLightLevel;
#endif // __COMMON_QTICONTENTLIGHTLEVEL_H__

View File

@@ -0,0 +1,21 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_QTIDYNAMICMETADATA_H__
#define __COMMON_QTIDYNAMICMETADATA_H__
#include <cstdint>
#define QTI_HDR_DYNAMIC_META_DATA_SZ 1024
/**
* Dynamic HDR metadata.
* This is not used in tone mapping until it has been set for the first time.
*/
typedef struct vendor_qti_hardware_display_common_QtiDynamicMetadata {
bool dynamicMetaDataValid;
uint32_t dynamicMetaDataLen;
uint8_t dynamicMetaDataPayload[QTI_HDR_DYNAMIC_META_DATA_SZ];
} vendor_qti_hardware_display_common_QtiDynamicMetadata;
#endif // __COMMON_QTIDYNAMICMETADATA_H__

View File

@@ -0,0 +1,30 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_QTIGAMMATRANSFER_H__
#define __COMMON_QTIGAMMATRANSFER_H__
// Based on BT.2380 / H.265 specifications
typedef enum vendor_qti_hardware_display_common_QtiGammaTransfer {
// Unused = 0;
QtiTransfer_sRGB = 1, // IEC 61966-2-1 sRGB
/* Unspecified = 2, Reserved = 3 */
QtiTransfer_Gamma2_2 = 4,
QtiTransfer_Gamma2_8 = 5,
QtiTransfer_SMPTE_170M = 6, // BT.601-6 525 or 625
QtiTransfer_SMPTE_240M = 7, // SMPTE_240M
QtiTransfer_Linear = 8,
QtiTransfer_Log = 9,
QtiTransfer_Log_Sqrt = 10,
QtiTransfer_XvYCC = 11, // IEC 61966-2-4
QtiTransfer_BT1361 = 12, // Rec.ITU-R BT.1361 extended gamut
QtiTransfer_sYCC = 13, // IEC 61966-2-1 sRGB or sYCC
QtiTransfer_BT2020_2_1 = 14, // Rec. ITU-R BT.2020-2 (same as the values 6, and 15)
QtiTransfer_BT2020_2_2 = 15, // Rec. ITU-R BT.2020-2 (same as the values 6, and 14)
QtiTransfer_SMPTE_ST2084 = 16, // 2084
QtiTransfer_ST_428 = 17, // SMPTE ST 428-1
QtiTransfer_HLG = 18, // ARIB STD-B67
QtiTransfer_Max = 0xffff,
} vendor_qti_hardware_display_common_QtiGammaTransfer;
#endif // __COMMON_QTIGAMMATRANSFER_H__

View File

@@ -0,0 +1,46 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_QTIMASTERINGDISPLAY_H__
#define __COMMON_QTIMASTERINGDISPLAY_H__
#include <cstdint>
#include "XyColor.h"
/*
* Mastering display metadata.
*/
typedef struct vendor_qti_hardware_display_common_QtiMasteringDisplay {
/**
* Color volume SEI (Supplement Enhancement Information).
* Indicates if QtiMasterDisplay info should be used.
*/
bool colorVolumeSEIEnabled;
/**
* Chromaticity for red in the RGB primaries (unit 1/50000).
*/
vendor_qti_hardware_display_common_XyColor primaryRed;
/**
* Chromaticity for green in the RGB primaries (unit 1/50000).
*/
vendor_qti_hardware_display_common_XyColor primaryGreen;
/**
* Chromaticity for blue in the RGB primaries (unit 1/50000).
*/
vendor_qti_hardware_display_common_XyColor primaryBlue;
/**
* Chromaticity for the white point (unit 1/50000).
*/
vendor_qti_hardware_display_common_XyColor whitePoint;
/**
* Maximum luminance in candelas per square meter.
*/
uint32_t maxDisplayLuminance;
/**
* Minimum luminance in 1/10000 candelas per square meter.
*/
uint32_t minDisplayLuminance;
} vendor_qti_hardware_display_common_QtiMasteringDisplay;
#endif // __COMMON_QTIMASTERINGDISPLAY_H__

View File

@@ -0,0 +1,24 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_QTIMATRIXCOEFFICIENTS_H__
#define __COMMON_QTIMATRIXCOEFFICIENTS_H__
typedef enum vendor_qti_hardware_display_common_QtiMatrixCoEfficients {
QtiMatrixCoEff_Identity = 0,
QtiMatrixCoEff_BT709_5 = 1,
/* Unspecified = 2, Reserved = 3 */
QtiMatrixCoeff_FCC_73_682 = 4,
QtiMatrixCoEff_BT601_6_625 = 5,
QtiMatrixCoEff_BT601_6_525 = 6,
QtiMatrixCoEff_SMPTE240M = 7, // used with 601_525_Unadjusted
QtiMatrixCoEff_YCgCo = 8,
QtiMatrixCoEff_BT2020 = 9,
QtiMatrixCoEff_BT2020Constant = 10,
QtiMatrixCoEff_BT601_6_Unadjusted = 11, // Used with BT601_625(KR=0.222, KB=0.071)
QtiMatrixCoEff_DCIP3 = 12,
QtiMatrixCoEff_Chroma_NonConstant = 13,
QtiMatrixCoEff_Max = 0xffff,
} vendor_qti_hardware_display_common_QtiMatrixCoEfficients;
#endif // __COMMON_QTIMATRIXCOEFFICIENTS_H__

View File

@@ -0,0 +1,14 @@
// Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_QTIVIEWS_H__
#define __COMMON_QTIVIEWS_H__
typedef enum vendor_qti_hardware_display_common_QtiViews {
PRIV_VIEW_MASK_PRIMARY = 0x00000001,
PRIV_VIEW_MASK_SECONDARY = 0x00000002,
PRIV_VIEW_MASK_PRIMARY_DEPTH = 0x00000004,
PRIV_VIEW_MASK_SECONDARY_DEPTH = 0x00000008,
} vendor_qti_hardware_display_common_QtiViews;
#endif // __COMMON_QTIVIEWS_H__

View File

@@ -0,0 +1,19 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_RECT_H__
#define __COMMON_RECT_H__
#include <cstdint>
/**
* Position of a rectangle.
*/
typedef struct vendor_qti_hardware_display_common_Rect {
int32_t left;
int32_t top;
int32_t right;
int32_t bottom;
} vendor_qti_hardware_display_common_Rect;
#endif // __COMMON_RECT_H__

View File

@@ -0,0 +1,20 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_RESERVEDREGION_H__
#define __COMMON_RESERVEDREGION_H__
#include <cstdint>
#include "Address.h"
/*
* Additional shared memory in buffer, outside of content and metadata,
* for client use.
*/
typedef struct vendor_qti_hardware_display_common_ReservedRegion {
uint32_t size;
vendor_qti_hardware_display_common_Address reserved_region_addr;
} vendor_qti_hardware_display_common_ReservedRegion;
#endif // __COMMON_RESERVEDREGION_H__

View File

@@ -0,0 +1,37 @@
// Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_QTITHREEDIMENSIONALREFINFO_H__
#define __COMMON_QTITHREEDIMENSIONALREFINFO_H__
#include <cstdint>
#define NUM_REF_DISPLAYS 32
typedef struct
vendor_qti_hardware_display_common_ThreeDimensionalRefDisplayInfo {
uint8_t left_view_id;
uint8_t right_view_id;
uint8_t exponent_ref_display_width;
uint8_t mantissa_ref_display_width;
uint8_t exponent_ref_viewing_distance;
// Valid only if ref_viewing_distance_flag is 1
uint8_t mantissa_ref_viewing_distance;
// Valid only if additional_shift_present_flag is 1
uint16_t num_sample_shift_plus512;
uint8_t additional_shift_present_flag;
uint8_t reserved[7]; // added for 64-bit alignment
} vendor_qti_hardware_display_common_ThreeDimensionalRefDisplayInfo;
typedef struct vendor_qti_hardware_display_common_ThreeDimensionalRefInfo {
uint8_t prec_ref_display_width;
uint8_t ref_viewing_distance_flag;
uint8_t prec_ref_viewing_dist; // Valid only if ref_viewing_distance_flag is 1
uint8_t num_ref_displays_minus1;
struct vendor_qti_hardware_display_common_ThreeDimensionalRefDisplayInfo
threedRefDispInfo[NUM_REF_DISPLAYS];
uint8_t three_dimensional_reference_displays_extension_flag;
uint8_t reserved[3]; // added for 64-bit alignment
} vendor_qti_hardware_display_common_ThreeDimensionalRefInfo;
#endif // __COMMON_QTITHREEDIMENSIONALREFINFO_H__

View File

@@ -0,0 +1,27 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_UBWCSTATS_H__
#define __COMMON_UBWCSTATS_H__
#include <cstdint>
#include "UBWCVersion.h"
#include "UBWC_CR_Stats.h"
#define QTI_UBWC_STATS_ARRAY_SIZE 2
#define QTI_MAX_UBWC_STATS_LENGTH 32
typedef struct vendor_qti_hardware_display_common_UBWCStats {
vendor_qti_hardware_display_common_UBWCVersion version; /* Union depends on this version. */
uint8_t bDataValid; /* If [non-zero], CR Stats data is valid.
* Consumers may use stats data.
* If [zero], CR Stats data is invalid.
* Consumers *Shall* not use stats data */
union {
struct vendor_qti_hardware_display_common_UBWC_CR_Stats ubwc_stats;
uint32_t reserved[QTI_MAX_UBWC_STATS_LENGTH]; /* This is for future */
};
} vendor_qti_hardware_display_common_UBWCStats;
#endif // __COMMON_UBWCSTATS_H__

View File

@@ -0,0 +1,17 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_UBWCVERSION_H__
#define __COMMON_UBWCVERSION_H__
typedef enum vendor_qti_hardware_display_common_UBWCVersion {
UBWC_VERSION_UNUSED = 0,
UBWC_VERSION_1_0 = 0x1,
UBWC_VERSION_2_0 = 0x2,
UBWC_VERSION_3_0 = 0x3,
UBWC_VERSION_4_0 = 0x4,
UBWC_VERSION_5_0 = 0x5,
UBWC_VERSION_MAX = 0xFF,
} vendor_qti_hardware_display_common_UBWCVersion;
#endif // __COMMON_UBWCVERSION_H__

View File

@@ -0,0 +1,19 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_UBWCCRSTATS_H__
#define __COMMON_UBWCCRSTATS_H__
#include <cstdint>
typedef struct vendor_qti_hardware_display_common_UBWC_CR_Stats {
uint32_t nCRStatsTile32; /**< UBWC Stats info for 32 Byte Tile */
uint32_t nCRStatsTile64; /**< UBWC Stats info for 64 Byte Tile */
uint32_t nCRStatsTile96; /**< UBWC Stats info for 96 Byte Tile */
uint32_t nCRStatsTile128; /**< UBWC Stats info for 128 Byte Tile */
uint32_t nCRStatsTile160; /**< UBWC Stats info for 160 Byte Tile */
uint32_t nCRStatsTile192; /**< UBWC Stats info for 192 Byte Tile */
uint32_t nCRStatsTile256; /**< UBWC Stats info for 256 Byte Tile */
} vendor_qti_hardware_display_common_UBWC_CR_Stats;
#endif // __COMMON_UBWCCRSTATS_H__

View File

@@ -0,0 +1,25 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_VIDEOHISTOGRAMMETADATA_H__
#define __COMMON_VIDEOHISTOGRAMMETADATA_H__
#include <cstdint>
#define QTI_VIDEO_HISTOGRAM_STATS_SIZE 4 * 1024
/**
* Video histogram stats populated by video decoder.
*/
typedef struct vendor_qti_hardware_display_common_VideoHistogramMetadata {
uint32_t stats_info[1024]; /* Video stats payload */
uint32_t stat_len; /* Payload size in bytes */
uint32_t frame_type; /* bit mask to indicate frame type */
uint32_t display_width;
uint32_t display_height;
uint32_t decode_width;
uint32_t decode_height;
uint32_t reserved[12];
} vendor_qti_hardware_display_common_VideoHistogramMetadata;
#endif // __COMMON_VIDEOHISTOGRAMMETADATA_H__

View File

@@ -0,0 +1,17 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_VIDEOTIMESTAMPINFO_H__
#define __COMMON_VIDEOTIMESTAMPINFO_H__
#include <cstdint>
#define VIDEO_TIMESTAMP_INFO_SIZE 16
typedef struct vendor_qti_hardware_display_common_VideoTimestampInfo {
uint32_t enable; /* Enable video timestamp info */
uint32_t frame_number; /* Frame number/counter */
int64_t frame_timestamp_us; /* Frame timestamp in us */
} vendor_qti_hardware_display_common_VideoTimestampInfo;
#endif // __COMMON_VIDEOTIMESTAMPINFO_H__

View File

@@ -0,0 +1,17 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_VIDEOTRANSCODESTATSMETADATA_H__
#define __COMMON_VIDEOTRANSCODESTATSMETADATA_H__
#include <cstdint>
#define QTI_VIDEO_TRANSCODE_PAYLOAD_NUM 32
#define QTI_VIDEO_TRANSCODE_STATS_SIZE (QTI_VIDEO_TRANSCODE_PAYLOAD_NUM * 4)
typedef struct vendor_qti_hardware_display_common_VideoTranscodeStatsMetadata {
uint32_t stats_info[QTI_VIDEO_TRANSCODE_PAYLOAD_NUM]; /* Transcode stats payload */
uint32_t stat_len; /* Full payload size in bytes */
} vendor_qti_hardware_display_common_VideoTranscodeStatsMetadata;
#endif // __COMMON_VIDEOTRANSCODESTATSMETADATA_H__

View File

@@ -0,0 +1,15 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __COMMON_XYCOLOR_H__
#define __COMMON_XYCOLOR_H__
/*
* 2-dimensional chromaticity, unit 1/50000.
*/
typedef struct vendor_qti_hardware_display_common_XyColor {
uint32_t x;
uint32_t y;
} vendor_qti_hardware_display_common_XyColor;
#endif // __COMMON_XYCOLOR_H__

View File

@@ -0,0 +1,42 @@
/*
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __DEBUG_CALLBACK_INTF__
#define __DEBUG_CALLBACK_INTF__
#include <cstdarg>
/*
This interface has all the functions necessary for debug info, such as
logs, traces and debug properties. Compositors must provide a concrete
implementation of this class on Init
*/
namespace sdm {
enum DebugLogType {
ERROR,
WARNING,
INFO,
DEBUG,
VERBOSE,
};
class DebugCallbackIntf {
public:
virtual ~DebugCallbackIntf() {}
virtual void Log(DebugLogType type, const char *log_tag, const char *fmt,
std::va_list &args) = 0;
virtual int GetProperty(const char *property_name, int *value) = 0;
virtual int GetProperty(const char *property_name, char *value) = 0;
virtual void BeginTrace(const char *class_name, const char *function_name,
const char *custom_string) = 0;
virtual void EndTrace() = 0;
virtual void ATrace(const char *custom_string, const int bit) = 0;
};
} // namespace sdm
#endif // __DEBUG_CALLBACK_INTF__

View File

@@ -0,0 +1,55 @@
/*
* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Changes from Qualcomm Innovation Center are provided under the following license:
*
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __SDM_COMPOSITOR_CB_INTF_H__
#define __SDM_COMPOSITOR_CB_INTF_H__
#include <core/sdm_types.h>
namespace sdm {
class SDMCompositorCbIntf {
public:
virtual ~SDMCompositorCbIntf() {}
virtual void OnHotplug(uint64_t in_display, bool in_connected) = 0;
virtual void OnRefresh(uint64_t in_display) = 0;
virtual void OnVsync(uint64_t in_display, int64_t in_timestamp,
int32_t in_vsync_period_nanos) = 0;
virtual void OnSeamlessPossible(uint64_t in_display) = 0;
virtual void OnVsyncIdle(uint64_t in_display) = 0;
virtual void
OnVsyncPeriodTimingChanged(uint64_t in_display,
const SDMVsyncPeriodChangeTimeline &timeline) = 0;
};
} // namespace sdm
#endif // __SDM_COMPOSITOR_CB_INTF_H__

View File

@@ -0,0 +1,97 @@
/*
* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Changes from Qualcomm Innovation Center are provided under the following license:
*
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __SDM_COMPOSITOR_SIDEBAND_CB_INTF_H__
#define __SDM_COMPOSITOR_SIDEBAND_CB_INTF_H__
#include <core/sdm_types.h>
#include <private/generic_payload.h>
#define NUM_HISTOGRAM_COLOR_COMPONENTS 4
namespace sdm {
class SDMSideBandCompositorCbIntf {
public:
virtual ~SDMSideBandCompositorCbIntf() {}
virtual void NotifyQsyncChange(uint64_t display_id, bool qsync_enabled,
uint32_t refresh_rate,
uint32_t qsync_refresh_rate) = 0;
virtual void NotifyCameraSmoothInfo(SDMCameraSmoothOp op, int32_t fps) = 0;
virtual void NotifyResolutionChange(uint64_t display_id,
SDMConfigAttributes &attr) = 0;
virtual void NotifyTUIEventDone(uint32_t ret, uint32_t disp_id,
SDMTUIEventType type) = 0;
virtual void NotifyIdleStatus(bool status) = 0;
virtual void NotifyCWBStatus(int32_t status, void *buffer) = 0;
virtual void NotifyContentFps(const std::string& name, int32_t fps) = 0;
// qservice
virtual void OnHdmiHotplug(bool connected) = 0;
virtual void OnCECMessageReceived(char *message, int len) = 0;
// gl color convert callbacks
virtual void InitColorConvert(uint64_t display, bool secure) = 0;
virtual void ColorConvertBlit(uint64_t display,
ColorConvertBlitContext *ctx) = 0;
virtual void ResetColorConvert(uint64_t display) = 0;
virtual void DestroyColorConvert(uint64_t display) = 0;
// Histogram callbacks
virtual void StartHistogram(uint64_t display, int max_frames) = 0;
virtual void StopHistogram(uint64_t display, bool teardown) = 0;
virtual void NotifyHistogram(uint64_t display, int fd, uint64_t blob_id,
uint32_t panel_width, uint32_t panel_height) = 0;
virtual std::string DumpHistogram(uint64_t display) = 0;
virtual void
CollectHistogram(uint64_t display, uint64_t max_frames, uint64_t timestamp,
int32_t samples_size[NUM_HISTOGRAM_COLOR_COMPONENTS],
uint64_t *samples[NUM_HISTOGRAM_COLOR_COMPONENTS],
uint64_t *numFrames) = 0;
virtual DisplayError
GetHistogramAttributes(uint64_t display, int32_t *format, int32_t *dataspace,
uint8_t *supported_components) = 0;
// gl layer stitch
virtual void StitchLayers(uint64_t display, LayerStitchContext *params) = 0;
virtual void InitLayerStitch(uint64_t display) = 0;
virtual void DestroyLayerStitch(uint64_t display) = 0;
// misc
virtual nsecs_t SystemTime(int clock) = 0;
virtual int GetDemuraFilePaths(const GenericPayload &in,
GenericPayload *out) = 0;
};
} // namespace sdm
#endif // __SDM_COMPOSITOR_SIDEAND_CB_INTF_H__

View File

@@ -0,0 +1,107 @@
/*
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __SDM_DISPLAY_INTF_AIQE_H__
#define __SDM_DISPLAY_INTF_AIQE_H__
#include <core/sdm_types.h>
namespace sdm {
/**
* The purpose of this interface is to set/get any AIQE configuration options
* that can be changed within a display's lifetime.
*/
class SDMDisplayAiqeIntf {
public:
virtual ~SDMDisplayAiqeIntf(){};
/**
* Set the ssrc mode on the given display
*
* @param display_id: The id of the specified display
* @param mode_name: String form of the requested SSRC mode
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if the given SSRC mode is not valid
* @exception: kErrorResources if the display doesn't support SSRC
*/
virtual DisplayError SetSsrcMode(uint64_t display_id,
const std::string &mode_name) = 0;
/**
* Set the COPR enablement state on the given display
*
* @param display_id: The id of the specified display
* @param enable: Enablement state of COPR. True is ON, False is OFF
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorResources if the display doesn't support COPR
*/
virtual DisplayError EnableCopr(uint64_t display_id, bool enable) = 0;
/**
* Retrieve the COPR stats on the given display
*
* @param display_id: The id of the specified display
* @param copr_status: Vector to return the COPR stats into
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if an error occured when querying the COPR
* status
* @exception: kErrorResources if the display doesn't support COPR
*/
virtual DisplayError GetCoprStats(uint64_t display_id,
std::vector<int32_t> *copr_status) = 0;
/**
* Set the ABC state(enable/disable) on the given display
*
* @param display_id: The id of the specified display
* @param state: State to set for ABC. 1 for enable, 0 for disable
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorResources if the display doesn't support ABC
*/
virtual DisplayError SetABCState(uint64_t display_id, bool state) = 0;
/**
* Reconfig the ABC on the given display
*
* @param display_id: The id of the specified display
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorResources if the display doesn't support ABC
*/
virtual DisplayError SetABCReconfig(uint64_t display_id) = 0;
/**
* Set the ABC with given mode on the given display
*
* @param display_id: The id of the specified display
* @param mode_name: Mode name to be set to ABC
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorResources if the display doesn't support ABC
*/
virtual DisplayError SetABCMode(uint64_t display_id,
std::string mode_name) = 0;
};
} // namespace sdm
#endif // __SDM_DISPLAY_INTF_AIQE_H__

View File

@@ -0,0 +1,284 @@
/*
* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Changes from Qualcomm Innovation Center are provided under the following license:
*
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __SDM_DISPLAY_INTF_CAPS_H__
#define __SDM_DISPLAY_INTF_CAPS_H__
#include <core/core_interface.h>
#include <core/display_interface.h>
#include <core/sdm_types.h>
namespace sdm {
/**
* This is a discovery interface for a system backend to determine the types
* and capabilities of the possible displays that could be connected.
*
* Not as much documentation here is necessary for life cycle, effects, etc.
* since this is a read-only interface.
*
* Exceptions will be returned as the service specific error code
* in a ScopedAStatus object, so in case of a method failure, check that
* code to see what went wrong. The code corresponds to the SdmClientError enum
*/
class SDMDisplayCapsIntf {
public:
virtual ~SDMDisplayCapsIntf() {}
virtual bool GetComposerStatus() = 0;
/**
* Get a list of currently connected displays, along with their display type,
* display id, and other display + panel info
*/
virtual DisplayError GetDisplaysStatus(HWDisplaysInfo *ret) = 0;
/**
* Query the capacities for a certain display type in the system
*
* @return: Number of diplays of the given type that are supported
*/
virtual DisplayError GetMaxDisplaysSupported(SDMDisplayType in_type,
int32_t *ret) = 0;
virtual DisplayError GetDisplayType(uint64_t display_id, int32_t *ret) = 0;
/**
* Get identification into for a given display. This info is static and will
* never change so clients can call this once and save the information.
*
* @param display_id: The id of the specified display
*
* @return: DisplayIdentificationParcel
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorDriverData if driver fails to provide the data on request
*/
virtual DisplayError GetDisplayIdentificationData(uint64_t display_id,
uint8_t *port,
uint32_t *size,
uint8_t *data) = 0;
/**
* Get the maximum backlight level for the specified display, if it is
* applicable
*
* @param display_id: The id of the specified display
*
* @return: int value of backlight max level
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError GetPanelBlMaxLvl(uint64_t display_id, int32_t *ret) = 0;
/**
* Get the max brightness level for a specified display
*
* @param display_id: The id of the specified display
*
* @return: int value of max brightness level
*
* @exception kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if the display doesn't have a panel with
* brightness support
*/
virtual DisplayError GetPanelMaxBrightness(uint64_t display_id,
int32_t *ret) = 0;
/**
* Get the inclusive range for a display's possible refresh rates
* The min and max refresh rates will be the same if the display doesn't
* contain custom hardware panel info, typically for secondary displays and
* command mode panels
*
* @param display_id: The id of the specified display
*
* @return: List of min and max refresh rates. min[i] and max[i] are a pair
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError GetRefreshRateRange(uint64_t display_id, uint32_t *min,
uint32_t *max) = 0;
/**
* Check if underscan is supported for the given display
* Only applicable to external/pluggable displays
*
* @param display_id: The id of the specified display
*
* @return boolean: true if underscan is supported, else false
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError IsUnderScanSupported(uint64_t display_id, bool *ret) = 0;
/**
* Get the attributes of a specified color mode on a given display
*
* @param display_id: The id of the specified display
* @param color_mode: The color mode in string form to get attributes of
*
* @return: list of attribute key/values for the color mode, both in string
* form. AIDL doesn't support maps in ndk backend yet, so it will be a list
* instead and any client calling this function will have to search the list
* manually
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if the display's color manager failed to
* load or if the requested color mode doesn't have an attribute
*/
virtual DisplayError
GetColorModeAttr(uint64_t display_id, const std::string &in_color_mode,
std::vector<ColorModeAttributeVal> *ret) = 0;
/**
* Get the default color mode for the given display, in string mode
*
* @param display_id: The id of the specified display
*
* @return: string value of the display's default color mode
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if the display's color manager failed to
* load
*/
virtual DisplayError GetDefaultColorMode(uint64_t display_id,
std::string *ret) = 0;
// TODO(JJ): can encapsulate this in identification info to minimize traffic
virtual DisplayError GetDisplayPort(uint64_t display_id,
DisplayPort *ret) = 0;
/**
* Check if the display supports low power mode
* Generally, only builtin displays will support this mode
*
* @param display_id: The id of the specified display
*
* @return: true if the display supports low power modes
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError GetDozeSupport(uint64_t display_id, int32_t *ret) = 0;
/**
* Get the supported DSI clock rates for a given display
*
* @param display_id: The id of the specified display
*
* @return: list of supported clock rates in long form
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if the display is not builtin/doesn't use
* DSI
*/
virtual DisplayError GetSupportedDSIClock(uint64_t display_id,
std::vector<int64_t> *ret) = 0;
/**
* Get a list of the supported stc color modes for the given display
* Generally only supported for builtin displays
*
* @param display_id: The id of the specified display
*
* @return: List of supported stc color modes
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if the display doesn't support stc color
* modes
*/
virtual DisplayError GetStcColorModes(uint64_t display_id) = 0;
/**
* Check if the given feature is supported on the given display
*
* @param display_id: The id of the given display
* @param feature: The requested feature
*
* @return: true if requested feature is supported on given display
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError IsSupportedOnDisplay(uint64_t display_id,
SupportedDisplayFeature in_feature,
bool *ret) = 0;
/**
* Check the hdr capabilities on a given display
*
* @param display_id: The id of the specified display
*
* @return: parcel containing info about the display's hdr capabilities
* each pair at slot [i] is a tuple
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError GetHdrCapabilities(uint64_t display_id,
uint32_t *out_num_types,
int32_t *out_types,
float *out_max_luminance,
float *out_max_average_luminance,
float *out_min_luminance) = 0;
virtual DisplayError
GetDisplayConnectionType(uint64_t display_id,
DisplayClass *display_class) = 0;
virtual uint32_t GetMaxVirtualDisplayCount() = 0;
virtual DisplayError GetFixedConfig(uint64_t display_id,
DisplayConfigFixedInfo *info) = 0;
virtual DisplayError GetDisplayConfigs(uint64_t display_id,
std::vector<int32_t> *out_configs) = 0;
virtual void GetCapabilities(uint32_t *outCount,
int32_t *outCapabilities) = 0;
virtual DisplayError IsWbUbwcSupported(bool *value) = 0;
virtual DisplayError IsSmartPanelConfig(uint64_t display_id,
uint32_t config_id,
bool *is_smart) = 0;
virtual bool IsRotatorSupportedFormat(LayerBufferFormat format) = 0;
virtual DisplayError GetDisplayHwId(uint64_t disp_id,
int32_t *disp_hw_id) = 0;
virtual DisplayError GetSupportedDisplayRefreshRates(
int disp_id, std::vector<uint32_t> *supported_refresh_rates) = 0;
virtual bool IsModeSwitchAllowed(uint64_t disp_id, int32_t config) = 0;
virtual DisplayError GetDisplayPortId(uint32_t disp_id, int *port_id) = 0;
virtual DisplayError IsCacV2Supported(uint32_t disp_id, bool *supported) = 0;
};
} // namespace sdm
#endif // __SDM_DISPLAY_INTF_CAPS_H__

View File

@@ -0,0 +1,250 @@
/*
* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Changes from Qualcomm Innovation Center are provided under the following license:
*
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __SDM_DISPLAY_INTF_DRAWCYCLE_H__
#define __SDM_DISPLAY_INTF_DRAWCYCLE_H__
#include <color_metadata.h>
#include <core/display_interface.h>
#include <core/layer_stack.h>
#include <core/sdm_types.h>
#include <utils/fence.h>
namespace sdm {
class SDMDisplayDrawCycleIntf {
public:
SDMDisplayDrawCycleIntf() {}
virtual ~SDMDisplayDrawCycleIntf() {}
/**
* Attempt to prepare and present a layer stack to the specified display in
* one call.
*
* SDM will always assume a full layer stack, so any incremental builds or
* optimizations must be done in compositor backend before submitting the
* layer stack.
*
* If SDM is unable to handle the layer stack, return an error code with
* details on what the client needs to do next, and afterwards, resubmit the
* layer stack to thie method.
*
* The layer stack should not be modified until this call returns to avoid any
* concurrency issues.
*
* FBT = Frame Buffer Target
*
* Draw method contracts:
* - Unified
* - Unified with GPU target
*
* @param display_id: The id of the specified display
* @param draw_method: The method SDM will use to draw the layer stack
* @param layer_stack: pointer to the layer stack to be presented
*
* @return: SUCCESS: SDM was able to prepare and present the layer stack in
* one call NEED_FENCE_BIND: If a fbt was submitted with a speculative fence,
* NEED_FBT: If SDM is unable to handle all of the layers, the layers
* which cannot be handled will be marked for GPU comp. Client must send those
* layers to GPU and resubmit layer stack with an fbt on top FAILED: If a
* fatal error occurs when attempting to present. Check the returned error
* code to see what went wrong
*/
virtual DisplayError PresentDisplay(uint64_t display_id,
DisplayDrawMethod draw_method,
LayerStack *layer_stack,
SDMPresentResult *present_type) = 0;
/**
* Flush any pending buffers/fences submitted previously through a
* PresentDisplay() call
*
* Client shall call this method to request SDM to release all buffers and
* respective fences currently in use. This may result in a blank display
* until a new frame is submitted.
*
* @param display_id: The id of the specified display
* @param layer_stack: The layer stack to flush
*/
virtual DisplayError Flush(uint64_t display_id, LayerStack *layer_stack) = 0;
/**
* Client can use this method to enable/disable a specific type of layer
* composition. If client disables a composition type, SDM will not handle any
* of the layer composition using the disabled method in a draw cycle. On lack
* of resources to handle all layers using other enabled composition methods,
* Prepare() will return an error.
*
* Default state of all composition types is enabled
*
* @param display_id: The id of the specified display
* @param composition: The type of composition to enable/disable
* @param enable: Enable or disable comp type
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if the comp type cannot be disabled/enabled
* - Currently, only gpu comp can be disabled
*/
virtual DisplayError SetCompositionState(uint64_t display_id,
LayerComposition composition,
bool enable) = 0;
/**
* Set the expected time for the current frame to present on the display
*
* @param display_id: The id of the specified display
* @param expected_time: Expected present time in ns
*/
virtual DisplayError SetExpectedPresentTime(uint64_t display,
uint64_t expectedPresentTime) = 0;
/**
* Check if a frame buffer target(fbt) with the given configuration is
* supported by the hardware.
*
* @param display_id: The id of the specified display
* @param width: fbt width
* @param height: fbt height
* @param format: fbt format
* @param color_metadata: fbt color metadata
*
* @return: kErrorNone if the config is supported
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if one of the following conditions is met:
* - fbt format is not supported on the display
* - fbt width/height combo is not supported on the display
* - unsupported GammaTransfer or ColorPrimaries in fbt
* metadata
* - fbt color metadata requests an unsupported mode
*/
virtual DisplayError GetClientTargetSupport(uint64_t display_id,
int32_t in_width,
int32_t in_height,
LayerBufferFormat format,
Dataspace color_metadata) = 0;
/**
* Get a list of layer id's on the given display and their corresponding
* release fences.
*
* Since we can't return the actual fence impl, we will return the
* fence fd and the client can create their own fence using the fd.
*
* @param display_id: The id of the given display
*
* @return: parcel containing list of layer id's and their release fence.
* The layer id at slot layers[i] corresponds to the fence at
* fences[i]
*
* @exception: kErrorParameters if display_id is not found
*/
// QUESTION(JJ): Can we replace this format of out_num pointers with something
// more logical? Maybe vector<pair<LayerId, shared_ptr<Fence>>> so only need 1
// call seems like cleaner call flow to me
virtual DisplayError
GetReleaseFences(uint64_t display, uint32_t *out_num_elements,
LayerId *out_layers,
std::vector<shared_ptr<Fence>> *out_fences) = 0;
/**
* Enable or disable vsync on a given display
*
* @param display_id: The id of the given display
* @param enable: true to enable vsync, false to disable
*/
virtual DisplayError SetVsyncEnabled(uint64_t display_id, bool enable) = 0;
/**
* Set the output buffer for a virtual display
*
* @param display_id: The id of the specified display
* @param buffer: The buffer to be written to
* @param release_fence: Fence that represents when the buffer is safe to
* access
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if the display isn't virtual
*/
virtual DisplayError SetOutputBuffer(uint64_t display, const SnapHandle *buffer,
const shared_ptr<Fence> &release_fence) = 0;
virtual DisplayError GetVsyncPeriod(uint64_t display_id,
uint32_t *vsync_period) = 0;
virtual void Refresh(uint64_t display_id);
virtual DisplayError SetClientTarget(uint64_t display, const SnapHandle *target,
shared_ptr<Fence> acquire_fence, int32_t dataspace,
const SDMRegion& damage, uint32_t version) = 0;
virtual DisplayError CommitOrPrepare(uint64_t display, bool validate_only,
shared_ptr<Fence> *out_retire_fence,
uint32_t *out_num_types,
uint32_t *out_num_requests,
bool *needs_commit) = 0;
virtual DisplayError PresentDisplay(uint64_t display,
shared_ptr<Fence> *out_retire_fence) = 0;
virtual DisplayError GetChangedCompositionTypes(uint64_t display,
uint32_t *out_num_elements,
LayerId *out_layers,
int32_t *out_types) = 0;
virtual DisplayError GetDisplayRequests(uint64_t display,
int32_t *out_display_requests,
uint32_t *out_num_elements,
LayerId *out_layers,
int32_t *out_layer_requests) = 0;
virtual DisplayError SetDisplayElapseTime(uint64_t display,
uint64_t time) = 0;
virtual DisplayError AcceptDisplayChanges(uint64_t display) = 0;
virtual DisplayError GetActiveConfigIndex(uint64_t display,
uint32_t *config) = 0;
virtual DisplayError SetActiveConfigIndex(uint64_t display,
uint32_t config) = 0;
virtual DisplayError
MinHdcpEncryptionLevelChanged(uint64_t display, uint32_t min_enc_level) = 0;
virtual void LayerStackUpdated(uint64_t display) = 0;
virtual void WaitForDrawCycleToComplete(uint64_t display) = 0;
virtual DisplayError NotifyExpectedPresent(uint64_t display, uint64_t expected_present_time,
uint32_t frame_interval_ns) = 0;
virtual DisplayError SetFrameIntervalNs(uint64_t display, uint32_t frame_interval_ns) = 0;
};
} // namespace sdm
#endif // __SDM_DISPLAY_INTF_DRAWCYCLE_H__

View File

@@ -0,0 +1,134 @@
/*
* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Changes from Qualcomm Innovation Center are provided under the following license:
*
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __SDM_DISPLAY_LAYER_BUILDER_INTF_H__
#define __SDM_DISPLAY_LAYER_BUILDER_INTF_H__
#include <unordered_map>
#include <unordered_set>
#include <SnapHandle.h>
#include <core/buffer_allocator.h>
#include <core/sdm_types.h>
namespace sdm {
using SnapHandle = vendor::qti::hardware::display::snapalloc::SnapHandle;
class SDMDisplayLayerBuilderIntf {
public:
virtual ~SDMDisplayLayerBuilderIntf() {}
virtual DisplayError Init(BufferAllocator *buffer_allocator,
uint64_t display_id) = 0;
virtual DisplayError DeInit(uint64_t display_id) = 0;
virtual DisplayError CreateLayer(uint64_t display_id,
int64_t *out_layer_id) = 0;
virtual DisplayError DestroyLayer(uint64_t display_id, int64_t layer_id) = 0;
virtual DisplayError SetLayerBuffer(uint64_t display_id, int64_t layer_id, const SnapHandle *buffer,
const shared_ptr<Fence> &acquire_fence) = 0;
virtual DisplayError SetLayerBlendMode(uint64_t display_id, int64_t layer_id,
int32_t int_mode) = 0;
virtual DisplayError SetLayerDisplayFrame(uint64_t display_id,
int64_t layer_id,
SDMRect frame) = 0;
virtual DisplayError SetLayerPlaneAlpha(uint64_t display_id, int64_t layer_id,
float alpha) = 0;
virtual DisplayError SetLayerSourceCrop(uint64_t display_id, int64_t layer_id,
SDMRect crop) = 0;
virtual DisplayError SetLayerTransform(uint64_t display_id, int64_t layer_id,
SDMTransform transform) = 0;
virtual DisplayError SetLayerZOrder(uint64_t display_id, int64_t layer_id,
uint32_t z) = 0;
virtual DisplayError SetLayerType(uint64_t display_id, int64_t layer_id,
SDMLayerTypes type) = 0;
virtual DisplayError SetLayerFlag(uint64_t display_id, int64_t layer_id,
SDMLayerFlag flag) = 0;
virtual DisplayError SetLayerSurfaceDamage(uint64_t display_id,
int64_t layer_id,
SDMRegion damage) = 0;
virtual DisplayError SetLayerVisibleRegion(uint64_t display_id,
int64_t layer_id,
SDMRegion damage) = 0;
virtual DisplayError SetLayerCompositionType(uint64_t display_id,
int64_t layer_id,
int32_t int_type) = 0;
virtual DisplayError SetLayerColor(uint64_t display_id, int64_t layer_id,
SDMColor color) = 0;
virtual DisplayError SetLayerDataspace(uint64_t display_id, int64_t layer_id,
int32_t dataspace) = 0;
virtual DisplayError SetLayerPerFrameMetadata(uint64_t display_id,
int64_t layer_id,
uint32_t num_elements,
const int32_t *int_keys,
const float *metadata) = 0;
virtual DisplayError SetLayerColorTransform(uint64_t display_id,
int64_t layer_id,
const float *matrix) = 0;
virtual DisplayError
SetLayerPerFrameMetadataBlobs(uint64_t display_id, int64_t layer_id,
uint32_t num_elements, const int32_t *int_keys,
const uint32_t *sizes,
const uint8_t *metadata) = 0;
virtual DisplayError SetLayerBrightness(uint64_t display_id, int64_t layer_id,
float brightness) = 0;
virtual DisplayError SetLayerAsMask(uint64_t display_id,
int64_t layer_id) = 0;
virtual SDMCompositionType
GetDeviceSelectedCompositionType(uint64_t display_id, int64_t layer_id) = 0;
virtual DisplayError SetCursorPosition(uint64_t disp_id, int64_t layer_id,
int32_t x, int32_t y) = 0;
virtual LayerBufferFormat GetSDMFormat(const int32_t &source,
const int32_t flags,
const int64_t compression_type) = 0;
};
} // namespace sdm
#endif // __SDM_DISPLAY_LAYER_BUILDER_INTF_H__

View File

@@ -0,0 +1,153 @@
/*
* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* 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 __SDM_DISPLAY_INTF_LIFECYCLE_H__
#define __SDM_DISPLAY_INTF_LIFECYCLE_H__
#include <core/display_interface.h>
#include <core/socket_handler.h>
#include <utils/fence.h>
#include "debug_callback_intf.h"
#include "sdm_compositor_cb_intf.h"
#include "sdm_compositor_sideband_cb_intf.h"
using std::shared_ptr;
namespace sdm {
enum CompositorSyncType {
CompositorSyncTypeAcquire,
CompositorSyncTypeRelease,
};
class SDMDisplayLifeCycleIntf {
public:
SDMDisplayLifeCycleIntf() {}
virtual ~SDMDisplayLifeCycleIntf(){};
virtual void RegisterSideBandCallback(SDMSideBandCompositorCbIntf *cb,
bool enable) = 0;
virtual void RegisterCompositorCallback(SDMCompositorCbIntf *cb, bool enable) = 0;
/**
* Create and initialize a display with SDM
*
* For builtin displays: Query GetDisplayList immediately to determine if any
* builtin displays are connected, and initialize them afterwards.
*
* For external displays, call this after receiving a hotplug notification
*
* For virtual displays, compositor will call this in order to create the
* display
*
* @param display_id: The SDM id of the display to be created/initialized.
* This can be queried through GetDisplayList()
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError CreateDisplay(SDMDisplayType type, int32_t width,
int32_t height, int32_t *format,
uint64_t *display_id) = 0;
/**
* De-init and destroy a display with SDM
*
* For builtin/external: call this method after a hotplug disconnect is
* detected
*
* For virtual: Compositor calls this whenever the virtual display should be
* destroyed
*
* @param display_id: The SDM id of the display to be destroyed
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError DestroyDisplay(uint64_t display_id) = 0;
/**
* Get a list of currently connected displays, along with their display type,
* display id, and other display + panel info
*/
virtual DisplayError
GetDisplayList(std::vector<SDMDisplayInfo> *display_info) = 0;
/**
* Set the state of specified display
* In case of power off:
* - The display is off. In this state, there is nothing displayed on the
* screen.
*
* In case of power on:
* - The display is on. In this state, regular UI and application layers
* are visible.
*
* In case of doze:
* - The display is on but set to a low power state. In this state, only
* ambient information is displayed on the screen such as the time, weather,
* and notifications.
*
* In case of doze suspend:
* - The display is configured similar to doze mode but may stop applying
* updates on the display. In this state, the current contents will be
* displayed indefinitely until the power mode changes.
*
* @param display_id: The id of the specified display
* @param state: The state for the display to be set to
* @param teardown: Set this flag to force a full teardown on pluggable
* displays if requested state is OFF - no-op for other display types.
*
* @return: fd of the release fence
*
* @exception: kErrorParameters if display_id is not found
* @exception: NO_RESOURCES if the transition to requested state is deferred
* (can be deferred active secure session, pending CaptureFeedback teardown)
*/
virtual DisplayError SetDisplayState(uint64_t display_id, DisplayState state,
bool teardown, Fence *fence) = 0;
virtual DisplayError SetPowerMode(uint64_t display_id, int32_t int_mode) = 0;
virtual DisplayError Init(BufferAllocator *buffer_allocator,
SocketHandler *socket_handler,
DebugCallbackIntf *debug_handler) = 0;
virtual bool IsDisplayConnected(uint64_t display_id) = 0;
virtual DisplayError SetDisplayStatus(uint64_t disp_id,
SDMDisplayStatus status) = 0;
virtual DisplayError GetConfigCount(uint64_t disp_id, uint32_t *count) = 0;
virtual DisplayError TryDrawMethod(Display display,
DisplayDrawMethod drawMethod) = 0;
virtual void CompositorSync(CompositorSyncType syncType) = 0;
};
} // namespace sdm
#endif // __SDM_DISPLAY_INTF_LIFECYCLE_H__

View File

@@ -0,0 +1,51 @@
/*
* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Changes from Qualcomm Innovation Center are provided under the following license:
*
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __SDM_PARCEL_INTF_H___
#define __SDM_PARCEL_INTF_H___
namespace sdm {
class SDMParcel {
public:
virtual ~SDMParcel() {}
virtual uint32_t readInt32() = 0;
virtual uint64_t readInt64() = 0;
virtual float readFloat() = 0;
virtual void writeInt32(uint32_t value) = 0;
virtual uint32_t dataSize() = 0;
virtual uint32_t writeFloat(float val) = 0;
virtual uint32_t dataPosition() = 0;
virtual uint32_t writeUint64(uint64_t value) = 0;
virtual uint32_t dataAvail() = 0;
virtual const void *readInplace(uint32_t size) = 0;
virtual uint32_t write(const void *data, uint32_t len) = 0;
virtual uint32_t writeDupFileDescriptor(int fd) = 0;
virtual double readDouble() = 0;
};
} // namespace sdm
#endif // __SDM_PARCEL_INTF_H__

View File

@@ -0,0 +1,454 @@
/*
* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Changes from Qualcomm Innovation Center are provided under the following license:
*
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __SDM_DISPLAY_INTF_SETTINGS_H__
#define __SDM_DISPLAY_INTF_SETTINGS_H__
#include <core/display_interface.h>
#include <core/sdm_types.h>
namespace sdm {
enum SDMDisplayCapability {
SDM_CAPS_SKIP_CLIENT_COLOR_TRANSFORM,
SDM_CAPS_DOZE,
SDM_CAPS_BRIGHTNESS,
SDM_CAPS_PROTECTED_CONTENTS,
};
/**
* The purpose of this interface is to set/get any configuration options that
* can be changed within a display's lifetime. So unlike display_caps, these
* values are not static and may be changed, whether that is driven internally
* or from a client call.
*/
class SDMDisplaySettingsIntf {
public:
virtual ~SDMDisplaySettingsIntf(){};
/**
* Set the backlight scale on the display (if applicable)
*
* @param display_id: The id of the specified display
* @param level: the level in int value to set BL level
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorParameters if the level provided is invalid for any
* reason
*/
virtual DisplayError SetBacklightScale(uint64_t display_id,
int32_t in_level) = 0;
/**
* Set the blend space on the given display
*
* @param display_id: The id of the specified display
* @param blend_space: ColorPrimaries containing blend space info
*
* @return: kErrorNone if transaction succeeded
*/
virtual DisplayError
SetBlendSpace(uint64_t display_id,
const PrimariesTransfer &in_blend_space) = 0;
/**
* Client can call this to enable/disable vsync on display.
* Default sate is disabled
*
* @param display_id: The id of the specified display
* @param enable: enabled vsync state
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError SetVSyncState(uint64_t display_id, bool in_enabled) = 0;
/**
* Set autorefresh flag on given display
*
* @param display_id: The id of the specified display
* @param enable: State of autorefresh
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError SetAutoRefresh(uint64_t display_id, bool in_enable) = 0;
/**
* Override NoisePlugIn parameters of the given device
*
* @param display_id: The id of the specified display
* @param override_en: enable flag for toggling override on/off
* @param attn: output attenuation factor
* @param noise_zpos: z-order position of noise layer
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorParameters if any of the given params are invalid
*/
virtual DisplayError SetNoisePlugInOverride(uint64_t display_id,
bool in_override_en,
int32_t in_attn,
int32_t in_noise_zpos) = 0;
/**
* Set the color mode on given display
*
* @param display_id: The id of the specified display
* @param color_mode: String form of the requested color mode
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError SetColorMode(uint64_t display_id,
const std::string &in_color_mode) = 0;
/**
* Set the variable vsync mode on a given display (if the display supports it)
*
* @param display_id: The id of the specified display
* @param vsync_mode: The mode of variable vync to be set
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if the display doesn't support QSync
*/
virtual DisplayError
SetVariableVSyncMode(uint64_t display_id,
const VariableVSync &in_vsync_mode) = 0;
/**
* Set jitter configuration on given display (if the display supports it)
*
* @param display_id: The id of the specified display
* @param jitter_type: 0 - None, 1 - Instantaneous jitter, 2- Long term jitter
* @param value: max jitter value in percentage (0-10%)
* @param time: jitter time (for LTJ)
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if the display doesn't support jitter
*/
virtual DisplayError SetJitterConfig(uint64_t display_id,
int32_t in_jitter_type, float in_value,
int32_t in_time) = 0;
/**
* Method to set min/max luminance for dynamic tonemapping of external device
* of WFD. Only supported on virtual displays.
*
* @param display_id: The id of the specified display
* @param min_lum: min luminance supported by external device
* @param max_lum: max luminance supported by external device
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError SetPanelLuminanceAttributes(uint64_t display_id,
float in_min_lum,
float in_max_lum) = 0;
/**
* Set the color mode with extended info
*
* @param display_id: The id of the specified display
* @param color_mode: Mode attributes which will be set
*
* @return kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if the display doesn's support stc color
* mode
*/
virtual DisplayError
SetExtendedColorMode(uint64_t display_id,
const ColorModeInfo &in_color_mode) = 0;
/**
* Get the supported color modes with their info from the display
*
* @param display_id: The id of the specified display
*
* @return: List of color modes and their info
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError GetColorModes(uint64_t display_id,
uint32_t *out_num_modes,
int32_t *int_out_modes) = 0;
/**
* Method to enable/disable dimming on given display
*
* @param display_id: The id of the specified display
* @param int_enabled: 0- disable, >0- enable
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: UNDEFINED - something went wrong internally
*/
virtual DisplayError SetDimmingEnable(uint64_t display_id,
int32_t in_int_enabled) = 0;
/**
* Set minimal backlight value for diven display's dimming feature
*
* @param display_id: The id of the specified display
* @param min_bl: Min backlight value in int form
*
* @return: kErrorNone If transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: UNDEFINED if something went wrong internally (same as above)
*/
virtual DisplayError SetDimmingMinBacklight(uint64_t display_id,
int32_t in_min_bl) = 0;
/**
* Get the current brightness for a given display
* Only supported for builtin displays
*
* @param display_id: The id of the specified display
*
* @return: Display's brightness
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if the given display doesn't support
* brightness levels
*/
virtual DisplayError GetPanelBrightness(uint64_t display_id, float *ret) = 0;
/**
* Set the brightness of the specified display
* Only supported for builtin displays
*
* @param display_id: The id of the specified display
* @param brightness: brightness from level 0.0f(min) to 1.0f(max) where -1.0f
* represents off
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorParameters if the brightness value is invalid
* @exception: kErrorNotSupported if the display doesn't support brightness
* levels
* @exception: kErrorResources if power state is pending, or if hw fails to write
* the new level
*/
virtual DisplayError SetPanelBrightness(uint64_t display_id,
float in_brightness) = 0;
/**
* Get the current refresh rate for the given display
*
* @param display_id: The id of the specified display
*
* @return: int value of current refresh rate
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError GetRefreshRate(uint64_t display_id, int32_t *ret) = 0;
/**
* Set new refresh rate on the given display.
* Not supported on virtual displays.
*
* @param display_id: The id of the specified display
* @param refresh_rate: new refresh rate of the display
* @param final_rate: indicates whether refresh rate is final rate or can be
* changed by sdm
* @param idle_screen: indicates whether screen is idle. Used to be false by
* default, now needs to be explicitly declared
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if the display doesn't support refresh rate
* changes (virtual display, inactive display, panel doesn't support dynamic
* fps, QSync active, or bit clock rate update pending)
* @exception: kErrorParameters if the fps is below display's min
* supported/above max supported fps.
*/
virtual DisplayError SetRefreshRate(uint64_t display_id,
int32_t in_refresh_rate,
bool in_final_rate,
bool in_idle_screen) = 0;
/**
* Set active configuration for variable properties of the display device
* using DisplayConfigVariableInfo.
* Currently only supported for virtual displays, since we have to re-register
* the display with the new DisplayConfigVariableInfo
*
* @param display_id: The id of the specified display
* @param variable_info: Config info to be set as active
*
* @return: kErrorNone if transaction succeeded
*
* @exception: kErrorParameters if display_id is not found
* @exception: kErrorNotSupported if the display is not virtual
* @exception: NO_RESOURCES if there are currently no resources to make the
* change
*/
virtual DisplayError SetActiveConfig(uint64_t display_id, int32_t config) = 0;
/**
* Get the index of the active configuration on the given display
* For virtual displays, this will always be 0 as they don't have multiple
* configuration options.
*
* @param display_id: variable_info
*
* @return: index of active configuration
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError GetActiveConfig(uint64_t display_id, Config *ret) = 0;
virtual DisplayError GetAllDisplayAttributes(
uint64_t display_id,
std::map<uint32_t, DisplayConfigVariableInfo> *info) = 0;
virtual DisplayError GetDisplayAttributes(uint64_t display_id,
int32_t in_index,
DisplayConfigVariableInfo *ret) = 0;
/**
* Get the VSync event state. The default state is disabled
*
* @param display_id: The id of the specified display
*
* @return: true if VSync state is enabled
*
* @exception: kErrorParameters if display_id is not found
*/
virtual DisplayError GetVSyncState(uint64_t display_id, bool *ret) = 0;
virtual DisplayError GetDataspaceSaturationMatrix(int32_t dataspace,
float *out_matrix) = 0;
virtual DisplayError
GetDisplayVsyncPeriod(uint64_t display,
VsyncPeriodNanos *out_vsync_period) = 0;
virtual DisplayError GetReadbackBufferAttributes(uint64_t display,
int32_t *format,
int32_t *dataspace) = 0;
virtual DisplayError GetRenderIntents(uint64_t display, int32_t color_mode,
uint32_t *out_num_intents,
int32_t *int_out_intents) = 0;
virtual DisplayError
GetReadbackBufferFence(uint64_t display,
shared_ptr<Fence> *release_fence) = 0;
virtual DisplayError SetColorModeWithRenderIntent(uint64_t display,
int32_t mode,
int32_t intent) = 0;
virtual DisplayError
SetReadbackBuffer(uint64_t display, void *buffer,
const shared_ptr<Fence> &acquire_fence) = 0;
virtual DisplayError SetColorTransform(uint64_t display,
const std::vector<float> &matrix) = 0;
virtual DisplayError SetDisplayBrightness(Display display,
float brightness) = 0;
virtual DisplayError SetCursorPosition(Display display, LayerId layer,
int32_t x, int32_t y) = 0;
virtual DisplayError GetDisplayName(Display display, uint32_t *out_size,
char *out_name) = 0;
virtual DisplayError getDisplayDecorationSupport(Display display,
uint32_t *format,
uint32_t *alpha) = 0;
virtual DisplayError SetActiveConfigWithConstraints(
Display display, Config config,
const SDMVsyncPeriodChangeConstraints *vsync_period_change_constraints,
SDMVsyncPeriodChangeTimeline *out_timeline) = 0;
virtual DisplayError
GetClientTargetProperty(Display display,
SDMClientTargetProperty *outClientTargetProperty) = 0;
virtual bool IsHDRDisplay(uint64_t display) = 0;
virtual DisplayError ConfigureDynRefreshRate(SDMBuiltInDisplayOps ops,
int refresh_rate) = 0;
virtual DisplayError GetDisplayBrightness(uint64_t display,
float *brightness) = 0;
virtual DisplayError ControlPartialUpdate(uint64_t disp_id, bool enable) = 0;
virtual DisplayError ToggleScreenUpdate(bool on) = 0;
virtual DisplayError SetIdleTimeout(uint32_t value) = 0;
virtual DisplayError SetDisplayDppsAdROI(uint64_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) = 0;
virtual void UpdateVSyncSourceOnPowerModeOff() = 0;
virtual void UpdateVSyncSourceOnPowerModeDoze() = 0;
virtual DisplayError GetDSIClk(uint64_t disp_id, uint64_t *bit_clk) = 0;
virtual DisplayError SetDSIClk(uint64_t disp_id, uint64_t bit_clk) = 0;
virtual DisplayError SetQsyncMode(uint64_t disp_id, QSyncMode mode) = 0;
virtual DisplayError GetActiveBuiltinDisplay(uint64_t *disp_id) = 0;
virtual int GetDisplayConfigGroup(uint64_t display, DisplayConfigGroupInfo variable_config) = 0;
virtual DisplayError SetupVRRConfig(uint64_t display_id) = 0;
virtual int GetNotifyEptConfig(uint64_t display) = 0;
virtual DisplayError PerformCacConfig(uint64_t disp_id, CacConfig cac_config, bool enable) = 0;
};
} // namespace sdm
#endif // __SDM_DISPLAY_INTF_SETTINGS_H__

View File

@@ -0,0 +1,82 @@
/*
* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Changes from Qualcomm Innovation Center are provided under the following license:
*
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __SDM_DISPLAY_INTF_SIDEBAND_H__
#define __SDM_DISPLAY_INTF_SIDEBAND_H__
#include <core/sdm_types.h>
#include <core/layer_buffer.h>
#include "sdm_display_intf_parcel.h"
namespace sdm {
class SDMDisplaySideBandIntf {
public:
virtual ~SDMDisplaySideBandIntf() {}
virtual DisplayError SetCameraLaunchStatus(uint32_t on) = 0;
virtual DisplayError DisplayBWTransactionPending(bool *status) = 0;
virtual DisplayError SetDisplayAnimating(uint64_t display_id,
bool animating) = 0;
virtual DisplayError ControlIdlePowerCollapse(bool enable,
bool synchronous) = 0;
virtual void SetClientUp() = 0;
virtual bool IsBuiltInDisplay(uint64_t display) = 0;
virtual bool IsAsyncVDSCreationSupported() = 0;
virtual DisplayError CreateVirtualDisplay(int32_t width, int32_t height,
int32_t format) = 0;
virtual DisplayError TUIEventHandler(uint64_t display,
SDMTUIEventType event_type) = 0;
virtual DisplayError SetCameraSmoothInfo(SDMCameraSmoothOp op,
int32_t fps) = 0;
virtual DisplayError SetContentFps(const std::string& name, int32_t fps) = 0;
virtual DisplayError PostBuffer(const CwbConfig &cwb_config, void *buffer,
int32_t display_type) = 0;
virtual int GetProperty(const char *property_name, char *value) = 0;
virtual int GetProperty(const char *property_name, int *value) = 0;
virtual void Dump(uint32_t *out_size, char *out_buffer) = 0;
virtual DisplayError NotifyCallback(uint32_t command, SDMParcel *input_parcel,
SDMParcel *output_parcel) = 0;
};
} // namespace sdm
#endif // __SDM_DISPLAY_INTF_SIDEBAND_H__

View File

@@ -0,0 +1,56 @@
/*
* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Changes from Qualcomm Innovation Center, Inc. are provided under the following license:
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __SDM_DISPLAY_INTERFACE_FACTORY_H__
#define __SDM_DISPLAY_INTERFACE_FACTORY_H__
#include "sdm_display_intf_aiqe.h"
#include "sdm_display_intf_caps.h"
#include "sdm_display_intf_drawcycle.h"
#include "sdm_display_intf_layer_builder.h"
#include "sdm_display_intf_lifecycle.h"
#include "sdm_display_intf_settings.h"
#include "sdm_display_intf_sideband.h"
namespace sdm {
class SDMInterfaceFactory {
public:
virtual ~SDMInterfaceFactory() {}
virtual std::shared_ptr<SDMDisplayCapsIntf> CreateCapsIntf() = 0;
virtual std::shared_ptr<SDMDisplayDrawCycleIntf> CreateDrawCycleIntf() = 0;
virtual std::shared_ptr<SDMDisplayLayerBuilderIntf>
CreateLayerBuilderIntf() = 0;
virtual std::shared_ptr<SDMDisplayLifeCycleIntf> CreateLifeCycleIntf() = 0;
virtual std::shared_ptr<SDMDisplaySettingsIntf> CreateSettingsIntf() = 0;
virtual std::shared_ptr<SDMDisplaySideBandIntf> CreateSideBandIntf() = 0;
virtual std::shared_ptr<SDMDisplayAiqeIntf> CreateAiqeIntf() = 0;
};
SDMInterfaceFactory *GetSDMInterfaceFactory();
} // namespace sdm
#endif // __SDM_DISPLAY_INTERFACE_FACTORY_H__

View File

@@ -0,0 +1,27 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __SNAPALLOC_ALLOCATIONRESULT_H__
#define __SNAPALLOC_ALLOCATIONRESULT_H__
#include "SnapHandle.h"
#include <vector>
namespace vendor {
namespace qti {
namespace hardware {
namespace display {
namespace snapalloc {
typedef struct AllocationResult {
int stride;
std::vector<SnapHandle *> handles;
} AllocationResult;
} // namespace snapalloc
} // namespace display
} // namespace hardware
} // namespace qti
} // namespace vendor
#endif // __SNAPALLOC_ALLOCATIONRESULT_H__

View File

@@ -0,0 +1,37 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __SNAPALLOC_BUFFERDESCRIPTOR_H__
#define __SNAPALLOC_BUFFERDESCRIPTOR_H__
#include <PixelFormat.h>
#include <BufferUsage.h>
#include <KeyValuePair.h>
#include <vector>
namespace vendor {
namespace qti {
namespace hardware {
namespace display {
namespace snapalloc {
#define QTI_MAX_NAME_LEN 256
typedef struct BufferDescriptor {
char name[QTI_MAX_NAME_LEN];
int width;
int height;
int layerCount;
vendor_qti_hardware_display_common_PixelFormat format = PIXEL_FORMAT_UNSPECIFIED;
vendor_qti_hardware_display_common_BufferUsage usage = CPU_READ_NEVER;
long reservedSize;
std::vector<vendor_qti_hardware_display_common_KeyValuePair> additionalOptions;
} BufferDescriptor;
} // namespace snapalloc
} // namespace display
} // namespace hardware
} // namespace qti
} // namespace vendor
#endif // __SNAPALLOC_BUFFERDESCRIPTOR_H__

View File

@@ -0,0 +1,62 @@
// Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause-Clear
#ifndef __SNAPALLOC_ERROR_H__
#define __SNAPALLOC_ERROR_H__
namespace vendor {
namespace qti {
namespace hardware {
namespace display {
namespace snapalloc {
enum Error {
/**
* No error.
*/
NONE = 0,
/**
* Invalid BufferDescriptor.
*/
BAD_DESCRIPTOR = 1,
/**
* Invalid Buffer Handle.
*/
BAD_BUFFER = 2,
/**
* Invalid input.
*/
BAD_VALUE = 3,
/**
* Resource unavailable.
*/
NO_RESOURCES = 5,
/**
* Permanent failure.
*/
UNSUPPORTED = 7,
/**
* Metadata hasn't been set
*/
METADATA_NOT_SET = 9,
/**
* Buffer not freed
*/
BUF_NOT_FREED = 10,
};
} // namespace snapalloc
} // namespace display
} // namespace hardware
} // namespace qti
} // namespace vendor
#endif // __SNAPALLOC_ERROR_H__

View File

@@ -0,0 +1,30 @@
/*
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#pragma once
#include "AllocationResult.h"
#include "BufferDescriptor.h"
#include "Error.h"
namespace vendor {
namespace qti {
namespace hardware {
namespace display {
namespace snapalloc {
class ISnapAlloc {
public:
virtual ~ISnapAlloc() {}
virtual Error Allocate(const BufferDescriptor &in_descriptor, int in_count,
AllocationResult *allocation_result) = 0;
virtual Error IsSupported(const BufferDescriptor &in_descriptor, bool *is_supported) = 0;
};
} // namespace snapalloc
} // namespace display
} // namespace hardware
} // namespace qti
} // namespace vendor

View File

@@ -0,0 +1,63 @@
/*
* Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#pragma once
#include <vector>
#include "SnapHandle.h"
#include <MetadataType.h>
#include <Address.h>
#include <Rect.h>
#include <Fence.h>
#include "AllocationResult.h"
#include "BufferDescriptor.h"
#include "Error.h"
namespace vendor {
namespace qti {
namespace hardware {
namespace display {
namespace snapalloc {
class ISnapMapper {
public:
virtual ~ISnapMapper() {}
virtual Error Retain(const SnapHandle &in_handle) = 0;
virtual Error Release(const SnapHandle &in_handle) = 0;
virtual Error Lock(const SnapHandle &in_handle,
vendor_qti_hardware_display_common_BufferUsage usage,
const vendor_qti_hardware_display_common_Rect &access_region,
const vendor_qti_hardware_display_common_Fence &in_fence,
vendor_qti_hardware_display_common_Address *base_addr) = 0;
virtual Error Unlock(
const SnapHandle &in_handle,
vendor_qti_hardware_display_common_Fence *fence) = 0; // pointer with fence return
virtual Error ValidateBufferSize(const SnapHandle &in_handle,
const BufferDescriptor &in_desc) = 0;
virtual Error FlushLockedBuffer(const SnapHandle &in_handle) = 0;
virtual Error RereadLockedBuffer(const SnapHandle &in_handle) = 0;
virtual Error GetMetadata(const SnapHandle &in_handle,
vendor_qti_hardware_display_common_MetadataType type, void *out) = 0;
virtual Error SetMetadata(const SnapHandle &in_handle,
vendor_qti_hardware_display_common_MetadataType type, void *in) = 0;
virtual Error GetFromBufferDescriptor(const BufferDescriptor &in_desc,
vendor_qti_hardware_display_common_MetadataType type,
void *out) = 0;
virtual Error DumpBuffer(const SnapHandle &in_handle) = 0;
virtual Error DumpBuffers() = 0;
virtual Error ListSupportedMetadataTypes() = 0;
virtual Error GetMetadataState(const SnapHandle &in_handle,
vendor_qti_hardware_display_common_MetadataType type,
bool *out) = 0;
virtual Error RetainViewBuffer(const SnapHandle &in_meta_handle, uint32_t view,
SnapHandle **out_view_handle) = 0;
};
} // namespace snapalloc
} // namespace display
} // namespace hardware
} // namespace qti
} // namespace vendor

View File

@@ -0,0 +1,87 @@
/*
* Copyright (C) 2009 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Changes from Qualcomm Innovation Center are provided under the following license:
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __SNAPALLOC_SNAPHANDLE_H__
#define __SNAPALLOC_SNAPHANDLE_H__
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
namespace vendor {
namespace qti {
namespace hardware {
namespace display {
namespace snapalloc {
#define SNAP_HANDLE_MAX_FDS 1024
#define SNAP_HANDLE_MAX_INTS 1024
class SnapHandle {
public:
~SnapHandle(){};
SnapHandle(){};
int version;
int num_fds; /* number of file descriptors at &buffer_data[0] */
int num_ints; /* number of ints at &buffer_data[num_fds] */
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wzero-length-array"
#endif
int buffer_data[0]; /* num_fds + num_ints ints */
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
};
inline SnapHandle *snap_handle_create(int num_fds, int num_ints) {
if (num_fds < 0 || num_ints < 0 || num_fds > SNAP_HANDLE_MAX_FDS || num_ints > SNAP_HANDLE_MAX_INTS) {
errno = EINVAL;
return NULL;
}
size_t handle_size = sizeof(SnapHandle) + (sizeof(int) * (num_fds + num_ints));
SnapHandle *h = static_cast<SnapHandle *>(malloc(handle_size));
if (h) {
h->version = sizeof(SnapHandle);
h->num_fds = num_fds;
h->num_ints = num_ints;
}
return h;
}
inline int snap_handle_delete(SnapHandle *h) {
if (h) {
if (h->version != sizeof(SnapHandle))
return -EINVAL;
free(h);
}
return 0;
}
} // namespace snapalloc
} // namespace display
} // namespace hardware
} // namespace qti
} // namespace vendor
#endif // __SNAPALLOC_SNAPHANDLE_H__