sdm: Remove libsdmutils dependency on Android.
- Make libsdmutils Android independent. - Rename debug_android.cpp to debug.cpp. - Fix compilation errors observed in linux environment. Change-Id: I19e275939b27f2f47949c5e17559eeadb09bdccf
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
ec01c56d96
commit
e2a590859a
@@ -42,8 +42,7 @@
|
|||||||
#include "display_interface.h"
|
#include "display_interface.h"
|
||||||
#include "sdm_types.h"
|
#include "sdm_types.h"
|
||||||
#include "buffer_allocator.h"
|
#include "buffer_allocator.h"
|
||||||
|
#include "buffer_sync_handler.h"
|
||||||
class BufferSyncHandler;
|
|
||||||
|
|
||||||
/*! @brief Display manager interface version.
|
/*! @brief Display manager interface version.
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace sdm {
|
|||||||
/*! @brief This enum represents different modules/logical unit tags that a log message may
|
/*! @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.
|
be associated with. Client may use this to filter messages for dynamic logging.
|
||||||
|
|
||||||
@sa DisplayLogHandler
|
@sa DebugHandler
|
||||||
*/
|
*/
|
||||||
enum DebugTag {
|
enum DebugTag {
|
||||||
kTagNone, //!< Debug log is not tagged. This type of logs should always be printed.
|
kTagNone, //!< Debug log is not tagged. This type of logs should always be printed.
|
||||||
@@ -101,6 +101,15 @@ class DebugHandler {
|
|||||||
*/
|
*/
|
||||||
virtual void EndTrace() = 0;
|
virtual void EndTrace() = 0;
|
||||||
|
|
||||||
|
/*! @brief Method to get property value corresponding to give string.
|
||||||
|
|
||||||
|
@param[in] property_name name of the property
|
||||||
|
@param[out] value value corresponding to the property name
|
||||||
|
|
||||||
|
@return \link DisplayError \endlink
|
||||||
|
` */
|
||||||
|
virtual DisplayError GetProperty(const char *property_name, int *value) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~DebugHandler() { }
|
virtual ~DebugHandler() { }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,6 +26,11 @@
|
|||||||
#define __CONSTANTS_H__
|
#define __CONSTANTS_H__
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#ifndef PRIu64
|
||||||
|
#define PRIu64 "llu"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define INT(exp) static_cast<int>(exp)
|
#define INT(exp) static_cast<int>(exp)
|
||||||
#define FLOAT(exp) static_cast<float>(exp)
|
#define FLOAT(exp) static_cast<float>(exp)
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ class Debug {
|
|||||||
debug_.debug_handler_ = debug_handler;
|
debug_.debug_handler_ = debug_handler;
|
||||||
}
|
}
|
||||||
static inline DebugHandler* Get() { return debug_.debug_handler_; }
|
static inline DebugHandler* Get() { return debug_.debug_handler_; }
|
||||||
static inline bool IsVirtualDriver() { return debug_.virtual_driver_; }
|
|
||||||
static uint32_t GetSimulationFlag();
|
static uint32_t GetSimulationFlag();
|
||||||
static uint32_t GetHDMIResolution();
|
static uint32_t GetHDMIResolution();
|
||||||
static uint32_t GetIdleTimeoutMs();
|
static uint32_t GetIdleTimeoutMs();
|
||||||
@@ -81,11 +80,13 @@ class Debug {
|
|||||||
virtual void BeginTrace(const char */*class_name*/, const char */*function_name*/,
|
virtual void BeginTrace(const char */*class_name*/, const char */*function_name*/,
|
||||||
const char */*custom_string*/) { }
|
const char */*custom_string*/) { }
|
||||||
virtual void EndTrace() { }
|
virtual void EndTrace() { }
|
||||||
|
virtual DisplayError GetProperty(const char *property_name, int *value) {
|
||||||
|
return kErrorNotSupported;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
DefaultDebugHandler default_debug_handler_;
|
DefaultDebugHandler default_debug_handler_;
|
||||||
DebugHandler *debug_handler_;
|
DebugHandler *debug_handler_;
|
||||||
bool virtual_driver_;
|
|
||||||
static Debug debug_;
|
static Debug debug_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
#define SCOPE_LOCK(locker) Locker::ScopeLock lock(locker)
|
#define SCOPE_LOCK(locker) Locker::ScopeLock lock(locker)
|
||||||
#define SEQUENCE_ENTRY_SCOPE_LOCK(locker) Locker::SequenceEntryScopeLock lock(locker)
|
#define SEQUENCE_ENTRY_SCOPE_LOCK(locker) Locker::SequenceEntryScopeLock lock(locker)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class DumpImpl {
|
|||||||
static DumpImpl *dump_list_[kMaxDumpObjects];
|
static DumpImpl *dump_list_[kMaxDumpObjects];
|
||||||
static uint32_t dump_count_;
|
static uint32_t dump_count_;
|
||||||
|
|
||||||
friend DumpInterface;
|
friend class DumpInterface;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sdm
|
} // namespace sdm
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -43,23 +45,12 @@
|
|||||||
|
|
||||||
#define __CLASS__ "HWDevice"
|
#define __CLASS__ "HWDevice"
|
||||||
|
|
||||||
#ifdef DISPLAY_CORE_VIRTUAL_DRIVER
|
|
||||||
extern int virtual_ioctl(int fd, int cmd, ...);
|
|
||||||
extern int virtual_open(const char *file_name, int access, ...);
|
|
||||||
extern int virtual_close(int fd);
|
|
||||||
extern int virtual_poll(struct pollfd *fds, nfds_t num, int timeout);
|
|
||||||
extern ssize_t virtual_pread(int fd, void *data, size_t count, off_t offset);
|
|
||||||
extern ssize_t virtual_pwrite(int fd, const void *data, size_t count, off_t offset);
|
|
||||||
extern FILE* virtual_fopen(const char *fname, const char *mode);
|
|
||||||
extern int virtual_fclose(FILE* fileptr);
|
|
||||||
extern ssize_t virtual_getline(char **lineptr, size_t *linelen, FILE *stream);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace sdm {
|
namespace sdm {
|
||||||
|
|
||||||
HWDevice::HWDevice(BufferSyncHandler *buffer_sync_handler)
|
HWDevice::HWDevice(BufferSyncHandler *buffer_sync_handler)
|
||||||
: fb_node_index_(-1), fb_path_("/sys/devices/virtual/graphics/fb"), hotplug_enabled_(false),
|
: fb_node_index_(-1), fb_path_("/sys/devices/virtual/graphics/fb"), hotplug_enabled_(false),
|
||||||
buffer_sync_handler_(buffer_sync_handler), synchronous_commit_(false) {
|
buffer_sync_handler_(buffer_sync_handler), synchronous_commit_(false) {
|
||||||
|
#ifndef SDM_VIRTUAL_DRIVER
|
||||||
// Pointer to actual driver interfaces.
|
// Pointer to actual driver interfaces.
|
||||||
ioctl_ = ::ioctl;
|
ioctl_ = ::ioctl;
|
||||||
open_ = ::open;
|
open_ = ::open;
|
||||||
@@ -70,10 +61,18 @@ HWDevice::HWDevice(BufferSyncHandler *buffer_sync_handler)
|
|||||||
fopen_ = ::fopen;
|
fopen_ = ::fopen;
|
||||||
fclose_ = ::fclose;
|
fclose_ = ::fclose;
|
||||||
getline_ = ::getline;
|
getline_ = ::getline;
|
||||||
|
#else
|
||||||
|
// Point to virtual driver interfaces.
|
||||||
|
extern int virtual_ioctl(int fd, int cmd, ...);
|
||||||
|
extern int virtual_open(const char *file_name, int access, ...);
|
||||||
|
extern int virtual_close(int fd);
|
||||||
|
extern int virtual_poll(struct pollfd *fds, nfds_t num, int timeout);
|
||||||
|
extern ssize_t virtual_pread(int fd, void *data, size_t count, off_t offset);
|
||||||
|
extern ssize_t virtual_pwrite(int fd, const void *data, size_t count, off_t offset);
|
||||||
|
extern FILE* virtual_fopen(const char *fname, const char *mode);
|
||||||
|
extern int virtual_fclose(FILE* fileptr);
|
||||||
|
extern ssize_t virtual_getline(char **lineptr, size_t *linelen, FILE *stream);
|
||||||
|
|
||||||
#ifdef DISPLAY_CORE_VIRTUAL_DRIVER
|
|
||||||
// If debug property to use virtual driver is set, point to virtual driver interfaces.
|
|
||||||
if (Debug::IsVirtualDriver()) {
|
|
||||||
ioctl_ = virtual_ioctl;
|
ioctl_ = virtual_ioctl;
|
||||||
open_ = virtual_open;
|
open_ = virtual_open;
|
||||||
close_ = virtual_close;
|
close_ = virtual_close;
|
||||||
@@ -83,7 +82,6 @@ HWDevice::HWDevice(BufferSyncHandler *buffer_sync_handler)
|
|||||||
fopen_ = virtual_fopen;
|
fopen_ = virtual_fopen;
|
||||||
fclose_ = virtual_fclose;
|
fclose_ = virtual_fclose;
|
||||||
getline_ = virtual_getline;
|
getline_ = virtual_getline;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <utils/debug.h>
|
#include <utils/debug.h>
|
||||||
@@ -382,7 +384,7 @@ HWScanSupport HWHDMI::MapHWScanSupport(uint32_t value) {
|
|||||||
void HWHDMI::ReadScanInfo() {
|
void HWHDMI::ReadScanInfo() {
|
||||||
int scan_info_file = -1;
|
int scan_info_file = -1;
|
||||||
ssize_t len = -1;
|
ssize_t len = -1;
|
||||||
char data[PAGE_SIZE] = {'\0'};
|
char data[4096] = {'\0'};
|
||||||
|
|
||||||
snprintf(data, sizeof(data), "%s%d/scan_info", fb_path_, fb_node_index_);
|
snprintf(data, sizeof(data), "%s%d/scan_info", fb_path_, fb_node_index_);
|
||||||
scan_info_file = open_(data, O_RDONLY);
|
scan_info_file = open_(data, O_RDONLY);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "hw_info.h"
|
#include "hw_info.h"
|
||||||
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
#ifndef __HW_INFO_H__
|
#ifndef __HW_INFO_H__
|
||||||
#define __HW_INFO_H__
|
#define __HW_INFO_H__
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <core/sdm_types.h>
|
#include <core/sdm_types.h>
|
||||||
#include <private/hw_info_types.h>
|
#include <private/hw_info_types.h>
|
||||||
#include "hw_info_interface.h"
|
#include "hw_info_interface.h"
|
||||||
|
|||||||
@@ -27,11 +27,14 @@
|
|||||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <sys/prctl.h>
|
#include <sys/prctl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <pthread.h>
|
#include <sys/time.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <utils/debug.h>
|
#include <utils/debug.h>
|
||||||
#include "hw_primary.h"
|
#include "hw_primary.h"
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <utils/constants.h>
|
#include <utils/constants.h>
|
||||||
|
#include <cutils/properties.h>
|
||||||
|
|
||||||
#include "hwc_debugger.h"
|
#include "hwc_debugger.h"
|
||||||
|
|
||||||
@@ -123,5 +124,16 @@ void HWCDebugHandler::EndTrace() {
|
|||||||
atrace_end(ATRACE_TAG);
|
atrace_end(ATRACE_TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DisplayError HWCDebugHandler::GetProperty(const char *property_name, int *value) {
|
||||||
|
char property[PROPERTY_VALUE_MAX];
|
||||||
|
|
||||||
|
if (property_get(property_name, property, NULL) > 0) {
|
||||||
|
*value = atoi(property);
|
||||||
|
return kErrorNone;
|
||||||
|
}
|
||||||
|
|
||||||
|
return kErrorNotSupported;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace sdm
|
} // namespace sdm
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ class HWCDebugHandler : public DebugHandler {
|
|||||||
virtual void BeginTrace(const char *class_name, const char *function_name,
|
virtual void BeginTrace(const char *class_name, const char *function_name,
|
||||||
const char *custom_string);
|
const char *custom_string);
|
||||||
virtual void EndTrace();
|
virtual void EndTrace();
|
||||||
|
virtual DisplayError GetProperty(const char *property_name, int *value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static HWCDebugHandler debug_handler_;
|
static HWCDebugHandler debug_handler_;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ LOCAL_C_INCLUDES := hardware/qcom/display/sdm/include/
|
|||||||
LOCAL_CFLAGS := -Wno-missing-field-initializers -Wno-unused-parameter \
|
LOCAL_CFLAGS := -Wno-missing-field-initializers -Wno-unused-parameter \
|
||||||
-Wconversion -Wall -Werror \
|
-Wconversion -Wall -Werror \
|
||||||
-DLOG_TAG=\"SDM\"
|
-DLOG_TAG=\"SDM\"
|
||||||
LOCAL_SHARED_LIBRARIES := libcutils
|
LOCAL_SRC_FILES := debug.cpp rect.cpp
|
||||||
LOCAL_SRC_FILES := debug_android.cpp rect.cpp
|
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|||||||
@@ -30,73 +30,54 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <utils/debug.h>
|
#include <utils/debug.h>
|
||||||
#include <utils/constants.h>
|
#include <utils/constants.h>
|
||||||
#include <cutils/log.h>
|
|
||||||
#include <cutils/properties.h>
|
|
||||||
|
|
||||||
namespace sdm {
|
namespace sdm {
|
||||||
|
|
||||||
Debug Debug::debug_;
|
Debug Debug::debug_;
|
||||||
|
|
||||||
Debug::Debug() : debug_handler_(&default_debug_handler_), virtual_driver_(false) {
|
Debug::Debug() : debug_handler_(&default_debug_handler_) {
|
||||||
char property[PROPERTY_VALUE_MAX];
|
|
||||||
if (property_get("displaycore.virtualdriver", property, NULL) > 0) {
|
|
||||||
virtual_driver_ = (atoi(property) == 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Debug::GetSimulationFlag() {
|
uint32_t Debug::GetSimulationFlag() {
|
||||||
char property[PROPERTY_VALUE_MAX];
|
int value = 0;
|
||||||
if (property_get("debug.hwc.simulate", property, NULL) > 0) {
|
debug_.debug_handler_->GetProperty("debug.hwc.simulate", &value);
|
||||||
return atoi(property);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Debug::GetHDMIResolution() {
|
uint32_t Debug::GetHDMIResolution() {
|
||||||
char property[PROPERTY_VALUE_MAX];
|
int value = 0;
|
||||||
if (property_get("hw.hdmi.resolution", property, NULL) > 0) {
|
debug_.debug_handler_->GetProperty("hw.hdmi.resolution", &value);
|
||||||
return atoi(property);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Debug::GetIdleTimeoutMs() {
|
uint32_t Debug::GetIdleTimeoutMs() {
|
||||||
char property[PROPERTY_VALUE_MAX];
|
int value = IDLE_TIMEOUT_DEFAULT_MS;
|
||||||
if (property_get("debug.mdpcomp.idletime", property, NULL) > 0) {
|
debug_.debug_handler_->GetProperty("debug.mdpcomp.idletime", &value);
|
||||||
return atoi(property);
|
|
||||||
}
|
|
||||||
|
|
||||||
return IDLE_TIMEOUT_DEFAULT_MS;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Debug::IsRotatorDownScaleDisabled() {
|
bool Debug::IsRotatorDownScaleDisabled() {
|
||||||
char property[PROPERTY_VALUE_MAX];
|
int value = 0;
|
||||||
if (property_get("sdm.disable_rotator_downscaling", property, NULL) > 0) {
|
debug_.debug_handler_->GetProperty("sdm.disable_rotator_downscaling", &value);
|
||||||
return (atoi(property) ? 0 : false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return (value == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Debug::IsDecimationDisabled() {
|
bool Debug::IsDecimationDisabled() {
|
||||||
char property[PROPERTY_VALUE_MAX];
|
int value = 0;
|
||||||
if (property_get("sdm.disable_decimation", property, NULL) > 0) {
|
debug_.debug_handler_->GetProperty("sdm.disable_decimation", &value);
|
||||||
return (atoi(property) ? 0 : false, true);
|
|
||||||
|
return (value == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This property serves to disable/enable partial update
|
|
||||||
bool Debug::IsPartialUpdateEnabled() {
|
bool Debug::IsPartialUpdateEnabled() {
|
||||||
char property[PROPERTY_VALUE_MAX];
|
int value = 0;
|
||||||
if (property_get("sdm.hwc.partial_update", property, NULL) > 0) {
|
debug_.debug_handler_->GetProperty("sdm.hwc.partial_update", &value);
|
||||||
return (atoi(property) ? 1 : true, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return (value == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sdm
|
} // namespace sdm
|
||||||
Reference in New Issue
Block a user