add vsp vp8 encoder into build

Bug: 17783054
BZ: 225951

Change-Id: Ic0883ff983c2b34ac7c7c104ce312d5bf33bf405
Signed-off-by: ywan171 <yi.a.wang@intel.com>
diff --git a/src/Android.mk b/src/Android.mk
index 7f7b5d0..3710475 100644
--- a/src/Android.mk
+++ b/src/Android.mk
@@ -94,15 +94,11 @@
     tng_jpegES.c \
     tng_slotorder.c \
     tng_hostair.c \
-    tng_trace.c
-
-ifeq ($(TARGET_HAS_VPP),true)
-LOCAL_SRC_FILES += \
+    tng_trace.c \
     vsp_VPP.c \
-    vsp_cmdbuf.c \
     vsp_vp8.c \
-    vsp_compose.c
-endif
+    vsp_cmdbuf.c \
+    vsp_compose.c \
 
 
 ifeq ($(TARGET_HAS_VPP),true)
@@ -113,6 +109,7 @@
 
 ifeq ($(TARGET_HAS_VPP),true)
 LOCAL_SHARED_LIBRARIES += libvpp_setting
+LOCAL_CFLAGS += DPSBVIDEO_MRFL_VPP_SETTING
 endif
 
 
@@ -122,6 +119,7 @@
     -DPSBVIDEO_VPP_TILING -DSLICE_HEADER_PARSING
 else
 LOCAL_CFLAGS += \
+    -DPSBVIDEO_MRFL_VPP \
     -DPSBVIDEO_MRFL \
     -DSLICE_HEADER_PARSING
 endif
diff --git a/src/android/psb_android_glue.cpp b/src/android/psb_android_glue.cpp
index 52d4cd7..9d5b88e 100755
--- a/src/android/psb_android_glue.cpp
+++ b/src/android/psb_android_glue.cpp
@@ -44,7 +44,7 @@
 #ifdef TARGET_HAS_MULTIPLE_DISPLAY
 #include "psb_mds.h"
 #endif
-#if defined (PSBVIDEO_MRFL_VPP) && !defined (TARGET_HAS_MULTIPLE_DISPLAY)
+#if defined (PSBVIDEO_MRFL_VPP_SETTING) && !defined (TARGET_HAS_MULTIPLE_DISPLAY)
 #include <VPPSetting.h>
 #endif
 
@@ -149,8 +149,12 @@
 #ifdef PSBVIDEO_MRFL_VPP
 
 int psb_android_get_vpp_state() {
+#ifdef PSBVIDEO_MRFL_VPP_SETTING
     bool ret = VPPSetting::isVppOn();
     return (ret ? 1 : 0);
+#else
+    return 0;
+#endif
 }
 
 #endif
diff --git a/src/pnw_rotate.c b/src/pnw_rotate.c
index d0024d7..ebec022 100755
--- a/src/pnw_rotate.c
+++ b/src/pnw_rotate.c
@@ -109,7 +109,7 @@
 
 #ifdef PSBVIDEO_MRFL_VPP
 
