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,155 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Changes from Qualcomm Innovation Center, Inc. are provided under the following license:
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#ifndef __ALLOC_INTERFACE_H__
#define __ALLOC_INTERFACE_H__
#include "buffer_interface.h"
namespace sdm {
enum CacheOp {
kCacheReadStart = 0x1, //!< Invalidate the cache before the buffer read
kCacheReadDone, //!< Flush the cache after the buffer read
kCacheWriteStart, //!< Invalidate the cache before the buffer write
kCacheWriteDone, //!< Flush the cache after the buffer write
kCacheInvalidate, //!< Invalidate the cache before the buffer read/write
kCacheClean, //!< Flush the cache after the buffer read/write
};
struct AllocData {
bool uncached = false; //!< Specifies the buffer to be cached or uncached
uint32_t width; //!< Width of the buffer to be allocated.
uint32_t height; //!< Height of the buffer to be allocated.
BufferFormat format; //!< Format of the buffer to be allocated.
uint32_t size; //!< Size of the buffer to be allocated. Allocator allocates the
//!< buffer of this size, if size is non zero otherwise allocator
//!< allocates the buffer based on width, height and format.
struct UsageHints {
union {
struct {
uint32_t trusted_ui : 1; //!< Denotes buffer to be allocated from trusted ui heap.
uint32_t tui_demura : 2; //!< Denotes buffer to be allocated from trusted ui demura heap.
};
uint64_t hints;
};
};
UsageHints usage_hints; //!< Hints to know about the producer of the buffer
};
struct CloneData {
int fd = -1; //!< Buffer fd to be cloned.
uint32_t width; //!< Width of the buffer to be cloned.
uint32_t height; //!< Height of the buffer to be cloned.
BufferFormat format; //!< Format of the buffer to be cloned.
};
class AllocInterface {
public:
/*! @brief Method to get the instance of allocator interface.
@details This function opens the ion device and provides the ion allocator interface
@return Returns AllocInterface pointer on sucess otherwise NULL
*/
static AllocInterface *GetInstance();
/*! @brief Method to to allocate buffer for a given buffer attributes
@param[in] data - \link AllocData \endlink
@param[out] buffer_handle - \link BufferHandle \endlink
@return Returns 0 on sucess otherwise errno
*/
virtual int AllocBuffer(AllocData *data, BufferHandle *buffer_handle) = 0;
/*! @brief Method to deallocate buffer
@param[in] buffer_handle - \link BufferHandle \endlink
@return Returns 0 on sucess otherwise errno
*/
virtual int FreeBuffer(BufferHandle *buffer_handle) = 0;
/*! @brief This creates a new mapping in the virtual address space of the calling process and
provides the pointer.
@param[in] fd - fd of the buffer to be mapped
@param[in] size - size of the buffer to be mapped
@param[out] base - virtual base address after mapping
@return Returns 0 on sucess otherwise errno
*/
virtual int MapBuffer(int fd, unsigned int size, void **base) = 0;
/*! @brief This function unmaps the buffer for the given pointer.
@param[in] base - virtual base address to be unmapped
@param[in] size - size of the buffer to be unmapped
@return Returns 0 on sucess otherwise errno
*/
virtual int UnmapBuffer(void *base, unsigned int size) = 0;
/*! @brief This function helps to invalidate and flush the cache for the read write operation.
@param[in] CacheOp - \link CacheOp \endlink
@param[in] fd - fd of the buffer to be mapped
@return Returns 0 on sucess otherwise errno
*/
virtual int SyncBuffer(CacheOp op, int fd) = 0;
/*! @brief This function helps to clone the buffer handle for the given buffer parameters
@param[in] clone_data - \link CloneData \endlink
@param[out] buffer_handle - \link BufferHandle \endlink
@return Returns 0 on sucess otherwise errno
*/
virtual int CloneBuffer(const CloneData &clone_data, BufferHandle *buffer_handle) = 0;
protected:
virtual ~AllocInterface() { }
};
} // namespace sdm
#endif // __ALLOC_INTERFACE_H__

