summaryrefslogtreecommitdiff
authorbaocheng sun <baocheng.sun@amlogic.com>2020-05-28 05:43:31 (GMT)
committer baocheng sun <baocheng.sun@amlogic.com>2020-05-29 09:39:23 (GMT)
commitc6e40cc32076117f896327124d6a3df8c3bf5b2c (patch)
treef627b20d02e33ecd4929cdd94f2c367c936f99c9
parent26d4b3ab2aa2310c0eb48ded1686c66cc9168553 (diff)
downloadhwcomposer-r-tv-dev.zip
hwcomposer-r-tv-dev.tar.gz
hwcomposer-r-tv-dev.tar.bz2
hwc: enable meson-display service [2/5]
PD#SWPL-14827 Problem: enable meson_display sdk on android R Solution: enable meson_display service in hwc Verify: newton Change-Id: Ie4add3e7847fd6b7f824f4f2c98c0a9845b762bd Signed-off-by: baocheng sun <baocheng.sun@amlogic.com>
Diffstat
-rw-r--r--common/display/include/HwDisplayConnector.h8
-rw-r--r--common/hwc/ActiveModeMgr.cpp (renamed from hwc2/ActiveModeMgr.cpp)0
-rw-r--r--common/hwc/Android.mk5
-rw-r--r--common/hwc/FixedSizeModeMgr.cpp (renamed from hwc2/FixedSizeModeMgr.cpp)0
-rw-r--r--common/hwc/HwcModeMgr.cpp (renamed from hwc2/HwcModeMgr.cpp)0
-rw-r--r--common/hwc/RealModeMgr.cpp (renamed from hwc2/RealModeMgr.cpp)0
-rw-r--r--common/hwc/VariableModeMgr.cpp (renamed from hwc2/VariableModeMgr.cpp)0
-rw-r--r--common/hwc/include/ActiveModeMgr.h (renamed from hwc2/ActiveModeMgr.h)0
-rw-r--r--common/hwc/include/FixedSizeModeMgr.h (renamed from hwc2/FixedSizeModeMgr.h)0
-rw-r--r--common/hwc/include/RealModeMgr.h (renamed from hwc2/RealModeMgr.h)0
-rw-r--r--common/hwc/include/VariableModeMgr.h (renamed from hwc2/VariableModeMgr.h)0
-rw-r--r--hwc2/Android.mk62
-rwxr-xr-xhwc2/Hwc2Display.cpp18
-rw-r--r--hwc2/Hwc2Display.h4
-rw-r--r--hwc2/Hwc2Module.cpp9
-rw-r--r--hwc2/MesonHwc2.cpp8
-rw-r--r--hwc2/MesonHwc2.h9
-rw-r--r--postprocessor/Android.mk3
-rw-r--r--postprocessor/fbprocessor/CopyProcessor.cpp16
-rw-r--r--service/2.3/default/android.hardware.graphics.composer@2.3-service.droidlogic.xml9
-rw-r--r--service/2.4/default/android.hardware.graphics.composer@2.4-service.droidlogic.xml9
21 files changed, 138 insertions, 22 deletions
diff --git a/common/display/include/HwDisplayConnector.h b/common/display/include/HwDisplayConnector.h
index acb121d..42c4bff 100644
--- a/common/display/include/HwDisplayConnector.h
+++ b/common/display/include/HwDisplayConnector.h
@@ -22,6 +22,10 @@
class HwDisplayCrtc;
+namespace meson {
+ class DisplayAdapterLocal;
+};
+
class HwDisplayConnector {
public:
HwDisplayConnector(int32_t drvFd, uint32_t id);
@@ -47,12 +51,12 @@ public:
virtual int32_t setMode(drm_mode_info_t & mode __unused) { return 0;};
virtual uint32_t getId() { return mId;};
+ friend meson::DisplayAdapterLocal;
- protected:
+protected:
virtual void loadPhysicalSize();
virtual int32_t addDisplayMode(std::string& mode);
-protected:
int32_t mDrvFd;
uint32_t mId;
diff --git a/hwc2/ActiveModeMgr.cpp b/common/hwc/ActiveModeMgr.cpp
index 2d6cf78..2d6cf78 100644
--- a/hwc2/ActiveModeMgr.cpp
+++ b/common/hwc/ActiveModeMgr.cpp
diff --git a/common/hwc/Android.mk b/common/hwc/Android.mk
index c6910d5..4b160da 100644
--- a/common/hwc/Android.mk
+++ b/common/hwc/Android.mk
@@ -128,6 +128,11 @@ LOCAL_SRC_FILES := \
HwcVsync.cpp \
HwcConfig.cpp \
HwcPowerMode.cpp \
+ HwcModeMgr.cpp \
+ ActiveModeMgr.cpp \
+ RealModeMgr.cpp \
+ FixedSizeModeMgr.cpp \
+ VariableModeMgr.cpp \
HwcDisplayPipe.cpp \
FixedDisplayPipe.cpp \
LoopbackDisplayPipe.cpp \
diff --git a/hwc2/FixedSizeModeMgr.cpp b/common/hwc/FixedSizeModeMgr.cpp
index 9913a35..9913a35 100644
--- a/hwc2/FixedSizeModeMgr.cpp
+++ b/common/hwc/FixedSizeModeMgr.cpp
diff --git a/hwc2/HwcModeMgr.cpp b/common/hwc/HwcModeMgr.cpp
index c6d4c62..c6d4c62 100644
--- a/hwc2/HwcModeMgr.cpp
+++ b/common/hwc/HwcModeMgr.cpp
diff --git a/hwc2/RealModeMgr.cpp b/common/hwc/RealModeMgr.cpp
index 543e671..543e671 100644
--- a/hwc2/RealModeMgr.cpp
+++ b/common/hwc/RealModeMgr.cpp
diff --git a/hwc2/VariableModeMgr.cpp b/common/hwc/VariableModeMgr.cpp
index da4017d..da4017d 100644
--- a/hwc2/VariableModeMgr.cpp
+++ b/common/hwc/VariableModeMgr.cpp
diff --git a/hwc2/ActiveModeMgr.h b/common/hwc/include/ActiveModeMgr.h
index fb1c2c7..fb1c2c7 100644
--- a/hwc2/ActiveModeMgr.h
+++ b/common/hwc/include/ActiveModeMgr.h
diff --git a/hwc2/FixedSizeModeMgr.h b/common/hwc/include/FixedSizeModeMgr.h
index 683a367..683a367 100644
--- a/hwc2/FixedSizeModeMgr.h
+++ b/common/hwc/include/FixedSizeModeMgr.h
diff --git a/hwc2/RealModeMgr.h b/common/hwc/include/RealModeMgr.h
index 4c36b56..4c36b56 100644
--- a/hwc2/RealModeMgr.h
+++ b/common/hwc/include/RealModeMgr.h
diff --git a/hwc2/VariableModeMgr.h b/common/hwc/include/VariableModeMgr.h
index 557f598..557f598 100644
--- a/hwc2/VariableModeMgr.h
+++ b/common/hwc/include/VariableModeMgr.h
diff --git a/hwc2/Android.mk b/hwc2/Android.mk
index 5d43f10..9304362 100644
--- a/hwc2/Android.mk
+++ b/hwc2/Android.mk
@@ -17,14 +17,13 @@ ifeq ($(USE_HWC2), true)
$(info "Build HWC 2.0")
LOCAL_PATH := $(call my-dir)
+
include $(CLEAR_VARS)
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28 && echo OK),OK)
LOCAL_PROPRIETARY_MODULE := true
endif
-LOCAL_MODULE_RELATIVE_PATH := hw
-
LOCAL_CPPFLAGS := $(HWC_CPP_FLAGS)
LOCAL_CFLAGS := $(HWC_C_FLAGS)
LOCAL_SHARED_LIBRARIES := $(HWC_SHARED_LIBS)
@@ -42,12 +41,6 @@ LOCAL_SRC_FILES := \
Hwc2Base.cpp \
Hwc2Display.cpp \
Hwc2Layer.cpp \
- Hwc2Module.cpp \
- HwcModeMgr.cpp \
- FixedSizeModeMgr.cpp \
- VariableModeMgr.cpp \
- ActiveModeMgr.cpp \
- RealModeMgr.cpp \
MesonHwc2.cpp
LOCAL_C_INCLUDES := \
@@ -66,6 +59,59 @@ LOCAL_STATIC_LIBRARIES := \
libomxutil
LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE := hwc.composer_static
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+ $(LOCAL_PATH)
+
+include $(BUILD_STATIC_LIBRARY)
+
+
+include $(CLEAR_VARS)
+
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28 && echo OK),OK)
+LOCAL_PROPRIETARY_MODULE := true
+endif
+
+LOCAL_MODULE_RELATIVE_PATH := hw
+
+LOCAL_CPPFLAGS := $(HWC_CPP_FLAGS)
+LOCAL_CFLAGS := $(HWC_C_FLAGS)
+LOCAL_SHARED_LIBRARIES := \
+ $(HWC_SHARED_LIBS) \
+ vendor.amlogic.display.meson_display_ipc@1.0 \
+ libmeson_display_service
+
+# hwc 2.2 interface enable
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 28 && echo OK),OK)
+LOCAL_CFLAGS += -DHWC_HDR_METADATA_SUPPORT
+endif
+
+ifeq ($(HWC_SUPPORT_MODES_LIST), true)
+LOCAL_CFLAGS += -DHWC_SUPPORT_MODES_LIST
+endif
+
+LOCAL_SRC_FILES := \
+ Hwc2Module.cpp
+
+LOCAL_C_INCLUDES := \
+ hardware/libhardware/include \
+ $(LOCAL_PATH)/include
+
+# !!! static lib sequence is serious, donot change it.
+LOCAL_STATIC_LIBRARIES := \
+ libmeson_display_adapter_local \
+ hwc.composer_static \
+ hwc.common_static \
+ hwc.composition_static \
+ hwc.postprocessor_static \
+ hwc.display_static \
+ hwc.base_static \
+ hwc.utils_static \
+ hwc.debug_static \
+ libomxutil
+
+LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := hwcomposer.amlogic
include $(BUILD_SHARED_LIBRARY)
diff --git a/hwc2/Hwc2Display.cpp b/hwc2/Hwc2Display.cpp
index bbaa9b3..154d807 100755
--- a/hwc2/Hwc2Display.cpp
+++ b/hwc2/Hwc2Display.cpp
@@ -10,6 +10,7 @@
#include <inttypes.h>
#include "Hwc2Display.h"
+#include "Hwc2Layer.h"
#include "Hwc2Base.h"
#include <DrmTypes.h>
@@ -23,6 +24,10 @@
#include <EventThread.h>
#include <systemcontrol.h>
+#include "am_gralloc_ext.h"
+
+#include "CopyProcessor.h"
+
Hwc2Display::Hwc2Display(std::shared_ptr<Hwc2DisplayObserver> observer) {
mObserver = observer;
mForceClientComposer = false;
@@ -1136,3 +1141,16 @@ void Hwc2Display::dump(String8 & dumpstr) {
dumpHwDisplayPlane(dumpstr);
}
+int32_t Hwc2Display::captureDisplayScreen(buffer_handle_t hnd) {
+ int ret = -1;
+ std::shared_ptr<DrmFramebuffer> capBuffer;
+
+ ALOGD("hwc2Display:: captureDisplayScreen");
+ if (mPostProcessor && hnd) {
+ capBuffer = std::make_shared<DrmFramebuffer>(hnd, -1);
+ //ret = mPostProcessor->getScreencapFb(capBuffer);
+ capBuffer.reset();
+ }
+
+ return ret;
+}
diff --git a/hwc2/Hwc2Display.h b/hwc2/Hwc2Display.h
index 0608d13..60e715b 100644
--- a/hwc2/Hwc2Display.h
+++ b/hwc2/Hwc2Display.h
@@ -119,6 +119,10 @@ public:
virtual void onModeChanged(int stage);
virtual void getDispMode(drm_mode_info_t & dispMode);
+/* meson display ddk */
+public:
+ int32_t captureDisplayScreen(buffer_handle_t hnd);
+
protected:
/* For compose. */
hwc2_error_t collectLayersForPresent();
diff --git a/hwc2/Hwc2Module.cpp b/hwc2/Hwc2Module.cpp
index 366ebbd..ce7dd92 100644
--- a/hwc2/Hwc2Module.cpp
+++ b/hwc2/Hwc2Module.cpp
@@ -14,6 +14,8 @@
#include <MesonLog.h>
#include "MesonHwc2.h"
+#include "DisplayAdapterLocal.h"
+#include "DisplayService.h"
typedef struct hwc2_impl {
hwc2_device_t base;
@@ -529,7 +531,7 @@ static int hwc2_device_open(
/*init hwc device. */
hwc2_impl_t * hwc = (hwc2_impl_t*)calloc(1, sizeof(hwc2_impl_t));
- hwc->impl = new MesonHwc2();
+ hwc->impl = &(MesonHwc2::getInstance());
hwc->base.common.module = const_cast<hw_module_t*>(module);
hwc->base.common.version = HWC_DEVICE_API_VERSION_2_0;
@@ -538,6 +540,11 @@ static int hwc2_device_open(
hwc->base.getFunction = hwc2_getFunction;
*device = reinterpret_cast<hw_device_t*>(hwc);
+ static meson::DisplayServer* server;
+ std::unique_ptr<meson::DisplayAdapter> adapter =
+ meson::DisplayAdapterLocal::create(meson::DisplayAdapter::BackendType::DISPLAY_TYPE_FBDEV);
+ server = new meson::DisplayServer(adapter);
+ UNUSED(server);
return 0;
}
diff --git a/hwc2/MesonHwc2.cpp b/hwc2/MesonHwc2.cpp
index 96142b3..dcc73ac 100644
--- a/hwc2/MesonHwc2.cpp
+++ b/hwc2/MesonHwc2.cpp
@@ -59,6 +59,9 @@
static bool m3DMode = false;
static bool mKeyStoneMode = false;
#endif
+
+ANDROID_SINGLETON_STATIC_INSTANCE(MesonHwc2)
+
/************************************************************
* Hal Interface
************************************************************/
@@ -776,6 +779,11 @@ void MesonHwc2::onHotplug(hwc2_display_t display, bool connected) {
}
}
+int32_t MesonHwc2::captureDisplayScreen(buffer_handle_t hnd) {
+ GET_HWC_DISPLAY(0);
+ return hwcDisplay->captureDisplayScreen(hnd);
+}
+
int32_t MesonHwc2::initialize() {
std::map<uint32_t, std::shared_ptr<HwcDisplay>> mhwcDisps;
mDisplayPipe = createDisplayPipe(HwcConfig::getPipeline());
diff --git a/hwc2/MesonHwc2.h b/hwc2/MesonHwc2.h
index 562640c..94356ab 100644
--- a/hwc2/MesonHwc2.h
+++ b/hwc2/MesonHwc2.h
@@ -11,12 +11,11 @@
#include <map>
#include <hardware/hardware.h>
-#include <HwcDisplayPipe.h>
+#include "HwcDisplayPipe.h"
#include "Hwc2Display.h"
-
-class MesonHwc2 {
+class MesonHwc2 : public android::Singleton<MesonHwc2> {
/*hwc2 interface*/
public:
void getCapabilities(uint32_t* outCount, int32_t* outCapabilities);
@@ -144,6 +143,10 @@ public:
MesonHwc2();
virtual ~MesonHwc2();
+/* for meson display service */
+public:
+ int32_t captureDisplayScreen(buffer_handle_t hnd);
+
protected:
int32_t initialize();
bool isDisplayValid(hwc2_display_t display);
diff --git a/postprocessor/Android.mk b/postprocessor/Android.mk
index db09d71..22ea245 100644
--- a/postprocessor/Android.mk
+++ b/postprocessor/Android.mk
@@ -38,7 +38,8 @@ LOCAL_STATIC_LIBRARIES := \
hwc.display_static
LOCAL_EXPORT_C_INCLUDE_DIRS := \
- $(LOCAL_PATH)/include
+ $(LOCAL_PATH)/include \
+ $(LOCAL_PATH)/fbprocessor
LOCAL_MODULE := hwc.postprocessor_static
diff --git a/postprocessor/fbprocessor/CopyProcessor.cpp b/postprocessor/fbprocessor/CopyProcessor.cpp
index 24cacbb..93abb7d 100644
--- a/postprocessor/fbprocessor/CopyProcessor.cpp
+++ b/postprocessor/fbprocessor/CopyProcessor.cpp
@@ -9,6 +9,8 @@
#include "CopyProcessor.h"
#include <MesonLog.h>
+#include <ui/PixelFormat.h>
+
CopyProcessor::CopyProcessor() {
}
@@ -31,19 +33,19 @@ int32_t CopyProcessor::process(
int instride = am_gralloc_get_stride_in_pixel(inputfb->mBufferHandle);
int outstride = am_gralloc_get_stride_in_pixel(outfb->mBufferHandle);
- //MESON_LOGD("CopyProcessor %dx%d(%d,%d), fmt %d, %d",
- // w, h, instride, outstride, infmt, outfmt);
+ MESON_LOGD("CopyProcessor %dx%d stride (%d,%d), fmt %d, %d",
+ w, h, instride, outstride, infmt, outfmt);
if (inputfb->lock(&inmem) == 0 && outfb->lock(&outmem) == 0) {
char * src = (char *)inmem;
char * dst = (char *)outmem;
- if (infmt == HAL_PIXEL_FORMAT_RGB_888 &&
- outfmt == HAL_PIXEL_FORMAT_RGB_888) {
+ if (infmt == outfmt) {
+ int32_t bytes = bytesPerPixel(infmt);
for (int ir = 0; ir < h; ir++) {
- memcpy(dst, src, w * 3);
- src += instride * 3;
- dst += outstride * 3;
+ memcpy(dst, src, w * bytes);
+ src += instride * bytes;
+ dst += outstride * bytes;
}
}
diff --git a/service/2.3/default/android.hardware.graphics.composer@2.3-service.droidlogic.xml b/service/2.3/default/android.hardware.graphics.composer@2.3-service.droidlogic.xml
index 07bb8d7..38d2a0a 100644
--- a/service/2.3/default/android.hardware.graphics.composer@2.3-service.droidlogic.xml
+++ b/service/2.3/default/android.hardware.graphics.composer@2.3-service.droidlogic.xml
@@ -8,4 +8,13 @@
<instance>default</instance>
</interface>
</hal>
+ <hal format="hidl">
+ <name>vendor.amlogic.display.meson_display_ipc</name>
+ <transport>hwbinder</transport>
+ <version>1.0</version>
+ <interface>
+ <name>IMesonDisplayIPC</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
</manifest>
diff --git a/service/2.4/default/android.hardware.graphics.composer@2.4-service.droidlogic.xml b/service/2.4/default/android.hardware.graphics.composer@2.4-service.droidlogic.xml
index 7f37bbd..7fa1c83 100644
--- a/service/2.4/default/android.hardware.graphics.composer@2.4-service.droidlogic.xml
+++ b/service/2.4/default/android.hardware.graphics.composer@2.4-service.droidlogic.xml
@@ -8,4 +8,13 @@
<instance>default</instance>
</interface>
</hal>
+ <hal format="hidl">
+ <name>vendor.amlogic.display.meson_display_ipc</name>
+ <transport>hwbinder</transport>
+ <version>1.0</version>
+ <interface>
+ <name>IMesonDisplayIPC</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
</manifest>