-static int isVppOn(void* output) {
+static int isVppOn(void __maybe_unused *output) {
 #ifdef TARGET_HAS_MULTIPLE_DISPLAY
     return psb_android_get_mds_vpp_state(output);
 #else
diff --git a/src/vsp_VPP.c b/src/vsp_VPP.c
index 9e7ba9e..5feb3fc 100644
--- a/src/vsp_VPP.c
+++ b/src/vsp_VPP.c
@@ -135,21 +135,21 @@
 		 * type(0-Denoise,1-Deblock), value_thr, cnt_thr, coef, temp_thr1, temp_thr2, _pad[2]
 		 */
 		.denoise_deblock = {
-			[QCIF_TO_QVGA]    = {1, 15, 47, 35, 0, 0, 0, 0},
-			[QVGA_TO_VGA]     = {0, 7,  48, 47, 0, 0, 0, 0},
-			[VGA_TO_SD]       = {0, 10, 8,  9,  1, 3, 0, 0},
-			[SD_TO_720P]      = {0, 10, 48, 47, 0, 0, 0, 0},
-			[HD720P_TO_1080P] = {0, 10, 48, 47, 0, 0, 0, 0}
+			[QCIF_TO_QVGA]    = {1, 15, 47, 35, 0, 0, {0, 0}},
+			[QVGA_TO_VGA]     = {0, 7,  48, 47, 0, 0, {0, 0}},
+			[VGA_TO_SD]       = {0, 10, 8,  9,  1, 3, {0, 0}},
+			[SD_TO_720P]      = {0, 10, 48, 47, 0, 0, {0, 0}},
+			[HD720P_TO_1080P] = {0, 10, 48, 47, 0, 0, {0, 0}}
 		},
 		/* structure:
 		 * temp_detect, temp_correct, clip_thr, mid_thr, luma_amm, chroma_amm, _pad[2]
 		 */
 		.enhancer = {
-			[QCIF_TO_QVGA]    = {200, 100, 1, 42, 40, 60, 0, 0},
-			[QVGA_TO_VGA]     = {220, 180, 1, 42, 40, 60, 0, 0},
-			[VGA_TO_SD]       = {220, 200, 1, 42, 40, 60, 0, 0},
-			[SD_TO_720P]      = {100, 100, 5, 33, 0,  0,  0, 0},
-			[HD720P_TO_1080P] = {100, 100, 5, 33, 0,  0,  0, 0}
+			[QCIF_TO_QVGA]    = {200, 100, 1, 42, 40, 60, {0, 0}},
+			[QVGA_TO_VGA]     = {220, 180, 1, 42, 40, 60, {0, 0}},
+			[VGA_TO_SD]       = {220, 200, 1, 42, 40, 60, {0, 0}},
+			[SD_TO_720P]      = {100, 100, 5, 33, 0,  0,  {0, 0}},
+			[HD720P_TO_1080P] = {100, 100, 5, 33, 0,  0,  {0, 0}}
 		},
 		.sharpen = {
 			[QCIF_TO_QVGA]    = { .quality = SHARPEN_ON },
@@ -161,18 +161,18 @@
 	},
 	[MEDIUM_STRENGTH] = {
 		.denoise_deblock = {
-			[QCIF_TO_QVGA]    = {1, 25, 47, 12, 0, 0, 0, 0},
-			[QVGA_TO_VGA]     = {0, 10, 48, 47, 0, 0, 0, 0},
-			[VGA_TO_SD]       = {0, 20, 8,  9,  2, 4, 0, 0},
-			[SD_TO_720P]      = {0, 10, 48, 47, 0, 0, 0, 0},
-			[HD720P_TO_1080P] = {0, 10, 48, 47, 0, 0, 0, 0}
+			[QCIF_TO_QVGA]    = {1, 25, 47, 12, 0, 0, {0, 0}},
+			[QVGA_TO_VGA]     = {0, 10, 48, 47, 0, 0, {0, 0}},
+			[VGA_TO_SD]       = {0, 20, 8,  9,  2, 4, {0, 0}},
+			[SD_TO_720P]      = {0, 10, 48, 47, 0, 0, {0, 0}},
+			[HD720P_TO_1080P] = {0, 10, 48, 47, 0, 0, {0, 0}}
 		},
 		.enhancer = {
-			[QCIF_TO_QVGA]    = {100, 100, 1, 33, 100, 100, 0, 0},
-			[QVGA_TO_VGA]     = {100, 180, 1, 33, 100, 100, 0, 0},
-			[VGA_TO_SD]       = {100, 200, 1, 33, 100, 100, 0, 0},
-			[SD_TO_720P]      = {100, 100, 5, 33, 0,   0,   0, 0},
-			[HD720P_TO_1080P] = {100, 100, 5, 33, 0,   0,   0, 0}
+			[QCIF_TO_QVGA]    = {100, 100, 1, 33, 100, 100, {0, 0}},
+			[QVGA_TO_VGA]     = {100, 180, 1, 33, 100, 100, {0, 0}},
+			[VGA_TO_SD]       = {100, 200, 1, 33, 100, 100, {0, 0}},
+			[SD_TO_720P]      = {100, 100, 5, 33, 0,   0,   {0, 0}},
+			[HD720P_TO_1080P] = {100, 100, 5, 33, 0,   0,   {0, 0}}
 		},
 		.sharpen = {
 			[QCIF_TO_QVGA]    = { .quality = SHARPEN_ON },
@@ -184,18 +184,18 @@
 	},
 	[HIGH_STRENGTH] = {
 		.denoise_deblock = {
-			[QCIF_TO_QVGA]    = {1, 30, 40, 10, 0, 0, 0, 0},
-			[QVGA_TO_VGA]     = {0, 15, 45, 25, 0, 0, 0, 0},
-			[VGA_TO_SD]       = {0, 20, 7,  5,  3, 6, 0, 0},
-			[SD_TO_720P]      = {0, 10, 48, 47, 0, 0, 0, 0},
-			[HD720P_TO_1080P] = {0, 10, 48, 47, 0, 0, 0, 0}
+			[QCIF_TO_QVGA]    = {1, 30, 40, 10, 0, 0, {0, 0}},
+			[QVGA_TO_VGA]     = {0, 15, 45, 25, 0, 0, {0, 0}},
+			[VGA_TO_SD]       = {0, 20, 7,  5,  3, 6, {0, 0}},
+			[SD_TO_720P]      = {0, 10, 48, 47, 0, 0, {0, 0}},
+			[HD720P_TO_1080P] = {0, 10, 48, 47, 0, 0, {0, 0}}
 		},
 		.enhancer = {
-			[QCIF_TO_QVGA]    = {100, 100, 5, 33, 150, 200, 0, 0},
-			[QVGA_TO_VGA]     = {100, 180, 5, 33, 150, 200, 0, 0},
-			[VGA_TO_SD]       = {100, 200, 5, 33, 100, 150, 0, 0},
-			[SD_TO_720P]      = {100, 100, 5, 33, 0,   0,   0, 0},
-			[HD720P_TO_1080P] = {100, 100, 5, 33, 0,   0,   0, 0}
+			[QCIF_TO_QVGA]    = {100, 100, 5, 33, 150, 200, {0, 0}},
+			[QVGA_TO_VGA]     = {100, 180, 5, 33, 150, 200, {0, 0}},
+			[VGA_TO_SD]       = {100, 200, 5, 33, 100, 150, {0, 0}},
+			[SD_TO_720P]      = {100, 100, 5, 33, 0,   0,   {0, 0}},
+			[HD720P_TO_1080P] = {100, 100, 5, 33, 0,   0,   {0, 0}}
 		},
 		.sharpen = {
 			[QCIF_TO_QVGA]    = { .quality = SHARPEN_ON },
@@ -215,10 +215,10 @@
 static int check_vpp_strength(int value);
 
 static void vsp_VPP_QueryConfigAttributes(
-	VAProfile profile,
-	VAEntrypoint entrypoint,
-	VAConfigAttrib *attrib_list,
-	int num_attribs)
+	VAProfile __maybe_unused profile,
+	VAEntrypoint __maybe_unused entrypoint,
+	VAConfigAttrib __maybe_unused *attrib_list,
+	int __maybe_unused num_attribs)
 {
 	/* No VPP specific attributes */
 	return;
@@ -538,8 +538,8 @@
 #endif
 	/*  According to VIED's design, the width must be multiple of 16 */
 	width = ALIGN_TO_16(input_surface->width);
-	if (width > input_surface->psb_surface->stride)
-		width = input_surface->psb_surface->stride;
+	if (width > (int)input_surface->psb_surface->stride)
+		width = (int)input_surface->psb_surface->stride;
 
 	/* Setup input surface */
 	cell_proc_picture_param->num_input_pictures  = 1;
@@ -633,7 +633,7 @@
 
 			/*  According to VIED's design, the width must be multiple of 16 */
 			width = ALIGN_TO_16(cur_output_surf->width);
-			if (width > cur_output_surf->psb_surface->stride)
+			if (width > (int)cur_output_surf->psb_surface->stride)
 				width = cur_output_surf->psb_surface->stride;
 			height = cur_output_surf->height_origin;
 			stride = cur_output_surf->psb_surface->stride;
diff --git a/src/vsp_VPP.h b/src/vsp_VPP.h
index 579c762..afd7162 100644
--- a/src/vsp_VPP.h
+++ b/src/vsp_VPP.h
@@ -30,7 +30,7 @@
 #define _VSP_VPP_H_
 
 #include "psb_drv_video.h"
-#include <linux/vsp_fw.h>
+#include "vsp_fw.h"
 
 #define CONTEXT_VPP_ID 0
 #define CONTEXT_VP8_ID 1
diff --git a/src/vsp_cmdbuf.c b/src/vsp_cmdbuf.c
index 6ee7b83..a5a6ee3 100644
--- a/src/vsp_cmdbuf.c
+++ b/src/vsp_cmdbuf.c
@@ -284,7 +284,7 @@
 vspDRMCmdBuf(int fd, int ioctl_offset, psb_buffer_p *buffer_list, int buffer_count, unsigned cmdBufHandle,
              unsigned cmdBufOffset, unsigned cmdBufSize,
              unsigned relocBufHandle, unsigned relocBufOffset,
-             unsigned numRelocs, int damage,
+             unsigned __maybe_unused numRelocs, int __maybe_unused damage,
              unsigned engine, unsigned fence_flags, struct psb_ttm_fence_rep *fence_rep)
 {
 	drm_psb_cmdbuf_arg_t ca;
@@ -292,7 +292,6 @@
 	int i;
 	int ret = 0;
 	uint64_t mask = PSB_GPU_ACCESS_MASK;
-
 	arg_list = (struct psb_validate_arg *) calloc(1, sizeof(struct psb_validate_arg) * buffer_count);
 	if (arg_list == NULL) {
 		drv_debug_msg(VIDEO_DEBUG_ERROR, "Allocate memory failed\n");
@@ -382,9 +381,8 @@
  *
  * Returns 0 on success
  */
-int vsp_context_submit_cmdbuf(object_context_p obj_context)
+int vsp_context_submit_cmdbuf(object_context_p __maybe_unused obj_context)
 {
-
 	return 0;
 }
 
diff --git a/src/vsp_compose.h b/src/vsp_compose.h
index 1900ebf..8876d93 100644
--- a/src/vsp_compose.h
+++ b/src/vsp_compose.h
@@ -31,7 +31,7 @@
 
 #include "psb_drv_video.h"
 #include "vsp_VPP.h"
-#include <linux/vsp_fw.h>
+#include "vsp_fw.h"
 
 VAStatus vsp_compose_process_pipeline_param(context_VPP_p ctx, object_context_p obj_context, object_buffer_p obj_buffer);
 
diff --git a/src/vsp_vp8.c b/src/vsp_vp8.c
index e5e3269..2e0315e 100644
--- a/src/vsp_vp8.c
+++ b/src/vsp_vp8.c
@@ -102,8 +102,8 @@
 static VAStatus vsp__VP8_check_legal_picture(object_context_p obj_context, object_config_p obj_config);
 
 static void vsp_VP8_QueryConfigAttributes(
-    VAProfile profile,
-    VAEntrypoint entrypoint,
+    VAProfile  __maybe_unused profile,
+    VAEntrypoint __maybe_unused entrypoint,
     VAConfigAttrib *attrib_list,
     int num_attribs)
 {
@@ -115,7 +115,7 @@
         case VAConfigAttribRTFormat:
             break;
         case VAConfigAttribRateControl:
-            attrib_list[i].value = VA_RC_CBR | VA_RC_VCM;
+            attrib_list[i].value = VA_RC_CBR | VA_RC_VCM | VA_RC_VBR;
             break;
         case VAConfigAttribEncAutoReference:
             attrib_list[i].value = 1;
diff --git a/src/vsp_vp8.h b/src/vsp_vp8.h
index d01214b..029862a 100644
--- a/src/vsp_vp8.h
+++ b/src/vsp_vp8.h
@@ -31,7 +31,7 @@
 #define _VSP_VP8_H_
 
 #include "psb_drv_video.h"
-#include <linux/vsp_fw.h>
+#include "vsp_fw.h"
 
 extern struct format_vtable_s vsp_VP8_vtable;