View File

@@ -0,0 +1,122 @@
/*
* 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 __BUFFER_INTERFACE_H__
#define __BUFFER_INTERFACE_H__
namespace sdm {
typedef void * Handle;
enum BufferFormat {
/* All RGB formats, Any new format will be added towards end of this group to maintain backward
compatibility.
*/
kBufferFormatInvalid = -1, //!< Invalid buffer format
kBufferFormatARGB8888, //!< 8-bits Alpha, Red, Green, Blue interleaved in ARGB order.
kBufferFormatRGBA8888, //!< 8-bits Red, Green, Blue, Alpha interleaved in RGBA order.
kBufferFormatBGRA8888, //!< 8-bits Blue, Green, Red, Alpha interleaved in BGRA order.
kBufferFormatXRGB8888, //!< 8-bits Padding, Red, Green, Blue interleaved in XRGB order.
//!< NoAlpha.
kBufferFormatRGBX8888, //!< 8-bits Red, Green, Blue, Padding interleaved in RGBX order.
//!< NoAlpha.
kBufferFormatBGRX8888, //!< 8-bits Blue, Green, Red, Padding interleaved in BGRX order.
//!< NoAlpha.
kBufferFormatRGBA5551, //!< 5-bits Red, Green, Blue, and 1 bit Alpha interleaved in
//!< RGBA order.
kBufferFormatRGBA4444, //!< 4-bits Red, Green, Blue, Alpha interleaved in RGBA order.
kBufferFormatRGB888, //!< 8-bits Red, Green, Blue interleaved in RGB order. No Alpha.
kBufferFormatBGR888, //!< 8-bits Blue, Green, Red interleaved in BGR order. No Alpha.
kBufferFormatRGB565, //!< 5-bit Red, 6-bit Green, 5-bit Blue interleaved in RGB order.
//!< NoAlpha.
kBufferFormatBGR565, //!< 5-bit Blue, 6-bit Green, 5-bit Red interleaved in BGR order.
//!< NoAlpha.
kBufferFormatRGBA1010102, //!< 10-bits Red, Green, Blue, Alpha interleaved in RGBA order.
kBufferFormatARGB2101010, //!< 10-bits Alpha, Red, Green, Blue interleaved in ARGB order.
kBufferFormatRGBX1010102, //!< 10-bits Red, Green, Blue, Padding interleaved in RGBX order.
//!< NoAlpha.
kBufferFormatXRGB2101010, //!< 10-bits Padding, Red, Green, Blue interleaved in XRGB order.
//!< NoAlpha.
kBufferFormatBGRA1010102, //!< 10-bits Blue, Green, Red, Alpha interleaved in BGRA order.
kBufferFormatABGR2101010, //!< 10-bits Alpha, Blue, Green, Red interleaved in ABGR order.
kBufferFormatBGRX1010102, //!< 10-bits Blue, Green, Red, Padding interleaved in BGRX order.
//!< NoAlpha.
kBufferFormatXBGR2101010, //!< 10-bits Padding, Blue, Green, Red interleaved in XBGR order.
//!< NoAlpha.
kBufferFormatRGB101010, //!< 10-bits Red, Green, Blue, interleaved in RGB order. No Alpha.
kBufferFormatRGBA8888Ubwc, //!< UBWC aligned RGBA8888 format
kBufferFormatRGBX8888Ubwc, //!< UBWC aligned RGBX8888 format
kBufferFormatBGR565Ubwc, //!< UBWC aligned BGR565 format
kBufferFormatRGBA1010102Ubwc, //!< UBWC aligned RGBA1010102 format
kBufferFormatRGBX1010102Ubwc, //!< UBWC aligned RGBX1010102 format
};
struct Rect {
float left = 0.0f; //!< Specifies the left coordinates of the pixel buffer
float top = 0.0f; //!< Specifies the top coordinates of the pixel buffer
float right = 0.0f; //!< Specifies the right coordinates of the pixel buffer
float bottom = 0.0f; //!< Specifies the bottom coordinates of the pixel buffer
bool operator==(const Rect& rect) const {
return left == rect.left && right == rect.right && top == rect.top && bottom == rect.bottom;
}
bool operator!=(const Rect& rect) const {
return !operator==(rect);
}
};
struct BufferHandle {
int32_t fd = -1; //!< fd of the allocated buffer to be displayed.
int32_t producer_fence_fd = -1; //!< Created and signaled by the producer. Consumer
//!< needs to wait on this before the buffer
//!< is being accessed
int32_t consumer_fence_fd = -1; //!< Created and signaled by the consumer. Producer
//!< needs to wait on this before the buffer
//!< is being modified
uint32_t width = 0; //!< Actual width of the buffer in pixels
uint32_t height = 0; //!< Actual height of the buffer in pixels.
uint32_t aligned_width = 0; //!< Aligned width of the buffer in pixels
uint32_t aligned_height = 0; //!< Aligned height of the buffer in pixels
BufferFormat format = kBufferFormatInvalid; //!< Format of the buffer refer BufferFormat
uint32_t stride_in_bytes = 0; //!< Stride of the buffer in bytes
uint32_t size = 0; //!< Allocated buffer size
bool uncached = false; //!< Enable or disable buffer caching during R/W
int64_t buffer_id = -1; //!< Unique Id of the allocated buffer for the
//!< internal use only
Rect src_crop = {}; //!< Crop rectangle of src buffer, if client doesn't
//!< specify, its default to {0, 0, width, height}
};
} // namespace sdm
#endif // __BUFFER_INTERFACE_H__

