summaryrefslogtreecommitdiff
authorTellen Yu <tellen.yu@amlogic.com>2018-01-11 11:10:03 (GMT)
committer Tellen Yu <tellen.yu@amlogic.com>2018-01-12 02:49:12 (GMT)
commita27d2d564ad0cf0bd4e0505d91828bc0ea06cf98 (patch)
tree214d398d004b61dbda5ca1b949cdbdb6fd007a72
parentf0604ca89d90261e22d25cccda411130ff795888 (diff)
downloadscreen_source-a27d2d564ad0cf0bd4e0505d91828bc0ea06cf98.zip
screen_source-a27d2d564ad0cf0bd4e0505d91828bc0ea06cf98.tar.gz
screen_source-a27d2d564ad0cf0bd4e0505d91828bc0ea06cf98.tar.bz2
screensrc: add screen source project for tv features [6/11]
PD# 157786 add screen source for T962E/X projects Change-Id: Ie88fe8efb7ddaae5db43a792cdd794d3bcb9eb11
Diffstat
-rw-r--r--Android.mk15
-rw-r--r--aml_screen.cpp2
-rw-r--r--aml_screen.h114
-rw-r--r--v4l2_vdin.cpp6
-rw-r--r--v4l2_vdin.h3
5 files changed, 131 insertions, 9 deletions
diff --git a/Android.mk b/Android.mk
index cab3802..0bdf23c 100644
--- a/Android.mk
+++ b/Android.mk
@@ -12,12 +12,15 @@ LOCAL_SRC_FILES := aml_screen.cpp v4l2_vdin.cpp
MESON_GRALLOC_DIR ?= hardware/amlogic/gralloc
-LOCAL_C_INCLUDES += frameworks/native/include/utils \
- frameworks/native/include/android \
- system/core/include/utils \
- system/core/libion/include \
- system/core/libion/kernel-headers \
- $(MESON_GRALLOC_DIR)
+LOCAL_C_INCLUDES += \
+ frameworks/native/include/utils \
+ frameworks/native/include \
+ frameworks/native/include/android \
+ frameworks/native/libs/nativewindow/include \
+ system/core/include/utils \
+ system/core/libion/include \
+ system/core/libion/kernel-headers \
+ $(MESON_GRALLOC_DIR)
LOCAL_SHARED_LIBRARIES:= libutils liblog libui libcutils
diff --git a/aml_screen.cpp b/aml_screen.cpp
index 77f143a..d86b132 100644
--- a/aml_screen.cpp
+++ b/aml_screen.cpp
@@ -17,7 +17,7 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "screen_source"
#include <hardware/hardware.h>
-#include <hardware/aml_screen.h>
+#include <aml_screen.h>
#include <signal.h>
#include <stdio.h>
diff --git a/aml_screen.h b/aml_screen.h
new file mode 100644
index 0000000..871eef8
--- a/dev/null
+++ b/aml_screen.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * 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.
+ */
+
+#ifndef ANDROID_INCLUDE_HARDWARE_AML_SCREEN_H
+#define ANDROID_INCLUDE_HARDWARE_AML_SCREEN_H
+
+#include <hardware/hardware.h>
+#include <android/native_window.h>
+
+
+__BEGIN_DECLS
+
+/*****************************************************************************/
+
+/**
+ * The id of this module
+ */
+
+#define AML_SCREEN_HARDWARE_MODULE_ID "screen_source"
+#define AML_SCREEN_SOURCE "screen_source"
+
+
+/*****************************************************************************/
+
+typedef struct aml_screen_buffer_info {
+ long * buffer_mem;
+ int buffer_canvas;
+ long tv_sec;
+ long tv_usec;
+} aml_screen_buffer_info_t;
+
+typedef void (*olStateCB)(int state);
+
+typedef void (*app_data_callback)(void* user,
+ aml_screen_buffer_info_t *buff_info);
+
+struct aml_screen_device;
+
+typedef struct aml_screen_module {
+ struct hw_module_t common;
+} aml_screen_module_t;
+
+enum SOURCETYPE{
+ WIFI_DISPLAY,
+ HDMI_IN,
+};
+
+enum aml_screen_mode_e {
+ AML_SCREEN_MODE_RATIO = 0,
+ AML_SCREEN_MODE_FULL,
+ AML_SCREEN_MODE_ADAPTIVE,
+ AML_SCREEN_MODE_MAX
+};
+
+/**
+ * set_port_type() parameter description:
+ portType is consisted by 32-bit binary.
+ bit 28 : start tvin service flag, 1 : enable, 0 : disable.
+ bit 24 : vdin device num : 0 or 1, which means use vdin0 or vdin1.
+ bit 15~0 : tvin port type --TVIN_PORT_VIU,TVIN_PORT_HDMI0...
+ (port type define in tvin.h)
+ */
+typedef struct aml_screen_operations {
+ int (*start)(struct aml_screen_device*);
+ int (*stop)(struct aml_screen_device*);
+ int (*pause)(struct aml_screen_device*);
+ int (*setStateCallBack)(struct aml_screen_device*, olStateCB);
+ int (*setPreviewWindow)(struct aml_screen_device*, ANativeWindow*);
+ int (*setDataCallBack)(struct aml_screen_device*,app_data_callback, void*);
+ int (*get_format)(struct aml_screen_device*);
+ int (*set_format)(struct aml_screen_device*, int, int, int);
+ int (*set_rotation)(struct aml_screen_device*, int);
+ int (*set_crop)(struct aml_screen_device*, int, int, int, int);
+ int (*get_amlvideo2_crop)(struct aml_screen_device*, int *, int *, int *, int *);
+ int (*set_amlvideo2_crop)(struct aml_screen_device*, int, int, int, int);
+ int (*aquire_buffer)(struct aml_screen_device*, aml_screen_buffer_info_t*);
+ // int (*set_buffer_refcount)(struct aml_screen_device, int*, int);
+ int (*release_buffer)(struct aml_screen_device*, long*);
+ // int (*inc_buffer_refcount)(struct aml_screen_device*, int*);
+ int (*set_frame_rate)(struct aml_screen_device*, int);
+ int (*get_current_sourcesize)(struct aml_screen_device*, int *, int *);
+ int (*set_screen_mode)(struct aml_screen_device*, int);
+ int (*start_v4l2_device)(struct aml_screen_device*);
+ int (*stop_v4l2_device)(struct aml_screen_device*);
+ int (*get_port_type)(struct aml_screen_device*);
+ int (*set_port_type)(struct aml_screen_device*, unsigned int);
+ int (*set_mode)(struct aml_screen_device*, int);
+} aml_screen_operations_t;
+
+typedef struct aml_screen_device {
+ hw_device_t common;
+ aml_screen_operations_t ops;
+ int device_id;
+ void* priv;
+} aml_screen_device_t;
+
+/*****************************************************************************/
+
+__END_DECLS
+
+#endif
diff --git a/v4l2_vdin.cpp b/v4l2_vdin.cpp
index ff989f9..34f41aa 100644
--- a/v4l2_vdin.cpp
+++ b/v4l2_vdin.cpp
@@ -959,7 +959,11 @@ int vdin_screen_source::workThread()
return BAD_VALUE;
}
mANativeWindow->lockBuffer_DEPRECATED(mANativeWindow.get(), buf);
- sp<GraphicBuffer> graphicBuffer(new GraphicBuffer(buf, false));
+ sp<GraphicBuffer> graphicBuffer(new GraphicBuffer(buf->handle, GraphicBuffer::WRAP_HANDLE,
+ buf->width, buf->height,
+ buf->format, buf->layerCount,
+ buf->usage, buf->stride));
+
graphicBuffer->lock(SCREENSOURCE_GRALLOC_USAGE, (void **)&dest);
if (dest == NULL) {
ALOGE("Invalid Gralloc Handle");
diff --git a/v4l2_vdin.h b/v4l2_vdin.h
index 1d6ce24..2934664 100644
--- a/v4l2_vdin.h
+++ b/v4l2_vdin.h
@@ -32,9 +32,10 @@
#include <sys/stat.h>
#include <utils/threads.h>
#include <android/native_window.h>
+#include <system/window.h>
#include <gralloc_priv.h>
-#include <hardware/aml_screen.h>
+#include <aml_screen.h>
namespace android {