summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSushil Chauhan <sushilchauhan@codeaurora.org>2016-12-09 15:16:15 -0800
committerSushil Chauhan <sushilchauhan@codeaurora.org>2016-12-16 16:07:01 -0800
commitf27f5e7b4783c5434e391696dc617f6dbabe06f0 (patch)
tree5326ea05903a0e439b87eb25bcc2d01739aa4570
parentbf2b25c1064e856a69821d7e65148f3ed3544ee5 (diff)
downloaddisplay-f27f5e7b4783c5434e391696dc617f6dbabe06f0.tar.gz
sdm: Define Socket Handler interface
1. Define Socket Handler interface for SDM. 2. Add HWC Socket Handler implementation. 3. SDM will use this interface to get the platform specific DPPS Socket fd from HWC. CRs-Fixed: 1099069 Change-Id: I8c3b48306d4ee994133990a160e4c4f3a90b1875
-rw-r--r--sdm/include/core/core_interface.h24
-rw-r--r--sdm/include/core/socket_handler.h75
-rw-r--r--sdm/libs/core/Android.mk3
-rw-r--r--sdm/libs/core/comp_manager.cpp3
-rw-r--r--sdm/libs/core/comp_manager.h3
-rw-r--r--sdm/libs/core/core_impl.cpp10
-rw-r--r--sdm/libs/core/core_impl.h4
-rw-r--r--sdm/libs/core/core_interface.cpp11
-rw-r--r--sdm/libs/hwc/Android.mk3
-rw-r--r--sdm/libs/hwc/hwc_session.cpp3
-rw-r--r--sdm/libs/hwc/hwc_session.h2
-rw-r--r--sdm/libs/hwc/hwc_socket_handler.cpp48
-rw-r--r--sdm/libs/hwc/hwc_socket_handler.h47
-rw-r--r--sdm/libs/hwc2/Android.mk3
-rw-r--r--sdm/libs/hwc2/hwc_session.cpp3
-rw-r--r--sdm/libs/hwc2/hwc_session.h1
16 files changed, 231 insertions, 12 deletions
diff --git a/sdm/include/core/core_interface.h b/sdm/include/core/core_interface.h
index 8f97cb48..85001bd9 100644
--- a/sdm/include/core/core_interface.h
+++ b/sdm/include/core/core_interface.h
@@ -43,6 +43,7 @@
#include "sdm_types.h"
#include "buffer_allocator.h"
#include "buffer_sync_handler.h"
+#include "socket_handler.h"
/*! @brief Display manager interface version.
@@ -132,6 +133,29 @@ class CoreInterface {
BufferSyncHandler *buffer_sync_handler, CoreInterface **interface,
uint32_t version = SDM_VERSION_TAG);
+ /*! @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[in] socket_handler \link SocketHandler \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,
+ SocketHandler *socket_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.
diff --git a/sdm/include/core/socket_handler.h b/sdm/include/core/socket_handler.h
new file mode 100644
index 00000000..e7fe00e4
--- /dev/null
+++ b/sdm/include/core/socket_handler.h
@@ -0,0 +1,75 @@
+/*
+* 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.
+*/
+
+/*! @file socket_handler.h
+ @brief Interface file for platform specific Socket Handler.
+
+ @details SDM will use this interface to get the platform specific Socket fd.
+*/
+
+#ifndef __SOCKET_HANDLER_H__
+#define __SOCKET_HANDLER_H__
+
+namespace sdm {
+
+/*! @brief This enum represents Socket types, for which SDM can request the fd.
+
+*/
+enum SocketType {
+ kDpps, //!< Socket for Dpps
+};
+
+/*! @brief Socket handler implemented by the client
+
+ @details This class declares prototype for SocketHandler methods which must be
+ implemented by client. SDM will use these methods to get the platform specific Socket fd.
+
+ @sa CoreInterface::CreateCore
+*/
+class SocketHandler {
+ public:
+ /*! @brief Method to get the platform specific Socket fd for a given socket type.
+
+ @details This method returns the platform specific Socket fd for a given socket type.
+ It is the responsibility of the caller to close the file descriptor.
+
+ @param[in] socket_type
+
+ @return \link int \endlink
+ */
+
+ virtual int GetSocketFd(SocketType socket_type) = 0;
+
+ protected:
+ virtual ~SocketHandler() { }
+};
+
+} // namespace sdm
+
+#endif // __SOCKET_HANDLER_H__
diff --git a/sdm/libs/core/Android.mk b/sdm/libs/core/Android.mk
index 8600c551..c05b1e39 100644
--- a/sdm/libs/core/Android.mk
+++ b/sdm/libs/core/Android.mk
@@ -42,7 +42,8 @@ LOCAL_COPY_HEADERS = $(SDM_HEADER_PATH)/core/buffer_allocator.h \
$(SDM_HEADER_PATH)/core/dump_interface.h \
$(SDM_HEADER_PATH)/core/layer_buffer.h \
$(SDM_HEADER_PATH)/core/layer_stack.h \
- $(SDM_HEADER_PATH)/core/sdm_types.h
+ $(SDM_HEADER_PATH)/core/sdm_types.h \
+ $(SDM_HEADER_PATH)/core/socket_handler.h
include $(BUILD_COPY_HEADERS)
include $(CLEAR_VARS)
diff --git a/sdm/libs/core/comp_manager.cpp b/sdm/libs/core/comp_manager.cpp
index 199be867..509c53f4 100644
--- a/sdm/libs/core/comp_manager.cpp
+++ b/sdm/libs/core/comp_manager.cpp
@@ -42,7 +42,8 @@ static bool NeedsScaledComposition(const DisplayConfigVariableInfo &fb_config,
DisplayError CompManager::Init(const HWResourceInfo &hw_res_info,
ExtensionInterface *extension_intf,
BufferAllocator *buffer_allocator,
- BufferSyncHandler *buffer_sync_handler) {
+ BufferSyncHandler *buffer_sync_handler,
+ SocketHandler *socket_handler) {
SCOPE_LOCK(locker_);
DisplayError error = kErrorNone;
diff --git a/sdm/libs/core/comp_manager.h b/sdm/libs/core/comp_manager.h
index 49a7ce06..480ce43f 100644
--- a/sdm/libs/core/comp_manager.h
+++ b/sdm/libs/core/comp_manager.h
@@ -40,7 +40,8 @@ namespace sdm {
class CompManager : public DumpImpl {
public:
DisplayError Init(const HWResourceInfo &hw_res_info_, ExtensionInterface *extension_intf,
- BufferAllocator *buffer_allocator, BufferSyncHandler *buffer_sync_handler);
+ BufferAllocator *buffer_allocator, BufferSyncHandler *buffer_sync_handler,
+ SocketHandler *socket_handler);
DisplayError Deinit();
DisplayError RegisterDisplay(DisplayType type, const HWDisplayAttributes &display_attributes,
const HWPanelInfo &hw_panel_info,
diff --git a/sdm/libs/core/core_impl.cpp b/sdm/libs/core/core_impl.cpp
index 59761764..369e2ddb 100644
--- a/sdm/libs/core/core_impl.cpp
+++ b/sdm/libs/core/core_impl.cpp
@@ -39,8 +39,10 @@
namespace sdm {
CoreImpl::CoreImpl(BufferAllocator *buffer_allocator,
- BufferSyncHandler *buffer_sync_handler)
- : buffer_allocator_(buffer_allocator), buffer_sync_handler_(buffer_sync_handler) {
+ BufferSyncHandler *buffer_sync_handler,
+ SocketHandler *socket_handler)
+ : buffer_allocator_(buffer_allocator), buffer_sync_handler_(buffer_sync_handler),
+ socket_handler_(socket_handler) {
}
DisplayError CoreImpl::Init() {
@@ -76,7 +78,9 @@ DisplayError CoreImpl::Init() {
goto CleanupOnError;
}
- error = comp_mgr_.Init(hw_resource_, extension_intf_, buffer_allocator_, buffer_sync_handler_);
+ error = comp_mgr_.Init(hw_resource_, extension_intf_, buffer_allocator_,
+ buffer_sync_handler_, socket_handler_);
+
if (error != kErrorNone) {
goto CleanupOnError;
}
diff --git a/sdm/libs/core/core_impl.h b/sdm/libs/core/core_impl.h
index 459495d3..2647c78d 100644
--- a/sdm/libs/core/core_impl.h
+++ b/sdm/libs/core/core_impl.h
@@ -42,7 +42,8 @@ class CoreImpl : public CoreInterface {
public:
// This class implements display core interface revision 1.0.
static const uint16_t kRevision = SET_REVISION(1, 0);
- CoreImpl(BufferAllocator *buffer_allocator, BufferSyncHandler *buffer_sync_handler);
+ CoreImpl(BufferAllocator *buffer_allocator, BufferSyncHandler *buffer_sync_handler,
+ SocketHandler *socket_handler);
virtual ~CoreImpl() { }
// This method returns the interface revision for the current display core object.
@@ -69,6 +70,7 @@ class CoreImpl : public CoreInterface {
ExtensionInterface *extension_intf_ = NULL;
CreateExtensionInterface create_extension_intf_ = NULL;
DestroyExtensionInterface destroy_extension_intf_ = NULL;
+ SocketHandler *socket_handler_ = NULL;
};
} // namespace sdm
diff --git a/sdm/libs/core/core_interface.cpp b/sdm/libs/core/core_interface.cpp
index 177e7bfb..911ad014 100644
--- a/sdm/libs/core/core_interface.cpp
+++ b/sdm/libs/core/core_interface.cpp
@@ -56,6 +56,15 @@ DisplayError CoreInterface::CreateCore(DebugHandler *debug_handler,
BufferAllocator *buffer_allocator,
BufferSyncHandler *buffer_sync_handler,
CoreInterface **interface, uint32_t client_version) {
+ return CreateCore(debug_handler, buffer_allocator, buffer_sync_handler, NULL,
+ interface, client_version);
+}
+
+DisplayError CoreInterface::CreateCore(DebugHandler *debug_handler,
+ BufferAllocator *buffer_allocator,
+ BufferSyncHandler *buffer_sync_handler,
+ SocketHandler *socket_handler,
+ CoreInterface **interface, uint32_t client_version) {
SCOPE_LOCK(g_core.locker);
if (!debug_handler || !buffer_allocator || !buffer_sync_handler || !interface) {
@@ -81,7 +90,7 @@ DisplayError CoreInterface::CreateCore(DebugHandler *debug_handler,
// Create appropriate CoreImpl object based on client version.
if (GET_REVISION(client_version) == CoreImpl::kRevision) {
- core_impl = new CoreImpl(buffer_allocator, buffer_sync_handler);
+ core_impl = new CoreImpl(buffer_allocator, buffer_sync_handler, socket_handler);
} else {
return kErrorNotSupported;
}
diff --git a/sdm/libs/hwc/Android.mk b/sdm/libs/hwc/Android.mk
index d2828b46..594ade9d 100644
--- a/sdm/libs/hwc/Android.mk
+++ b/sdm/libs/hwc/Android.mk
@@ -29,7 +29,8 @@ LOCAL_SRC_FILES := hwc_session.cpp \
hwc_color_manager.cpp \
blit_engine_c2d.cpp \
cpuhint.cpp \
- hwc_tonemapper.cpp
+ hwc_tonemapper.cpp \
+ hwc_socket_handler.cpp
include $(BUILD_SHARED_LIBRARY)
endif
diff --git a/sdm/libs/hwc/hwc_session.cpp b/sdm/libs/hwc/hwc_session.cpp
index a7f4d67c..2d0605a8 100644
--- a/sdm/libs/hwc/hwc_session.cpp
+++ b/sdm/libs/hwc/hwc_session.cpp
@@ -131,7 +131,8 @@ int HWCSession::Init() {
}
DisplayError error = CoreInterface::CreateCore(HWCDebugHandler::Get(), &buffer_allocator_,
- &buffer_sync_handler_, &core_intf_);
+ &buffer_sync_handler_, &socket_handler_,
+ &core_intf_);
if (error != kErrorNone) {
DLOGE("Display core initialization failed. Error = %d", error);
return -EINVAL;
diff --git a/sdm/libs/hwc/hwc_session.h b/sdm/libs/hwc/hwc_session.h
index c0dba84e..6ef92eb2 100644
--- a/sdm/libs/hwc/hwc_session.h
+++ b/sdm/libs/hwc/hwc_session.h
@@ -33,6 +33,7 @@
#include "hwc_display_external.h"
#include "hwc_display_virtual.h"
#include "hwc_color_manager.h"
+#include "hwc_socket_handler.h"
namespace sdm {
@@ -149,6 +150,7 @@ class HWCSession : hwc_composer_device_1_t, public qClient::BnQClient {
bool is_hdmi_primary_ = false;
bool is_hdmi_yuv_ = false;
std::bitset<HWC_NUM_DISPLAY_TYPES> connected_displays_; // Bit mask of connected displays
+ HWCSocketHandler socket_handler_;
};
} // namespace sdm
diff --git a/sdm/libs/hwc/hwc_socket_handler.cpp b/sdm/libs/hwc/hwc_socket_handler.cpp
new file mode 100644
index 00000000..7ebaab48
--- /dev/null
+++ b/sdm/libs/hwc/hwc_socket_handler.cpp
@@ -0,0 +1,48 @@
+/*
+* 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.
+*/
+
+#include <cutils/sockets.h>
+#include "hwc_socket_handler.h"
+
+#define __CLASS__ "HWCSocketHandler"
+
+#define DPPS_SOCKET "pps"
+
+namespace sdm {
+
+int HWCSocketHandler::GetSocketFd(SocketType socket_type) {
+ switch (socket_type) {
+ case kDpps:
+ return socket_local_client(DPPS_SOCKET, ANDROID_SOCKET_NAMESPACE_RESERVED, SOCK_STREAM);
+ default:
+ return -1;
+ }
+}
+
+} // namespace sdm
diff --git a/sdm/libs/hwc/hwc_socket_handler.h b/sdm/libs/hwc/hwc_socket_handler.h
new file mode 100644
index 00000000..5b2292a2
--- /dev/null
+++ b/sdm/libs/hwc/hwc_socket_handler.h
@@ -0,0 +1,47 @@
+/*
+* 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 __HWC_SOCKET_HANDLER_H__
+#define __HWC_SOCKET_HANDLER_H__
+
+#include <core/socket_handler.h>
+
+namespace sdm {
+
+class HWCSocketHandler : public SocketHandler {
+ public:
+ HWCSocketHandler() { }
+
+ virtual int GetSocketFd(SocketType socket_type);
+};
+
+} // namespace sdm
+
+#endif // __HWC_SOCKET_HANDLER_H__
diff --git a/sdm/libs/hwc2/Android.mk b/sdm/libs/hwc2/Android.mk
index f633d7e6..75d7f9be 100644
--- a/sdm/libs/hwc2/Android.mk
+++ b/sdm/libs/hwc2/Android.mk
@@ -31,7 +31,8 @@ LOCAL_SRC_FILES := hwc_session.cpp \
hwc_layers.cpp \
hwc_callbacks.cpp \
../hwc/blit_engine_c2d.cpp \
- ../hwc/cpuhint.cpp
+ ../hwc/cpuhint.cpp \
+ ../hwc/hwc_socket_handler.cpp
include $(BUILD_SHARED_LIBRARY)
endif
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp
index 96111d9f..8fcc2551 100644
--- a/sdm/libs/hwc2/hwc_session.cpp
+++ b/sdm/libs/hwc2/hwc_session.cpp
@@ -95,7 +95,8 @@ int HWCSession::Init() {
}
DisplayError error = CoreInterface::CreateCore(HWCDebugHandler::Get(), &buffer_allocator_,
- &buffer_sync_handler_, &core_intf_);
+ &buffer_sync_handler_, &socket_handler_,
+ &core_intf_);
if (error != kErrorNone) {
DLOGE("Display core initialization failed. Error = %d", error);
return -EINVAL;
diff --git a/sdm/libs/hwc2/hwc_session.h b/sdm/libs/hwc2/hwc_session.h
index 7ae59ed6..43ae0ccc 100644
--- a/sdm/libs/hwc2/hwc_session.h
+++ b/sdm/libs/hwc2/hwc_session.h
@@ -186,6 +186,7 @@ class HWCSession : hwc2_device_t, public qClient::BnQClient {
bool need_invalidate_ = false;
int bw_mode_release_fd_ = -1;
qService::QService *qservice_ = NULL;
+ HWCSocketHandler socket_handler_;
};
} // namespace sdm