summaryrefslogtreecommitdiff
Diffstat
-rw-r--r--hwc2/common/base/HwcFenceControl.cpp22
-rw-r--r--hwc2/common/base/HwcLayer.cpp61
-rw-r--r--hwc2/common/base/HwcLayer.h7
-rw-r--r--hwc2/common/base/Hwcomposer.cpp3
-rw-r--r--hwc2/common/composers/Composers.cpp16
-rw-r--r--hwc2/common/composers/Composers.h15
-rw-r--r--hwc2/common/composers/GE2DComposer.cpp33
-rw-r--r--hwc2/common/composers/GE2DComposer.h22
-rw-r--r--hwc2/common/devices/PhysicalDevice.cpp598
-rw-r--r--hwc2/common/devices/PrimaryDevice.cpp13
-rw-r--r--hwc2/common/devices/VirtualDevice.cpp14
-rw-r--r--hwc2/common/hdmi/DisplayHdmi.cpp853
-rw-r--r--hwc2/common/hdmi/DisplayHdmi.h202
-rw-r--r--hwc2/common/observers/SoftVsyncObserver.cpp18
-rw-r--r--hwc2/common/observers/SoftVsyncObserver.h3
-rw-r--r--hwc2/common/observers/UeventObserver.cpp2
-rw-r--r--hwc2/common/utils/AmVideo.cpp109
-rw-r--r--hwc2/common/utils/AmVinfo.cpp928
-rw-r--r--hwc2/common/utils/Utils.cpp89
-rw-r--r--hwc2/common/utils/Utils.h30
-rw-r--r--hwc2/include/AmVideo.h45
-rw-r--r--hwc2/include/AmVinfo.h221
-rw-r--r--hwc2/include/HwcFenceControl.h15
-rw-r--r--hwc2/include/IComposer.h16
-rw-r--r--hwc2/include/IComposerFactory.h16
-rw-r--r--hwc2/include/IDisplayDevice.h16
-rw-r--r--hwc2/include/PhysicalDevice.h33
-rw-r--r--hwc2/include/VirtualDevice.h1
-rw-r--r--hwc2/platforms/Android.mk6
-rw-r--r--tvp/LICENSE23
-rw-r--r--tvp/OmxUtil.cpp48
-rw-r--r--tvp/OmxUtil.h13
32 files changed, 2617 insertions, 874 deletions
diff --git a/hwc2/common/utils/AmVideo.cpp b/hwc2/common/utils/AmVideo.cpp
new file mode 100644
index 0000000..15db0c9
--- a/dev/null
+++ b/hwc2/common/utils/AmVideo.cpp
@@ -0,0 +1,109 @@
+/*
+// Copyright (c) 2017 Amlogic
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+*/
+
+#define LOG_TAG "AmVideo"
+//#define LOG_NDEBUG 0
+#include <cutils/log.h>
+
+#include <AmVideo.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+
+//#define AMVIDEO_DEBUG
+
+using namespace android;
+
+#define AM_VIDEO_DEV "/dev/amvideo"
+
+#define AMSTREAM_IOC_MAGIC 'S'
+#define AMSTREAM_IOC_GLOBAL_GET_VIDEO_OUTPUT _IOR(AMSTREAM_IOC_MAGIC, 0x21, int)
+#define AMSTREAM_IOC_GLOBAL_SET_VIDEO_OUTPUT _IOW(AMSTREAM_IOC_MAGIC, 0x22, int)
+
+AmVideo* AmVideo::mInstance = NULL;
+Mutex AmVideo::mLock;
+
+AmVideo::AmVideo() {
+ mDevFd = open(AM_VIDEO_DEV, O_RDWR | O_NONBLOCK);
+ if (mDevFd < 0) {
+ ALOGE("Open %s Failed. ", AM_VIDEO_DEV);
+ }
+
+ if (getVideoPresent(mVideoPresent) != 0) {
+ ALOGE("Get video mute failed.");
+ mVideoPresent = true;
+ }
+}
+
+AmVideo::~AmVideo() {
+ if (mDevFd >= 0) {
+ close(mDevFd);
+ mDevFd = -1;
+ }
+}
+
+AmVideo* AmVideo::getInstance() {
+ if (mInstance == NULL) {
+ Mutex::Autolock _l(mLock);
+ if (mInstance == NULL) {
+ mInstance = new AmVideo();
+ }
+ }
+
+ return mInstance;
+}
+
+int AmVideo::presentVideo(bool bPresent) {
+ if (mDevFd < 0)
+ return -EBADF;
+
+ if (mVideoPresent != bPresent) {
+ ALOGD("muteVideo to %d", bPresent);
+ uint32_t val = bPresent ? 1 : 0;
+ if (ioctl(mDevFd, AMSTREAM_IOC_GLOBAL_SET_VIDEO_OUTPUT, val) != 0) {
+ ALOGE("AMSTREAM_SET_VIDEO_OUTPUT ioctl (%d) return(%d)", bPresent, errno);
+ return -EINVAL;
+ }
+ mVideoPresent = bPresent;
+ } else {
+ #ifdef AMVIDEO_DEBUG
+ bool val = true;
+ getVideoPresent(val);
+ if (mVideoPresent != val) {
+ ALOGE("presentVideo (%d) vs (%d)", mVideoPresent, val);
+ }
+ ALOGD("Already set video to (%d)", bPresent);
+ #endif
+ }
+
+ return 0;
+}
+
+int AmVideo::getVideoPresent(bool& output) {
+ if (mDevFd < 0)
+ return -EBADF;
+
+ uint32_t val = 1;
+ if (ioctl(mDevFd, AMSTREAM_IOC_GLOBAL_GET_VIDEO_OUTPUT, &val) != 0) {
+ ALOGE("AMSTREAM_GET_VIDEO_OUTPUT ioctl fail(%d)", errno);
+ return -EINVAL;
+ }
+
+ output = (val ==0) ? false : true;
+ return 0;
+}
+