libmix: Exclude the number of actual buffer needed calculation for AVC in BYT
BZ: 146862
On MFLD/CTP/MERR platforms, extra buffers are allocated for the encoder and
decoder buffer sharing in the WiDi use cases. Two extra buffers are needed
for native window buffer cycling. The buffer numbers have been set as a fixed
value in LibMIX. But on Baytrail platforms, these buffers are no longer needed.
Change-Id: I5465930eca6ca491b62f4da267f6bcd097dc49f0
Signed-off-by: Gu, Wangyi <wangyi.gu@intel.com>
diff --git a/videodecoder/Android.mk b/videodecoder/Android.mk
index 243b49a..18ccd15 100644
--- a/videodecoder/Android.mk
+++ b/videodecoder/Android.mk
@@ -30,7 +30,7 @@
endif
ifeq ($(TARGET_BOARD_PLATFORM),baytrail)
-LOCAL_CFLAGS += -DLOAD_PVR_DRIVER
+LOCAL_CFLAGS += -DUSE_GEN_HW
endif
#LOCAL_LDLIBS += -lpthread
diff --git a/videodecoder/VideoDecoderAVC.cpp b/videodecoder/VideoDecoderAVC.cpp
index d34965d..221db27 100644
--- a/videodecoder/VideoDecoderAVC.cpp
+++ b/videodecoder/VideoDecoderAVC.cpp
@@ -26,6 +26,11 @@
#include "VideoDecoderTrace.h"
#include <string.h>
+// Macros for actual buffer needed calculation
+#define WIDI_CONSUMED 6
+#define HDMI_CONSUMED 2
+#define NW_CONSUMED 2
+
VideoDecoderAVC::VideoDecoderAVC(const char *mimeType)
: VideoDecoderBase(mimeType, VBP_H264),
mToggleDPB(0),
@@ -721,9 +726,12 @@
// outputQueue + nativewindow_owned + (diff > 0 ? diff : 1) + widi_need_max + 1(available buffer)
// while outputQueue = DPB < 8? DPB :8
// and diff = Reference + 1 - ouputQueue
- mVideoFormatInfo.actualBufferNeeded = mOutputWindowSize + 4 /* Owned by native window */
+ mVideoFormatInfo.actualBufferNeeded = mOutputWindowSize + NW_CONSUMED /* Owned by native window */
+ (diff > 0 ? diff : 1)
- + 6 /* WiDi maximum needs */
+#ifndef USE_GEN_HW
+ + HDMI_CONSUMED /* Two extra buffers are needed for native window buffer cycling */
+ + WIDI_CONSUMED /* WiDi maximum needs */
+#endif
+ 1;
}
diff --git a/videodecoder/VideoDecoderBase.cpp b/videodecoder/VideoDecoderBase.cpp
index f62c706..19b8fee 100755
--- a/videodecoder/VideoDecoderBase.cpp
+++ b/videodecoder/VideoDecoderBase.cpp
@@ -745,7 +745,7 @@
}
// Display is defined as "unsigned int"
-#ifndef LOAD_PVR_DRIVER
+#ifndef USE_GEN_HW
mDisplay = new Display;
*mDisplay = ANDROID_DISPLAY_HANDLE;
#else
@@ -986,7 +986,7 @@
}
if (mDisplay) {
-#ifndef LOAD_PVR_DRIVER
+#ifndef USE_GEN_HW
delete mDisplay;
#endif
mDisplay = NULL;
diff --git a/videodecoder/VideoDecoderBase.h b/videodecoder/VideoDecoderBase.h
index e823b22..f2e5dee 100644
--- a/videodecoder/VideoDecoderBase.h
+++ b/videodecoder/VideoDecoderBase.h
@@ -37,7 +37,7 @@
}
#ifndef Display
-#ifdef LOAD_PVR_DRIVER
+#ifdef USE_GEN_HW
typedef char Display;
#else
typedef unsigned int Display;