upload android base code part4
This commit is contained in:
parent
b9e30e05b1
commit
78ea2404cd
23455 changed files with 5250148 additions and 0 deletions
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* Copyright (c) 2015, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! @file buffer_allocator.h
|
||||
@brief Interface file for platform specific buffer allocator.
|
||||
|
||||
@details This interface is used by SDM to allocate internal buffers.
|
||||
*/
|
||||
|
||||
#ifndef __BUFFER_ALLOCATOR_H__
|
||||
#define __BUFFER_ALLOCATOR_H__
|
||||
|
||||
#include "layer_buffer.h"
|
||||
|
||||
namespace sdm {
|
||||
/*! @brief Input configuration set by the client for buffer allocation.
|
||||
|
||||
@sa BufferInfo::BufferConfig
|
||||
*/
|
||||
|
||||
struct BufferConfig {
|
||||
uint32_t width = 0; //!< Specifies buffer width for buffer allocation.
|
||||
uint32_t height = 0; //!< Specifies buffer height for buffer allocation.
|
||||
LayerBufferFormat format = kFormatInvalid; //!< Specifies buffer format for buffer allocation.
|
||||
uint32_t buffer_count = 0; //!< Specifies number of buffers to be allocated.
|
||||
bool secure = false; //!< Specifies buffer to be allocated from
|
||||
//!< secure region.
|
||||
bool cache = false; //!< Specifies whether the buffer needs to be cache.
|
||||
};
|
||||
|
||||
/*! @brief Holds the information about the allocated buffer.
|
||||
|
||||
@sa BufferAllocator::AllocateBuffer
|
||||
@sa BufferAllocator::FreeBuffer
|
||||
*/
|
||||
struct AllocatedBufferInfo {
|
||||
int fd = -1; //!< Specifies the fd of the allocated buffer.
|
||||
uint32_t stride = 0; //!< Specifies aligned buffer width of the allocated buffer.
|
||||
uint32_t size = 0; //!< Specifies the size of the allocated buffer.
|
||||
};
|
||||
|
||||
/*! @brief Holds the information about the input/output configuration of an output buffer.
|
||||
|
||||
@sa BufferAllocator::AllocateBuffer
|
||||
@sa BufferAllocator::FreeBuffer
|
||||
*/
|
||||
struct BufferInfo {
|
||||
BufferConfig buffer_config; //!< Specifies configuration of a buffer to be allocated.
|
||||
AllocatedBufferInfo alloc_buffer_info; //!< Specifies buffer information of allocated buffer.
|
||||
|
||||
void *private_data = NULL; //!< Pointer to private data.
|
||||
};
|
||||
|
||||
/*! @brief Buffer allocator implemented by the client
|
||||
|
||||
@details This class declares prototype for BufferAllocator methods which must be
|
||||
implemented by the client. Buffer manager in display manager will use these methods to
|
||||
allocate/deallocate buffers for display manager.
|
||||
|
||||
@sa CoreInterface::CreateCore
|
||||
*/
|
||||
class BufferAllocator {
|
||||
public:
|
||||
/*! @brief Method to allocate ouput buffer for the given input configuration.
|
||||
|
||||
@details This method allocates memory based on input configuration.
|
||||
|
||||
@param[in] buffer_info \link BufferInfo \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError AllocateBuffer(BufferInfo *buffer_info) = 0;
|
||||
|
||||
|
||||
/*! @brief Method to deallocate the ouput buffer.
|
||||
|
||||
@details This method deallocates the memory allocated using AllocateBuffer method.
|
||||
|
||||
@param[in] buffer_info \link BufferInfo \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError FreeBuffer(BufferInfo *buffer_info) = 0;
|
||||
|
||||
|
||||
/*! @brief Method to get the buffer size.
|
||||
|
||||
@details This method returns buffer size for a specific configuration mentioned in buffer info.
|
||||
|
||||
@param[in] buffer_info \link BufferInfo \endlink
|
||||
|
||||
@return \link unsigned int \endlink
|
||||
*/
|
||||
virtual uint32_t GetBufferSize(BufferInfo *buffer_info) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~BufferAllocator() { }
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __BUFFER_ALLOCATOR_H__
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* Copyright (c) 2015, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! @file buffer_sync_handler.h
|
||||
@brief Interface file for platform specific buffer allocator.
|
||||
|
||||
@details SDM will use this interface to wait for buffer sync fd to be signaled/merge
|
||||
the two buffer sync fds into one.
|
||||
*/
|
||||
|
||||
#ifndef __BUFFER_SYNC_HANDLER_H__
|
||||
#define __BUFFER_SYNC_HANDLER_H__
|
||||
|
||||
#include "sdm_types.h"
|
||||
|
||||
namespace sdm {
|
||||
|
||||
/*! @brief Buffer sync handler implemented by the client
|
||||
|
||||
@details This class declares prototype for BufferSyncHandler methods which must be
|
||||
implemented by the client. SDM will use these methods to wait for buffer sync fd to be
|
||||
signaled/merge two buffer sync fds into one.
|
||||
|
||||
@sa CoreInterface::CreateCore
|
||||
*/
|
||||
class BufferSyncHandler {
|
||||
public:
|
||||
/*! @brief Method to wait for ouput buffer to be released.
|
||||
|
||||
@details This method waits for fd to be signaled by the producer/consumer.
|
||||
It is responsibility of the caller to close file descriptor.
|
||||
|
||||
@param[in] fd
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
|
||||
virtual DisplayError SyncWait(int fd) = 0;
|
||||
|
||||
/*! @brief Method to merge two sync fds into one sync fd
|
||||
|
||||
@details This method merges two buffer sync fds into one sync fd, if a producer/consumer
|
||||
requires to wait for more than one sync fds. It is responsibility of the caller to close file
|
||||
descriptor.
|
||||
|
||||
@param[in] fd1
|
||||
@param[in] fd2
|
||||
@param[out] merged_fd
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
|
||||
virtual DisplayError SyncMerge(int fd1, int fd2, int *merged_fd) = 0;
|
||||
|
||||
/*! @brief Method to detect if sync fd is signaled
|
||||
|
||||
@details This method detects if sync fd is signaled. It is responsibility of the caller to
|
||||
close file descriptor.
|
||||
|
||||
@param[in] fd
|
||||
|
||||
@return \link Tue if fd has been signaled \endlink
|
||||
*/
|
||||
virtual bool IsSyncSignaled(int fd) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~BufferSyncHandler() { }
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __BUFFER_SYNC_HANDLER_H__
|
||||
|
|
@ -0,0 +1,207 @@
|
|||
/*
|
||||
* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! @file core_interface.h
|
||||
@brief Interface file for core of the display subsystem.
|
||||
|
||||
@details Display core is primarily used for loading and unloading different display device
|
||||
components viz primary, external and virtual. Display core is a statically linked library which
|
||||
runs in caller's process context.
|
||||
*/
|
||||
#ifndef __CORE_INTERFACE_H__
|
||||
#define __CORE_INTERFACE_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "display_interface.h"
|
||||
#include "sdm_types.h"
|
||||
#include "buffer_allocator.h"
|
||||
#include "buffer_sync_handler.h"
|
||||
|
||||
/*! @brief Display manager interface version.
|
||||
|
||||
@details Display manager interfaces are version tagged to maintain backward compatibility. This
|
||||
version is supplied as a default argument during display core initialization.
|
||||
|
||||
Client may use an older version of interfaces and link to a higher version of display manager
|
||||
library, but vice versa is not allowed.
|
||||
|
||||
A 32-bit client must use 32-bit display core library and a 64-bit client must use 64-bit display
|
||||
core library.
|
||||
|
||||
Display manager interfaces follow default data structures alignment. Client must not override the
|
||||
default padding rules while using these interfaces.
|
||||
|
||||
@warning It is assumed that client upgrades or downgrades display core interface all at once
|
||||
and recompile all binaries which use these interfaces. Mix and match of these interfaces can
|
||||
lead to unpredictable behaviour.
|
||||
|
||||
@sa CoreInterface::CreateCore
|
||||
*/
|
||||
#define SDM_REVISION_MAJOR (1)
|
||||
#define SDM_REVISION_MINOR (0)
|
||||
|
||||
#define SDM_VERSION_TAG ((uint32_t) ((SDM_REVISION_MAJOR << 24) | (SDM_REVISION_MINOR << 16) | \
|
||||
(sizeof(SDMCompatibility) << 8) | sizeof(int *)))
|
||||
|
||||
namespace sdm {
|
||||
|
||||
/*! @brief Forward declaration for debug handler.
|
||||
*/
|
||||
class DebugHandler;
|
||||
|
||||
/*! @brief This enum represents max bandwidth limit mode.
|
||||
|
||||
@sa DisplayInterface::SetMaxBandwidthMode
|
||||
*/
|
||||
enum HWBwModes {
|
||||
kBwDefault, //!< Default state. No change in device bandwidth limit.
|
||||
kBwCamera, //!< Camera is on. Bandwidth limit should be reduced accordingly.
|
||||
kBwVFlip, //!< VFlip is required. Reduce bandwidth limit accordingly.
|
||||
kBwHFlip, //!< HFlip is required. Reduce bandwidth limit accordingly.
|
||||
kBwModeMax, //!< Limiter for maximum available bandwidth modes.
|
||||
};
|
||||
|
||||
|
||||
/*! @brief Information on hardware for the first display
|
||||
|
||||
@details This structure returns the display type of the first display on the device
|
||||
(internal display or HDMI etc) and whether it is currently connected,
|
||||
|
||||
*/
|
||||
struct HWDisplayInterfaceInfo {
|
||||
DisplayType type;
|
||||
bool is_connected;
|
||||
};
|
||||
|
||||
/*! @brief Display core interface.
|
||||
|
||||
@details This class defines display core interfaces. It contains methods which client shall use
|
||||
to create/destroy different display devices. This interface is created during display core
|
||||
CreateCore() and remains valid until DestroyCore().
|
||||
|
||||
@sa CoreInterface::CreateCore
|
||||
@sa CoreInterface::DestroyCore
|
||||
*/
|
||||
class CoreInterface {
|
||||
public:
|
||||
/*! @brief Method to create and get handle to display core interface.
|
||||
|
||||
@details This method is the entry point into the display core. Client can create and operate on
|
||||
different display devices only through a valid interface handle obtained using this method. An
|
||||
object of display core is created and handle to this object is returned via output parameter.
|
||||
This interface shall be called only once.
|
||||
|
||||
@param[in] debug_handler \link DebugHandler \endlink
|
||||
@param[in] buffer_allocator \link BufferAllocator \endlink
|
||||
@param[in] buffer_sync_handler \link BufferSyncHandler \endlink
|
||||
@param[out] interface \link CoreInterface \endlink
|
||||
@param[in] version \link SDM_VERSION_TAG \endlink. Client must not override this argument.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
|
||||
@sa DestroyCore
|
||||
*/
|
||||
static DisplayError CreateCore(DebugHandler *debug_handler, BufferAllocator *buffer_allocator,
|
||||
BufferSyncHandler *buffer_sync_handler, CoreInterface **interface,
|
||||
uint32_t version = SDM_VERSION_TAG);
|
||||
|
||||
/*! @brief Method to release handle to display core interface.
|
||||
|
||||
@details The object of corresponding display core is destroyed when this method is invoked.
|
||||
Client must explicitly destroy all created display device objects associated with this handle
|
||||
before invoking this method.
|
||||
|
||||
@param[in] interface \link CoreInterface \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
|
||||
@sa CreateCore
|
||||
*/
|
||||
static DisplayError DestroyCore();
|
||||
|
||||
/*! @brief Method to create a display device for a given type.
|
||||
|
||||
@details Client shall use this method to create each of the connected display type. A handle to
|
||||
interface associated with this object is returned via output parameter which can be used to
|
||||
interact further with the display device.
|
||||
|
||||
@param[in] type \link DisplayType \endlink
|
||||
@param[in] event_handler \link DisplayEventHandler \endlink
|
||||
@param[out] interface \link DisplayInterface \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
|
||||
@sa DestroyDisplay
|
||||
*/
|
||||
virtual DisplayError CreateDisplay(DisplayType type, DisplayEventHandler *event_handler,
|
||||
DisplayInterface **interface) = 0;
|
||||
|
||||
/*! @brief Method to destroy a display device.
|
||||
|
||||
@details Client shall use this method to destroy each of the created display device objects.
|
||||
|
||||
@param[in] interface \link DisplayInterface \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
|
||||
@sa CreateDisplay
|
||||
*/
|
||||
virtual DisplayError DestroyDisplay(DisplayInterface *interface) = 0;
|
||||
|
||||
/*! @brief Method to update the bandwidth limit as per given mode.
|
||||
|
||||
@param[in] mode indicate the mode or use case
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
|
||||
*/
|
||||
virtual DisplayError SetMaxBandwidthMode(HWBwModes mode) = 0;
|
||||
|
||||
/*! @brief Method to get characteristics of the first display.
|
||||
|
||||
@details Client shall use this method to determine if the first display is HDMI, and whether
|
||||
it is currently connected.
|
||||
|
||||
@param[in] hw_disp_info structure that this method will fill up with info.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
|
||||
*/
|
||||
virtual DisplayError GetFirstDisplayInterfaceType(HWDisplayInterfaceInfo *hw_disp_info) = 0;
|
||||
|
||||
|
||||
protected:
|
||||
virtual ~CoreInterface() { }
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __CORE_INTERFACE_H__
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* Copyright (c) 2015 - 2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! @file debug_interface.h
|
||||
@brief This file provides the debug interface for display manager.
|
||||
*/
|
||||
#ifndef __DEBUG_INTERFACE_H__
|
||||
#define __DEBUG_INTERFACE_H__
|
||||
|
||||
namespace sdm {
|
||||
|
||||
/*! @brief This enum represents different modules/logical unit tags that a log message may
|
||||
be associated with. Client may use this to filter messages for dynamic logging.
|
||||
|
||||
@sa DebugHandler
|
||||
*/
|
||||
enum DebugTag {
|
||||
kTagNone, //!< Debug log is not tagged. This type of logs should always be printed.
|
||||
kTagResources, //!< Debug log is tagged for resource management.
|
||||
kTagStrategy, //!< Debug log is tagged for strategy decisions.
|
||||
kTagCompManager, //!< Debug log is tagged for composition manager.
|
||||
kTagDriverConfig, //!< Debug log is tagged for driver config.
|
||||
kTagRotator, //!< Debug log is tagged for rotator.
|
||||
kTagScalar, //!< Debug log is tagged for Scalar Helper.
|
||||
kTagQDCM, //!< Debug log is tagged for display QDCM color managing.
|
||||
};
|
||||
|
||||
/*! @brief Display debug handler class.
|
||||
|
||||
@details This class defines display debug handler. The handle contains methods which client
|
||||
should implement to get different levels of logging/tracing from display manager. Display manager
|
||||
will call into these methods at appropriate times to send logging/tracing information.
|
||||
|
||||
@sa CoreInterface::CreateCore
|
||||
*/
|
||||
class DebugHandler {
|
||||
public:
|
||||
/*! @brief Method to handle error messages.
|
||||
|
||||
@param[in] tag \link DebugTag \endlink
|
||||
@param[in] format \link message format with variable argument list \endlink
|
||||
*/
|
||||
virtual void Error(DebugTag tag, const char *format, ...) = 0;
|
||||
|
||||
/*! @brief Method to handle warning messages.
|
||||
|
||||
@param[in] tag \link DebugTag \endlink
|
||||
@param[in] format \link message format with variable argument list \endlink
|
||||
*/
|
||||
virtual void Warning(DebugTag tag, const char *format, ...) = 0;
|
||||
|
||||
/*! @brief Method to handle informative messages.
|
||||
|
||||
@param[in] tag \link DebugTag \endlink
|
||||
@param[in] format \link message format with variable argument list \endlink
|
||||
*/
|
||||
virtual void Info(DebugTag tag, const char *format, ...) = 0;
|
||||
|
||||
/*! @brief Method to handle debug messages.
|
||||
|
||||
@param[in] tag \link DebugTag \endlink
|
||||
@param[in] format \link message format with variable argument list \endlink
|
||||
*/
|
||||
virtual void Debug(DebugTag tag, const char *format, ...) = 0;
|
||||
|
||||
/*! @brief Method to handle verbose messages.
|
||||
|
||||
@param[in] tag \link DebugTag \endlink
|
||||
@param[in] format \link message format with variable argument list \endlink
|
||||
*/
|
||||
virtual void Verbose(DebugTag tag, const char *format, ...) = 0;
|
||||
|
||||
/*! @brief Method to begin trace for a module/logical unit.
|
||||
|
||||
@param[in] class_name \link name of the class that the function belongs to \endlink
|
||||
@param[in] function_name \link name of the function to be traced \endlink
|
||||
@param[in] custom_string \link custom string for multiple traces within a function \endlink
|
||||
*/
|
||||
virtual void BeginTrace(const char *class_name, const char *function_name,
|
||||
const char *custom_string) = 0;
|
||||
|
||||
/*! @brief Method to end trace for a module/logical unit.
|
||||
*/
|
||||
virtual void EndTrace() = 0;
|
||||
|
||||
/*! @brief Method to get property value corresponding to give string.
|
||||
|
||||
@param[in] property_name name of the property
|
||||
@param[out] integer converted value corresponding to the property name
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError GetProperty(const char *property_name, int *value) = 0;
|
||||
|
||||
/*! @brief Method to get property value corresponding to give string.
|
||||
|
||||
@param[in] property_name name of the property
|
||||
@param[out] string value corresponding to the property name
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError GetProperty(const char *property_name, char *value) = 0;
|
||||
|
||||
/*! @brief Method to set a property to a given string value.
|
||||
|
||||
@param[in] property_name name of the property
|
||||
@param[in] value new value of the property name
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError SetProperty(const char *property_name, const char *value) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~DebugHandler() { }
|
||||
};
|
||||
|
||||
/*! @brief Scope tracer template class.
|
||||
|
||||
@details This class template implements the funtionality to capture the trace for function/
|
||||
module. It starts the trace upon object creation and ends the trace upon object destruction.
|
||||
*/
|
||||
template <class T>
|
||||
class ScopeTracer {
|
||||
public:
|
||||
ScopeTracer(const char *class_name, const char *function_name) {
|
||||
T::Get()->BeginTrace(class_name, function_name, "");
|
||||
}
|
||||
|
||||
~ScopeTracer() { T::Get()->EndTrace(); }
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __DEBUG_INTERFACE_H__
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,583 @@
|
|||
/*
|
||||
* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
* provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its contributors may be used to
|
||||
* endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! @file display_interface.h
|
||||
@brief Interface file for display device which represents a physical panel or an output buffer
|
||||
where contents can be rendered.
|
||||
|
||||
@details Display device is used to send layer buffers for composition and get them rendered onto
|
||||
the target device. Each display device represents a unique display target which may be either a
|
||||
physical panel or an output buffer..
|
||||
*/
|
||||
#ifndef __DISPLAY_INTERFACE_H__
|
||||
#define __DISPLAY_INTERFACE_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "layer_stack.h"
|
||||
#include "sdm_types.h"
|
||||
|
||||
namespace sdm {
|
||||
|
||||
/*! @brief This enum represents display device types where contents can be rendered.
|
||||
|
||||
@sa CoreInterface::CreateDisplay
|
||||
@sa CoreInterface::IsDisplaySupported
|
||||
*/
|
||||
enum DisplayType {
|
||||
kPrimary, //!< Main physical display which is attached to the handheld device.
|
||||
kHDMI, //!< HDMI physical display which is generally detachable.
|
||||
kVirtual, //!< Contents would be rendered into the output buffer provided by the client
|
||||
//!< e.g. wireless display.
|
||||
kDisplayMax,
|
||||
};
|
||||
|
||||
/*! @brief This enum represents states of a display device.
|
||||
|
||||
@sa DisplayInterface::GetDisplayState
|
||||
@sa DisplayInterface::SetDisplayState
|
||||
*/
|
||||
enum DisplayState {
|
||||
kStateOff, //!< Display is OFF. Contents are not rendered in this state. Client will not
|
||||
//!< receive VSync events in this state. This is default state as well.
|
||||
|
||||
kStateOn, //!< Display is ON. Contents are rendered in this state.
|
||||
|
||||
kStateDoze, //!< Display is ON and it is configured in a low power state.
|
||||
|
||||
kStateDozeSuspend,
|
||||
//!< Display is ON in a low power state and continue showing its current
|
||||
//!< contents indefinitely until the mode changes.
|
||||
|
||||
kStateStandby, //!< Display is OFF. Client will continue to receive VSync events in this state
|
||||
//!< if VSync is enabled. Contents are not rendered in this state.
|
||||
};
|
||||
|
||||
/*! @brief This enum represents flags to override detail enhancer parameters.
|
||||
|
||||
@sa DisplayInterface::SetDetailEnhancerData
|
||||
*/
|
||||
enum DetailEnhancerOverrideFlags {
|
||||
kOverrideDEEnable = 0x1, // Specifies to enable detail enhancer
|
||||
kOverrideDESharpen1 = 0x2, // Specifies user defined Sharpening/smooth for noise
|
||||
kOverrideDESharpen2 = 0x4, // Specifies user defined Sharpening/smooth for signal
|
||||
kOverrideDEClip = 0x8, // Specifies user defined DE clip shift
|
||||
kOverrideDELimit = 0x10, // Specifies user defined DE limit value
|
||||
kOverrideDEThrQuiet = 0x20, // Specifies user defined DE quiet threshold
|
||||
kOverrideDEThrDieout = 0x40, // Specifies user defined DE dieout threshold
|
||||
kOverrideDEThrLow = 0x80, // Specifies user defined DE low threshold
|
||||
kOverrideDEThrHigh = 0x100, // Specifies user defined DE high threshold
|
||||
kOverrideDEFilterConfig = 0x200, // Specifies user defined scaling filter config
|
||||
kOverrideDEMax = 0xFFFFFFFF,
|
||||
};
|
||||
|
||||
/*! @brief This enum represents Y/RGB scaling filter configuration.
|
||||
|
||||
@sa DisplayInterface::SetDetailEnhancerData
|
||||
*/
|
||||
enum ScalingFilterConfig {
|
||||
kFilterEdgeDirected,
|
||||
kFilterCircular,
|
||||
kFilterSeparable,
|
||||
kFilterBilinear,
|
||||
kFilterMax,
|
||||
};
|
||||
|
||||
/*! @brief This enum represents the quality level of the content.
|
||||
|
||||
@sa DisplayInterface::SetDetailEnhancerData
|
||||
*/
|
||||
enum ContentQuality {
|
||||
kContentQualityUnknown, // Default: high artifact and noise
|
||||
kContentQualityLow, // Low quality content, high artifact and noise,
|
||||
kContentQualityMedium, // Medium quality, medium artifact and noise,
|
||||
kContentQualityHigh, // High quality content, low artifact and noise
|
||||
kContentQualityMax,
|
||||
};
|
||||
|
||||
/*! @brief This structure defines configuration for fixed properties of a display device.
|
||||
|
||||
@sa DisplayInterface::GetConfig
|
||||
@sa DisplayInterface::SetConfig
|
||||
*/
|
||||
struct DisplayConfigFixedInfo {
|
||||
bool underscan = false; //!< If display support CE underscan.
|
||||
bool secure = false; //!< If this display is capable of handling secure content.
|
||||
};
|
||||
|
||||
/*! @brief This structure defines configuration for variable properties of a display device.
|
||||
|
||||
@sa DisplayInterface::GetConfig
|
||||
@sa DisplayInterface::SetConfig
|
||||
*/
|
||||
struct DisplayConfigVariableInfo {
|
||||
uint32_t x_pixels = 0; //!< Total number of pixels in X-direction on the display panel.
|
||||
uint32_t y_pixels = 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.
|
||||
uint32_t fps = 0; //!< Frame rate per second.
|
||||
uint32_t vsync_period_ns = 0; //!< VSync period in nanoseconds.
|
||||
bool is_yuv = false; //!< If the display output is in YUV format.
|
||||
};
|
||||
|
||||
/*! @brief Event data associated with VSync event.
|
||||
|
||||
@sa DisplayEventHandler::VSync
|
||||
*/
|
||||
struct DisplayEventVSync {
|
||||
int64_t timestamp = 0; //!< System monotonic clock timestamp in nanoseconds.
|
||||
};
|
||||
|
||||
/*! @brief The structure defines the user input for detail enhancer module.
|
||||
|
||||
@sa DisplayInterface::SetDetailEnhancerData
|
||||
*/
|
||||
struct DisplayDetailEnhancerData {
|
||||
uint32_t override_flags = 0; // flags to specify which data to be set.
|
||||
uint16_t enable = 0; // Detail enchancer enable
|
||||
int16_t sharpen_level1 = 0; // Sharpening/smooth strenght for noise
|
||||
int16_t sharpen_level2 = 0; // Sharpening/smooth strenght for signal
|
||||
uint16_t clip = 0; // DE clip shift
|
||||
uint16_t limit = 0; // DE limit value
|
||||
uint16_t thr_quiet = 0; // DE quiet threshold
|
||||
uint16_t thr_dieout = 0; // DE dieout threshold
|
||||
uint16_t thr_low = 0; // DE low threshold
|
||||
uint16_t thr_high = 0; // DE high threshold
|
||||
int32_t sharp_factor = 50; // sharp_factor specifies sharpness/smoothness level,
|
||||
// range -100..100 positive for sharpness and negative for
|
||||
// smoothness
|
||||
ContentQuality quality_level = kContentQualityUnknown;
|
||||
// Specifies context quality level
|
||||
ScalingFilterConfig filter_config = kFilterEdgeDirected;
|
||||
// Y/RGB filter configuration
|
||||
};
|
||||
|
||||
/*! @brief Display device event handler implemented by the client.
|
||||
|
||||
@details This class declares prototype for display device event handler methods which must be
|
||||
implemented by the client. Display device will use these methods to notify events to the client.
|
||||
Client must post heavy-weight event handling to a separate thread and unblock display manager
|
||||
thread instantly.
|
||||
|
||||
@sa CoreInterface::CreateDisplay
|
||||
*/
|
||||
class DisplayEventHandler {
|
||||
public:
|
||||
/*! @brief Event handler for VSync event.
|
||||
|
||||
@details This event is dispatched on every vertical synchronization. The event is disabled by
|
||||
default.
|
||||
|
||||
@param[in] vsync \link DisplayEventVSync \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
|
||||
@sa DisplayInterface::GetDisplayState
|
||||
@sa DisplayInterface::SetDisplayState
|
||||
*/
|
||||
virtual DisplayError VSync(const DisplayEventVSync &vsync) = 0;
|
||||
|
||||
/*! @brief Event handler for Refresh event.
|
||||
|
||||
@details This event is dispatched to trigger a screen refresh. Client must call Prepare() and
|
||||
Commit() in response to it from a separate thread. There is no data associated with this
|
||||
event.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
|
||||
@sa DisplayInterface::Prepare
|
||||
@sa DisplayInterface::Commit
|
||||
*/
|
||||
virtual DisplayError Refresh() = 0;
|
||||
|
||||
/*! @brief Event handler for CEC messages.
|
||||
|
||||
@details This event is dispatched to send CEC messages to the CEC HAL.
|
||||
|
||||
@param[in] message message to be sent
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError CECMessage(char *message) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~DisplayEventHandler() { }
|
||||
};
|
||||
|
||||
struct PPDisplayAPIPayload;
|
||||
struct PPPendingParams;
|
||||
|
||||
/*! @brief Display device interface.
|
||||
|
||||
@details This class defines display device interface. It contains methods which client shall use
|
||||
to configure or submit layers for composition on the display device. This interface is created
|
||||
during display device creation and remains valid until destroyed.
|
||||
|
||||
@sa CoreInterface::CreateDisplay
|
||||
@sa CoreInterface::DestroyDisplay
|
||||
*/
|
||||
class DisplayInterface {
|
||||
public:
|
||||
/*! @brief Method to determine hardware capability to compose layers associated with given frame.
|
||||
|
||||
@details Client shall send all layers associated with a frame targeted for current display
|
||||
using this method and check the layers which can be handled completely in display manager.
|
||||
|
||||
Client shall mark composition type for one of the layer as kCompositionGPUTarget; the GPU
|
||||
composed output would be rendered at the specified layer if some of the layers are not handled
|
||||
by SDM.
|
||||
|
||||
Display manager will set each layer as kCompositionGPU or kCompositionSDE upon return. Client
|
||||
shall render all the layers marked as kCompositionGPU using GPU.
|
||||
|
||||
This method can be called multiple times but only last call prevails. This method must be
|
||||
followed by Commit().
|
||||
|
||||
@param[inout] layer_stack \link LayerStack \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
|
||||
@sa Commit
|
||||
*/
|
||||
virtual DisplayError Prepare(LayerStack *layer_stack) = 0;
|
||||
|
||||
/*! @brief Method to commit layers of a frame submitted in a former call to Prepare().
|
||||
|
||||
@details Client shall call this method to submit layers for final composition. The composed
|
||||
output would be displayed on the panel or written in output buffer.
|
||||
|
||||
Client must ensure that layer stack is same as previous call to Prepare.
|
||||
|
||||
This method shall be called only once for each frame.
|
||||
|
||||
In the event of an error as well, this call will cause any fences returned in the previous call
|
||||
to Commit() to eventually become signaled, so the client's wait on fences can be released to
|
||||
prevent deadlocks.
|
||||
|
||||
@param[in] layer_stack \link LayerStack \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
|
||||
@sa Prepare
|
||||
*/
|
||||
virtual DisplayError Commit(LayerStack *layer_stack) = 0;
|
||||
|
||||
/*! @brief Method to flush any pending buffers/fences submitted previously via Commit() call.
|
||||
|
||||
@details Client shall call this method to request the Display manager to release all buffers and
|
||||
respective fences currently in use. This operation may result in a blank display on the panel
|
||||
until a new frame is submitted for composition.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
|
||||
@sa Prepare
|
||||
@sa Commit
|
||||
*/
|
||||
virtual DisplayError Flush() = 0;
|
||||
|
||||
/*! @brief Method to get current state of the display device.
|
||||
|
||||
@param[out] state \link DisplayState \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
|
||||
@sa SetDisplayState
|
||||
*/
|
||||
virtual DisplayError GetDisplayState(DisplayState *state) = 0;
|
||||
|
||||
/*! @brief Method to get number of configurations(variable properties) supported on the display
|
||||
device.
|
||||
|
||||
@param[out] count Number of modes supported; mode index starts with 0.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError GetNumVariableInfoConfigs(uint32_t *count) = 0;
|
||||
|
||||
/*! @brief Method to get configuration for fixed properties of the display device.
|
||||
|
||||
@param[out] fixed_info \link DisplayConfigFixedInfo \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError GetConfig(DisplayConfigFixedInfo *fixed_info) = 0;
|
||||
|
||||
/*! @brief Method to get configuration for variable properties of the display device.
|
||||
|
||||
@param[in] index index of the mode
|
||||
@param[out] variable_info \link DisplayConfigVariableInfo \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError GetConfig(uint32_t index, DisplayConfigVariableInfo *variable_info) = 0;
|
||||
|
||||
/*! @brief Method to get index of active configuration of the display device.
|
||||
|
||||
@param[out] index index of the mode corresponding to variable properties.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError GetActiveConfig(uint32_t *index) = 0;
|
||||
|
||||
/*! @brief Method to get VSync event state. Default event state is disabled.
|
||||
|
||||
@param[out] enabled vsync state
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError GetVSyncState(bool *enabled) = 0;
|
||||
|
||||
/*! @brief Method to set current state of the display device.
|
||||
|
||||
@param[in] state \link DisplayState \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
|
||||
@sa SetDisplayState
|
||||
*/
|
||||
virtual DisplayError SetDisplayState(DisplayState state) = 0;
|
||||
|
||||
/*! @brief Method to set active configuration for variable properties of the display device.
|
||||
|
||||
@param[in] variable_info \link DisplayConfigVariableInfo \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError SetActiveConfig(DisplayConfigVariableInfo *variable_info) = 0;
|
||||
|
||||
/*! @brief Method to set active configuration for variable properties of the display device.
|
||||
|
||||
@param[in] index index of the mode corresponding to variable properties.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError SetActiveConfig(uint32_t index) = 0;
|
||||
|
||||
/*! @brief Method to set VSync event state. Default event state is disabled.
|
||||
|
||||
@param[out] enabled vsync state
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError SetVSyncState(bool enable) = 0;
|
||||
|
||||
/*! @brief Method to set idle timeout value. Idle fallback is disabled with timeout value 0.
|
||||
|
||||
@param[in] timeout value in milliseconds.
|
||||
|
||||
@return \link void \endlink
|
||||
*/
|
||||
virtual void SetIdleTimeoutMs(uint32_t timeout_ms) = 0;
|
||||
|
||||
/*! @brief Method to set maximum number of mixer stages for each display.
|
||||
|
||||
@param[in] max_mixer_stages maximum number of mixer stages.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError SetMaxMixerStages(uint32_t max_mixer_stages) = 0;
|
||||
|
||||
/*! @brief Method to control partial update feature for each display.
|
||||
|
||||
@param[in] enable partial update feature control flag
|
||||
@param[out] pending whether the operation is completed or pending for completion
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError ControlPartialUpdate(bool enable, uint32_t *pending) = 0;
|
||||
|
||||
/*! @brief Method to disable partial update for at least 1 frame.
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError DisablePartialUpdateOneFrame() = 0;
|
||||
|
||||
/*! @brief Method to set the mode of the primary display.
|
||||
|
||||
@param[in] mode the new display mode.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError SetDisplayMode(uint32_t mode) = 0;
|
||||
|
||||
/*! @brief Method to get the min and max refresh rate of a display.
|
||||
|
||||
@param[out] min and max refresh rate.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError GetRefreshRateRange(uint32_t *min_refresh_rate,
|
||||
uint32_t *max_refresh_rate) = 0;
|
||||
|
||||
/*! @brief Method to set the refresh rate of a display.
|
||||
|
||||
@param[in] new refresh rate of the display.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError SetRefreshRate(uint32_t refresh_rate) = 0;
|
||||
|
||||
/*! @brief Method to query whether scanning is support for the HDMI display.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual bool IsUnderscanSupported() = 0;
|
||||
|
||||
/*! @brief Method to set brightness of the primary display.
|
||||
|
||||
@param[in] level the new backlight level.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError SetPanelBrightness(int level) = 0;
|
||||
|
||||
/*! @brief Method to notify display about change in min HDCP encryption level.
|
||||
|
||||
@param[in] min_enc_level minimum encryption level value.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level) = 0;
|
||||
|
||||
/*! @brief Method to route display API requests to color service.
|
||||
|
||||
@param[in] in_payload \link PPDisplayAPIPayload \endlink
|
||||
@param[out] out_payload \link PPDisplayPayload \endlink
|
||||
@param[out] pending_action \link PPPendingParams \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError ColorSVCRequestRoute(const PPDisplayAPIPayload &in_payload,
|
||||
PPDisplayAPIPayload *out_payload,
|
||||
PPPendingParams *pending_action) = 0;
|
||||
|
||||
/*! @brief Method to request the number of color modes supported.
|
||||
|
||||
@param[out] mode_count Number of modes
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError GetColorModeCount(uint32_t *mode_count) = 0;
|
||||
|
||||
/*! @brief Method to request the information of supported color modes.
|
||||
|
||||
@param[inout] mode_count Number of updated modes
|
||||
@param[out] vector of mode strings
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError GetColorModes(uint32_t *mode_count,
|
||||
std::vector<std::string> *color_modes) = 0;
|
||||
|
||||
/*! @brief Method to set the color mode
|
||||
|
||||
@param[in] mode_name Mode name which needs to be set
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError SetColorMode(const std::string &color_mode) = 0;
|
||||
|
||||
/*! @brief Method to set the color transform
|
||||
|
||||
@param[in] length Mode name which needs to be set
|
||||
@param[in] color_transform 4x4 Matrix for color transform
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError SetColorTransform(const uint32_t length, const double *color_transform) = 0;
|
||||
|
||||
/*! @brief Method to request applying default display mode.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError ApplyDefaultDisplayMode() = 0;
|
||||
|
||||
/*! @brief Method to set the position of the hw cursor.
|
||||
|
||||
@param[in] x \link x position \endlink
|
||||
@param[in] y \link y position \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError SetCursorPosition(int x, int y) = 0;
|
||||
|
||||
/*! @brief Method to get the brightness level of the display
|
||||
|
||||
@param[out] level brightness level
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError GetPanelBrightness(int *level) = 0;
|
||||
|
||||
/*! @brief Method to set layer mixer resolution.
|
||||
|
||||
@param[in] width layer mixer width
|
||||
@param[in] height layer mixer height
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError SetMixerResolution(uint32_t width, uint32_t height) = 0;
|
||||
|
||||
/*! @brief Method to get layer mixer resolution.
|
||||
|
||||
@param[out] width layer mixer width
|
||||
@param[out] height layer mixer height
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError GetMixerResolution(uint32_t *width, uint32_t *height) = 0;
|
||||
|
||||
/*! @brief Method to set frame buffer configuration.
|
||||
|
||||
@param[in] variable_info \link DisplayConfigVariableInfo \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError SetFrameBufferConfig(const DisplayConfigVariableInfo &variable_info) = 0;
|
||||
|
||||
/*! @brief Method to get frame buffer configuration.
|
||||
|
||||
@param[out] variable_info \link DisplayConfigVariableInfo \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError GetFrameBufferConfig(DisplayConfigVariableInfo *variable_info) = 0;
|
||||
|
||||
/*! @brief Method to set detail enhancement data.
|
||||
|
||||
@param[in] de_data \link DisplayDetailEnhancerData \endlink
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
*/
|
||||
virtual DisplayError SetDetailEnhancerData(const DisplayDetailEnhancerData &de_data) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~DisplayInterface() { }
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __DISPLAY_INTERFACE_H__
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright (c) 2014, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
* provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its contributors may be used to
|
||||
* endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! @file dump_interface.h
|
||||
@brief Interface file for dump options provided by display manager.
|
||||
|
||||
*/
|
||||
#ifndef __DUMP_INTERFACE_H__
|
||||
#define __DUMP_INTERFACE_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "sdm_types.h"
|
||||
|
||||
namespace sdm {
|
||||
|
||||
/*! @brief Display dump interface.
|
||||
|
||||
@details This class defines dump methods provided by display manager.
|
||||
|
||||
*/
|
||||
class DumpInterface {
|
||||
public:
|
||||
/*! @brief Method to get dump information in form of a string.
|
||||
|
||||
@details Client shall use this method to get current snapshot of display manager context as a
|
||||
formatted string for logging or dumping purposes.
|
||||
|
||||
@param[inout] buffer String buffer allocated by the client. Filled with null terminated dump
|
||||
information upon return.
|
||||
@param[in] length Length of the string buffer. Length shall be offset adjusted if any.
|
||||
|
||||
@return \link DisplayError \endlink
|
||||
|
||||
@warning Client shall ensure that this interface is not used while a display is being either
|
||||
created or destroyed through display core.
|
||||
*/
|
||||
static DisplayError GetDump(char *buffer, uint32_t length);
|
||||
|
||||
protected:
|
||||
virtual ~DumpInterface() { }
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __DUMP_INTERFACE_H__
|
||||
|
|
@ -0,0 +1,270 @@
|
|||
/*
|
||||
* Copyright (c) 2014, 2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
* provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its contributors may be used to
|
||||
* endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! @file layer_buffer.h
|
||||
@brief File for layer buffer structure.
|
||||
|
||||
*/
|
||||
#ifndef __LAYER_BUFFER_H__
|
||||
#define __LAYER_BUFFER_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "sdm_types.h"
|
||||
|
||||
namespace sdm {
|
||||
|
||||
/*! @brief This enum represents display layer color space conversion (CSC) matrix types.
|
||||
|
||||
@sa Layer
|
||||
*/
|
||||
enum LayerCSC {
|
||||
kCSCLimitedRange601, //!< 601 limited range color space.
|
||||
kCSCFullRange601, //!< 601 full range color space.
|
||||
kCSCLimitedRange709, //!< 709 limited range color space.
|
||||
};
|
||||
|
||||
/*! @brief This enum represents display layer inverse gamma correction (IGC) types.
|
||||
|
||||
@sa Layer
|
||||
*/
|
||||
enum LayerIGC {
|
||||
kIGCNotSpecified, //!< IGC is not specified.
|
||||
kIGCsRGB, //!< sRGB IGC type.
|
||||
};
|
||||
|
||||
/*! @brief This enum represents different buffer formats supported by display manager.
|
||||
|
||||
@sa LayerBuffer
|
||||
*/
|
||||
enum LayerBufferFormat {
|
||||
/* All RGB formats, Any new format will be added towards end of this group to maintain backward
|
||||
compatibility.
|
||||
*/
|
||||
kFormatARGB8888, //!< 8-bits Alpha, Red, Green, Blue interleaved in ARGB order.
|
||||
kFormatRGBA8888, //!< 8-bits Red, Green, Blue, Alpha interleaved in RGBA order.
|
||||
kFormatBGRA8888, //!< 8-bits Blue, Green, Red, Alpha interleaved in BGRA order.
|
||||
kFormatXRGB8888, //!< 8-bits Padding, Red, Green, Blue interleaved in XRGB order. No Alpha.
|
||||
kFormatRGBX8888, //!< 8-bits Red, Green, Blue, Padding interleaved in RGBX order. No Alpha.
|
||||
kFormatBGRX8888, //!< 8-bits Blue, Green, Red, Padding interleaved in BGRX order. No Alpha.
|
||||
kFormatRGBA5551, //!< 5-bits Red, Green, Blue, and 1 bit Alpha interleaved in RGBA order.
|
||||
kFormatRGBA4444, //!< 4-bits Red, Green, Blue, Alpha interleaved in RGBA order.
|
||||
kFormatRGB888, //!< 8-bits Red, Green, Blue interleaved in RGB order. No Alpha.
|
||||
kFormatBGR888, //!< 8-bits Blue, Green, Red interleaved in BGR order. No Alpha.
|
||||
kFormatRGB565, //!< 5-bit Red, 6-bit Green, 5-bit Blue interleaved in RGB order. No Alpha.
|
||||
kFormatBGR565, //!< 5-bit Blue, 6-bit Green, 5-bit Red interleaved in BGR order. No Alpha.
|
||||
kFormatRGBA8888Ubwc, //!< UBWC aligned RGBA8888 format
|
||||
kFormatRGBX8888Ubwc, //!< UBWC aligned RGBX8888 format
|
||||
kFormatBGR565Ubwc, //!< UBWC aligned BGR565 format
|
||||
kFormatRGBA1010102, //!< 10-bits Red, Green, Blue, Alpha interleaved in RGBA order.
|
||||
kFormatARGB2101010, //!< 10-bits Alpha, Red, Green, Blue interleaved in ARGB order.
|
||||
kFormatRGBX1010102, //!< 10-bits Red, Green, Blue, Padding interleaved in RGBX order. No Alpha.
|
||||
kFormatXRGB2101010, //!< 10-bits Padding, Red, Green, Blue interleaved in XRGB order. No Alpha.
|
||||
kFormatBGRA1010102, //!< 10-bits Blue, Green, Red, Alpha interleaved in BGRA order.
|
||||
kFormatABGR2101010, //!< 10-bits Alpha, Blue, Green, Red interleaved in ABGR order.
|
||||
kFormatBGRX1010102, //!< 10-bits Blue, Green, Red, Padding interleaved in BGRX order. No Alpha.
|
||||
kFormatXBGR2101010, //!< 10-bits Padding, Blue, Green, Red interleaved in XBGR order. No Alpha.
|
||||
kFormatRGBA1010102Ubwc, //!< UBWC aligned RGBA1010102 format
|
||||
kFormatRGBX1010102Ubwc, //!< UBWC aligned RGBX1010102 format
|
||||
kFormatRGB101010, // 10-bits Red, Green, Blue, interleaved in RGB order. No Alpha.
|
||||
|
||||
/* All YUV-Planar formats, Any new format will be added towards end of this group to maintain
|
||||
backward compatibility.
|
||||
*/
|
||||
kFormatYCbCr420Planar = 0x100, //!< Y-plane: y(0), y(1), y(2) ... y(n)
|
||||
//!< 2x2 subsampled U-plane: u(0), u(2) ... u(n-1)
|
||||
//!< 2x2 subsampled V-plane: v(0), v(2) ... v(n-1)
|
||||
|
||||
kFormatYCrCb420Planar, //!< Y-plane: y(0), y(1), y(2) ... y(n)
|
||||
//!< 2x2 subsampled V-plane: v(0), v(2) ... v(n-1)
|
||||
//!< 2x2 subsampled U-plane: u(0), u(2) ... u(n-1)
|
||||
|
||||
kFormatYCrCb420PlanarStride16, //!< kFormatYCrCb420Planar with stride aligned to 16 bytes
|
||||
|
||||
/* All YUV-Semiplanar formats, Any new format will be added towards end of this group to
|
||||
maintain backward compatibility.
|
||||
*/
|
||||
kFormatYCbCr420SemiPlanar = 0x200, //!< Y-plane: y(0), y(1), y(2) ... y(n)
|
||||
//!< 2x2 subsampled interleaved UV-plane:
|
||||
//!< u(0), v(0), u(2), v(2) ... u(n-1), v(n-1)
|
||||
//!< aka NV12.
|
||||
|
||||
kFormatYCrCb420SemiPlanar, //!< Y-plane: y(0), y(1), y(2) ... y(n)
|
||||
//!< 2x2 subsampled interleaved VU-plane:
|
||||
//!< v(0), u(0), v(2), u(2) ... v(n-1), u(n-1)
|
||||
//!< aka NV21.
|
||||
|
||||
kFormatYCbCr420SemiPlanarVenus, //!< Y-plane: y(0), y(1), y(2) ... y(n)
|
||||
//!< 2x2 subsampled interleaved UV-plane:
|
||||
//!< u(0), v(0), u(2), v(2) ... u(n-1), v(n-1)
|
||||
|
||||
kFormatYCbCr422H1V2SemiPlanar, //!< Y-plane: y(0), y(1), y(2) ... y(n)
|
||||
//!< vertically subsampled interleaved UV-plane:
|
||||
//!< u(0), v(1), u(2), v(3) ... u(n-1), v(n)
|
||||
|
||||
kFormatYCrCb422H1V2SemiPlanar, //!< Y-plane: y(0), y(1), y(2) ... y(n)
|
||||
//!< vertically subsampled interleaved VU-plane:
|
||||
//!< v(0), u(1), v(2), u(3) ... v(n-1), u(n)
|
||||
|
||||
kFormatYCbCr422H2V1SemiPlanar, //!< Y-plane: y(0), y(1), y(2) ... y(n)
|
||||
//!< horizontally subsampled interleaved UV-plane:
|
||||
//!< u(0), v(1), u(2), v(3) ... u(n-1), v(n)
|
||||
|
||||
kFormatYCrCb422H2V1SemiPlanar, //!< Y-plane: y(0), y(1), y(2) ... y(n)
|
||||
//!< horizontally subsampled interleaved VU-plane:
|
||||
//!< v(0), u(1), v(2), u(3) ... v(n-1), u(n)
|
||||
|
||||
kFormatYCbCr420SPVenusUbwc, //!< UBWC aligned YCbCr420SemiPlanarVenus format
|
||||
|
||||
kFormatYCrCb420SemiPlanarVenus, //!< Y-plane: y(0), y(1), y(2) ... y(n)
|
||||
//!< 2x2 subsampled interleaved UV-plane:
|
||||
//!< v(0), u(0), v(2), u(2) ... v(n-1), u(n-1)
|
||||
|
||||
kFormatYCbCr420P010, //!< 16 bit Y-plane with 5 MSB bits set to 0:
|
||||
//!< y(0), y(1), y(2) ... y(n)
|
||||
//!< 2x2 subsampled interleaved 10 bit UV-plane with
|
||||
//!< 5 MSB bits set to 0:
|
||||
//!< u(0), v(0), u(2), v(2) ... u(n-1), v(n-1)
|
||||
//!< aka P010.
|
||||
|
||||
kFormatYCbCr420TP10Ubwc, //!< UBWC aligned YCbCr420TP10 format.
|
||||
|
||||
/* All YUV-Packed formats, Any new format will be added towards end of this group to maintain
|
||||
backward compatibility.
|
||||
*/
|
||||
kFormatYCbCr422H2V1Packed = 0x300, //!< Y-plane interleaved with horizontally subsampled U/V by
|
||||
//!< factor of 2
|
||||
//!< y(0), u(0), y(1), v(0), y(2), u(2), y(3), v(2)
|
||||
//!< y(n-1), u(n-1), y(n), v(n-1)
|
||||
|
||||
kFormatInvalid = 0xFFFFFFFF,
|
||||
};
|
||||
|
||||
|
||||
/*! @brief This enum represents different types of 3D formats supported.
|
||||
|
||||
@sa LayerBufferS3DFormat
|
||||
*/
|
||||
enum LayerBufferS3DFormat {
|
||||
kS3dFormatNone, //!< Layer buffer content is not 3D content.
|
||||
kS3dFormatLeftRight, //!< Left and Right view of a 3D content stitched left and right.
|
||||
kS3dFormatRightLeft, //!< Right and Left view of a 3D content stitched left and right.
|
||||
kS3dFormatTopBottom, //!< Left and RightView of a 3D content stitched top and bottom.
|
||||
kS3dFormatFramePacking //!< Left and right view of 3D content coded in consecutive frames.
|
||||
};
|
||||
|
||||
/*! @brief This structure defines a color sample plane belonging to a buffer format. RGB buffer
|
||||
formats have 1 plane whereas YUV buffer formats may have upto 4 planes.
|
||||
|
||||
@sa LayerBuffer
|
||||
*/
|
||||
struct LayerBufferPlane {
|
||||
int fd = -1; //!< File descriptor referring to the buffer associated with this plane.
|
||||
uint32_t offset = 0; //!< Offset of the plane in bytes from beginning of the buffer.
|
||||
uint32_t stride = 0; //!< Stride in bytes i.e. length of a scanline including padding.
|
||||
};
|
||||
|
||||
/*! @brief This structure defines flags associated with a layer buffer. The 1-bit flag can be set
|
||||
to ON(1) or OFF(0).
|
||||
|
||||
@sa LayerBuffer
|
||||
*/
|
||||
struct LayerBufferFlags {
|
||||
union {
|
||||
struct {
|
||||
uint32_t secure : 1; //!< This flag shall be set by client to indicate that the
|
||||
//!< buffer need to be handled securely.
|
||||
|
||||
uint32_t video : 1; //!< This flag shall be set by client to indicate that the
|
||||
//!< buffer is video/ui buffer.
|
||||
|
||||
uint32_t macro_tile : 1; //!< This flag shall be set by client to indicate that the
|
||||
//!< buffer format is macro tiled.
|
||||
|
||||
uint32_t interlace : 1; //!< This flag shall be set by the client to indicate that
|
||||
//!< the buffer has interlaced content.
|
||||
|
||||
uint32_t secure_display : 1; //!< This flag shall be set by the client to indicate that the
|
||||
//!< secure display session is in progress. Secure display
|
||||
//!< session can not coexist with non-secure session.
|
||||
};
|
||||
|
||||
uint32_t flags = 0; //!< For initialization purpose only.
|
||||
//!< Client shall not refer to it directly.
|
||||
};
|
||||
};
|
||||
|
||||
/*! @brief This structure defines a layer buffer handle which contains raw buffer and its associated
|
||||
properties.
|
||||
|
||||
@sa LayerBuffer
|
||||
@sa LayerStack
|
||||
*/
|
||||
struct LayerBuffer {
|
||||
uint32_t width = 0; //!< Actual width of the Layer that this buffer is for.
|
||||
uint32_t height = 0; //!< Actual height of the Layer that this buffer is for.
|
||||
uint32_t size = 0; //!< Size of a single buffer (even if multiple clubbed together)
|
||||
LayerBufferFormat format = kFormatRGBA8888; //!< Format of the buffer content.
|
||||
LayerCSC csc = kCSCFullRange601; //!< Color Space of the layer.
|
||||
LayerIGC igc = kIGCNotSpecified; //!< IGC that will be applied on this layer.
|
||||
LayerBufferPlane planes[4] = {};
|
||||
//!< Array of planes that this buffer contains. RGB buffer formats
|
||||
//!< have 1 plane whereas YUV buffer formats may have upto 4 planes
|
||||
//!< Total number of planes for the buffer will be interpreted based
|
||||
//!< on the buffer format specified.
|
||||
|
||||
int acquire_fence_fd = -1; //!< File descriptor referring to a sync fence object which will be
|
||||
//!< signaled when buffer can be read/write by display manager.
|
||||
//!< This fence object is set by the client during Commit(). For
|
||||
//!< input buffers client shall signal this fence when buffer
|
||||
//!< content is available and can be read by display manager. For
|
||||
//!< output buffers, client shall signal fence when buffer is ready
|
||||
//!< to be written by display manager.
|
||||
|
||||
//!< This field is used only during Commit() and shall be set to -1
|
||||
//!< by the client when buffer is already available for read/write.
|
||||
|
||||
int release_fence_fd = -1; //!< File descriptor referring to a sync fence object which will be
|
||||
//!< signaled when buffer has been read/written by display manager.
|
||||
//!< This fence object is set by display manager during Commit().
|
||||
//!< For input buffers display manager will signal this fence when
|
||||
//!< buffer has been consumed. For output buffers, display manager
|
||||
//!< will signal this fence when buffer is produced.
|
||||
|
||||
//!< This field is used only during Commit() and will be set to -1
|
||||
//!< by display manager when buffer is already available for
|
||||
//!< read/write.
|
||||
|
||||
LayerBufferFlags flags; //!< Flags associated with this buffer.
|
||||
|
||||
LayerBufferS3DFormat s3d_format = kS3dFormatNone;
|
||||
//!< Represents the format of the buffer content in 3D.
|
||||
uint64_t buffer_id __attribute__((aligned(8))) = 0;
|
||||
//!< Specifies the buffer id.
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __LAYER_BUFFER_H__
|
||||
|
|
@ -0,0 +1,324 @@
|
|||
/*
|
||||
* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
* provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its contributors may be used to
|
||||
* endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! @file layer_stack.h
|
||||
@brief File for display layer stack structure which represents a drawing buffer.
|
||||
|
||||
@details Display layer is a drawing buffer object which will be blended with other drawing buffers
|
||||
under blending rules.
|
||||
*/
|
||||
#ifndef __LAYER_STACK_H__
|
||||
#define __LAYER_STACK_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <utils/constants.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "layer_buffer.h"
|
||||
#include "sdm_types.h"
|
||||
|
||||
namespace sdm {
|
||||
|
||||
/*! @brief This enum represents display layer blending types.
|
||||
|
||||
@sa Layer
|
||||
*/
|
||||
enum LayerBlending {
|
||||
kBlendingPremultiplied, //!< Pixel color is expressed using premultiplied alpha in RGBA tuples.
|
||||
//!< If plane alpha is less than 0xFF, apply modulation as well.
|
||||
//!< pixel.rgb = src.rgb + dest.rgb x (1 - src.a)
|
||||
|
||||
kBlendingOpaque, //!< Pixel color is expressed using straight alpha in color tuples. It
|
||||
//!< is constant blend operation. The layer would appear opaque if plane
|
||||
//!< alpha is 0xFF.
|
||||
|
||||
kBlendingCoverage, //!< Pixel color is expressed using straight alpha in color tuples. If
|
||||
//!< plane alpha is less than 0xff, apply modulation as well.
|
||||
//!< pixel.rgb = src.rgb x src.a + dest.rgb x (1 - src.a)
|
||||
};
|
||||
|
||||
/*! @brief This enum represents display layer composition types.
|
||||
|
||||
@sa Layer
|
||||
*/
|
||||
enum LayerComposition {
|
||||
kCompositionGPU, //!< This layer will be drawn onto the target buffer by GPU. Display
|
||||
//!< device will mark the layer for GPU composition if it can not handle
|
||||
//!< it completely.
|
||||
|
||||
kCompositionSDE, //!< This layer will be handled by SDE. It must not be composed by GPU.
|
||||
|
||||
kCompositionHWCursor, //!< This layer will be handled by SDE using HWCursor. It must not be
|
||||
//!< composed by GPU
|
||||
|
||||
kCompositionHybrid, //!< This layer will be drawn by a blit engine and SDE together. Display
|
||||
//!< device will split the layer, update the blit rectangle that
|
||||
//!< need to be composed by a blit engine and update original source
|
||||
//!< rectangle that will be composed by SDE.
|
||||
|
||||
kCompositionBlit, //!< This layer will be composed using Blit Engine
|
||||
|
||||
kCompositionGPUTarget, //!< This layer will hold result of composition for layers marked for
|
||||
//!< GPU composition.
|
||||
//!< If display device does not set any layer for SDE composition then
|
||||
//!< this would be ignored during Commit().
|
||||
//!< Only one layer shall be marked as target buffer by the caller.
|
||||
//!< GPU target layer shall be after application layers in layer stack.
|
||||
|
||||
kCompositionBlitTarget, //!< This layer will hold result of composition for blit rectangles
|
||||
//!< from the layers marked for hybrid composition. Nth blit rectangle
|
||||
//!< in a layer shall be composed onto Nth blit target.
|
||||
//!< If display device does not set any layer for hybrid composition
|
||||
//!< then this would be ignored during Commit().
|
||||
//!< Blit target layers shall be after GPU target layer in layer stack.
|
||||
};
|
||||
|
||||
/*! @brief This structure defines rotation and flip values for a display layer.
|
||||
|
||||
@sa Layer
|
||||
*/
|
||||
struct LayerTransform {
|
||||
float rotation = 0.0f; //!< Left most pixel coordinate.
|
||||
bool flip_horizontal = false; //!< Mirror reversal of the layer across a horizontal axis.
|
||||
bool flip_vertical = false; //!< Mirror reversal of the layer across a vertical axis.
|
||||
|
||||
bool operator==(const LayerTransform& transform) const {
|
||||
return (rotation == transform.rotation && flip_horizontal == transform.flip_horizontal &&
|
||||
flip_vertical == transform.flip_vertical);
|
||||
}
|
||||
|
||||
bool operator!=(const LayerTransform& transform) const {
|
||||
return !operator==(transform);
|
||||
}
|
||||
};
|
||||
|
||||
/*! @brief This structure defines flags associated with a layer. The 1-bit flag can be set to ON(1)
|
||||
or OFF(0).
|
||||
|
||||
@sa LayerBuffer
|
||||
*/
|
||||
struct LayerFlags {
|
||||
union {
|
||||
struct {
|
||||
uint32_t skip : 1; //!< This flag shall be set by client to indicate that this layer
|
||||
//!< will be handled by GPU. Display Device will not consider it
|
||||
//!< for composition.
|
||||
|
||||
uint32_t updating : 1; //!< This flag shall be set by client to indicate that this is
|
||||
//!< updating non-updating. so strategy manager will mark them for
|
||||
//!< SDE/GPU composition respectively when the layer stack qualifies
|
||||
//!< for cache based composition.
|
||||
|
||||
uint32_t solid_fill : 1;
|
||||
//!< This flag shall be set by client to indicate that this layer
|
||||
//!< is for solid fill without input buffer. Display Device will
|
||||
//!< use SDE HW feature to achieve it.
|
||||
|
||||
uint32_t cursor : 1; //!< This flag shall be set by client to indicate that this layer
|
||||
//!< is a cursor
|
||||
//!< Display Device may handle this layer using HWCursor
|
||||
|
||||
uint32_t single_buffer : 1; //!< This flag shall be set by client to indicate that the layer
|
||||
//!< uses only a single buffer that will not be swapped out
|
||||
};
|
||||
|
||||
uint32_t flags = 0; //!< For initialization purpose only.
|
||||
//!< Client shall not refer it directly.
|
||||
};
|
||||
};
|
||||
|
||||
/*! @brief This structure defines flags associated with a layer stack. The 1-bit flag can be set to
|
||||
ON(1) or OFF(0).
|
||||
|
||||
@sa LayerBuffer
|
||||
*/
|
||||
struct LayerStackFlags {
|
||||
union {
|
||||
struct {
|
||||
uint32_t geometry_changed : 1; //!< This flag shall be set by client to indicate that the
|
||||
//!< layer set passed to Prepare() has changed by more than
|
||||
//!< just the buffer handles and acquire fences.
|
||||
|
||||
uint32_t skip_present : 1; //!< This flag will be set to true, if the current layer
|
||||
//!< stack contains skip layers.
|
||||
|
||||
uint32_t video_present : 1; //!< This flag will be set to true, if current layer stack
|
||||
//!< contains video.
|
||||
|
||||
uint32_t secure_present : 1; //!< This flag will be set to true, if the current layer
|
||||
//!< stack contains secure layers.
|
||||
|
||||
uint32_t animating : 1; //!< This flag shall be set by client to indicate that the
|
||||
//!< current frame is animating.i
|
||||
|
||||
uint32_t attributes_changed : 1;
|
||||
//!< This flag shall be set by client to indicate that the
|
||||
//!< current frame has some properties changed and
|
||||
//!< needs re-config.
|
||||
|
||||
uint32_t cursor_present : 1; //!< This flag will be set to true if the current layer
|
||||
//!< stack contains cursor layer.
|
||||
|
||||
uint32_t single_buffered_layer_present : 1; //!< Set if stack has single buffered layer
|
||||
|
||||
uint32_t s3d_mode_present : 1; //!< This flag will be set to true, if the current layer
|
||||
//!< stack contains s3d layer, and the layer stack can enter
|
||||
//!< s3d mode.
|
||||
|
||||
uint32_t post_processed_output : 1; // If output_buffer should contain post processed output
|
||||
// This applies only to primary displays currently
|
||||
};
|
||||
|
||||
uint32_t flags = 0; //!< For initialization purpose only.
|
||||
//!< Client shall not refer it directly.
|
||||
};
|
||||
};
|
||||
|
||||
/*! @brief This structure defines a rectanglular area inside a display layer.
|
||||
|
||||
@sa LayerRectArray
|
||||
*/
|
||||
struct LayerRect {
|
||||
float left = 0.0f; //!< Left-most pixel coordinate.
|
||||
float top = 0.0f; //!< Top-most pixel coordinate.
|
||||
float right = 0.0f; //!< Right-most pixel coordinate.
|
||||
float bottom = 0.0f; //!< Bottom-most pixel coordinate.
|
||||
|
||||
LayerRect() = default;
|
||||
|
||||
LayerRect(float l, float t, float r, float b) : left(l), top(t), right(r), bottom(b) { }
|
||||
|
||||
bool operator==(const LayerRect& rect) const {
|
||||
return left == rect.left && right == rect.right && top == rect.top && bottom == rect.bottom;
|
||||
}
|
||||
|
||||
bool operator!=(const LayerRect& rect) const {
|
||||
return !operator==(rect);
|
||||
}
|
||||
};
|
||||
|
||||
/*! @brief This structure defines an array of display layer rectangles.
|
||||
|
||||
@sa LayerRect
|
||||
*/
|
||||
struct LayerRectArray {
|
||||
LayerRect *rect = NULL; //!< Pointer to first element of array.
|
||||
uint32_t count = 0; //!< Number of elements in the array.
|
||||
};
|
||||
|
||||
/*! @brief This structure defines display layer object which contains layer properties and a drawing
|
||||
buffer.
|
||||
|
||||
@sa LayerArray
|
||||
*/
|
||||
struct Layer {
|
||||
LayerBuffer *input_buffer = NULL; //!< Pointer to the buffer to be composed.
|
||||
//!< If this remains unchanged between two
|
||||
//!< consecutive Prepare() calls and
|
||||
//!< geometry_changed flag is not set for the
|
||||
//!< second call, then the display device will
|
||||
//!< assume that buffer content has not
|
||||
//!< changed.
|
||||
|
||||
LayerComposition composition = kCompositionGPU; //!< Composition type which can be set by either
|
||||
//!< the client or the display device. This value
|
||||
//!< should be preserved between Prepare() and
|
||||
//!< Commit() calls.
|
||||
|
||||
LayerRect src_rect = {}; //!< Rectangular area of the layer buffer to
|
||||
//!< consider for composition.
|
||||
|
||||
LayerRect dst_rect = {}; //!< The target position where the frame will be
|
||||
//!< displayed. Cropping rectangle is scaled to
|
||||
//!< fit into this rectangle. The origin is the
|
||||
//!< top-left corner of the screen.
|
||||
|
||||
std::vector<LayerRect> visible_regions = {}; //!< Visible rectangular areas in screen space.
|
||||
//!< The visible region includes areas overlapped
|
||||
//!< by a translucent layer.
|
||||
|
||||
std::vector<LayerRect> dirty_regions = {}; //!< Rectangular areas in the current frames
|
||||
//!< that have changed in comparison to
|
||||
//!< previous frame.
|
||||
|
||||
std::vector<LayerRect> blit_regions = {}; //!< Rectangular areas of this layer which need
|
||||
//!< to be composed to blit target. Display
|
||||
//!< device will update blit rectangles if a
|
||||
//!< layer composition is set as hybrid. Nth blit
|
||||
//!< rectangle shall be composed onto Nth blit
|
||||
//!< target.
|
||||
|
||||
LayerBlending blending = kBlendingPremultiplied; //!< Blending operation which need to be
|
||||
//!< applied on the layer buffer during
|
||||
//!< composition.
|
||||
|
||||
LayerTransform transform = {}; //!< Rotation/Flip operations which need to be
|
||||
//!< applied to the layer buffer during
|
||||
//!< composition.
|
||||
|
||||
uint8_t plane_alpha = 0xff; //!< Alpha value applied to the whole layer.
|
||||
//!< Value of each pixel is computed as:
|
||||
//!< if(kBlendingPremultiplied) {
|
||||
//!< pixel.RGB = pixel.RGB * planeAlpha/255
|
||||
//!< }
|
||||
//!< pixel.a = pixel.a * planeAlpha
|
||||
|
||||
uint32_t frame_rate = 0; //!< Rate at which frames are being updated for
|
||||
//!< this layer.
|
||||
|
||||
uint32_t solid_fill_color = 0; //!< Solid color used to fill the layer when
|
||||
//!< no content is associated with the layer.
|
||||
|
||||
LayerFlags flags; //!< Flags associated with this layer.
|
||||
};
|
||||
|
||||
/*! @brief This structure defines a layer stack that contains layers which need to be composed and
|
||||
rendered onto the target.
|
||||
|
||||
@sa DisplayInterface::Prepare
|
||||
@sa DisplayInterface::Commit
|
||||
*/
|
||||
struct LayerStack {
|
||||
std::vector<Layer *> layers = {}; //!< Vector of layer pointers.
|
||||
|
||||
int retire_fence_fd = -1; //!< File descriptor referring to a sync fence object which
|
||||
//!< will be signaled when this composited frame has been
|
||||
//!< replaced on screen by a subsequent frame on a physical
|
||||
//!< display. The fence object is created and returned during
|
||||
//!< Commit(). Client shall close the returned file
|
||||
//!< descriptor.
|
||||
//!< NOTE: This field applies to a physical display only.
|
||||
|
||||
LayerBuffer *output_buffer = NULL; //!< Pointer to the buffer where composed buffer would be
|
||||
//!< rendered for virtual displays.
|
||||
//!< NOTE: This field applies to a virtual display only.
|
||||
|
||||
LayerStackFlags flags; //!< Flags associated with this layer set.
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __LAYER_STACK_H__
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*! @file sdm_types.h
|
||||
@brief This file contains miscellaneous data types used across display interfaces.
|
||||
*/
|
||||
#ifndef __SDM_TYPES_H__
|
||||
#define __SDM_TYPES_H__
|
||||
|
||||
namespace sdm {
|
||||
|
||||
/*! @brief This enum represents different error codes that display interfaces may return.
|
||||
*/
|
||||
enum DisplayError {
|
||||
kErrorNone, //!< Call executed successfully.
|
||||
kErrorUndefined, //!< An unspecified error has occured.
|
||||
kErrorNotSupported, //!< Requested operation is not supported.
|
||||
kErrorPermission, //!< Operation is not permitted in current state.
|
||||
kErrorVersion, //!< Client is using advanced version of interfaces and calling into an
|
||||
//!< older version of display library.
|
||||
kErrorDataAlignment, //!< Client data structures are not aligned on naturual boundaries.
|
||||
kErrorInstructionSet, //!< 32-bit client is calling into 64-bit library or vice versa.
|
||||
kErrorParameters, //!< Invalid parameters passed to a method.
|
||||
kErrorFileDescriptor, //!< Invalid file descriptor.
|
||||
kErrorMemory, //!< System is running low on memory.
|
||||
kErrorResources, //!< Not enough hardware resources available to execute call.
|
||||
kErrorHardware, //!< A hardware error has occured.
|
||||
kErrorTimeOut, //!< The operation has timed out to prevent client from waiting forever.
|
||||
kErrorShutDown, //!< Driver is processing shutdown sequence
|
||||
kErrorNotValidated, //!< Draw cycle has not been validated.
|
||||
};
|
||||
|
||||
/*! @brief This structure is defined for client and library compatibility check purpose only. This
|
||||
structure is used in SDM_VERSION_TAG definition only. Client should not refer it directly for
|
||||
any purpose.
|
||||
*/
|
||||
struct SDMCompatibility {
|
||||
char c1;
|
||||
int i1;
|
||||
char c2;
|
||||
int i2;
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __SDM_TYPES_H__
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
/* Copyright (c) 2015-2016, The Linux Foundataion. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __COLOR_INTERFACE_H__
|
||||
#define __COLOR_INTERFACE_H__
|
||||
|
||||
#include "core/sdm_types.h"
|
||||
#include "color_params.h"
|
||||
|
||||
namespace sdm {
|
||||
|
||||
#define COLORMGR_LIBRARY_NAME "libsdm-color.so"
|
||||
#define CREATE_COLOR_INTERFACE_NAME "CreateColorInterface"
|
||||
#define DESTROY_COLOR_INTERFACE_NAME "DestroyColorInterface"
|
||||
#define COLOR_REVISION_MAJOR (1)
|
||||
#define COLOR_REVISION_MINOR (0)
|
||||
|
||||
#define COLOR_VERSION_TAG ((uint16_t)((COLOR_REVISION_MAJOR << 8) | COLOR_REVISION_MINOR))
|
||||
|
||||
class ColorInterface;
|
||||
|
||||
typedef DisplayError (*CreateColorInterface)(uint16_t version, DisplayType type,
|
||||
const PPHWAttributes &attributes,
|
||||
ColorInterface **interface);
|
||||
|
||||
typedef DisplayError (*DestroyColorInterface)(DisplayType type);
|
||||
|
||||
class ColorInterface {
|
||||
public:
|
||||
virtual DisplayError ColorSVCRequestRoute(const PPDisplayAPIPayload &in_payload,
|
||||
PPDisplayAPIPayload *out_payload,
|
||||
PPFeaturesConfig *out_features,
|
||||
PPPendingParams *pending_action) = 0;
|
||||
|
||||
virtual DisplayError ApplyDefaultDisplayMode(PPFeaturesConfig *out_features) = 0;
|
||||
|
||||
virtual DisplayError ColorIntfSetColorTransform(PPFeaturesConfig *out_features,
|
||||
uint32_t disp_id, uint32_t length,
|
||||
const double *trans_data) = 0;
|
||||
|
||||
virtual DisplayError ColorIntfSetDisplayMode(PPFeaturesConfig *out_features,
|
||||
uint32_t disp_id, int32_t mode_id) = 0;
|
||||
|
||||
virtual DisplayError ColorIntfGetNumDisplayModes(PPFeaturesConfig *out_features,
|
||||
uint32_t disp_id, uint32_t *mode_cnt) = 0;
|
||||
|
||||
virtual DisplayError ColorIntfEnumerateDisplayModes(PPFeaturesConfig *out_features,
|
||||
uint32_t disp_id, SDEDisplayMode *modes,
|
||||
uint32_t *mode_cnt) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~ColorInterface() {}
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __COLOR_INTERFACE_H__
|
|
@ -0,0 +1,493 @@
|
|||
/* Copyright (c) 2015-2016, The Linux Foundataion. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __COLOR_PARAMS_H__
|
||||
#define __COLOR_PARAMS_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <utils/locker.h>
|
||||
#include <utils/constants.h>
|
||||
#include <core/sdm_types.h>
|
||||
#include <core/display_interface.h>
|
||||
#include "hw_info_types.h"
|
||||
|
||||
namespace sdm {
|
||||
|
||||
// Bitmap Pending action to indicate to the caller what's pending to be taken care of.
|
||||
enum PendingAction {
|
||||
kInvalidating = BITMAP(0),
|
||||
kApplySolidFill = BITMAP(1),
|
||||
kDisableSolidFill = BITMAP(2),
|
||||
kEnterQDCMMode = BITMAP(3),
|
||||
kExitQDCMMode = BITMAP(4),
|
||||
kSetPanelBrightness = BITMAP(5),
|
||||
kEnableFrameCapture = BITMAP(6),
|
||||
kDisableFrameCapture = BITMAP(7),
|
||||
kNoAction = BITMAP(31),
|
||||
};
|
||||
|
||||
// ENUM to identify different Postprocessing feature block to program.
|
||||
// Note: For each new entry added here, also need update hw_interface::GetPPFeaturesVersion<>
|
||||
// AND HWPrimary::SetPPFeatures<>.
|
||||
enum PPGlobalColorFeatureID {
|
||||
kGlobalColorFeaturePcc,
|
||||
kGlobalColorFeatureIgc,
|
||||
kGlobalColorFeaturePgc,
|
||||
kMixerColorFeatureGc,
|
||||
kGlobalColorFeaturePaV2,
|
||||
kGlobalColorFeatureDither,
|
||||
kGlobalColorFeatureGamut,
|
||||
kGlobalColorFeaturePADither,
|
||||
kMaxNumPPFeatures,
|
||||
};
|
||||
|
||||
struct PPPendingParams {
|
||||
PendingAction action = kNoAction;
|
||||
void *params = NULL;
|
||||
};
|
||||
|
||||
struct PPColorInfo {
|
||||
uint32_t r_bitdepth = 0;
|
||||
uint32_t r = 0;
|
||||
uint32_t g_bitdepth = 0;
|
||||
uint32_t g = 0;
|
||||
uint32_t b_bitdepth = 0;
|
||||
uint32_t b = 0;
|
||||
};
|
||||
|
||||
struct PPColorFillParams {
|
||||
uint32_t flags = 0;
|
||||
struct {
|
||||
uint32_t width = 0;
|
||||
uint32_t height = 0;
|
||||
int32_t x = 0;
|
||||
int32_t y = 0;
|
||||
} rect;
|
||||
|
||||
PPColorInfo color;
|
||||
};
|
||||
|
||||
struct PPFeatureVersion {
|
||||
// SDE ASIC versioning its PP block at each specific feature level.
|
||||
static const uint32_t kSDEIgcV17 = 1;
|
||||
static const uint32_t kSDEPgcV17 = 5;
|
||||
static const uint32_t kSDEDitherV17 = 7;
|
||||
static const uint32_t kSDEGamutV17 = 9;
|
||||
static const uint32_t kSDEPaV17 = 11;
|
||||
static const uint32_t kSDEPccV17 = 13;
|
||||
static const uint32_t kSDEPADitherV17 = 15;
|
||||
static const uint32_t kSDELegacyPP = 17;
|
||||
|
||||
uint32_t version[kMaxNumPPFeatures];
|
||||
PPFeatureVersion() { memset(version, 0, sizeof(version)); }
|
||||
};
|
||||
|
||||
struct PPHWAttributes : HWResourceInfo, HWPanelInfo, DisplayConfigVariableInfo {
|
||||
char panel_name[256] = "generic_panel";
|
||||
PPFeatureVersion version;
|
||||
int panel_max_brightness = 0;
|
||||
|
||||
void Set(const HWResourceInfo &hw_res, const HWPanelInfo &panel_info,
|
||||
const DisplayConfigVariableInfo &attr, const PPFeatureVersion &feature_ver);
|
||||
};
|
||||
|
||||
struct PPDisplayAPIPayload {
|
||||
bool own_payload = false; // to indicate if *payload is owned by this or just a reference.
|
||||
uint32_t size = 0;
|
||||
uint8_t *payload = NULL;
|
||||
|
||||
PPDisplayAPIPayload() = default;
|
||||
PPDisplayAPIPayload(uint32_t size, uint8_t *param)
|
||||
: size(size), payload(param) {}
|
||||
|
||||
template <typename T>
|
||||
DisplayError CreatePayload(T *&output) {
|
||||
DisplayError ret = kErrorNone;
|
||||
|
||||
payload = new uint8_t[sizeof(T)]();
|
||||
if (!payload) {
|
||||
ret = kErrorMemory;
|
||||
output = NULL;
|
||||
} else {
|
||||
this->size = sizeof(T);
|
||||
output = reinterpret_cast<T *>(payload);
|
||||
own_payload = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
DisplayError CreatePayloadBytes(uint8_t *output, uint32_t size_in_bytes) {
|
||||
DisplayError ret = kErrorNone;
|
||||
|
||||
payload = new uint8_t[size_in_bytes]();
|
||||
if (!payload) {
|
||||
ret = kErrorMemory;
|
||||
output = NULL;
|
||||
} else {
|
||||
this->size = size_in_bytes;
|
||||
output = payload;
|
||||
own_payload = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline void DestroyPayload() {
|
||||
if (payload && own_payload) {
|
||||
delete[] payload;
|
||||
payload = NULL;
|
||||
size = 0;
|
||||
} else {
|
||||
payload = NULL;
|
||||
size = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct PPRectInfo {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
PP_PIXEL_FORMAT_NONE = 0,
|
||||
PP_PIXEL_FORMAT_RGB_888,
|
||||
PP_PIXEL_FORMAT_RGB_2101010,
|
||||
PP_PIXEL_FORMAT_MAX,
|
||||
PP_PIXEL_FORMAT_FORCE32BIT = 0x7FFFFFFF,
|
||||
} PPPixelFormats;
|
||||
|
||||
struct PPFrameCaptureInputParams {
|
||||
PPRectInfo rect;
|
||||
PPPixelFormats out_pix_format;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
struct PPFrameCaptureData {
|
||||
PPFrameCaptureInputParams input_params;
|
||||
uint8_t *buffer;
|
||||
uint32_t buffer_stride;
|
||||
uint32_t buffer_size;
|
||||
};
|
||||
|
||||
struct SDEGamutCfg {
|
||||
static const int kGamutTableNum = 4;
|
||||
static const int kGamutScaleoffTableNum = 3;
|
||||
static const int kGamutTableSize = 1229;
|
||||
static const int kGamutTableCoarseSize = 32;
|
||||
static const int kGamutScaleoffSize = 16;
|
||||
uint32_t mode;
|
||||
uint32_t map_en;
|
||||
uint32_t tbl_size[kGamutTableNum];
|
||||
uint32_t *c0_data[kGamutTableNum];
|
||||
uint32_t *c1_c2_data[kGamutTableNum];
|
||||
uint32_t tbl_scale_off_sz[kGamutScaleoffTableNum];
|
||||
uint32_t *scale_off_data[kGamutScaleoffTableNum];
|
||||
};
|
||||
|
||||
struct SDEPccCoeff {
|
||||
uint32_t c = 0;
|
||||
uint32_t r = 0;
|
||||
uint32_t g = 0;
|
||||
uint32_t b = 0;
|
||||
uint32_t rg = 0;
|
||||
uint32_t gb = 0;
|
||||
uint32_t rb = 0;
|
||||
uint32_t rgb = 0;
|
||||
};
|
||||
|
||||
struct SDEPccCfg {
|
||||
SDEPccCoeff red;
|
||||
SDEPccCoeff green;
|
||||
SDEPccCoeff blue;
|
||||
|
||||
static SDEPccCfg *Init(uint32_t arg __attribute__((__unused__)));
|
||||
SDEPccCfg *GetConfig() { return this; }
|
||||
};
|
||||
|
||||
struct SDEDitherCfg {
|
||||
uint32_t g_y_depth;
|
||||
uint32_t r_cr_depth;
|
||||
uint32_t b_cb_depth;
|
||||
uint32_t length;
|
||||
uint32_t dither_matrix[16];
|
||||
uint32_t temporal_en;
|
||||
|
||||
static SDEDitherCfg *Init(uint32_t arg __attribute__((__unused__)));
|
||||
SDEDitherCfg *GetConfig() { return this; }
|
||||
};
|
||||
|
||||
struct SDEPADitherData {
|
||||
uint32_t data_flags;
|
||||
uint32_t matrix_size;
|
||||
uint64_t matrix_data_addr;
|
||||
uint32_t strength;
|
||||
uint32_t offset_en;
|
||||
};
|
||||
|
||||
class SDEPADitherWrapper : private SDEPADitherData {
|
||||
public:
|
||||
static SDEPADitherWrapper *Init(uint32_t arg __attribute__((__unused__)));
|
||||
~SDEPADitherWrapper() {
|
||||
if (buffer_)
|
||||
delete[] buffer_;
|
||||
}
|
||||
inline SDEPADitherData *GetConfig(void) { return this; }
|
||||
|
||||
private:
|
||||
SDEPADitherWrapper() {}
|
||||
uint32_t *buffer_ = NULL;
|
||||
};
|
||||
|
||||
struct SDEPaMemColorData {
|
||||
uint32_t adjust_p0 = 0;
|
||||
uint32_t adjust_p1 = 0;
|
||||
uint32_t adjust_p2 = 0;
|
||||
uint32_t blend_gain = 0;
|
||||
uint8_t sat_hold = 0;
|
||||
uint8_t val_hold = 0;
|
||||
uint32_t hue_region = 0;
|
||||
uint32_t sat_region = 0;
|
||||
uint32_t val_region = 0;
|
||||
};
|
||||
|
||||
struct SDEPaData {
|
||||
static const int kSixZoneLUTSize = 384;
|
||||
uint32_t mode = 0;
|
||||
uint32_t hue_adj = 0;
|
||||
uint32_t sat_adj = 0;
|
||||
uint32_t val_adj = 0;
|
||||
uint32_t cont_adj;
|
||||
SDEPaMemColorData skin;
|
||||
SDEPaMemColorData sky;
|
||||
SDEPaMemColorData foliage;
|
||||
uint32_t six_zone_thresh = 0;
|
||||
uint32_t six_zone_adj_p0 = 0;
|
||||
uint32_t six_zone_adj_p1 = 0;
|
||||
uint8_t six_zone_sat_hold = 0;
|
||||
uint8_t six_zone_val_hold = 0;
|
||||
uint32_t six_zone_len = 0;
|
||||
uint32_t *six_zone_curve_p0 = NULL;
|
||||
uint32_t *six_zone_curve_p1 = NULL;
|
||||
};
|
||||
|
||||
struct SDEIgcLUTData {
|
||||
static const int kMaxIgcLUTEntries = 256;
|
||||
uint32_t table_fmt = 0;
|
||||
uint32_t len = 0;
|
||||
uint32_t *c0_c1_data = NULL;
|
||||
uint32_t *c2_data = NULL;
|
||||
};
|
||||
|
||||
struct SDEPgcLUTData {
|
||||
static const int kPgcLUTEntries = 1024;
|
||||
uint32_t len = 0;
|
||||
uint32_t *c0_data = NULL;
|
||||
uint32_t *c1_data = NULL;
|
||||
uint32_t *c2_data = NULL;
|
||||
};
|
||||
|
||||
struct SDEDisplayMode {
|
||||
static const int kMaxModeNameSize = 256;
|
||||
int32_t id = -1;
|
||||
uint32_t type = 0;
|
||||
char name[kMaxModeNameSize] = {0};
|
||||
};
|
||||
|
||||
// Wrapper on HW block config data structure to encapsulate the details of allocating
|
||||
// and destroying from the caller.
|
||||
class SDEGamutCfgWrapper : private SDEGamutCfg {
|
||||
public:
|
||||
enum GamutMode {
|
||||
GAMUT_FINE_MODE = 0x01,
|
||||
GAMUT_COARSE_MODE,
|
||||
};
|
||||
|
||||
// This factory method will be used by libsdm-color.so data producer to be populated with
|
||||
// converted config values for SDE feature blocks.
|
||||
static SDEGamutCfgWrapper *Init(uint32_t arg);
|
||||
|
||||
// Data consumer<Commit thread> will be responsible to destroy it once the feature is commited.
|
||||
~SDEGamutCfgWrapper() {
|
||||
if (buffer_)
|
||||
delete[] buffer_;
|
||||
}
|
||||
|
||||
// Data consumer will use this method to retrieve contained feature configuration.
|
||||
inline SDEGamutCfg *GetConfig(void) { return this; }
|
||||
|
||||
private:
|
||||
SDEGamutCfgWrapper() {}
|
||||
uint32_t *buffer_ = NULL;
|
||||
};
|
||||
|
||||
class SDEPaCfgWrapper : private SDEPaData {
|
||||
public:
|
||||
static SDEPaCfgWrapper *Init(uint32_t arg = 0);
|
||||
~SDEPaCfgWrapper() {
|
||||
if (buffer_)
|
||||
delete[] buffer_;
|
||||
}
|
||||
inline SDEPaData *GetConfig(void) { return this; }
|
||||
|
||||
private:
|
||||
SDEPaCfgWrapper() {}
|
||||
uint32_t *buffer_ = NULL;
|
||||
};
|
||||
|
||||
class SDEIgcLUTWrapper : private SDEIgcLUTData {
|
||||
public:
|
||||
static SDEIgcLUTWrapper *Init(uint32_t arg __attribute__((__unused__)));
|
||||
~SDEIgcLUTWrapper() {
|
||||
if (buffer_)
|
||||
delete[] buffer_;
|
||||
}
|
||||
inline SDEIgcLUTData *GetConfig(void) { return this; }
|
||||
|
||||
private:
|
||||
SDEIgcLUTWrapper() {}
|
||||
uint32_t *buffer_ = NULL;
|
||||
};
|
||||
|
||||
class SDEPgcLUTWrapper : private SDEPgcLUTData {
|
||||
public:
|
||||
static SDEPgcLUTWrapper *Init(uint32_t arg __attribute__((__unused__)));
|
||||
~SDEPgcLUTWrapper() {
|
||||
if (buffer_)
|
||||
delete[] buffer_;
|
||||
}
|
||||
inline SDEPgcLUTData *GetConfig(void) { return this; }
|
||||
|
||||
private:
|
||||
SDEPgcLUTWrapper() {}
|
||||
uint32_t *buffer_ = NULL;
|
||||
};
|
||||
|
||||
// Base Postprocessing features information.
|
||||
class PPFeatureInfo {
|
||||
public:
|
||||
uint32_t enable_flags_ = 0; // bitmap to indicate subset of parameters enabling or not.
|
||||
uint32_t feature_version_ = 0;
|
||||
uint32_t feature_id_ = 0;
|
||||
uint32_t disp_id_ = 0;
|
||||
uint32_t pipe_id_ = 0;
|
||||
|
||||
virtual ~PPFeatureInfo() {}
|
||||
virtual void *GetConfigData(void) const = 0;
|
||||
};
|
||||
|
||||
// Individual Postprocessing feature representing physical attributes and information
|
||||
// This template class wrapping around abstract data type representing different
|
||||
// post-processing features. It will take output from ColorManager converting from raw metadata.
|
||||
// The configuration will directly pass into HWInterface to program the hardware accordingly.
|
||||
template <typename T>
|
||||
class TPPFeatureInfo : public PPFeatureInfo {
|
||||
public:
|
||||
virtual ~TPPFeatureInfo() {
|
||||
if (params_)
|
||||
delete params_;
|
||||
}
|
||||
|
||||
// API for data consumer to get underlying data configs to program into pp hardware block.
|
||||
virtual void *GetConfigData(void) const { return params_->GetConfig(); }
|
||||
|
||||
// API for data producer to get access to underlying data configs to populate it.
|
||||
T *GetParamsReference(void) { return params_; }
|
||||
|
||||
// API for create this template object.
|
||||
static TPPFeatureInfo *Init(uint32_t arg = 0) {
|
||||
TPPFeatureInfo *info = new TPPFeatureInfo();
|
||||
if (info) {
|
||||
info->params_ = T::Init(arg);
|
||||
if (!info->params_) {
|
||||
delete info;
|
||||
info = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
protected:
|
||||
TPPFeatureInfo() = default;
|
||||
|
||||
private:
|
||||
T *params_ = NULL;
|
||||
};
|
||||
|
||||
// This singleton class serves as data exchanging central between data producer
|
||||
// <libsdm-color.so> and data consumer<SDM and HWC.>
|
||||
// This class defines PP pending features to be programmed, which generated from
|
||||
// ColorManager. Dirty flag indicates some features are available to be programmed.
|
||||
// () Lock is needed since the object wil be accessed from 2 tasks.
|
||||
// All API exposed are not threadsafe, it's caller's responsiblity to acquire the locker.
|
||||
class PPFeaturesConfig {
|
||||
public:
|
||||
PPFeaturesConfig() { memset(feature_, 0, sizeof(feature_)); }
|
||||
~PPFeaturesConfig() { Reset(); }
|
||||
|
||||
// ColorManager installs one TFeatureInfo<T> to take the output configs computed
|
||||
// from ColorManager, containing all physical features to be programmed and also compute
|
||||
// metadata/populate into T.
|
||||
inline DisplayError AddFeature(uint32_t feature_id, PPFeatureInfo *feature) {
|
||||
if (feature_id < kMaxNumPPFeatures) {
|
||||
if (feature_[feature_id]) {
|
||||
delete feature_[feature_id];
|
||||
feature_[feature_id] = NULL;
|
||||
}
|
||||
feature_[feature_id] = feature;
|
||||
}
|
||||
return kErrorNone;
|
||||
}
|
||||
|
||||
inline Locker &GetLocker(void) { return locker_; }
|
||||
inline PPFrameCaptureData *GetFrameCaptureData(void) { return &frame_capture_data; }
|
||||
// Once all features are consumed, destroy/release all TFeatureInfo<T> on the list,
|
||||
// then clear dirty_ flag and return the lock to the TFeatureInfo<T> producer.
|
||||
void Reset();
|
||||
|
||||
// Consumer to call this to retrieve all the TFeatureInfo<T> on the list to be programmed.
|
||||
DisplayError RetrieveNextFeature(PPFeatureInfo **feature);
|
||||
|
||||
inline bool IsDirty() { return dirty_; }
|
||||
inline void MarkAsDirty() { dirty_ = true; }
|
||||
|
||||
private:
|
||||
bool dirty_ = 0;
|
||||
Locker locker_;
|
||||
PPFeatureInfo *feature_[kMaxNumPPFeatures]; // reference to TFeatureInfo<T>.
|
||||
uint32_t next_idx_ = 0;
|
||||
PPFrameCaptureData frame_capture_data;
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __COLOR_PARAMS_H__
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright (c) 2015 - 2016, 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 __EXTENSION_INTERFACE_H__
|
||||
#define __EXTENSION_INTERFACE_H__
|
||||
|
||||
#include <core/sdm_types.h>
|
||||
#include <core/display_interface.h>
|
||||
|
||||
#include "partial_update_interface.h"
|
||||
#include "strategy_interface.h"
|
||||
#include "resource_interface.h"
|
||||
#include "rotator_interface.h"
|
||||
|
||||
namespace sdm {
|
||||
|
||||
#define EXTENSION_LIBRARY_NAME "libsdmextension.so"
|
||||
#define CREATE_EXTENSION_INTERFACE_NAME "CreateExtensionInterface"
|
||||
#define DESTROY_EXTENSION_INTERFACE_NAME "DestroyExtensionInterface"
|
||||
|
||||
#define EXTENSION_REVISION_MAJOR (1)
|
||||
#define EXTENSION_REVISION_MINOR (0)
|
||||
|
||||
#define EXTENSION_VERSION_TAG ((uint16_t) ((EXTENSION_REVISION_MAJOR << 8) \
|
||||
| EXTENSION_REVISION_MINOR))
|
||||
|
||||
class ExtensionInterface;
|
||||
|
||||
typedef DisplayError (*CreateExtensionInterface)(uint16_t version, ExtensionInterface **interface);
|
||||
typedef DisplayError (*DestroyExtensionInterface)(ExtensionInterface *interface);
|
||||
|
||||
class ExtensionInterface {
|
||||
public:
|
||||
virtual DisplayError CreatePartialUpdate(DisplayType type, const HWResourceInfo &hw_resource_info,
|
||||
const HWPanelInfo &hw_panel_info,
|
||||
const HWMixerAttributes &mixer_attributes,
|
||||
const HWDisplayAttributes &display_attributes,
|
||||
PartialUpdateInterface **interface) = 0;
|
||||
virtual DisplayError DestroyPartialUpdate(PartialUpdateInterface *interface) = 0;
|
||||
|
||||
virtual DisplayError CreateStrategyExtn(DisplayType type, HWDisplayMode mode,
|
||||
HWS3DMode s3d_mode,
|
||||
const HWMixerAttributes &mixer_attributes,
|
||||
const DisplayConfigVariableInfo &fb_config,
|
||||
StrategyInterface **interface) = 0;
|
||||
virtual DisplayError DestroyStrategyExtn(StrategyInterface *interface) = 0;
|
||||
|
||||
virtual DisplayError CreateResourceExtn(const HWResourceInfo &hw_resource_info,
|
||||
ResourceInterface **interface,
|
||||
BufferSyncHandler *buffer_sync_handler) = 0;
|
||||
virtual DisplayError DestroyResourceExtn(ResourceInterface *interface) = 0;
|
||||
|
||||
virtual DisplayError CreateRotator(const HWRotatorInfo &hw_rot_info,
|
||||
BufferAllocator *buffer_allocator,
|
||||
BufferSyncHandler *buffer_sync_handler,
|
||||
RotatorInterface **intf) = 0;
|
||||
virtual DisplayError DestroyRotator(RotatorInterface *intf) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~ExtensionInterface() { }
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __EXTENSION_INTERFACE_H__
|
||||
|
|
@ -0,0 +1,495 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
* provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of The Linux Foundation nor the names of its contributors may be used to
|
||||
* endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __HW_INFO_TYPES_H__
|
||||
#define __HW_INFO_TYPES_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <core/display_interface.h>
|
||||
#include <core/core_interface.h>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <bitset>
|
||||
|
||||
namespace sdm {
|
||||
const int kMaxSDELayers = 16; // Maximum number of layers that can be handled by hardware in a
|
||||
// given layer stack.
|
||||
#define MAX_PLANES 4
|
||||
|
||||
#define MAX_DETAIL_ENHANCE_CURVE 3
|
||||
|
||||
enum HWDeviceType {
|
||||
kDevicePrimary,
|
||||
kDeviceHDMI,
|
||||
kDeviceVirtual,
|
||||
kDeviceRotator,
|
||||
kDeviceMax,
|
||||
};
|
||||
|
||||
enum HWBlockType {
|
||||
kHWPrimary,
|
||||
kHWHDMI,
|
||||
kHWWriteback0,
|
||||
kHWWriteback1,
|
||||
kHWWriteback2,
|
||||
kHWBlockMax
|
||||
};
|
||||
|
||||
enum HWDisplayMode {
|
||||
kModeDefault,
|
||||
kModeVideo,
|
||||
kModeCommand,
|
||||
};
|
||||
|
||||
enum HWDisplayPort {
|
||||
kPortDefault,
|
||||
kPortDSI,
|
||||
kPortDTv,
|
||||
kPortWriteBack,
|
||||
kPortLVDS,
|
||||
kPortEDP,
|
||||
};
|
||||
|
||||
enum PipeType {
|
||||
kPipeTypeUnused,
|
||||
kPipeTypeVIG,
|
||||
kPipeTypeRGB,
|
||||
kPipeTypeDMA,
|
||||
kPipeTypeCursor,
|
||||
};
|
||||
|
||||
enum HWSubBlockType {
|
||||
kHWVIGPipe,
|
||||
kHWRGBPipe,
|
||||
kHWDMAPipe,
|
||||
kHWCursorPipe,
|
||||
kHWRotatorInput,
|
||||
kHWRotatorOutput,
|
||||
kHWWBIntfOutput,
|
||||
kHWDestinationScalar,
|
||||
kHWSubBlockMax,
|
||||
};
|
||||
|
||||
enum HWAlphaInterpolation {
|
||||
kInterpolationPixelRepeat,
|
||||
kInterpolationBilinear,
|
||||
kInterpolationMax,
|
||||
};
|
||||
|
||||
enum HWBlendingFilter {
|
||||
kBlendFilterCircular,
|
||||
kBlendFilterSeparable,
|
||||
kBlendFilterMax,
|
||||
};
|
||||
|
||||
enum HWPipeFlags {
|
||||
kIGC = 0x01,
|
||||
kMultiRect = 0x02,
|
||||
kMultiRectParallelMode = 0x04,
|
||||
};
|
||||
|
||||
typedef std::map<HWSubBlockType, std::vector<LayerBufferFormat>> FormatsMap;
|
||||
|
||||
struct HWDynBwLimitInfo {
|
||||
uint32_t cur_mode = kBwDefault;
|
||||
uint32_t total_bw_limit[kBwModeMax] = { 0 };
|
||||
uint32_t pipe_bw_limit[kBwModeMax] = { 0 };
|
||||
};
|
||||
|
||||
struct HWPipeCaps {
|
||||
PipeType type = kPipeTypeUnused;
|
||||
uint32_t id = 0;
|
||||
uint32_t max_rects = 1;
|
||||
};
|
||||
|
||||
struct HWRotatorInfo {
|
||||
enum { ROT_TYPE_MDSS, ROT_TYPE_V4L2 };
|
||||
uint32_t type = ROT_TYPE_MDSS;
|
||||
uint32_t num_rotator = 0;
|
||||
bool has_downscale = false;
|
||||
std::string device_path = "";
|
||||
|
||||
void Reset() { *this = HWRotatorInfo(); }
|
||||
};
|
||||
|
||||
struct HWDestScalarInfo {
|
||||
uint32_t count = 0;
|
||||
uint32_t max_input_width = 0;
|
||||
uint32_t max_output_width = 0;
|
||||
uint32_t max_scale_up = 1;
|
||||
};
|
||||
|
||||
struct HWResourceInfo {
|
||||
uint32_t hw_version = 0;
|
||||
uint32_t hw_revision = 0;
|
||||
uint32_t num_dma_pipe = 0;
|
||||
uint32_t num_vig_pipe = 0;
|
||||
uint32_t num_rgb_pipe = 0;
|
||||
uint32_t num_cursor_pipe = 0;
|
||||
uint32_t num_blending_stages = 0;
|
||||
uint32_t num_control = 0;
|
||||
uint32_t num_mixer_to_disp = 0;
|
||||
uint32_t smp_total = 0;
|
||||
uint32_t smp_size = 0;
|
||||
uint32_t num_smp_per_pipe = 0;
|
||||
uint32_t max_scale_up = 1;
|
||||
uint32_t max_scale_down = 1;
|
||||
uint64_t max_bandwidth_low = 0;
|
||||
uint64_t max_bandwidth_high = 0;
|
||||
uint32_t max_mixer_width = 2048;
|
||||
uint32_t max_pipe_width = 2048;
|
||||
uint32_t max_cursor_size = 0;
|
||||
uint32_t max_pipe_bw = 0;
|
||||
uint32_t max_sde_clk = 0;
|
||||
float clk_fudge_factor = 1.0f;
|
||||
uint32_t macrotile_nv12_factor = 0;
|
||||
uint32_t macrotile_factor = 0;
|
||||
uint32_t linear_factor = 0;
|
||||
uint32_t scale_factor = 0;
|
||||
uint32_t extra_fudge_factor = 0;
|
||||
uint32_t amortizable_threshold = 0;
|
||||
uint32_t system_overhead_lines = 0;
|
||||
bool has_bwc = false;
|
||||
bool has_ubwc = false;
|
||||
bool has_decimation = false;
|
||||
bool has_macrotile = false;
|
||||
bool has_non_scalar_rgb = false;
|
||||
bool is_src_split = false;
|
||||
bool perf_calc = false;
|
||||
bool has_dyn_bw_support = false;
|
||||
bool separate_rotator = false;
|
||||
bool has_qseed3 = false;
|
||||
bool has_concurrent_writeback = false;
|
||||
uint32_t writeback_index = kHWBlockMax;
|
||||
HWDynBwLimitInfo dyn_bw_info;
|
||||
std::vector<HWPipeCaps> hw_pipes;
|
||||
FormatsMap supported_formats_map;
|
||||
HWRotatorInfo hw_rot_info;
|
||||
HWDestScalarInfo hw_dest_scalar_info;
|
||||
|
||||
void Reset() { *this = HWResourceInfo(); }
|
||||
};
|
||||
|
||||
struct HWSplitInfo {
|
||||
uint32_t left_split = 0;
|
||||
uint32_t right_split = 0;
|
||||
|
||||
bool operator !=(const HWSplitInfo &split_info) {
|
||||
return ((left_split != split_info.left_split) || (right_split != split_info.right_split));
|
||||
}
|
||||
|
||||
bool operator ==(const HWSplitInfo &split_info) {
|
||||
return !(operator !=(split_info));
|
||||
}
|
||||
};
|
||||
|
||||
enum HWS3DMode {
|
||||
kS3DModeNone,
|
||||
kS3DModeLR,
|
||||
kS3DModeRL,
|
||||
kS3DModeTB,
|
||||
kS3DModeFP,
|
||||
kS3DModeMax,
|
||||
};
|
||||
|
||||
struct HWPanelInfo {
|
||||
HWDisplayPort port = kPortDefault; // Display port
|
||||
HWDisplayMode mode = kModeDefault; // Display mode
|
||||
bool partial_update = false; // Partial update feature
|
||||
int left_align = 0; // ROI left alignment restriction
|
||||
int width_align = 0; // ROI width alignment restriction
|
||||
int top_align = 0; // ROI top alignment restriction
|
||||
int height_align = 0; // ROI height alignment restriction
|
||||
int min_roi_width = 0; // Min width needed for ROI
|
||||
int min_roi_height = 0; // Min height needed for ROI
|
||||
bool needs_roi_merge = false; // Merge ROI's of both the DSI's
|
||||
bool dynamic_fps = false; // Panel Supports dynamic fps
|
||||
uint32_t min_fps = 0; // Min fps supported by panel
|
||||
uint32_t max_fps = 0; // Max fps supported by panel
|
||||
bool is_primary_panel = false; // Panel is primary display
|
||||
bool is_pluggable = false; // Panel is pluggable
|
||||
HWSplitInfo split_info; // Panel split configuration
|
||||
char panel_name[256] = {0}; // Panel name
|
||||
HWS3DMode s3d_mode = kS3DModeNone; // Panel's current s3d mode.
|
||||
int panel_max_brightness = 0; // Max panel brightness
|
||||
|
||||
bool operator !=(const HWPanelInfo &panel_info) {
|
||||
return ((port != panel_info.port) || (mode != panel_info.mode) ||
|
||||
(partial_update != panel_info.partial_update) ||
|
||||
(left_align != panel_info.left_align) || (width_align != panel_info.width_align) ||
|
||||
(top_align != panel_info.top_align) || (height_align != panel_info.height_align) ||
|
||||
(min_roi_width != panel_info.min_roi_width) ||
|
||||
(min_roi_height != panel_info.min_roi_height) ||
|
||||
(needs_roi_merge != panel_info.needs_roi_merge) ||
|
||||
(dynamic_fps != panel_info.dynamic_fps) || (min_fps != panel_info.min_fps) ||
|
||||
(max_fps != panel_info.max_fps) || (is_primary_panel != panel_info.is_primary_panel) ||
|
||||
(split_info != panel_info.split_info) ||
|
||||
(s3d_mode != panel_info.s3d_mode));
|
||||
}
|
||||
|
||||
bool operator ==(const HWPanelInfo &panel_info) {
|
||||
return !(operator !=(panel_info));
|
||||
}
|
||||
};
|
||||
|
||||
struct HWSessionConfig {
|
||||
LayerRect src_rect;
|
||||
LayerRect dst_rect;
|
||||
uint32_t buffer_count = 0;
|
||||
bool secure = false;
|
||||
uint32_t frame_rate = 0;
|
||||
LayerTransform transform;
|
||||
|
||||
bool operator==(const HWSessionConfig& config) const {
|
||||
return (src_rect == config.src_rect &&
|
||||
dst_rect == config.dst_rect &&
|
||||
buffer_count == config.buffer_count &&
|
||||
secure == config.secure &&
|
||||
frame_rate == config.frame_rate &&
|
||||
transform == config.transform);
|
||||
}
|
||||
|
||||
bool operator!=(const HWSessionConfig& config) const {
|
||||
return !operator==(config);
|
||||
}
|
||||
};
|
||||
|
||||
struct HWRotateInfo {
|
||||
int pipe_id = -1; // Not actual pipe id, but the relative DMA id
|
||||
int writeback_id = -1; // Writeback block id, but this is the same as DMA id
|
||||
LayerRect src_roi; // Source crop of each split
|
||||
LayerRect dst_roi; // Destination crop of each split
|
||||
bool valid = false;
|
||||
int rotate_id = -1; // Actual rotator session id with driver
|
||||
|
||||
void Reset() { *this = HWRotateInfo(); }
|
||||
};
|
||||
|
||||
struct HWRotatorSession {
|
||||
HWRotateInfo hw_rotate_info[kMaxRotatePerLayer];
|
||||
uint32_t hw_block_count = 0; // number of rotator hw blocks used by rotator session
|
||||
int session_id = -1; // A handle with Session Manager
|
||||
HWSessionConfig hw_session_config;
|
||||
LayerBuffer input_buffer; // Input to rotator
|
||||
LayerBuffer output_buffer; // Output of rotator, crop width and stride are same
|
||||
float input_compression = 1.0f;
|
||||
float output_compression = 1.0f;
|
||||
bool is_buffer_cached = false;
|
||||
};
|
||||
|
||||
struct HWScaleLutInfo {
|
||||
uint32_t dir_lut_size = 0;
|
||||
uint32_t cir_lut_size = 0;
|
||||
uint32_t sep_lut_size = 0;
|
||||
uint64_t dir_lut = 0;
|
||||
uint64_t cir_lut = 0;
|
||||
uint64_t sep_lut = 0;
|
||||
};
|
||||
|
||||
struct HWDetailEnhanceData : DisplayDetailEnhancerData {
|
||||
uint16_t prec_shift = 0;
|
||||
int16_t adjust_a[MAX_DETAIL_ENHANCE_CURVE] = {0};
|
||||
int16_t adjust_b[MAX_DETAIL_ENHANCE_CURVE] = {0};
|
||||
int16_t adjust_c[MAX_DETAIL_ENHANCE_CURVE] = {0};
|
||||
};
|
||||
|
||||
struct HWPixelExtension {
|
||||
int32_t extension = 0; // Number of pixels extension in left, right, top and bottom directions
|
||||
// for all color components. This pixel value for each color component
|
||||
// should be sum of fetch and repeat pixels.
|
||||
|
||||
int32_t overfetch = 0; // Number of pixels need to be overfetched in left, right, top and bottom
|
||||
// directions from source image for scaling.
|
||||
|
||||
int32_t repeat = 0; // Number of pixels need to be repeated in left, right, top and bottom
|
||||
// directions for scaling.
|
||||
};
|
||||
|
||||
struct HWPlane {
|
||||
int32_t init_phase_x = 0;
|
||||
int32_t phase_step_x = 0;
|
||||
int32_t init_phase_y = 0;
|
||||
int32_t phase_step_y = 0;
|
||||
HWPixelExtension left;
|
||||
HWPixelExtension top;
|
||||
HWPixelExtension right;
|
||||
HWPixelExtension bottom;
|
||||
uint32_t roi_width = 0;
|
||||
int32_t preload_x = 0;
|
||||
int32_t preload_y = 0;
|
||||
uint32_t src_width = 0;
|
||||
uint32_t src_height = 0;
|
||||
};
|
||||
|
||||
struct HWScaleData {
|
||||
struct enable {
|
||||
uint8_t scale = 0;
|
||||
uint8_t direction_detection = 0;
|
||||
uint8_t detail_enhance = 0;
|
||||
} enable;
|
||||
uint32_t dst_width = 0;
|
||||
uint32_t dst_height = 0;
|
||||
HWPlane plane[MAX_PLANES];
|
||||
// scale_v2_data fields
|
||||
ScalingFilterConfig y_rgb_filter_cfg = kFilterEdgeDirected;
|
||||
ScalingFilterConfig uv_filter_cfg = kFilterEdgeDirected;
|
||||
HWAlphaInterpolation alpha_filter_cfg = kInterpolationPixelRepeat;
|
||||
HWBlendingFilter blend_cfg = kBlendFilterCircular;
|
||||
|
||||
struct lut_flags {
|
||||
uint8_t lut_swap = 0;
|
||||
uint8_t lut_dir_wr = 0;
|
||||
uint8_t lut_y_cir_wr = 0;
|
||||
uint8_t lut_uv_cir_wr = 0;
|
||||
uint8_t lut_y_sep_wr = 0;
|
||||
uint8_t lut_uv_sep_wr = 0;
|
||||
} lut_flag;
|
||||
|
||||
uint32_t dir_lut_idx = 0;
|
||||
/* for Y(RGB) and UV planes*/
|
||||
uint32_t y_rgb_cir_lut_idx = 0;
|
||||
uint32_t uv_cir_lut_idx = 0;
|
||||
uint32_t y_rgb_sep_lut_idx = 0;
|
||||
uint32_t uv_sep_lut_idx = 0;
|
||||
|
||||
HWDetailEnhanceData detail_enhance;
|
||||
};
|
||||
|
||||
struct HWDestScaleInfo {
|
||||
uint32_t mixer_width = 0;
|
||||
uint32_t mixer_height = 0;
|
||||
bool scale_update = false;
|
||||
HWScaleData scale_data = {};
|
||||
};
|
||||
|
||||
typedef std::map<uint32_t, HWDestScaleInfo *> DestScaleInfoMap;
|
||||
|
||||
struct HWPipeInfo {
|
||||
uint32_t pipe_id = 0;
|
||||
HWSubBlockType sub_block_type = kHWSubBlockMax;
|
||||
LayerRect src_roi;
|
||||
LayerRect dst_roi;
|
||||
uint8_t horizontal_decimation = 0;
|
||||
uint8_t vertical_decimation = 0;
|
||||
HWScaleData scale_data;
|
||||
uint32_t z_order = 0;
|
||||
uint8_t flags = 0;
|
||||
bool valid = false;
|
||||
|
||||
void Reset() { *this = HWPipeInfo(); }
|
||||
};
|
||||
|
||||
struct HWLayerConfig {
|
||||
HWPipeInfo left_pipe; // pipe for left side of output
|
||||
HWPipeInfo right_pipe; // pipe for right side of output
|
||||
HWRotatorSession hw_rotator_session;
|
||||
float compression = 1.0f;
|
||||
|
||||
void Reset() { *this = HWLayerConfig(); }
|
||||
};
|
||||
|
||||
struct HWLayersInfo {
|
||||
LayerStack *stack = NULL; // Input layer stack. Set by the caller.
|
||||
|
||||
uint32_t index[kMaxSDELayers]; // Indexes of the layers from the layer stack which need to be
|
||||
// programmed on hardware.
|
||||
LayerRect updated_src_rect[kMaxSDELayers]; // Updated layer src rects in s3d mode
|
||||
LayerRect updated_dst_rect[kMaxSDELayers]; // Updated layer dst rects in s3d mode
|
||||
bool updating[kMaxSDELayers] = {0}; // Updated by strategy, considering plane_alpha+updating
|
||||
|
||||
uint32_t count = 0; // Total number of layers which need to be set on hardware.
|
||||
|
||||
int sync_handle = -1;
|
||||
|
||||
LayerRect left_partial_update; // Left ROI.
|
||||
LayerRect right_partial_update; // Right ROI.
|
||||
|
||||
bool use_hw_cursor = false; // Indicates that HWCursor pipe needs to be used for cursor layer
|
||||
DestScaleInfoMap dest_scale_info_map = {};
|
||||
};
|
||||
|
||||
struct HWLayers {
|
||||
HWLayersInfo info;
|
||||
HWLayerConfig config[kMaxSDELayers];
|
||||
float output_compression = 1.0f;
|
||||
uint32_t bandwidth = 0;
|
||||
uint32_t clock = 0;
|
||||
};
|
||||
|
||||
struct HWDisplayAttributes : DisplayConfigVariableInfo {
|
||||
bool is_device_split = false;
|
||||
uint32_t v_front_porch = 0; //!< Vertical front porch of panel
|
||||
uint32_t v_back_porch = 0; //!< Vertical back porch of panel
|
||||
uint32_t v_pulse_width = 0; //!< Vertical pulse width of panel
|
||||
uint32_t h_total = 0; //!< Total width of panel (hActive + hFP + hBP + hPulseWidth)
|
||||
std::bitset<32> s3d_config; //!< Stores the bit mask of S3D modes
|
||||
|
||||
void Reset() { *this = HWDisplayAttributes(); }
|
||||
|
||||
bool operator !=(const HWDisplayAttributes &display_attributes) {
|
||||
return ((is_device_split != display_attributes.is_device_split) ||
|
||||
(x_pixels != display_attributes.x_pixels) ||
|
||||
(y_pixels != display_attributes.y_pixels) ||
|
||||
(x_dpi != display_attributes.x_dpi) ||
|
||||
(y_dpi != display_attributes.y_dpi) ||
|
||||
(fps != display_attributes.fps) ||
|
||||
(vsync_period_ns != display_attributes.vsync_period_ns) ||
|
||||
(v_front_porch != display_attributes.v_front_porch) ||
|
||||
(v_back_porch != display_attributes.v_back_porch) ||
|
||||
(v_pulse_width != display_attributes.v_pulse_width) ||
|
||||
(is_yuv != display_attributes.is_yuv));
|
||||
}
|
||||
|
||||
bool operator ==(const HWDisplayAttributes &display_attributes) {
|
||||
return !(operator !=(display_attributes));
|
||||
}
|
||||
};
|
||||
|
||||
struct HWMixerAttributes {
|
||||
uint32_t width = 0; // Layer mixer width
|
||||
uint32_t height = 0; // Layer mixer height
|
||||
uint32_t split_left = 0;
|
||||
LayerBufferFormat output_format = kFormatRGB101010; // Layer mixer output format
|
||||
|
||||
bool operator !=(const HWMixerAttributes &mixer_attributes) {
|
||||
return ((width != mixer_attributes.width) ||
|
||||
(height != mixer_attributes.height) ||
|
||||
(output_format != mixer_attributes.output_format) ||
|
||||
(split_left != mixer_attributes.split_left));
|
||||
}
|
||||
|
||||
bool operator ==(const HWMixerAttributes &mixer_attributes) {
|
||||
return !(operator !=(mixer_attributes));
|
||||
}
|
||||
|
||||
bool IsValid() {
|
||||
return (width > 0 && height > 0);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __HW_INFO_TYPES_H__
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2015, 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 __PARTIAL_UPDATE_INTERFACE_H__
|
||||
#define __PARTIAL_UPDATE_INTERFACE_H__
|
||||
|
||||
#include <core/display_interface.h>
|
||||
#include <core/buffer_allocator.h>
|
||||
#include <core/buffer_sync_handler.h>
|
||||
|
||||
#include "hw_info_types.h"
|
||||
|
||||
namespace sdm {
|
||||
|
||||
class PartialUpdateInterface {
|
||||
public:
|
||||
virtual DisplayError GenerateROI(HWLayersInfo *hw_layers_info) = 0;
|
||||
virtual void ControlPartialUpdate(bool enable) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~PartialUpdateInterface() { }
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __PARTIAL_UPDATE_INTERFACE_H__
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (c) 2015 - 2016, 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 __RESOURCE_INTERFACE_H__
|
||||
#define __RESOURCE_INTERFACE_H__
|
||||
|
||||
#include <core/display_interface.h>
|
||||
#include "hw_info_types.h"
|
||||
|
||||
namespace sdm {
|
||||
|
||||
class ResourceInterface {
|
||||
public:
|
||||
virtual DisplayError RegisterDisplay(DisplayType type,
|
||||
const HWDisplayAttributes &display_attributes,
|
||||
const HWPanelInfo &hw_panel_info,
|
||||
const HWMixerAttributes &mixer_attributes,
|
||||
Handle *display_ctx) = 0;
|
||||
virtual DisplayError UnregisterDisplay(Handle display_ctx) = 0;
|
||||
virtual DisplayError ReconfigureDisplay(Handle display_ctx,
|
||||
const HWDisplayAttributes &display_attributes,
|
||||
const HWPanelInfo &hw_panel_info,
|
||||
const HWMixerAttributes &mixer_attributes) = 0;
|
||||
virtual DisplayError Start(Handle display_ctx) = 0;
|
||||
virtual DisplayError Stop(Handle display_ctx) = 0;
|
||||
virtual DisplayError Acquire(Handle display_ctx, HWLayers *hw_layers) = 0;
|
||||
virtual DisplayError PostPrepare(Handle display_ctx, HWLayers *hw_layers) = 0;
|
||||
virtual DisplayError PostCommit(Handle display_ctx, HWLayers *hw_layers) = 0;
|
||||
virtual void Purge(Handle display_ctx) = 0;
|
||||
virtual DisplayError SetMaxMixerStages(Handle display_ctx, uint32_t max_mixer_stages) = 0;
|
||||
virtual DisplayError ValidateScaling(const LayerRect &crop, const LayerRect &dst,
|
||||
bool rotate90, bool ubwc_tiled,
|
||||
bool use_rotator_downscale) = 0;
|
||||
virtual DisplayError ValidateCursorConfig(Handle display_ctx, const Layer *layer,
|
||||
bool is_top) = 0;
|
||||
virtual DisplayError ValidateCursorPosition(Handle display_ctx, HWLayers *hw_layers,
|
||||
int x, int y) = 0;
|
||||
virtual DisplayError SetMaxBandwidthMode(HWBwModes mode) = 0;
|
||||
virtual DisplayError GetScaleLutConfig(HWScaleLutInfo *lut_info) = 0;
|
||||
virtual DisplayError SetDetailEnhancerData(Handle display_ctx,
|
||||
const DisplayDetailEnhancerData &de_data) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~ResourceInterface() { }
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __RESOURCE_INTERFACE_H__
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) 2015, 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 __ROTATOR_INTERFACE_H__
|
||||
#define __ROTATOR_INTERFACE_H__
|
||||
|
||||
#include <core/display_interface.h>
|
||||
#include <core/buffer_allocator.h>
|
||||
#include <core/buffer_sync_handler.h>
|
||||
|
||||
#include "hw_info_types.h"
|
||||
|
||||
namespace sdm {
|
||||
|
||||
class RotatorInterface {
|
||||
public:
|
||||
virtual DisplayError RegisterDisplay(DisplayType type, Handle *display_ctx) = 0;
|
||||
virtual void UnregisterDisplay(Handle display_ctx) = 0;
|
||||
virtual DisplayError Prepare(Handle display_ctx, HWLayers *hw_layers) = 0;
|
||||
virtual DisplayError Commit(Handle display_ctx, HWLayers *hw_layers) = 0;
|
||||
virtual DisplayError PostCommit(Handle display_ctx, HWLayers *hw_layers) = 0;
|
||||
virtual DisplayError Purge(Handle display_ctx) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~RotatorInterface() { }
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __ROTATOR_INTERFACE_H__
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) 2014 - 2016, 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 __STRATEGY_INTERFACE_H__
|
||||
#define __STRATEGY_INTERFACE_H__
|
||||
|
||||
#include <core/sdm_types.h>
|
||||
#include <core/display_interface.h>
|
||||
#include "hw_info_types.h"
|
||||
|
||||
namespace sdm {
|
||||
|
||||
struct StrategyConstraints {
|
||||
bool safe_mode = false; //!< In this mode, strategy manager chooses the composition strategy
|
||||
//!< that requires minimum number of pipe for the current frame. i.e.,
|
||||
//!< video only composition, secure only composition or GPU composition
|
||||
|
||||
bool use_cursor = false; //!< If this is set, strategy manager will configure cursor layer in the
|
||||
//!< layer stack as hw cursor else it will be treated as a normal layer
|
||||
|
||||
uint32_t max_layers = kMaxSDELayers; //!< Maximum number of layers that shall be programmed
|
||||
//!< on hardware for the given layer stack.
|
||||
};
|
||||
|
||||
class StrategyInterface {
|
||||
public:
|
||||
virtual DisplayError Start(HWLayersInfo *hw_layers_info, uint32_t *max_attempts) = 0;
|
||||
virtual DisplayError GetNextStrategy(StrategyConstraints *constraints) = 0;
|
||||
virtual DisplayError Stop() = 0;
|
||||
virtual DisplayError Reconfigure(HWDisplayMode mode, HWS3DMode s3d_mode,
|
||||
const HWMixerAttributes &mixer_attributes,
|
||||
const DisplayConfigVariableInfo &fb_config) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~StrategyInterface() { }
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __STRATEGY_INTERFACE_H__
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright (c) 2014 - 2016, 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 __CONSTANTS_H__
|
||||
#define __CONSTANTS_H__
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifndef PRIu64
|
||||
#define PRIu64 "llu"
|
||||
#endif
|
||||
|
||||
#define INT(exp) static_cast<int>(exp)
|
||||
#define FLOAT(exp) static_cast<float>(exp)
|
||||
#define UINT8(exp) static_cast<uint8_t>(exp)
|
||||
#define UINT16(exp) static_cast<uint16_t>(exp)
|
||||
#define UINT32(exp) static_cast<uint32_t>(exp)
|
||||
#define INT32(exp) static_cast<int32_t>(exp)
|
||||
#define UINT64(exp) static_cast<uint64_t>(exp)
|
||||
|
||||
#define ROUND_UP(number, step) ((((number) + ((step) - 1)) / (step)) * (step))
|
||||
|
||||
#define BITMAP(bit) (1 << (bit))
|
||||
|
||||
#define ROUND_UP_ALIGN_DOWN(value, a) FLOAT(FloorToMultipleOf(UINT32(value + 0.5f), UINT32(a)))
|
||||
#define ROUND_UP_ALIGN_UP(value, a) FLOAT(CeilToMultipleOf(UINT32(value + 0.5f), UINT32(a)))
|
||||
|
||||
#define IDLE_TIMEOUT_DEFAULT_MS 70
|
||||
|
||||
#define IS_RGB_FORMAT(format) (((format) < kFormatYCbCr420Planar) ? true: false)
|
||||
|
||||
#define BITS_PER_BYTE 8
|
||||
#define BITS_TO_BYTES(x) (((x) + (BITS_PER_BYTE - 1)) / (BITS_PER_BYTE))
|
||||
|
||||
// factor value should be in powers of 2(eg: 1, 2, 4, 8)
|
||||
template <class T1, class T2>
|
||||
inline T1 FloorToMultipleOf(const T1 &value, const T2 &factor) {
|
||||
return (T1)(value & (~(factor - 1)));
|
||||
}
|
||||
|
||||
template <class T1, class T2>
|
||||
inline T1 CeilToMultipleOf(const T1 &value, const T2 &factor) {
|
||||
return (T1)((value + (factor - 1)) & (~(factor - 1)));
|
||||
}
|
||||
|
||||
namespace sdm {
|
||||
|
||||
const int kThreadPriorityUrgent = -9;
|
||||
const int kMaxRotatePerLayer = 2;
|
||||
const uint32_t kMaxBlitTargetLayers = 2;
|
||||
const int kPageSize = 4096;
|
||||
const int kMaxThermalLevel = 3;
|
||||
|
||||
typedef void * Handle;
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __CONSTANTS_H__
|
||||
|
114
android/hardware/qcom/display/msm8996/sdm/include/utils/debug.h
Normal file
114
android/hardware/qcom/display/msm8996/sdm/include/utils/debug.h
Normal file
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* Copyright (c) 2014 - 2016, 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 __DEBUG_H__
|
||||
#define __DEBUG_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <core/sdm_types.h>
|
||||
#include <core/debug_interface.h>
|
||||
#include <core/display_interface.h>
|
||||
|
||||
#define DLOG(tag, method, format, ...) Debug::Get()->method(tag, __CLASS__ "::%s: " format, \
|
||||
__FUNCTION__, ##__VA_ARGS__)
|
||||
|
||||
#define DLOGE_IF(tag, format, ...) DLOG(tag, Error, format, ##__VA_ARGS__)
|
||||
#define DLOGW_IF(tag, format, ...) DLOG(tag, Warning, format, ##__VA_ARGS__)
|
||||
#define DLOGI_IF(tag, format, ...) DLOG(tag, Info, format, ##__VA_ARGS__)
|
||||
#define DLOGD_IF(tag, format, ...) DLOG(tag, Debug, format, ##__VA_ARGS__)
|
||||
#define DLOGV_IF(tag, format, ...) DLOG(tag, Verbose, format, ##__VA_ARGS__)
|
||||
|
||||
#define DLOGE(format, ...) DLOGE_IF(kTagNone, format, ##__VA_ARGS__)
|
||||
#define DLOGD(format, ...) DLOGD_IF(kTagNone, format, ##__VA_ARGS__)
|
||||
#define DLOGW(format, ...) DLOGW_IF(kTagNone, format, ##__VA_ARGS__)
|
||||
#define DLOGI(format, ...) DLOGI_IF(kTagNone, format, ##__VA_ARGS__)
|
||||
#define DLOGV(format, ...) DLOGV_IF(kTagNone, format, ##__VA_ARGS__)
|
||||
|
||||
#define DTRACE_BEGIN(custom_string) Debug::Get()->BeginTrace(__CLASS__, __FUNCTION__, custom_string)
|
||||
#define DTRACE_END() Debug::Get()->EndTrace()
|
||||
#define DTRACE_SCOPED() ScopeTracer <Debug> scope_tracer(__CLASS__, __FUNCTION__)
|
||||
|
||||
namespace sdm {
|
||||
|
||||
class Debug {
|
||||
public:
|
||||
static inline void SetDebugHandler(DebugHandler *debug_handler) {
|
||||
debug_.debug_handler_ = debug_handler;
|
||||
}
|
||||
static inline DebugHandler* Get() { return debug_.debug_handler_; }
|
||||
static int GetSimulationFlag();
|
||||
static int GetHDMIResolution();
|
||||
static uint32_t GetIdleTimeoutMs();
|
||||
static int GetBootAnimLayerCount();
|
||||
static bool IsRotatorDownScaleDisabled();
|
||||
static bool IsDecimationDisabled();
|
||||
static int GetMaxPipesPerMixer(DisplayType display_type);
|
||||
static bool IsVideoModeEnabled();
|
||||
static bool IsRotatorUbwcDisabled();
|
||||
static bool IsRotatorSplitDisabled();
|
||||
static bool IsScalarDisabled();
|
||||
static bool IsUbwcTiledFrameBuffer();
|
||||
static bool GetProperty(const char *property_name, char *value);
|
||||
static bool SetProperty(const char *property_name, const char *value);
|
||||
|
||||
private:
|
||||
Debug();
|
||||
|
||||
// By default, drop any log messages/traces coming from Display manager. It will be overriden by
|
||||
// Display manager client when core is successfully initialized.
|
||||
class DefaultDebugHandler : public DebugHandler {
|
||||
public:
|
||||
virtual void Error(DebugTag /*tag*/, const char */*format*/, ...) { }
|
||||
virtual void Warning(DebugTag /*tag*/, const char */*format*/, ...) { }
|
||||
virtual void Info(DebugTag /*tag*/, const char */*format*/, ...) { }
|
||||
virtual void Debug(DebugTag /*tag*/, const char */*format*/, ...) { }
|
||||
virtual void Verbose(DebugTag /*tag*/, const char */*format*/, ...) { }
|
||||
virtual void BeginTrace(const char */*class_name*/, const char */*function_name*/,
|
||||
const char */*custom_string*/) { }
|
||||
virtual void EndTrace() { }
|
||||
virtual DisplayError GetProperty(const char */*property_name*/, int */*value*/) {
|
||||
return kErrorNotSupported;
|
||||
}
|
||||
virtual DisplayError GetProperty(const char */*property_name*/, char */*value*/) {
|
||||
return kErrorNotSupported;
|
||||
}
|
||||
virtual DisplayError SetProperty(const char */*property_name*/, const char */*value*/) {
|
||||
return kErrorNotSupported;
|
||||
}
|
||||
};
|
||||
|
||||
DefaultDebugHandler default_debug_handler_;
|
||||
DebugHandler *debug_handler_;
|
||||
static Debug debug_;
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __DEBUG_H__
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 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 __FORMATS_H__
|
||||
#define __FORMATS_H__
|
||||
|
||||
#include <core/layer_stack.h>
|
||||
|
||||
namespace sdm {
|
||||
|
||||
bool IsUBWCFormat(LayerBufferFormat format);
|
||||
bool Is10BitFormat(LayerBufferFormat format);
|
||||
const char *GetFormatString(const LayerBufferFormat &format);
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __FORMATS_H__
|
||||
|
166
android/hardware/qcom/display/msm8996/sdm/include/utils/locker.h
Normal file
166
android/hardware/qcom/display/msm8996/sdm/include/utils/locker.h
Normal file
|
@ -0,0 +1,166 @@
|
|||
/*
|
||||
* Copyright (c) 2014 - 2016, 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 __LOCKER_H__
|
||||
#define __LOCKER_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define SCOPE_LOCK(locker) Locker::ScopeLock lock(locker)
|
||||
#define SEQUENCE_ENTRY_SCOPE_LOCK(locker) Locker::SequenceEntryScopeLock lock(locker)
|
||||
#define SEQUENCE_EXIT_SCOPE_LOCK(locker) Locker::SequenceExitScopeLock lock(locker)
|
||||
#define SEQUENCE_WAIT_SCOPE_LOCK(locker) Locker::SequenceWaitScopeLock lock(locker)
|
||||
#define SEQUENCE_CANCEL_SCOPE_LOCK(locker) Locker::SequenceCancelScopeLock lock(locker)
|
||||
|
||||
namespace sdm {
|
||||
|
||||
class Locker {
|
||||
public:
|
||||
class ScopeLock {
|
||||
public:
|
||||
explicit ScopeLock(Locker& locker) : locker_(locker) {
|
||||
locker_.Lock();
|
||||
}
|
||||
|
||||
~ScopeLock() {
|
||||
locker_.Unlock();
|
||||
}
|
||||
|
||||
private:
|
||||
Locker &locker_;
|
||||
};
|
||||
|
||||
class SequenceEntryScopeLock {
|
||||
public:
|
||||
explicit SequenceEntryScopeLock(Locker& locker) : locker_(locker) {
|
||||
locker_.Lock();
|
||||
locker_.sequence_wait_ = 1;
|
||||
}
|
||||
|
||||
~SequenceEntryScopeLock() {
|
||||
locker_.Unlock();
|
||||
}
|
||||
|
||||
private:
|
||||
Locker &locker_;
|
||||
};
|
||||
|
||||
class SequenceExitScopeLock {
|
||||
public:
|
||||
explicit SequenceExitScopeLock(Locker& locker) : locker_(locker) {
|
||||
locker_.Lock();
|
||||
locker_.sequence_wait_ = 0;
|
||||
}
|
||||
|
||||
~SequenceExitScopeLock() {
|
||||
locker_.Broadcast();
|
||||
locker_.Unlock();
|
||||
}
|
||||
|
||||
private:
|
||||
Locker &locker_;
|
||||
};
|
||||
|
||||
class SequenceWaitScopeLock {
|
||||
public:
|
||||
explicit SequenceWaitScopeLock(Locker& locker) : locker_(locker), error_(false) {
|
||||
locker_.Lock();
|
||||
|
||||
while (locker_.sequence_wait_ == 1) {
|
||||
locker_.Wait();
|
||||
error_ = (locker_.sequence_wait_ == -1);
|
||||
}
|
||||
}
|
||||
|
||||
~SequenceWaitScopeLock() {
|
||||
locker_.Unlock();
|
||||
}
|
||||
|
||||
bool IsError() {
|
||||
return error_;
|
||||
}
|
||||
|
||||
private:
|
||||
Locker &locker_;
|
||||
bool error_;
|
||||
};
|
||||
|
||||
class SequenceCancelScopeLock {
|
||||
public:
|
||||
explicit SequenceCancelScopeLock(Locker& locker) : locker_(locker) {
|
||||
locker_.Lock();
|
||||
locker_.sequence_wait_ = -1;
|
||||
}
|
||||
|
||||
~SequenceCancelScopeLock() {
|
||||
locker_.Broadcast();
|
||||
locker_.Unlock();
|
||||
}
|
||||
|
||||
private:
|
||||
Locker &locker_;
|
||||
};
|
||||
|
||||
Locker() : sequence_wait_(0) {
|
||||
pthread_mutex_init(&mutex_, 0);
|
||||
pthread_cond_init(&condition_, 0);
|
||||
}
|
||||
|
||||
~Locker() {
|
||||
pthread_mutex_destroy(&mutex_);
|
||||
pthread_cond_destroy(&condition_);
|
||||
}
|
||||
|
||||
void Lock() { pthread_mutex_lock(&mutex_); }
|
||||
void Unlock() { pthread_mutex_unlock(&mutex_); }
|
||||
void Signal() { pthread_cond_signal(&condition_); }
|
||||
void Broadcast() { pthread_cond_broadcast(&condition_); }
|
||||
void Wait() { pthread_cond_wait(&condition_, &mutex_); }
|
||||
int WaitFinite(int ms) {
|
||||
struct timespec ts;
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
ts.tv_sec = tv.tv_sec + ms/1000;
|
||||
ts.tv_nsec = tv.tv_usec*1000 + (ms%1000)*1000000;
|
||||
ts.tv_sec += ts.tv_nsec/1000000000L;
|
||||
ts.tv_nsec += ts.tv_nsec%1000000000L;
|
||||
return pthread_cond_timedwait(&condition_, &mutex_, &ts);
|
||||
}
|
||||
|
||||
private:
|
||||
pthread_mutex_t mutex_;
|
||||
pthread_cond_t condition_;
|
||||
int sequence_wait_; // This flag is set to 1 on sequence entry, 0 on exit, and -1 on cancel.
|
||||
// Some routines will wait for sequence of function calls to finish
|
||||
// so that capturing a transitionary snapshot of context is prevented.
|
||||
// If flag is set to -1, these routines will exit without doing any
|
||||
// further processing.
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __LOCKER_H__
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2016, 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 __RECT_H__
|
||||
#define __RECT_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <core/sdm_types.h>
|
||||
#include <core/layer_stack.h>
|
||||
#include <utils/debug.h>
|
||||
|
||||
namespace sdm {
|
||||
|
||||
enum RectOrientation {
|
||||
kOrientationPortrait,
|
||||
kOrientationLandscape,
|
||||
kOrientationUnknown,
|
||||
};
|
||||
|
||||
bool IsValid(const LayerRect &rect);
|
||||
bool IsCongruent(const LayerRect &rect1, const LayerRect &rect2);
|
||||
void Log(DebugTag debug_tag, const char *prefix, const LayerRect &roi);
|
||||
void Normalize(const uint32_t &align_x, const uint32_t &align_y, LayerRect *rect);
|
||||
LayerRect Union(const LayerRect &rect1, const LayerRect &rect2);
|
||||
LayerRect Intersection(const LayerRect &rect1, const LayerRect &rect2);
|
||||
LayerRect Subtract(const LayerRect &rect1, const LayerRect &rect2);
|
||||
LayerRect Reposition(const LayerRect &rect1, const int &x_offset, const int &y_offset);
|
||||
void SplitLeftRight(const LayerRect &in_rect, uint32_t split_count, uint32_t align_x,
|
||||
bool flip_horizontal, LayerRect *out_rects);
|
||||
void SplitTopBottom(const LayerRect &in_rect, uint32_t split_count, uint32_t align_y,
|
||||
bool flip_horizontal, LayerRect *out_rects);
|
||||
void ScaleRect(const LayerRect &src_domain, const LayerRect &dst_domain, const LayerRect &in_rect,
|
||||
LayerRect *out_rect);
|
||||
RectOrientation GetOrientation(const LayerRect &in_rect);
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __RECT_H__
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright (c) 2015, 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 __SYS_H__
|
||||
#define __SYS_H__
|
||||
|
||||
#include <sys/eventfd.h>
|
||||
#include <dlfcn.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <poll.h>
|
||||
#include <pthread.h>
|
||||
#include <fstream>
|
||||
|
||||
#ifdef SDM_VIRTUAL_DRIVER
|
||||
#include <virtual_driver.h>
|
||||
#endif
|
||||
|
||||
namespace sdm {
|
||||
|
||||
class Sys {
|
||||
public:
|
||||
#ifndef SDM_VIRTUAL_DRIVER
|
||||
typedef std::fstream fstream;
|
||||
#else
|
||||
typedef VirtualFStream fstream;
|
||||
#endif
|
||||
|
||||
// Pointers to system calls which are either mapped to actual system call or virtual driver.
|
||||
typedef int (*ioctl)(int, int, ...);
|
||||
typedef int (*open)(const char *, int, ...);
|
||||
typedef int (*close)(int);
|
||||
typedef int (*poll)(struct pollfd *, nfds_t, int);
|
||||
typedef ssize_t (*pread)(int, void *, size_t, off_t);
|
||||
typedef ssize_t (*pwrite)(int, const void *, size_t, off_t);
|
||||
typedef int (*pthread_cancel)(pthread_t thread);
|
||||
typedef int (*dup)(int fd);
|
||||
typedef ssize_t (*read)(int, void *, size_t);
|
||||
typedef ssize_t (*write)(int, const void *, size_t);
|
||||
typedef int (*eventfd)(unsigned int, int);
|
||||
|
||||
static bool getline_(fstream &fs, std::string &line); // NOLINT
|
||||
|
||||
static ioctl ioctl_;
|
||||
static open open_;
|
||||
static close close_;
|
||||
static poll poll_;
|
||||
static pread pread_;
|
||||
static pwrite pwrite_;
|
||||
static pthread_cancel pthread_cancel_;
|
||||
static dup dup_;
|
||||
static read read_;
|
||||
static write write_;
|
||||
static eventfd eventfd_;
|
||||
};
|
||||
|
||||
class DynLib {
|
||||
public:
|
||||
~DynLib();
|
||||
bool Open(const char *lib_name);
|
||||
bool Sym(const char *func_name, void **func_ptr);
|
||||
const char * Error() { return ::dlerror(); }
|
||||
operator bool() const { return lib_ != NULL; }
|
||||
|
||||
private:
|
||||
void Close();
|
||||
|
||||
void *lib_ = NULL;
|
||||
};
|
||||
|
||||
} // namespace sdm
|
||||
|
||||
#endif // __SYS_H__
|
Loading…
Add table
Add a link
Reference in a new issue