View File

@@ -0,0 +1,86 @@
/*
Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted (subject to the limitations in the
disclaimer below) provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __PROPERTY_PARSER_INTERFACE__
#define __PROPERTY_PARSER_INTERFACE__
class PropertyParserInterface {
public:
/*! @brief Method to create property parser interface.
@details This function to be called once per the device life cycle. This function creates
property parser interface which parses the property and its value from
vendor_build.prop property file. Property and value should be stored in following
format "property_name=value" to parse the file appropriately.
@param[out] intf - Populates property parser interface pointer.
@return Returns 0 on sucess otherwise errno
*/
static int Create(PropertyParserInterface **intf);
/*! @brief Method to destroy property parser interface.
@details This function to be called once per the device life cycle.
@param[in] intf - Property parser interface pointer which was populated by Create() function.
@return Returns 0 on sucess otherwise errno
*/
static int Destroy(PropertyParserInterface *intf);
/*! @brief Method to get the value of the property as integer.
@param[in] property_name - property name for which you want to retrieve the value.
@param[out] value - Integer pointer stores the value of the property.
@return Returns 0 on sucess otherwise errno
*/
virtual int GetProperty(const char *property_name, int *value) = 0;
/*! @brief Method to get the value of the property as char string.
@param[in] property_name - property name for which you want to retrieve the value.
@param[out] value - char pointer stores the value of the property.
@return Returns 0 on sucess otherwise errno
*/
virtual int GetProperty(const char *property_name, char *value) = 0;
protected:
virtual ~PropertyParserInterface() { }
};
#endif // __PROPERTY_PARSER_INTERFACE__

View File

