summaryrefslogtreecommitdiff
authorjintao.xu <jintao.xu@amlogic.com>2014-09-03 06:34:04 (GMT)
committer Sandy lUo <sandy.luo@amlogic.com>2014-09-04 06:20:45 (GMT)
commit6200aa7dfa5b8b91c6eb6d8fc4ad4f5063d19bc1 (patch)
tree6ad03adb27770d2412884b8902716787af8ed7c7
parentb2b58450de6464be65d83459687ad86222c885d9 (diff)
downloadhwcomposer-6200aa7dfa5b8b91c6eb6d8fc4ad4f5063d19bc1.zip
hwcomposer-6200aa7dfa5b8b91c6eb6d8fc4ad4f5063d19bc1.tar.gz
hwcomposer-6200aa7dfa5b8b91c6eb6d8fc4ad4f5063d19bc1.tar.bz2
PD #95678: omx decoder video layer display use GRALLOC_USAGE_AML_VIDEO_OVERLAYGR instead of ALLOC_USAGE_PROTECTED
Change-Id: I3dde454fa9f743fe3ad5e0edb97225686dc927c0
Diffstat
-rwxr-xr-xhwcomposer.cpp25
-rwxr-xr-xtvp/OmxUtil.cpp24
-rwxr-xr-xtvp/OmxUtil.h2
3 files changed, 28 insertions, 23 deletions
diff --git a/hwcomposer.cpp b/hwcomposer.cpp
index 2788099..2701bab 100755
--- a/hwcomposer.cpp
+++ b/hwcomposer.cpp
@@ -60,8 +60,6 @@
#endif
#include "tvp/OmxUtil.h"
-#define TVP_SECRET "amlogic_omx_decoder,pts="
-#define TVP_SECRET_RENDER "is rendered = true"
static int Amvideo_Handle = 0;
extern "C" int clock_nanosleep(clockid_t clock_id, int flags,
@@ -307,27 +305,8 @@ static int hwc_set(struct hwc_composer_device_1 *dev,
if (l->handle) {
private_handle_t const* hnd = reinterpret_cast<private_handle_t const*>(l->handle);
if (hnd->flags & private_handle_t::PRIV_FLAGS_VIDEO_OMX) {
- if (strncmp((char*)hnd->base, TVP_SECRET, strlen(TVP_SECRET))==0) {
- hwc_overlay_compose(dev, l);
- char* data = (char*)hnd->base;
- if (Amvideo_Handle==0 && istvp==false) {
- Amvideo_Handle = openamvideo();
- if (Amvideo_Handle == 0)
- ALOGW("can not open amvideo");
- }
- if (strncmp((char*)hnd->base+sizeof(TVP_SECRET)+sizeof(signed long long), TVP_SECRET_RENDER, strlen(TVP_SECRET_RENDER))!=0) {
- signed long long time;
- memcpy(&time, (char*)data+sizeof(TVP_SECRET), sizeof(signed long long));
- int time_video = time * 9 / 100 + 1;
- //ALOGW("render____time=%lld,time_video=%d",time,time_video);
- int ret = setomxpts(time_video);
- if (ret < 0) {
- ALOGW("setomxpts error, ret =%d",ret);
- }
- }
- memcpy((char*)data+sizeof(TVP_SECRET)+sizeof(signed long long), TVP_SECRET_RENDER, sizeof(TVP_SECRET_RENDER));
- istvp = true;
- }
+ set_omx_pts((char*)hnd->base, &Amvideo_Handle);
+ istvp = true;
}
if (hnd->flags & private_handle_t::PRIV_FLAGS_VIDEO_OVERLAY) {
hwc_overlay_compose(dev, l);
diff --git a/tvp/OmxUtil.cpp b/tvp/OmxUtil.cpp
index 69d3dec..01c7949 100755
--- a/tvp/OmxUtil.cpp
+++ b/tvp/OmxUtil.cpp
@@ -20,6 +20,10 @@
#define AMSTREAM_IOC_SET_VIDEO_DISABLE _IOW(AMSTREAM_IOC_MAGIC, 0x49, unsigned long)
static int amvideo_handle = 0;
+
+#define TVP_SECRET "amlogic_omx_decoder,pts="
+#define TVP_SECRET_RENDER "is rendered = true"
+
int openamvideo() {
amvideo_handle = open("/dev/amvideo",O_RDWR | O_NONBLOCK);
return amvideo_handle;
@@ -42,4 +46,24 @@ int setomxpts(int time_video) {
return ioctl(amvideo_handle, AMSTREAM_IOC_SET_OMX_VPTS, (unsigned long)&time_video);
}
+void set_omx_pts(char* data, int* handle) {
+ if (strncmp(data, TVP_SECRET, strlen(TVP_SECRET))==0) {
+ if (*handle==0) {
+ *handle = openamvideo();
+ if (*handle == 0)
+ ALOGW("can not open amvideo");
+ }
+ if (strncmp(data+sizeof(TVP_SECRET)+sizeof(signed long long), TVP_SECRET_RENDER, strlen(TVP_SECRET_RENDER))!=0) {
+ signed long long time;
+ memcpy(&time, (char*)data+sizeof(TVP_SECRET), sizeof(signed long long));
+ int time_video = time * 9 / 100 + 1;
+ //ALOGW("render____time=%lld,time_video=%d",time,time_video);
+ int ret = setomxpts(time_video);
+ if (ret < 0) {
+ ALOGW("setomxpts error, ret =%d",ret);
+ }
+ }
+ memcpy((char*)data+sizeof(TVP_SECRET)+sizeof(signed long long), TVP_SECRET_RENDER, sizeof(TVP_SECRET_RENDER));
+ }
+}
diff --git a/tvp/OmxUtil.h b/tvp/OmxUtil.h
index 26060a9..846c9aa 100755
--- a/tvp/OmxUtil.h
+++ b/tvp/OmxUtil.h
@@ -11,5 +11,7 @@ int openamvideo();
void closeamvideo();
int setomxdisplaymode();
int setomxpts(int time_video);
+void set_omx_pts(char* data, int* handle);
+