@@ -0,0 +1,284 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __SDM_COMP_INTERFACE_H__
#define __SDM_COMP_INTERFACE_H__
#include "buffer_interface.h"
namespace sdm {
typedef void * Handle;
enum SDMCompDisplayType {
kSDMCompDisplayTypePrimary, // Defines the display type for primary display
kSDMCompDisplayTypeSecondary1, // Defines the display type for secondary builtin display
kSDMCompDisplayTypeMax,
};
// The following values matches the HEVC spec
typedef enum ColorPrimaries {
// Unused = 0;
ColorPrimaries_BT709_5 = 1, // ITU-R BT.709-5 or equivalent
/* Unspecified = 2, Reserved = 3*/
ColorPrimaries_BT470_6M = 4, // ITU-R BT.470-6 System M or equivalent
ColorPrimaries_BT601_6_625 = 5, // ITU-R BT.601-6 625 or equivalent
ColorPrimaries_BT601_6_525 = 6, // ITU-R BT.601-6 525 or equivalent
ColorPrimaries_SMPTE_240M = 7, // SMPTE_240M
ColorPrimaries_GenericFilm = 8, // Generic Film
ColorPrimaries_BT2020 = 9, // ITU-R BT.2020 or equivalent
ColorPrimaries_SMPTE_ST428 = 10, // SMPTE_240M
ColorPrimaries_AdobeRGB = 11,
ColorPrimaries_DCIP3 = 12,
ColorPrimaries_EBU3213 = 22,
ColorPrimaries_Max = 0xff,
} ColorPrimaries;
typedef enum GammaTransfer {
// Unused = 0;
Transfer_sRGB = 1, // ITR-BT.709-5
/* Unspecified = 2, Reserved = 3 */
Transfer_Gamma2_2 = 4,
Transfer_Gamma2_8 = 5,
Transfer_SMPTE_170M = 6, // BT.601-6 525 or 625
Transfer_SMPTE_240M = 7, // SMPTE_240M
Transfer_Linear = 8,
Transfer_Log = 9,
Transfer_Log_Sqrt = 10,
Transfer_XvYCC = 11, // IEC 61966-2-4
Transfer_BT1361 = 12, // Rec.ITU-R BT.1361 extended gamut
Transfer_sYCC = 13, // IEC 61966-2-1 sRGB or sYCC
Transfer_BT2020_2_1 = 14, // Rec. ITU-R BT.2020-2 (same as the values 1, 6, and 15)
Transfer_BT2020_2_2 = 15, // Rec. ITU-R BT.2020-2 (same as the values 1, 6, and 14)
Transfer_SMPTE_ST2084 = 16, // 2084
Transfer_ST_428 = 17, // SMPTE ST 428-1
Transfer_HLG = 18, // ARIB STD-B67
Transfer_Max = 0xff,
} GammaTransfer;
enum RenderIntent {
//<! Colors with vendor defined gamut
kRenderIntentNative,
//<! Colors with in gamut are left untouched, out side the gamut are hard clipped
kRenderIntentColorimetric,
//<! Colors with in gamut are ehanced, out side the gamuat are hard clipped
kRenderIntentEnhance,
//<! Tone map hdr colors to display's dynamic range, mapping to display gamut is
//<! defined in colormertic.
kRenderIntentToneMapColorimetric,
//<! Tone map hdr colors to display's dynamic range, mapping to display gamut is
//<! defined in enhance.
kRenderIntentToneMapEnhance,
//<! Custom render intents range
kRenderIntentOemCustomStart = 0x100,
kRenderIntentOemCustomEnd = 0x1ff,
//<! If STC implementation returns kOemModulateHw render intent, STC manager will
//<! call the implementation for all the render intent/blend space combination.
//<! STC implementation can modify/modulate the HW assets.
kRenderIntentOemModulateHw = 0xffff - 1,
kRenderIntentMaxRenderIntent = 0xffff
};
struct SDMCompDisplayAttributes {
uint32_t vsync_period = 0; //!< VSync period in nanoseconds.
uint32_t x_res = 0; //!< Total number of pixels in X-direction on the display panel.
uint32_t y_res = 0; //!< Total number of pixels in Y-direction on the display panel.
float x_dpi = 0.0f; //!< Dots per inch in X-direction.
float y_dpi = 0.0f; //!< Dots per inch in Y-direction.
bool is_yuv = false; //!< If the display output is in YUV format.
uint32_t fps = 0; //!< fps of the display.
bool smart_panel = false; //!< Speficies the panel is video mode or command mode
};
struct SDMCompMixerConfig {
uint32_t width = 0;
uint32_t height = 0;
};
struct ColorMode {
//<! Blend-Space gamut
ColorPrimaries gamut = ColorPrimaries_Max;
//<! Blend-space Gamma
GammaTransfer gamma = Transfer_Max;
//<! Intent of the mode
RenderIntent intent = kRenderIntentMaxRenderIntent ;
};
class CallbackInterface {
public:
/*! @brief Callback method to handle any asyn error.
@details This function need to be implemented by the client which will be called
by the sdm composer on any hardware hang etc.
*/
virtual void OnError() = 0;
protected:
virtual ~CallbackInterface() { }
// callbackdata where client can store the context information about display type
// for which this callback corresponds to.
Handle callback_data_ = nullptr;
};
class SDMCompInterface {
public:
/*! @brief Method to create display composer interface for TUI service.
@details This function to be called once per the device life cycle. This function creates
sdm core and opens up the display driver drm interface.
@param[out] intf - Populates composer interface pointer.
@return Returns 0 on sucess otherwise errno
*/
static int Create(SDMCompInterface **intf);
/*! @brief Method to destroy display composer interface for TUI service.
@details This function to be called once per the device life cycle. This function destroys
sdm core and closes the display driver drm interface.
@param[in] intf - Composer interface pointer which was populated by Create() function.
@return Returns 0 on sucess otherwise errno
*/
static int Destroy(SDMCompInterface *intf);
/*! @brief Method to create display for composer where the TUI to be rendered.
@details This function to be called on start of TUI session. This function creates primary or
secondary display based on the display type passed by the client and intialize the
display.to its appropriate state This function to be called once per display. This is
also responsible to create single layer to the created display
@param[in] display_type - Specifies the type of a display. \link SDMCompDisplayType \endlink
@param[in] callback - Pointer to callback interface which handles the async error.
\link CallbackInterface \endlink
@param[out] disp_hnd - pointer to display handle which stores the context of the client.
@return Returns 0 on sucess otherwise errno
*/
virtual int CreateDisplay(SDMCompDisplayType display_type, CallbackInterface *callback,
Handle *disp_hnd) = 0;
/*! @brief Method to destroy display for composer where the TUI to be rendered.
@details This function to be called on end of TUI session. This function destroys primary or
secondary display based on the display type passed by the client and relinquish all the
MDP hw resources. This function to be called once per display.
@param[in] disp_hnd - pointer to display handle which was created during CreateDisplay()
@return Returns 0 on sucess otherwise errno
*/
virtual int DestroyDisplay(Handle disp_hnd) = 0;
/*! @brief Method to get display attributes for a given display handle.
@param[in] disp_hnd - pointer to display handle which was created during CreateDisplay()
@param[out] display_attributes - pointer to display attributes to b populated for a given
display handle. \link SDMCompDisplayAttributes \endlink.
@return Returns 0 on sucess otherwise errno
*/
virtual int GetDisplayAttributes(Handle disp_hnd,
SDMCompDisplayAttributes *display_attributes) = 0;
/*! @brief Method to prepare and render buffer to display
@param[in] disp_hnd - pointer to display handle which was created during CreateDisplay()
@param[in] buf_handle - pointer to buffer handle which specifies the attributes of a buffer
@param[out] retire_fence - pointer to retire fence which will be signaled once display hw
picks up the buf_handle for rendering.
@return Returns 0 on sucess otherwise errno
*/
virtual int ShowBuffer(Handle disp_hnd, BufferHandle *buf_handle, int32_t *retire_fence) = 0;
/*! @brief Method to set color mode with render intent
@param[in] disp_hnd - pointer to display handle which was created during CreateDisplay()
@param[in] mode - ColorMode struct which contains blend space and render intent info
@return Returns 0 on sucess otherwise errno
*/
virtual int SetColorModeWithRenderIntent(Handle disp_hnd, struct ColorMode mode) = 0;
/*! @brief Method to get all the supported color modesDprepare and render buffer to display
* ut
@param[in] disp_hnd - pointer to display handle which was created during CreateDisplay()
@param[out] out_num_modes - pointer to uint32_t which specifies the number of color modes
@param[out] out_modes - pointer to ColorMode struct which contains all color modes that
are parsed from xml files
@return Returns 0 on sucess otherwise errno
*/
virtual int GetColorModes(Handle disp_hnd, uint32_t *out_num_modes,
struct ColorMode *out_modes) = 0;
/*! @brief Method to set panel brightness
@detail This api enables client to set the panel brightness of a given display, If the set
brightness level is below the minimum panel brightness values set by the API
SetMinPanelBrightness(), then it ignores the request.
@param[in] disp_hnd - pointer to display handle which was created during CreateDisplay()
@param[in] brightness_level - brightness_level of the panel varies from 0.0f to 1.0f
@return Returns 0 on sucess otherwise errno
*/
virtual int SetPanelBrightness(Handle disp_hnd, float brightness_level) = 0;
/*! @brief Method to set minimum panel brightness level
@detail This api enables client to set minimum panel brightness threshold of a given display,
If the set brightness level is below the minimum panel brightness threshold, Reset the
panel brightness level to minimum panel brightness value
@param[in] disp_hnd - pointer to display handle which was created during CreateDisplay()
@param[in] min_brightness_level - min_brightness_level of the panel varies from 0.0f to 1.0f
@return Returns 0 on sucess otherwise errno
*/
virtual int SetMinPanelBrightness(Handle disp_hnd, float min_brightness_level) = 0;
protected:
virtual ~SDMCompInterface() { }
};
} // namespace sdm
#endif // __SDM_COMP_INTERFACE_H__

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __SDMCOMP_SERVICE_EXTN_INTF_H__
#define __SDMCOMP_SERVICE_EXTN_INTF_H__
#include "libqrtr.h"
#define EXTN_LIB_NAME "libsdmcompserviceextn.so"
#define CREATE_SDMCOMP_SERVICE_EXTN "CreateSDMCompServiceExtn"
#define DESTROY_SDMCOMP_SERVICE_EXTN "DestroySDMCompServiceExtn"
class SDMCompServiceExtnIntf;
typedef int (*CreateSDMCompExtnIntf)(int qrtr_fd, SDMCompServiceExtnIntf **intf);
typedef int (*DestroySDMCompExtnIntf)(SDMCompServiceExtnIntf *intf);
class SDMCompServiceExtnIntf {
public:
virtual void CommandHandler(const struct qrtr_packet &qrtr_pkt) = 0;
protected:
virtual ~SDMCompServiceExtnIntf() { }
};
#endif // __SDMCOMP_SERVICE_EXTN_INTF_H__

View File

@@ -0,0 +1,114 @@
/*
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
Changes from Qualcomm Innovation Center are provided under the following license:
Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted (subject to the limitations in the
disclaimer below) provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __SDMCOMP_SERVICE_INTF_H__
#define __SDMCOMP_SERVICE_INTF_H__
#include <stdarg.h>
#include "libqrtr.h"
namespace sdm {
class SDMCompServiceIntf;
enum SDMCompServiceEvents {
kEventSetPanelBrightness,
kEventSetDisplayConfig,
kEventImportDemuraBuffers,
kEventMax,
};
struct SDMCompServiceDispConfigs {
uint32_t h_total = 0;
uint32_t v_total = 0;
uint32_t fps = 0;
bool smart_panel = false;
uint32_t mixer_width = 0;
uint32_t mixer_height = 0;
};
struct SDMCompServiceDemuraBufInfo {
int hfc_buf_fd = -1;
uint32_t hfc_buf_size = 0;
uint64_t panel_id = 0;
};
class SDMCompServiceCbIntf {
public:
virtual int OnEvent(SDMCompServiceEvents event_type, ...) = 0;
protected:
virtual ~SDMCompServiceCbIntf() { }
};
class SDMCompServiceIntf {
public:
static int Create(SDMCompServiceCbIntf *callback, SDMCompServiceIntf **intf);
static int Destroy(SDMCompServiceIntf *intf);
protected:
virtual ~SDMCompServiceIntf() { }
};
}
#endif // __SDMCOMP_SERVICE_INTF_H__