Kaynağa Gözat

driver: video: port settings changes

updated hfi command, property header files.
deleted hfi definition header file.
added new input and output properties for decoder.
added profile, level and tier properties as part of
port settings subscription.

Change-Id: I072d0bb56183950920975950b3873003218d526e
Signed-off-by: Darshana Patil <[email protected]>
Darshana Patil 4 yıl önce
ebeveyn
işleme
9b4556df59

+ 11 - 0
driver/platform/waipio/src/msm_vidc_waipio.c

@@ -17,6 +17,7 @@
 #define DDR_TYPE_LPDDR4X 0x7
 #define DDR_TYPE_LPDDR5 0x8
 #define DDR_TYPE_LPDDR5X 0x9
+#define DEFAULT_VIDEO_CONCEAL_COLOR_BLACK 0x8020010
 
 #define UBWC_CONFIG(mco, mlo, hbo, bslo, bso, rs, mc, ml, hbb, bsl, bsp) \
 {	\
@@ -894,6 +895,16 @@ static struct msm_platform_inst_capability instance_data_waipio[] = {
 		{0},
 		{ENTROPY_MODE},
 		NULL, msm_vidc_set_u32},
+
+	/* conceal color */
+	{CONCEAL_COLOR_8BIT, DEC, CODECS_ALL, 0x0, 0xff3fcff, 1,
+		DEFAULT_VIDEO_CONCEAL_COLOR_BLACK,
+		V4L2_CID_MPEG_VIDEO_MUTE_YUV,
+		HFI_PROP_CONCEAL_COLOR_8BIT},
+	{CONCEAL_COLOR_10BIT, DEC, CODECS_ALL, 0x0, 0x3fffffff, 1,
+		DEFAULT_VIDEO_CONCEAL_COLOR_BLACK,
+		V4L2_CID_MPEG_VIDEO_MUTE_YUV,
+		HFI_PROP_CONCEAL_COLOR_10BIT},
 };
 
 /*

+ 70 - 57
driver/vidc/inc/hfi_command.h

@@ -9,7 +9,7 @@
 #include <linux/types.h>
 #include <linux/bits.h>
 
-#define HFI_VIDEO_ARCH_OX               0x1
+#define HFI_VIDEO_ARCH_LX               0x1
 
 struct hfi_header {
 	u32 size;
@@ -43,19 +43,24 @@ struct hfi_buffer {
 };
 
 enum hfi_packet_host_flags {
-	HFI_HOST_FLAGS_NONE              = 0,
-	HFI_HOST_FLAGS_INTR_REQUIRED     = BIT(0),
-	HFI_HOST_FLAGS_RESPONSE_REQUIRED = BIT(1),
-	HFI_HOST_FLAGS_NON_DISCARDABLE   = BIT(2),
-	HFI_HOST_FLAGS_GET_PROPERTY      = BIT(3),
+	HFI_HOST_FLAGS_NONE                = 0x00000000,
+	HFI_HOST_FLAGS_INTR_REQUIRED       = 0x00000001,
+	HFI_HOST_FLAGS_RESPONSE_REQUIRED   = 0x00000002,
+	HFI_HOST_FLAGS_NON_DISCARDABLE     = 0x00000004,
+	HFI_HOST_FLAGS_GET_PROPERTY        = 0x00000008,
+	HFI_HOST_FLAGS_CB_NON_SECURE       = 0x00000010,
+	HFI_HOST_FLAGS_CB_SECURE_PIXEL     = 0x00000020,
+	HFI_HOST_FLAGS_CB_SECURE_BITSTREAM = 0x00000040,
+	HFI_HOST_FLAGS_CB_SECURE_NON_PIXEL = 0x00000080,
+	HFI_HOST_FLAGS_CB_NON_SECURE_PIXEL = 0x00000100,
 };
 
 enum hfi_packet_firmware_flags {
-	HFI_FW_FLAGS_NONE          = 0,
-	HFI_FW_FLAGS_SUCCESS       = BIT(0),
-	HFI_FW_FLAGS_INFORMATION   = BIT(1),
-	HFI_FW_FLAGS_SESSION_ERROR = BIT(2),
-	HFI_FW_FLAGS_SYSTEM_ERROR  = BIT(3),
+	HFI_FW_FLAGS_NONE          = 0x00000000,
+	HFI_FW_FLAGS_SUCCESS       = 0x00000001,
+	HFI_FW_FLAGS_INFORMATION   = 0x00000002,
+	HFI_FW_FLAGS_SESSION_ERROR = 0x00000004,
+	HFI_FW_FLAGS_SYSTEM_ERROR  = 0x00000008,
 };
 
 enum hfi_packet_payload_info {
@@ -72,52 +77,49 @@ enum hfi_packet_payload_info {
 	HFI_PAYLOAD_32_PACKED = 0x0000000a,
 	HFI_PAYLOAD_U32_ARRAY = 0x0000000b,
 	HFI_PAYLOAD_S32_ARRAY = 0x0000000c,
+	HFI_PAYLOAD_64_PACKED = 0x0000000d,
 };
 
 enum hfi_packet_port_type {
-	HFI_PORT_NONE      = 0,
-	HFI_PORT_BITSTREAM = BIT(0),
-	HFI_PORT_RAW       = BIT(1),
+	HFI_PORT_NONE      = 0x00000000,
+	HFI_PORT_BITSTREAM = 0x00000001,
+	HFI_PORT_RAW       = 0x00000002,
 };
 
 enum hfi_buffer_type {
 	HFI_BUFFER_BITSTREAM  = 0x00000001,
 	HFI_BUFFER_RAW        = 0x00000002,
 	HFI_BUFFER_METADATA   = 0x00000003,
-	HFI_BUFFER_DPB        = 0x00000004,
-	HFI_BUFFER_BIN        = 0x00000005,
-	HFI_BUFFER_LINE       = 0x00000006,
-	HFI_BUFFER_ARP        = 0x00000007,
-	HFI_BUFFER_COMV       = 0x00000008,
-	HFI_BUFFER_NON_COMV   = 0x00000009,
-	HFI_BUFFER_PERSIST    = 0x0000000A,
-	HFI_BUFFER_SUBCACHE   = 0x0000000B,
-	HFI_BUFFER_SFR        = 0x0000000C,
+	HFI_BUFFER_SUBCACHE   = 0x00000004,
+	HFI_BUFFER_SFR        = 0x00000005,
+	HFI_BUFFER_DPB        = 0x00000006,
+	HFI_BUFFER_BIN        = 0x00000007,
+	HFI_BUFFER_LINE       = 0x00000008,
+	HFI_BUFFER_ARP        = 0x00000009,
+	HFI_BUFFER_COMV       = 0x0000000A,
+	HFI_BUFFER_NON_COMV   = 0x0000000B,
+	HFI_BUFFER_PERSIST    = 0x0000000C,
+	HFI_BUFFER_VPSS       = 0x0000000D,
 };
 
 enum hfi_buffer_host_flags {
-	HFI_BUF_HOST_FLAG_NONE           = 0,
-	HFI_BUF_HOST_FLAG_RELEASE        = BIT(0),
-	HFI_BUF_HOST_FLAG_READONLY       = BIT(1),
-	HFI_BUF_HOST_FLAG_CODEC_CONFIG   = BIT(2),
+	HFI_BUF_HOST_FLAG_NONE         = 0x00000000,
+	HFI_BUF_HOST_FLAG_RELEASE      = 0x00000001,
+	HFI_BUF_HOST_FLAG_READONLY     = 0x00000002,
+	HFI_BUF_HOST_FLAG_CODEC_CONFIG = 0x00000004,
 };
 
 enum hfi_buffer_firmware_flags {
-	HFI_BUF_FW_FLAG_NONE           = 0,
-	HFI_BUF_FW_FLAG_LAST           = BIT(0),
-	HFI_BUF_FW_FLAG_READONLY       = BIT(1),
-	HFI_BUF_FW_FLAG_CODEC_CONFIG   = BIT(2),
-	// TODO
-	HFI_BUF_FW_FLAG_SUBFRAME       = BIT(3),
-	HFI_BUF_FW_FLAG_KEYFRAME       = BIT(4),
-	HFI_BUF_FW_FLAG_CORRUPT        = BIT(28),
-	HFI_BUF_FW_FLAG_UNSUPPORTED    = BIT(29),
+	HFI_BUF_FW_FLAG_NONE         = 0x00000000,
+	HFI_BUF_FW_FLAG_LAST         = 0x00000001,
+	HFI_BUF_FW_FLAG_READONLY     = 0x00000002,
+	HFI_BUF_FW_FLAG_CODEC_CONFIG = 0x00000004,
 };
 
 enum hfi_metapayload_header_flags {
-	HFI_METADATA_FLAGS_NONE           = 0,
-	HFI_METADATA_FLAGS_TOP_FIELD      = BIT(0),
-	HFI_METADATA_FLAGS_BOTTOM_FIELDS  = BIT(1),
+	HFI_METADATA_FLAGS_NONE         = 0x00000000,
+	HFI_METADATA_FLAGS_TOP_FIELD    = 0x00000001,
+	HFI_METADATA_FLAGS_BOTTOM_FIELD = 0x00000002,
 };
 
 struct metabuf_header {
@@ -137,25 +139,36 @@ struct metapayload_header {
 };
 
 enum hfi_property_mode_type {
-	HFI_MODE_NONE                  = 0,
-	HFI_MODE_PORT_SETTINGS_CHANGE  = BIT(0),
-	HFI_MODE_PROPERTY              = BIT(1),
-	HFI_MODE_METADATA              = BIT(2),
+	HFI_MODE_NONE                 = 0x00000000,
+	HFI_MODE_PORT_SETTINGS_CHANGE = 0x00000001,
+	HFI_MODE_PROPERTY             = 0x00000002,
+	HFI_MODE_METADATA             = 0x00000004,
 };
 
-#define HFI_CMD_BEGIN                                           0x0
-#define HFI_CMD_INIT                                            0x1
-#define HFI_CMD_POWER_COLLAPSE                                  0x2
-#define HFI_CMD_OPEN                                            0x3
-#define HFI_CMD_CLOSE                                           0x4
-#define HFI_CMD_START                                           0x5
-#define HFI_CMD_STOP                                            0x6
-#define HFI_CMD_DRAIN                                           0x7
-#define HFI_CMD_RESUME                                          0x8
-#define HFI_CMD_BUFFER                                          0x9
-#define HFI_CMD_DELIVERY_MODE                                   0xA
-#define HFI_CMD_SUBSCRIBE_MODE                                  0xB
-#define HFI_CMD_SETTINGS_CHANGE                                 0xC
-#define HFI_CMD_END                                             0xD
+#define HFI_CMD_BEGIN                                           0x01000000
+#define HFI_CMD_INIT                                            0x01000001
+#define HFI_CMD_POWER_COLLAPSE                                  0x01000002
+#define HFI_CMD_OPEN                                            0x01000003
+#define HFI_CMD_CLOSE                                           0x01000004
+#define HFI_CMD_START                                           0x01000005
+#define HFI_CMD_STOP                                            0x01000006
+#define HFI_CMD_DRAIN                                           0x01000007
+#define HFI_CMD_RESUME                                          0x01000008
+#define HFI_CMD_BUFFER                                          0x01000009
+#define HFI_CMD_DELIVERY_MODE                                   0x0100000A
+#define HFI_CMD_SUBSCRIBE_MODE                                  0x0100000B
+#define HFI_CMD_SETTINGS_CHANGE                                 0x0100000C
+
+#define HFI_SSR_TYPE_SW_ERR_FATAL       0x1
+#define HFI_SSR_TYPE_SW_DIV_BY_ZERO     0x2
+#define HFI_SSR_TYPE_HW_WDOG_IRQ        0x3
+#define HFI_SSR_TYPE_NOC_ERROR          0x4
+#define HFI_SSR_TYPE_VCODEC_HUNG        0x5
+
+#define HFI_BITMASK_SSR_SUB_CLIENT_ID          0x000000f0
+#define HFI_BITMASK_SSR_TYPE                   0x0000000f
+#define HFI_CMD_SSR                                             0x0100000D
+
+#define HFI_CMD_END                                             0x01FFFFFF
 
 #endif //__H_HFI_COMMAND_H__

+ 0 - 30
driver/vidc/inc/hfi_definition.h

@@ -1,30 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
- */
-
-#ifndef __H_HFI_DEFINITION_H__
-#define __H_HFI_DEFINITION_H__
-
-typedef u8 HFI_U8;
-typedef s8 HFI_S8;
-typedef u16 HFI_U16;
-typedef s16 HFI_S16;
-typedef u32 HFI_U32;
-typedef s32 HFI_S32;
-typedef u64 HFI_U64;
-
-typedef HFI_U32 HFI_BOOL;
-#define  HFI_FALSE      0
-#define  HFI_TRUE       (!HFI_FALSE)
-
-typedef HFI_U32 HFI_STATUS;
-#define  HFI_FAIL       0
-#define  HFI_SUCCESS    1
-
-#define HFI_ALIGN(a, b) (((b) & ((b) - 1)) ? \
-	(((a) + (b) - 1) / (b) * (b)) : \
-	(((a) + (b) - 1) & (~((b) - 1))))
-
-#endif // __H_HFI_DEFINITION_H__
-

+ 0 - 1
driver/vidc/inc/hfi_packet.h

@@ -11,7 +11,6 @@
 #include "msm_vidc_core.h"
 #include "hfi_command.h"
 #include "hfi_property.h"
-#include "hfi_definition.h"
 
 u32 get_hfi_port(struct msm_vidc_inst *inst,
 	enum msm_vidc_port_type port);

+ 114 - 100
driver/vidc/inc/hfi_property.h

@@ -18,21 +18,27 @@
 #define HFI_PROP_UBWC_BANK_SPREADING                            0x03000009
 
 enum hfi_debug_config {
-    HFI_DEBUG_CONFIG_DEFAULT    = 0,
-    HFI_DEBUG_CONFIG_CLRDBGQ    = BIT(0),
-    HFI_DEBUG_CONFIG_WFI        = BIT(1),
-    HFI_DEBUG_CONFIG_ARM9WD     = BIT(2),
+    HFI_DEBUG_CONFIG_DEFAULT = 0x00000000,
+    HFI_DEBUG_CONFIG_CLRDBGQ = 0x00000001,
+    HFI_DEBUG_CONFIG_WFI     = 0x00000002,
+    HFI_DEBUG_CONFIG_ARM9WD  = 0x00000004,
 };
 #define HFI_PROP_DEBUG_CONFIG                                   0x0300000a
 
 enum hfi_debug_log_level {
-    HFI_DEBUG_LOG_NONE      = 0,
-    HFI_DEBUG_LOG_ERROR     = BIT(0),
-    HFI_DEBUG_LOG_FATAL     = BIT(1),
-    HFI_DEBUG_LOG_PERF      = BIT(2),
-    HFI_DEBUG_LOG_HIGH      = BIT(3),
-    HFI_DEBUG_LOG_MEDIUM    = BIT(4),
-    HFI_DEBUG_LOG_LOW       = BIT(5),
+    HFI_DEBUG_LOG_NONE   = 0x00000000,
+    HFI_DEBUG_LOG_ERROR  = 0x00000001,
+    HFI_DEBUG_LOG_FATAL  = 0x00000002,
+    HFI_DEBUG_LOG_PERF   = 0x00000004,
+    HFI_DEBUG_LOG_HIGH   = 0x00000008,
+    HFI_DEBUG_LOG_MEDIUM = 0x00000010,
+    HFI_DEBUG_LOG_LOW    = 0x00000020,
+};
+
+struct hfi_debug_header {
+	u32   size;
+	u32   debug_level;
+	u32   reserved[2];
 };
 #define HFI_PROP_DEBUG_LOG_LEVEL                                0x0300000b
 
@@ -60,17 +66,19 @@ enum hfi_color_format {
 
 #define HFI_PROP_SECURE                                         0x03000102
 
-#define HFI_BITMASK_ALIGN_WIDTH      0xffff0000
-#define HFI_BITMASK_ALIGN_HEIGHT     0x0000ffff
-#define HFI_PROP_ALIGN_RESOLUTION                               0x03000103
+#define HFI_BITMASK_BITSTREAM_WIDTH                             0xffff0000
+#define HFI_BITMASK_BITSTREAM_HEIGHT                            0x0000ffff
+#define HFI_PROP_BITSTREAM_RESOLUTION                           0x03000103
 
-#define HFI_BITMASK_CROP_WIDTH       0xffff0000
-#define HFI_BITMASK_CROP_HEIGHT      0x0000ffff
-#define HFI_PROP_CROP_RESOLUTION                                0x03000104
+#define HFI_BITMASK_LINEAR_STRIDE            0xffff0000
+#define HFI_BITMASK_LINEAR_SCANLINE          0x0000ffff
+#define HFI_PROP_LINEAR_STRIDE_SCANLINE                         0x03000104
 
-#define HFI_BITMASK_FRAME_COORDINATE_TOP   0xffff0000
-#define HFI_BITMASK_FRAME_COORDINATE_LEFT  0x0000ffff
-#define HFI_PROP_CROP_COORDINATE_TOP_LEFT                       0x03000105
+#define HFI_BITMASK_CROP_RIGHT_OFFSET        0xffff0000
+#define HFI_BITMASK_CROP_BOTTOM_OFFSET       0x0000ffff
+#define HFI_BITMASK_CROP_LEFT_OFFSET         0xffff0000
+#define HFI_BITMASK_CROP_TOP_OFFSET          0x0000ffff
+#define HFI_PROP_CROP_OFFSETS                                   0x03000105
 
 #define HFI_PROP_REALTIME                                       0x03000106
 
@@ -83,9 +91,9 @@ enum hfi_avc_profile_type {
 };
 
 enum hfi_hevc_profile_type {
-    HFI_HEVC_HEVC_PROFILE_MAIN          = 0,
-    HFI_HEVC_PROFILE_MAIN_STILL_PICTURE = 1,
-    HFI_HEVC_PROFILE_MAIN_10            = 2,
+    HFI_H265_PROFILE_MAIN               = 0,
+    HFI_H265_PROFILE_MAIN_STILL_PICTURE = 1,
+    HFI_H265_PROFILE_MAIN_10            = 2,
 };
 
 enum hfi_vp9_profile_type {
@@ -96,8 +104,8 @@ enum hfi_vp9_profile_type {
 };
 
 enum hfi_mpeg2_profile_type {
-    HFI_MPEG2_PROFILE_SIMPLE = 0,
-    HFI_MPEG2_PROFILE_MAIN   = 1,
+    HFI_MP2_PROFILE_SIMPLE = 0,
+    HFI_MP2_PROFILE_MAIN   = 1,
 };
 
 #define HFI_PROP_PROFILE                                        0x03000107
@@ -126,53 +134,52 @@ enum hfi_avc_level_type {
 };
 
 enum hfi_hevc_level_type {
-    HFI_HEVC_LEVEL_1   = 0,
-    HFI_HEVC_LEVEL_2   = 1,
-    HFI_HEVC_LEVEL_2_1 = 2,
-    HFI_HEVC_LEVEL_3   = 3,
-    HFI_HEVC_LEVEL_3_1 = 4,
-    HFI_HEVC_LEVEL_4   = 5,
-    HFI_HEVC_LEVEL_4_1 = 6,
-    HFI_HEVC_LEVEL_5   = 7,
-    HFI_HEVC_LEVEL_5_1 = 8,
-    HFI_HEVC_LEVEL_5_2 = 9,
-    HFI_HEVC_LEVEL_6   = 10,
-    HFI_HEVC_LEVEL_6_1 = 11,
-    HFI_HEVC_LEVEL_6_2 = 12,
+    HFI_H265_LEVEL_1   = 0,
+    HFI_H265_LEVEL_2   = 1,
+    HFI_H265_LEVEL_2_1 = 2,
+    HFI_H265_LEVEL_3   = 3,
+    HFI_H265_LEVEL_3_1 = 4,
+    HFI_H265_LEVEL_4   = 5,
+    HFI_H265_LEVEL_4_1 = 6,
+    HFI_H265_LEVEL_5   = 7,
+    HFI_H265_LEVEL_5_1 = 8,
+    HFI_H265_LEVEL_5_2 = 9,
+    HFI_H265_LEVEL_6   = 10,
+    HFI_H265_LEVEL_6_1 = 11,
+    HFI_H265_LEVEL_6_2 = 12,
 };
 
 enum hfi_vp9_level_type {
-    HFI_VP9_LEVEL_1  = 0,
-    HFI_VP9_LEVEL_11 = 1,
-    HFI_VP9_LEVEL_2  = 2,
-    HFI_VP9_LEVEL_21 = 3,
-    HFI_VP9_LEVEL_3  = 4,
-    HFI_VP9_LEVEL_31 = 5,
-    HFI_VP9_LEVEL_4  = 6,
-    HFI_VP9_LEVEL_41 = 7,
-    HFI_VP9_LEVEL_5  = 8,
-    HFI_VP9_LEVEL_51 = 9,
-    HFI_VP9_LEVEL_6  = 10,
-    HFI_VP9_LEVEL_61 = 11,
+    HFI_VP9_LEVEL_1_0 = 0,
+    HFI_VP9_LEVEL_1_1 = 1,
+    HFI_VP9_LEVEL_2_0 = 2,
+    HFI_VP9_LEVEL_2_1 = 3,
+    HFI_VP9_LEVEL_3_0 = 4,
+    HFI_VP9_LEVEL_3_1 = 5,
+    HFI_VP9_LEVEL_4_0 = 6,
+    HFI_VP9_LEVEL_4_1 = 7,
+    HFI_VP9_LEVEL_5_0 = 8,
+    HFI_VP9_LEVEL_5_1 = 9,
+    HFI_VP9_LEVEL_6_0 = 10,
+    HFI_VP9_LEVEL_6_1 = 11,
 };
 
 enum hfi_mpeg2_level_type {
-    HFI_MPEG2_LEVEL_LOW       = 0,
-    HFI_MPEG2_LEVEL_MAIN      = 1,
-    HFI_MPEG2_LEVEL_HIGH_1440 = 2,
-    HFI_MPEG2_LEVEL_HIGH      = 3,
+    HFI_MP2_LEVEL_LOW       = 0,
+    HFI_MP2_LEVEL_MAIN      = 1,
+    HFI_MP2_LEVEL_HIGH_1440 = 2,
+    HFI_MP2_LEVEL_HIGH      = 3,
 };
 
 enum hfi_codec_level_type {
-    HFI_LEVEL_UNKNOWN = 0xFFFFFFFF,
+    HFI_LEVEL_NONE = 0xFFFFFFFF,
 };
 
 #define HFI_PROP_LEVEL                                          0x03000108
 
-
 enum hfi_hevc_tier_type {
-    HFI_HEVC_TIER_MAIN = 0,
-    HFI_HEVC_TIER_HIGH = 1,
+    HFI_H265_TIER_MAIN = 0,
+    HFI_H265_TIER_HIGH = 1,
 };
 #define HFI_PROP_TIER                                           0x03000109
 
@@ -212,24 +219,25 @@ enum hfi_hevc_tier_type {
 
 #define HFI_PROP_BUFFER_MAX_NUM_REFERENCE                       0x03000126
 
-#define HFI_PROP_BUFFER_VUI_RESTRICTION                         0x03000127
+#define HFI_PROP_MAX_NUM_REORDER_FRAMES                         0x03000127
 
 #define HFI_PROP_PIC_ORDER_CNT_TYPE                             0x03000128
 
 enum hfi_deblock_mode {
-    HFI_DB_MODE_DISABLE             = 0,
-    HFI_DB_MODE_SKIP_SLICE_BOUNDARY = BIT(0),
-    HFI_DB_MODE_ALL_BOUNDARY        = BIT(1),
+    HFI_DEBLOCK_ALL_BOUNDARY              = 0x0,
+    HFI_DEBLOCK_DISABLE                   = 0x1,
+    HFI_DEBLOCK_DISABLE_AT_SLICE_BOUNDARY = 0x2,
 };
 #define HFI_PROP_DEBLOCKING_MODE                                0x03000129
 
 enum hfi_rate_control {
-    HFI_RC_OFF      = 0x00000000,
-    HFI_RC_VBR_CFR  = 0x00000001,
-    HFI_RC_CBR_CFR  = 0x00000002,
-    HFI_RC_CBR_VFR  = 0x00000003,
-    HFI_RC_CQ       = 0x00000004,
-    HFI_RC_LOSSLESS = 0x00000005,
+    HFI_RC_VBR_CFR        = 0x00000000,
+    HFI_RC_CBR_CFR        = 0x00000001,
+    HFI_RC_CQ             = 0x00000002,
+    HFI_RC_OFF            = 0x00000003,
+    HFI_RC_CBR_VFR        = 0x00000004,
+    HFI_RC_LOSSLESS       = 0x00000005,
+    HFI_RC_CBR_VFR_LEGACY = 0x00000006,
 };
 #define HFI_PROP_RATE_CONTROL                                   0x0300012a
 
@@ -267,7 +275,7 @@ enum hfi_rate_control {
 enum hfi_layer_encoding_type {
     HFI_HIER_P_SLIDING_WINDOW = 0x1,
     HFI_HIER_P_HYBRID_LTR     = 0x2,
-    HFI_HIER_B                = 0x4,
+    HFI_HIER_B                = 0x3,
 };
 #define HFI_PROP_LAYER_ENCODING_TYPE                            0x03000138
 
@@ -304,16 +312,16 @@ enum hfi_layer_encoding_type {
 #define HFI_PROP_MAX_B_FRAMES                                   0x03000147
 
 enum hfi_quality_mode {
-    HFI_MODE_MAX_QUALITY = BIT(0),
-    HFI_MODE_POWER_SAVE  = BIT(1),
+    HFI_MODE_MAX_QUALITY = 0x1,
+    HFI_MODE_POWER_SAVE  = 0x2,
 };
 #define HFI_PROP_QUALITY_MODE                                   0x03000148
 
 enum hfi_seq_header_mode {
-    HFI_SEQ_HEADER_SEPERATE_FRAME          = BIT(0),
-    HFI_SEQ_HEADER_JOINED_WITH_1ST_FRAME   = BIT(1),
-    HFI_SEQ_HEADER_PREFIX_WITH_SYNC_FRAME  = BIT(2),
-    HFI_SEQ_HEADER_METADATA                = BIT(3),
+    HFI_SEQ_HEADER_SEPERATE_FRAME         = 0x00000001,
+    HFI_SEQ_HEADER_JOINED_WITH_1ST_FRAME  = 0x00000002,
+    HFI_SEQ_HEADER_PREFIX_WITH_SYNC_FRAME = 0x00000004,
+    HFI_SEQ_HEADER_METADATA               = 0x00000008,
 };
 #define HFI_PROP_SEQ_HEADER_MODE                                0x03000149
 
@@ -328,18 +336,18 @@ enum hfi_rotation {
 #define HFI_PROP_ROTATION                                       0x0300014b
 
 enum hfi_flip {
-    HFI_FLIP_NONE       = 0,
-    HFI_FLIP_HORIZONTAL = BIT(0),
-    HFI_FLIP_VERTICAL   = BIT(1),
+    HFI_DISABLE_FLIP    = 0x00000000,
+    HFI_HORIZONTAL_FLIP = 0x00000001,
+    HFI_VERTICAL_FLIP   = 0x00000002,
 };
 #define HFI_PROP_FLIP                                           0x0300014c
 
 #define HFI_PROP_SCALAR                                         0x0300014d
 
 enum hfi_blur_types {
-    HFI_BLUR_NONE     = 0,
-    HFI_BLUR_EXTERNAL = BIT(0),
-    HFI_BLUR_ADAPTIVE = BIT(1),
+    HFI_BLUR_NONE     = 0x00000000,
+    HFI_BLUR_EXTERNAL = 0x00000001,
+    HFI_BLUR_ADAPTIVE = 0x00000002,
 };
 #define HFI_PROP_BLUR_TYPES                                     0x0300014e
 
@@ -354,8 +362,6 @@ enum hfi_blur_types {
 
 #define HFI_PROP_AUD                                            0x03000151
 
-#define HFI_PROP_VUI_TIMING_INFO                                0x03000152
-
 #define HFI_PROP_DPB_LUMA_CHROMA_MISR                           0x03000153
 
 #define HFI_PROP_OPB_LUMA_CHROMA_MISR                           0x03000154
@@ -368,13 +374,13 @@ enum hfi_blur_types {
 #define HFI_PROP_SIGNAL_COLOR_INFO                              0x03000155
 
 enum hfi_interlace_info {
-    HFI_INTERLACE_INFO_NONE                 = 0,
-    HFI_FRAME_PROGRESSIVE                   = BIT(0),
-    HFI_FRAME_MBAFF                         = BIT(1),
-    HFI_FRAME_INTERLEAVE_TOPFIELD_FIRST     = BIT(2),
-    HFI_FRAME_INTERLEAVE_BOTTOMFIELD_FIRST  = BIT(3),
-    HFI_FRAME_INTERLACE_TOPFIELD_FIRST      = BIT(4),
-    HFI_FRAME_INTERLACE_BOTTOMFIELD_FIRST   = BIT(5),
+    HFI_INTERLACE_INFO_NONE                = 0x00000000,
+    HFI_FRAME_PROGRESSIVE                  = 0x00000001,
+    HFI_FRAME_MBAFF                        = 0x00000002,
+    HFI_FRAME_INTERLEAVE_TOPFIELD_FIRST    = 0x00000004,
+    HFI_FRAME_INTERLEAVE_BOTTOMFIELD_FIRST = 0x00000008,
+    HFI_FRAME_INTERLACE_TOPFIELD_FIRST     = 0x00000010,
+    HFI_FRAME_INTERLACE_BOTTOMFIELD_FIRST  = 0x00000020,
 };
 #define HFI_PROP_INTERLACE_INFO                                 0x03000156
 
@@ -403,12 +409,12 @@ enum hfi_interlace_info {
 #define HFI_PROP_HISTOGRAM_INFO                                 0x03000161
 
 enum hfi_picture_type {
-    HFI_PICTURE_TYPE_IDR = BIT(0),
-    HFI_PICTURE_TYPE_P   = BIT(1),
-    HFI_PICTURE_TYPE_B   = BIT(2),
-    HFI_PICTURE_TYPE_I   = BIT(3),
-    HFI_PICTURE_TYPE_CRA = BIT(4),
-    HFI_PICTURE_TYPE_BLA = BIT(5),
+    HFI_PICTURE_IDR = 0x00000001,
+    HFI_PICTURE_P   = 0x00000002,
+    HFI_PICTURE_B   = 0x00000004,
+    HFI_PICTURE_I   = 0x00000008,
+    HFI_PICTURE_CRA = 0x00000010,
+    HFI_PICTURE_BLA = 0x00000020,
 };
 #define HFI_PROP_PICTURE_TYPE                                   0x03000162
 
@@ -420,13 +426,13 @@ enum hfi_picture_type {
 
 #define HFI_PROP_SEI_STREAM_USERDATA                            0x03000166
 
-#define HFI_PROP_CVP_STAT_INFO                                  0x03000167
+#define HFI_PROP_EVA_STAT_INFO                                  0x03000167
 
 #define HFI_PROP_DEC_DEFAULT_HEADER                             0x03000168
 
 #define HFI_PROP_DEC_START_FROM_RAP_FRAME                       0x03000169
 
-#define HFI_PROP_TAG_NOT_PROPAGATED_TO_OUTPUT                   0x0300016a
+#define HFI_PROP_NO_OUTPUT                                      0x0300016a
 
 #define HFI_PROP_BUFFER_TAG                                     0x0300016b
 
@@ -454,7 +460,13 @@ enum hfi_picture_type {
 
 #define HFI_ERROR_MAX_SESSIONS                                  0x04000002
 
-#define HFI_ERROR_UNSUPPORTED                                   0x04000003
+#define HFI_ERROR_FATAL                                         0x04000003
+
+#define HFI_ERROR_INVALID_STATE                                 0x04000004
+
+#define HFI_ERROR_INSUFFICIENT_RESOURCES                        0x04000005
+
+#define HFI_ERROR_BUFFER_NOT_SET                                0x04000006
 
 #define HFI_SESSION_ERROR_END                                   0x04FFFFFF
 
@@ -464,13 +476,15 @@ enum hfi_picture_type {
 
 #define HFI_SYS_ERROR_NOC                                       0x05000002
 
+#define HFI_SYS_ERROR_FATAL                                     0x05000003
+
 #define HFI_SYSTEM_ERROR_END                                    0x05FFFFFF
 
 #define HFI_INFORMATION_BEGIN                                   0x06000000
 
 #define HFI_INFO_UNSUPPORTED                                    0x06000001
 
-#define HFI_INFO_BITSTREAM_CORRUPT                              0x06000002
+#define HFI_INFO_DATA_CORRUPT                                   0x06000002
 
 #define HFI_INFORMATION_END                                     0x06FFFFFF
 

+ 4 - 7
driver/vidc/inc/msm_vidc_internal.h

@@ -321,6 +321,8 @@ enum msm_vidc_inst_capability_type {
 	CHROMA_QP_INDEX_OFFSET,
 	DISPLAY_DELAY_ENABLE,
 	DISPLAY_DELAY,
+	CONCEAL_COLOR_8BIT,
+	CONCEAL_COLOR_10BIT,
 	INST_CAP_MAX,
 };
 
@@ -525,8 +527,8 @@ struct msm_vidc_color_info {
 };
 
 struct msm_vidc_crop {
-	u32 x;
-	u32 y;
+	u32 left;
+	u32 top;
 	u32 width;
 	u32 height;
 };
@@ -534,11 +536,6 @@ struct msm_vidc_crop {
 struct msm_vidc_properties {
 	u32                    frame_rate;
 	u32                    operating_rate;
-	u32                    bit_rate;
-	u32                    profile;
-	u32                    level;
-	u32                    entropy_mode;
-	u32                    rc_type;
 };
 
 struct msm_vidc_subscription_params {

+ 1 - 1
driver/vidc/src/hfi_packet.c

@@ -313,7 +313,7 @@ int hfi_packet_sys_init(struct msm_vidc_core *core,
 		goto err_sys_init;
 
 	/* HFI_CMD_SYSTEM_INIT */
-	payload = HFI_VIDEO_ARCH_OX;
+	payload = HFI_VIDEO_ARCH_LX;
 	rc = hfi_create_packet(pkt, pkt_size,
 				   HFI_CMD_INIT,
 				   (HFI_HOST_FLAGS_RESPONSE_REQUIRED |

+ 426 - 176
driver/vidc/src/msm_vdec.c

@@ -14,23 +14,26 @@
 #include "msm_vidc_platform.h"
 #include "msm_vidc_control.h"
 #include "msm_vidc_debug.h"
+#include "msm_vidc_control.h"
 #include "venus_hfi.h"
 #include "hfi_packet.h"
 
 u32 msm_vdec_subscribe_for_port_settings_change[] = {
-	HFI_PROP_ALIGN_RESOLUTION,
-	HFI_PROP_CROP_COORDINATE_TOP_LEFT,
-	HFI_PROP_CROP_RESOLUTION,
+	HFI_PROP_BITSTREAM_RESOLUTION,
+	HFI_PROP_CROP_OFFSETS,
 	HFI_PROP_LUMA_CHROMA_BIT_DEPTH,
 	HFI_PROP_CABAC_SESSION,
 	HFI_PROP_CODED_FRAMES,
 	HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT,
 	HFI_PROP_PIC_ORDER_CNT_TYPE,
 	HFI_PROP_SIGNAL_COLOR_INFO,
+	HFI_PROP_PROFILE,
+	HFI_PROP_LEVEL,
+	HFI_PROP_TIER,
 };
 
 u32 msm_vdec_subscribe_for_properties[] = {
-	HFI_PROP_TAG_NOT_PROPAGATED_TO_OUTPUT,
+	HFI_PROP_NO_OUTPUT,
 };
 
 u32 msm_vdec_subscribe_for_metadata[] = {
@@ -68,79 +71,103 @@ exit:
 	return rc;
 }
 
-static int msm_vdec_set_resolution(struct msm_vidc_inst *inst,
+static int msm_vdec_set_bitstream_resolution(struct msm_vidc_inst *inst,
 	enum msm_vidc_port_type port)
 {
 	int rc = 0;
 	u32 resolution;
 
-	if (port != INPUT_PORT && port != OUTPUT_PORT) {
-		s_vpr_e(inst->sid, "%s: invalid port %d\n", __func__, port);
-		return -EINVAL;
-	}
-
-	resolution = inst->fmts[port].fmt.pix_mp.width << 16 |
-		inst->fmts[port].fmt.pix_mp.height;
+	resolution = inst->fmts[INPUT_PORT].fmt.pix_mp.width << 16 |
+		inst->fmts[INPUT_PORT].fmt.pix_mp.height;
+	s_vpr_h(inst->sid, "%s: width: %d height: %d\n", __func__,
+			inst->fmts[INPUT_PORT].fmt.pix_mp.width,
+			inst->fmts[INPUT_PORT].fmt.pix_mp.height);
 	rc = venus_hfi_session_property(inst,
-			HFI_PROP_ALIGN_RESOLUTION,
+			HFI_PROP_BITSTREAM_RESOLUTION,
 			HFI_HOST_FLAGS_NONE,
 			get_hfi_port(inst, port),
 			HFI_PAYLOAD_U32,
 			&resolution,
 			sizeof(u32));
 	if (rc)
-		return rc;
-	return 0;
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
 }
 
-static int msm_vdec_set_crop_top_left(struct msm_vidc_inst *inst,
-	enum msm_vidc_port_type port)
+static int msm_vdec_set_linear_stride_scanline(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
-	u32 crop_top_left;
+	u32 stride_y, scanline_y, stride_uv, scanline_uv;
+	u32 payload[2];
 
-	if (port != INPUT_PORT && port != OUTPUT_PORT) {
-		s_vpr_e(inst->sid, "%s: invalid port %d\n", __func__, port);
-		return -EINVAL;
-	}
+	if (inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat !=
+		V4L2_PIX_FMT_NV12 &&
+		inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat !=
+		V4L2_PIX_FMT_VIDC_P010)
+		return 0;
 
-	crop_top_left = 0;
+	stride_y = inst->fmts[OUTPUT_PORT].fmt.pix_mp.width;
+	scanline_y = inst->fmts[OUTPUT_PORT].fmt.pix_mp.height;
+	stride_uv = stride_y;
+	scanline_uv = scanline_y / 2;
+
+	payload[0] = stride_y << 16 | scanline_y;
+	payload[1] = stride_uv << 16 | scanline_uv;
+	s_vpr_h(inst->sid, "%s: stride_y: %d scanline_y: %d "
+		"stride_uv: %d, scanline_uv: %d", __func__,
+		stride_y, scanline_y, stride_uv, scanline_uv);
 	rc = venus_hfi_session_property(inst,
-			HFI_PROP_CROP_COORDINATE_TOP_LEFT,
+			HFI_PROP_LINEAR_STRIDE_SCANLINE,
 			HFI_HOST_FLAGS_NONE,
-			get_hfi_port(inst, port),
-			HFI_PAYLOAD_U32,
-			&crop_top_left,
-			sizeof(u32));
+			get_hfi_port(inst, OUTPUT_PORT),
+			HFI_PAYLOAD_U64,
+			&payload,
+			sizeof(u64));
 	if (rc)
-		return rc;
-	return 0;
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
 }
 
-static int msm_vdec_set_crop_resolution(struct msm_vidc_inst *inst,
+static int msm_vdec_set_crop_offsets(struct msm_vidc_inst *inst,
 	enum msm_vidc_port_type port)
 {
 	int rc = 0;
-	u32 crop;
+	u32 left_offset, top_offset, right_offset, bottom_offset;
+	u32 payload[2];
 
-	if (port != INPUT_PORT && port != OUTPUT_PORT) {
-		s_vpr_e(inst->sid, "%s: invalid port %d\n", __func__, port);
+	if (inst->fmts[INPUT_PORT].fmt.pix_mp.width <
+		inst->crop.width)
 		return -EINVAL;
-	}
 
-	/* output buffer resolution is nothing but crop */
-	crop = inst->fmts[OUTPUT_PORT].fmt.pix_mp.width << 16 |
-		inst->fmts[OUTPUT_PORT].fmt.pix_mp.height;
+	if (inst->fmts[INPUT_PORT].fmt.pix_mp.height <
+		inst->crop.height)
+		return -EINVAL;
+
+	left_offset = inst->crop.left;
+	top_offset = inst->crop.top;
+	right_offset = (inst->fmts[INPUT_PORT].fmt.pix_mp.width -
+		inst->crop.width);
+	bottom_offset = (inst->fmts[INPUT_PORT].fmt.pix_mp.height -
+		inst->crop.height);
+
+	payload[0] = right_offset << 16 | bottom_offset;
+	payload[1] = left_offset << 16 | top_offset;
+	s_vpr_h(inst->sid, "%s: left_offset: %d top_offset: %d "
+		"right_offset: %d bottom_offset: %d", __func__,
+		left_offset, top_offset, right_offset, bottom_offset);
 	rc = venus_hfi_session_property(inst,
-			HFI_PROP_CROP_RESOLUTION,
+			HFI_PROP_CROP_OFFSETS,
 			HFI_HOST_FLAGS_NONE,
 			get_hfi_port(inst, port),
-			HFI_PAYLOAD_U32,
-			&crop,
-			sizeof(u32));
+			HFI_PAYLOAD_U64,
+			&payload,
+			sizeof(u64));
 	if (rc)
-		return rc;
-	return 0;
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
 }
 
 static int msm_vdec_set_bit_depth(struct msm_vidc_inst *inst,
@@ -159,6 +186,7 @@ static int msm_vdec_set_bit_depth(struct msm_vidc_inst *inst,
 	if (colorformat == V4L2_PIX_FMT_VIDC_P010 ||
 	    colorformat == V4L2_PIX_FMT_VIDC_TP10C)
 		bitdepth = 10 << 16 | 10;
+	s_vpr_h(inst->sid, "%s: bit depth: %d", __func__, bitdepth);
 	rc = venus_hfi_session_property(inst,
 			HFI_PROP_LUMA_CHROMA_BIT_DEPTH,
 			HFI_HOST_FLAGS_NONE,
@@ -167,8 +195,9 @@ static int msm_vdec_set_bit_depth(struct msm_vidc_inst *inst,
 			&bitdepth,
 			sizeof(u32));
 	if (rc)
-		return rc;
-	return 0;
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
 }
 
 static int msm_vdec_set_cabac(struct msm_vidc_inst *inst,
@@ -182,6 +211,10 @@ static int msm_vdec_set_cabac(struct msm_vidc_inst *inst,
 		return -EINVAL;
 	}
 
+	rc = msm_vidc_v4l2_menu_to_hfi(inst, ENTROPY_MODE, &cabac);
+	if (rc)
+		return rc;
+	s_vpr_h(inst->sid, "%s: entropy mode: %d", __func__, cabac);
 	rc = venus_hfi_session_property(inst,
 			HFI_PROP_CABAC_SESSION,
 			HFI_HOST_FLAGS_NONE,
@@ -190,8 +223,9 @@ static int msm_vdec_set_cabac(struct msm_vidc_inst *inst,
 			&cabac,
 			sizeof(u32));
 	if (rc)
-		return rc;
-	return 0;
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
 }
 
 static int msm_vdec_set_coded_frames(struct msm_vidc_inst *inst,
@@ -206,7 +240,8 @@ static int msm_vdec_set_coded_frames(struct msm_vidc_inst *inst,
 	}
 
 	/* (mb_adaptive_frame_field_flag << 1) | frame_mbs_only_flag */
-	coded_frames = 1;
+	coded_frames = 0;
+	s_vpr_h(inst->sid, "%s: coded frames: %d", __func__, coded_frames);
 	rc = venus_hfi_session_property(inst,
 			HFI_PROP_CODED_FRAMES,
 			HFI_HOST_FLAGS_NONE,
@@ -215,8 +250,9 @@ static int msm_vdec_set_coded_frames(struct msm_vidc_inst *inst,
 			&coded_frames,
 			sizeof(u32));
 	if (rc)
-		return rc;
-	return 0;
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
 }
 
 static int msm_vdec_set_min_output_count(struct msm_vidc_inst *inst,
@@ -231,6 +267,8 @@ static int msm_vdec_set_min_output_count(struct msm_vidc_inst *inst,
 	}
 
 	min_output = inst->buffers.output.min_count;
+	s_vpr_h(inst->sid, "%s: firmware min output count: %d",
+		__func__, min_output);
 	rc = venus_hfi_session_property(inst,
 			HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT,
 			HFI_HOST_FLAGS_NONE,
@@ -239,21 +277,23 @@ static int msm_vdec_set_min_output_count(struct msm_vidc_inst *inst,
 			&min_output,
 			sizeof(u32));
 	if (rc)
-		return rc;
-	return 0;
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
 }
 
 static int msm_vdec_set_picture_order_count(struct msm_vidc_inst *inst,
 	enum msm_vidc_port_type port)
 {
 	int rc = 0;
-	u32 poc = 1;
+	u32 poc = 0;
 
 	if (port != INPUT_PORT && port != OUTPUT_PORT) {
 		s_vpr_e(inst->sid, "%s: invalid port %d\n", __func__, port);
 		return -EINVAL;
 	}
 
+	s_vpr_h(inst->sid, "%s: picture order count: %d", __func__, poc);
 	rc = venus_hfi_session_property(inst,
 			HFI_PROP_PIC_ORDER_CNT_TYPE,
 			HFI_HOST_FLAGS_NONE,
@@ -262,8 +302,9 @@ static int msm_vdec_set_picture_order_count(struct msm_vidc_inst *inst,
 			&poc,
 			sizeof(u32));
 	if (rc)
-		return rc;
-	return 0;
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
 }
 
 static int msm_vdec_set_colorspace(struct msm_vidc_inst *inst,
@@ -278,6 +319,7 @@ static int msm_vdec_set_colorspace(struct msm_vidc_inst *inst,
 	}
 
 	colorspace = inst->fmts[OUTPUT_PORT].fmt.pix_mp.colorspace;
+	s_vpr_h(inst->sid, "%s: colorspace: %d", __func__, colorspace);
 	rc = venus_hfi_session_property(inst,
 			HFI_PROP_SIGNAL_COLOR_INFO,
 			HFI_HOST_FLAGS_NONE,
@@ -286,152 +328,353 @@ static int msm_vdec_set_colorspace(struct msm_vidc_inst *inst,
 			&colorspace,
 			sizeof(u32));
 	if (rc)
-		return rc;
-	return 0;
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
 }
 
-static int msm_vdec_set_colorformat(struct msm_vidc_inst *inst,
+static int msm_vdec_set_profile(struct msm_vidc_inst *inst,
 	enum msm_vidc_port_type port)
 {
 	int rc = 0;
-	u32 pixelformat;
-	enum msm_vidc_colorformat_type colorformat;
-	u32 hfi_colorformat;
+	u32 profile;
 
 	if (port != INPUT_PORT && port != OUTPUT_PORT) {
 		s_vpr_e(inst->sid, "%s: invalid port %d\n", __func__, port);
 		return -EINVAL;
 	}
 
-	pixelformat = inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat;
-	if (pixelformat != V4L2_PIX_FMT_VIDC_NV12C &&
-	    pixelformat != V4L2_PIX_FMT_VIDC_TP10C) {
-		s_vpr_e(inst->sid, "%s: invalid pixelformat %#x\n",
-			__func__, pixelformat);
+	profile = inst->capabilities->cap[PROFILE].value;
+	s_vpr_h(inst->sid, "%s: profile: %d", __func__, profile);
+	rc = venus_hfi_session_property(inst,
+			HFI_PROP_PROFILE,
+			HFI_HOST_FLAGS_NONE,
+			get_hfi_port(inst, port),
+			HFI_PAYLOAD_U32_ENUM,
+			&profile,
+			sizeof(u32));
+	if (rc)
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
+}
+
+static int msm_vdec_set_level(struct msm_vidc_inst *inst,
+	enum msm_vidc_port_type port)
+{
+	int rc = 0;
+	u32 level;
+
+	if (port != INPUT_PORT && port != OUTPUT_PORT) {
+		s_vpr_e(inst->sid, "%s: invalid port %d\n", __func__, port);
 		return -EINVAL;
 	}
-	colorformat = v4l2_colorformat_to_driver(pixelformat, __func__);
-	hfi_colorformat = get_hfi_colorformat(inst, colorformat);
+
+	level = inst->capabilities->cap[LEVEL].value;
+	s_vpr_h(inst->sid, "%s: level: %d", __func__, level);
 	rc = venus_hfi_session_property(inst,
-			HFI_PROP_COLOR_FORMAT,
+			HFI_PROP_LEVEL,
 			HFI_HOST_FLAGS_NONE,
 			get_hfi_port(inst, port),
-			HFI_PAYLOAD_U32,
-			&hfi_colorformat,
+			HFI_PAYLOAD_U32_ENUM,
+			&level,
 			sizeof(u32));
 	if (rc)
-		return rc;
-	return 0;
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
 }
 
-static int msm_vdec_set_stage(struct msm_vidc_inst *inst,
+static int msm_vdec_set_tier(struct msm_vidc_inst *inst,
 	enum msm_vidc_port_type port)
 {
 	int rc = 0;
-	struct msm_vidc_core *core = inst->core;
+	u32 tier;
 
 	if (port != INPUT_PORT && port != OUTPUT_PORT) {
 		s_vpr_e(inst->sid, "%s: invalid port %d\n", __func__, port);
 		return -EINVAL;
 	}
 
+	tier = inst->capabilities->cap[HEVC_TIER].value;
+	s_vpr_h(inst->sid, "%s: tier: %d", __func__, tier);
+	rc = venus_hfi_session_property(inst,
+			HFI_PROP_TIER,
+			HFI_HOST_FLAGS_NONE,
+			get_hfi_port(inst, port),
+			HFI_PAYLOAD_U32_ENUM,
+			&tier,
+			sizeof(u32));
+	if (rc)
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
+}
+
+static int msm_vdec_set_colorformat(struct msm_vidc_inst *inst)
+{
+	int rc = 0;
+	u32 pixelformat;
+	enum msm_vidc_colorformat_type colorformat;
+	u32 hfi_colorformat;
+
+	pixelformat = inst->fmts[OUTPUT_PORT].fmt.pix_mp.pixelformat;
+	colorformat = v4l2_colorformat_to_driver(pixelformat, __func__);
+	hfi_colorformat = get_hfi_colorformat(inst, colorformat);
+	s_vpr_h(inst->sid, "%s: hfi colorformat: %d",
+		__func__, hfi_colorformat);
+	rc = venus_hfi_session_property(inst,
+			HFI_PROP_COLOR_FORMAT,
+			HFI_HOST_FLAGS_NONE,
+			get_hfi_port(inst, OUTPUT_PORT),
+			HFI_PAYLOAD_U32,
+			&hfi_colorformat,
+			sizeof(u32));
+	if (rc)
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
+}
+
+static int msm_vdec_set_stage(struct msm_vidc_inst *inst)
+{
+	int rc = 0;
+	u32 stage = 0;
+	struct msm_vidc_core *core = inst->core;
+
 	rc = call_session_op(core, decide_work_mode, inst);
 	if (rc) {
 		s_vpr_e(inst->sid, "%s: decide_work_mode failed %d\n",
-			__func__, port);
+			__func__);
 		return -EINVAL;
 	}
 
+	stage = inst->stage;
+	s_vpr_h(inst->sid, "%s: stage: %d", __func__, stage);
 	rc = venus_hfi_session_property(inst,
 			HFI_PROP_STAGE,
 			HFI_HOST_FLAGS_NONE,
+			HFI_PORT_NONE,
+			HFI_PAYLOAD_U32,
+			&stage,
+			sizeof(u32));
+	if (rc)
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
+}
+
+static int msm_vdec_set_pipe(struct msm_vidc_inst *inst)
+{
+	int rc = 0;
+	u32 pipe;
+	struct msm_vidc_core *core = inst->core;
+
+	rc = call_session_op(core, decide_work_route, inst);
+	if (rc) {
+		s_vpr_e(inst->sid, "%s: decide_work_route failed\n",
+			__func__);
+		return -EINVAL;
+	}
+
+	pipe = inst->pipe;
+	s_vpr_h(inst->sid, "%s: pipe: %d", __func__, pipe);
+	rc = venus_hfi_session_property(inst,
+			HFI_PROP_PIPE,
+			HFI_HOST_FLAGS_NONE,
+			HFI_PORT_NONE,
+			HFI_PAYLOAD_U32,
+			&inst->pipe,
+			sizeof(u32));
+	if (rc)
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
+}
+
+static int msm_vdec_set_output_order(struct msm_vidc_inst *inst,
+	enum msm_vidc_port_type port)
+{
+	int rc = 0;
+	u32 output_order;
+
+	if (port != INPUT_PORT) {
+		s_vpr_e(inst->sid, "%s: invalid port %d\n", __func__, port);
+		return -EINVAL;
+	}
+
+	output_order = inst->capabilities->cap[DISPLAY_DELAY_ENABLE].value;
+	s_vpr_h(inst->sid, "%s: output order: %d", __func__, output_order);
+	rc = venus_hfi_session_property(inst,
+			HFI_PROP_DECODE_ORDER_OUTPUT,
+			HFI_HOST_FLAGS_NONE,
 			get_hfi_port(inst, port),
 			HFI_PAYLOAD_U32,
-			&inst->stage,
+			&output_order,
 			sizeof(u32));
 	if (rc)
-		return rc;
-	return 0;
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
 }
 
-static int msm_vdec_set_pipe(struct msm_vidc_inst *inst,
+static int msm_vdec_set_secure_mode(struct msm_vidc_inst *inst,
 	enum msm_vidc_port_type port)
 {
 	int rc = 0;
-	struct msm_vidc_core *core = inst->core;
+	u32 secure_mode;
 
-	if (port != INPUT_PORT && port != OUTPUT_PORT) {
+	secure_mode = inst->capabilities->cap[SECURE_MODE].value;
+	s_vpr_h(inst->sid, "%s: secure mode: %d", __func__, secure_mode);
+	rc = venus_hfi_session_property(inst,
+			HFI_PROP_SECURE,
+			HFI_HOST_FLAGS_NONE,
+			HFI_PORT_NONE,
+			HFI_PAYLOAD_U32,
+			&secure_mode,
+			sizeof(u32));
+	if (rc)
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
+}
+
+static int msm_vdec_set_thumbnail_mode(struct msm_vidc_inst *inst,
+	enum msm_vidc_port_type port)
+{
+	int rc = 0;
+	u32 thumbnail_mode = 0;
+
+	if (port != INPUT_PORT) {
 		s_vpr_e(inst->sid, "%s: invalid port %d\n", __func__, port);
 		return -EINVAL;
 	}
 
-	rc = call_session_op(core, decide_work_route, inst);
-	if (rc) {
-		s_vpr_e(inst->sid, "%s: decide_work_route failed %d\n",
-			__func__, port);
+	s_vpr_h(inst->sid, "%s: thumbnail mode: %d", __func__, thumbnail_mode);
+	rc = venus_hfi_session_property(inst,
+			HFI_PROP_THUMBNAIL_MODE,
+			HFI_HOST_FLAGS_NONE,
+			get_hfi_port(inst, port),
+			HFI_PAYLOAD_U32,
+			&thumbnail_mode,
+			sizeof(u32));
+	if (rc)
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
+}
+
+static int msm_vdec_set_realtime(struct msm_vidc_inst *inst,
+	enum msm_vidc_port_type port)
+{
+	int rc = 0;
+	u32 realtime = 1;  //todo
+
+	if (port != INPUT_PORT) {
+		s_vpr_e(inst->sid, "%s: invalid port %d\n", __func__, port);
 		return -EINVAL;
 	}
 
+	s_vpr_h(inst->sid, "%s: priority: %d", __func__, realtime);
 	rc = venus_hfi_session_property(inst,
-			HFI_PROP_PIPE,
+			HFI_PROP_REALTIME,
 			HFI_HOST_FLAGS_NONE,
 			get_hfi_port(inst, port),
 			HFI_PAYLOAD_U32,
-			&inst->pipe,
+			&realtime,
 			sizeof(u32));
 	if (rc)
-		return rc;
-	return 0;
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
+}
+
+static int msm_vdec_set_conceal_color_8bit(struct msm_vidc_inst *inst,
+	enum msm_vidc_port_type port)
+{
+	int rc = 0;
+	u32 conceal_color_8bit;
+
+	if (port != INPUT_PORT) {
+		s_vpr_e(inst->sid, "%s: invalid port %d\n", __func__, port);
+		return -EINVAL;
+	}
+
+	conceal_color_8bit = inst->capabilities->cap[CONCEAL_COLOR_8BIT].value;
+	s_vpr_h(inst->sid, "%s: conceal color 8bit: %#x",
+		__func__, conceal_color_8bit);
+	rc = venus_hfi_session_property(inst,
+			HFI_PROP_CONCEAL_COLOR_8BIT,
+			HFI_HOST_FLAGS_NONE,
+			get_hfi_port(inst, port),
+			HFI_PAYLOAD_32_PACKED,
+			&conceal_color_8bit,
+			sizeof(u32));
+	if (rc)
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
+}
+
+static int msm_vdec_set_conceal_color_10bit(struct msm_vidc_inst *inst,
+	enum msm_vidc_port_type port)
+{
+	int rc = 0;
+	u32 conceal_color_10bit;
+
+	if (port != INPUT_PORT) {
+		s_vpr_e(inst->sid, "%s: invalid port %d\n", __func__, port);
+		return -EINVAL;
+	}
+
+	conceal_color_10bit = inst->capabilities->cap[CONCEAL_COLOR_8BIT].value;
+	s_vpr_h(inst->sid, "%s: conceal color 10bit: %#x",
+		__func__, conceal_color_10bit);
+	rc = venus_hfi_session_property(inst,
+			HFI_PROP_CONCEAL_COLOR_10BIT,
+			HFI_HOST_FLAGS_NONE,
+			get_hfi_port(inst, port),
+			HFI_PAYLOAD_32_PACKED,
+			&conceal_color_10bit,
+			sizeof(u32));
+	if (rc)
+		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);
+
+	return rc;
 }
 
 static int msm_vdec_set_input_properties(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
-	int i = 0;
 
-	d_vpr_h("%s()\n", __func__);
 	if (!inst) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
 
-	for (i = 0; i < ARRAY_SIZE(msm_vdec_subscribe_for_port_settings_change);
-	     i++) {
-		switch (msm_vdec_subscribe_for_port_settings_change[i]) {
-		case HFI_PROP_ALIGN_RESOLUTION:
-			rc = msm_vdec_set_resolution(inst, INPUT_PORT);
-			break;
-		case HFI_PROP_CROP_COORDINATE_TOP_LEFT:
-			rc = msm_vdec_set_crop_top_left(inst, INPUT_PORT);
-			break;
-		case HFI_PROP_CROP_RESOLUTION:
-			rc = msm_vdec_set_crop_resolution(inst, INPUT_PORT);
-			break;
-		case HFI_PROP_LUMA_CHROMA_BIT_DEPTH:
-			rc = msm_vdec_set_bit_depth(inst, INPUT_PORT);
-			break;
-		case HFI_PROP_CABAC_SESSION:
-			rc = msm_vdec_set_cabac(inst, INPUT_PORT);
-			break;
-		case HFI_PROP_CODED_FRAMES:
-			rc = msm_vdec_set_coded_frames(inst, INPUT_PORT);
-			break;
-		case HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT:
-			rc = msm_vdec_set_min_output_count(inst, INPUT_PORT);
-			break;
-		case HFI_PROP_PIC_ORDER_CNT_TYPE:
-			rc = msm_vdec_set_picture_order_count(inst, INPUT_PORT);
-			break;
-		case HFI_PROP_SIGNAL_COLOR_INFO:
-			rc = msm_vdec_set_colorspace(inst, INPUT_PORT);
-			break;
-		default:
-			d_vpr_e("%s: unknown property %#x\n", __func__,
-				msm_vdec_subscribe_for_port_settings_change[i]);
-			rc = -EINVAL;
-			break;
-		}
-	}
+	rc = msm_vdec_set_output_order(inst, INPUT_PORT);
+	if (rc)
+		return rc;
+
+	rc = msm_vdec_set_secure_mode(inst, INPUT_PORT);
+	if (rc)
+		return rc;
+
+	rc = msm_vdec_set_thumbnail_mode(inst, INPUT_PORT);
+	if (rc)
+		return rc;
+
+	rc = msm_vdec_set_realtime(inst, INPUT_PORT);
+	if (rc)
+		return rc;
+
+	rc = msm_vdec_set_conceal_color_8bit(inst, INPUT_PORT);
+	if (rc)
+		return rc;
+
+	rc = msm_vdec_set_conceal_color_10bit(inst, INPUT_PORT);
+	if (rc)
+		return rc;
 
 	return rc;
 }
@@ -439,63 +682,27 @@ static int msm_vdec_set_input_properties(struct msm_vidc_inst *inst)
 static int msm_vdec_set_output_properties(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
-	int i = 0;
 
-	d_vpr_h("%s()\n", __func__);
 	if (!inst) {
 		d_vpr_e("%s: invalid params\n", __func__);
 		return -EINVAL;
 	}
 
-	rc = msm_vdec_set_colorformat(inst, OUTPUT_PORT);
+	rc = msm_vdec_set_colorformat(inst);
 	if (rc)
 		return rc;
 
-	rc = msm_vdec_set_stage(inst, OUTPUT_PORT);
+	rc = msm_vdec_set_stage(inst);
 	if (rc)
 		return rc;
 
-	rc = msm_vdec_set_pipe(inst, OUTPUT_PORT);
+	rc = msm_vdec_set_pipe(inst);
 	if (rc)
 		return rc;
 
-	for (i = 0; i < ARRAY_SIZE(msm_vdec_subscribe_for_port_settings_change);
-	     i++) {
-		switch (msm_vdec_subscribe_for_port_settings_change[i]) {
-		case HFI_PROP_ALIGN_RESOLUTION:
-			rc = msm_vdec_set_resolution(inst, OUTPUT_PORT);
-			break;
-		case HFI_PROP_CROP_COORDINATE_TOP_LEFT:
-			rc = msm_vdec_set_crop_top_left(inst, OUTPUT_PORT);
-			break;
-		case HFI_PROP_CROP_RESOLUTION:
-			rc = msm_vdec_set_crop_resolution(inst, OUTPUT_PORT);
-			break;
-		case HFI_PROP_LUMA_CHROMA_BIT_DEPTH:
-			rc = msm_vdec_set_bit_depth(inst, OUTPUT_PORT);
-			break;
-		case HFI_PROP_CABAC_SESSION:
-			rc = msm_vdec_set_cabac(inst, OUTPUT_PORT);
-			break;
-		case HFI_PROP_CODED_FRAMES:
-			rc = msm_vdec_set_coded_frames(inst, OUTPUT_PORT);
-			break;
-		case HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT:
-			rc = msm_vdec_set_min_output_count(inst, OUTPUT_PORT);
-			break;
-		case HFI_PROP_PIC_ORDER_CNT_TYPE:
-			rc = msm_vdec_set_picture_order_count(inst, OUTPUT_PORT);
-			break;
-		case HFI_PROP_SIGNAL_COLOR_INFO:
-			rc = msm_vdec_set_colorspace(inst, OUTPUT_PORT);
-			break;
-		default:
-			d_vpr_e("%s: unknown property %#x\n", __func__,
-				msm_vdec_subscribe_for_port_settings_change[i]);
-			rc = -EINVAL;
-			break;
-		}
-	}
+	rc = msm_vdec_set_linear_stride_scanline(inst);
+	if (rc)
+		return rc;
 
 	return rc;
 }
@@ -664,6 +871,50 @@ static int msm_vdec_port_settings_subscription(struct msm_vidc_inst *inst,
 			(ARRAY_SIZE(msm_vdec_subscribe_for_port_settings_change) + 1) *
 			sizeof(u32));
 
+	for (i = 0; i < ARRAY_SIZE(msm_vdec_subscribe_for_port_settings_change);
+		i++) {
+		switch (msm_vdec_subscribe_for_port_settings_change[i]) {
+		case HFI_PROP_BITSTREAM_RESOLUTION:
+			rc = msm_vdec_set_bitstream_resolution(inst, port);
+			break;
+		case HFI_PROP_CROP_OFFSETS:
+			rc = msm_vdec_set_crop_offsets(inst, port);
+			break;
+		case HFI_PROP_LUMA_CHROMA_BIT_DEPTH:
+			rc = msm_vdec_set_bit_depth(inst, port);
+			break;
+		case HFI_PROP_CABAC_SESSION:
+			rc = msm_vdec_set_cabac(inst, port);
+			break;
+		case HFI_PROP_CODED_FRAMES:
+			rc = msm_vdec_set_coded_frames(inst, port);
+			break;
+		case HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT:
+			rc = msm_vdec_set_min_output_count(inst, port);
+			break;
+		case HFI_PROP_PIC_ORDER_CNT_TYPE:
+			rc = msm_vdec_set_picture_order_count(inst, port);
+			break;
+		case HFI_PROP_SIGNAL_COLOR_INFO:
+			rc = msm_vdec_set_colorspace(inst, port);
+			break;
+		case HFI_PROP_PROFILE:
+			rc = msm_vdec_set_profile(inst, port);
+			break;
+		case HFI_PROP_LEVEL:
+			rc = msm_vdec_set_level(inst, port);
+			break;
+		case HFI_PROP_TIER:
+			rc = msm_vdec_set_tier(inst, port);
+			break;
+		default:
+			d_vpr_e("%s: unknown property %#x\n", __func__,
+				msm_vdec_subscribe_for_port_settings_change[i]);
+			rc = -EINVAL;
+			break;
+		}
+	}
+
 	return rc;
 }
 
@@ -812,11 +1063,10 @@ int msm_vdec_start_input(struct msm_vidc_inst *inst)
 	//msm_vidc_scale_power(inst);
 
 	rc = msm_vdec_create_input_internal_buffers(inst);
-	rc = 0; // TODO
 	if (rc)
 		goto error;
+
 	rc = msm_vdec_queue_input_internal_buffers(inst);
-	rc = 0; // TODO
 	if (rc)
 		goto error;
 
@@ -978,7 +1228,7 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 			fmt->fmt.pix_mp.plane_fmt[0].sizeimage;
 
 		/* update crop dimensions */
-		inst->crop.x = inst->crop.y = 0;
+		inst->crop.left = inst->crop.top = 0;
 		inst->crop.width = f->fmt.pix_mp.width;
 		inst->crop.height = f->fmt.pix_mp.height;
 
@@ -1215,7 +1465,7 @@ int msm_vdec_inst_init(struct msm_vidc_inst *inst)
 			inst->buffers.input.extra_count;
 	inst->buffers.input.size = f->fmt.pix_mp.plane_fmt[0].sizeimage;
 
-	inst->crop.x = inst->crop.y = 0;
+	inst->crop.left = inst->crop.top = 0;
 	inst->crop.width = f->fmt.pix_mp.width;
 	inst->crop.height = f->fmt.pix_mp.height;
 

+ 19 - 50
driver/vidc/src/msm_venc.c

@@ -19,19 +19,17 @@
 
 u32 msm_venc_input_set_prop[] = {
 	HFI_PROP_COLOR_FORMAT,
-	HFI_PROP_ALIGN_RESOLUTION,
-	HFI_PROP_CROP_COORDINATE_TOP_LEFT,
-	HFI_PROP_CROP_RESOLUTION,
+	HFI_PROP_BITSTREAM_RESOLUTION,
+	HFI_PROP_CROP_OFFSETS,
 };
 
 u32 msm_venc_output_set_prop[] = {
-	HFI_PROP_ALIGN_RESOLUTION,
-	HFI_PROP_CROP_COORDINATE_TOP_LEFT,
-	HFI_PROP_CROP_RESOLUTION,
+	HFI_PROP_BITSTREAM_RESOLUTION,
+	HFI_PROP_CROP_OFFSETS,
 };
 
 u32 msm_venc_input_subscribe_for_properties[] = {
-	HFI_PROP_TAG_NOT_PROPAGATED_TO_OUTPUT,
+	HFI_PROP_NO_OUTPUT,
 };
 
 u32 msm_venc_deliver_as_metadata[] = {
@@ -39,7 +37,7 @@ u32 msm_venc_deliver_as_metadata[] = {
 	HFI_PROP_SEI_MASTERING_DISPLAY_COLOUR,
 	HFI_PROP_SEI_CONTENT_LIGHT_LEVEL,
 	HFI_PROP_SEI_HDR10PLUS_USERDATA,
-	HFI_PROP_CVP_STAT_INFO,
+	HFI_PROP_EVA_STAT_INFO,
 };
 
 u32 msm_venc_subscribe_for_metadata[] = {
@@ -83,6 +81,7 @@ exit:
 	return rc;
 }
 
+/* todo: add logs for each property once finalised */
 static int msm_venc_set_colorformat(struct msm_vidc_inst *inst,
 	enum msm_vidc_port_type port)
 {
@@ -131,7 +130,7 @@ static int msm_venc_set_resolution(struct msm_vidc_inst *inst,
 	resolution = inst->fmts[port].fmt.pix_mp.width << 16 |
 		inst->fmts[port].fmt.pix_mp.height;
 	rc = venus_hfi_session_property(inst,
-			HFI_PROP_ALIGN_RESOLUTION,
+			HFI_PROP_BITSTREAM_RESOLUTION,
 			HFI_HOST_FLAGS_NONE,
 			get_hfi_port(inst, port),
 			HFI_PAYLOAD_32_PACKED,
@@ -142,31 +141,7 @@ static int msm_venc_set_resolution(struct msm_vidc_inst *inst,
 	return 0;
 }
 
-static int msm_venc_set_crop_top_left(struct msm_vidc_inst *inst,
-	enum msm_vidc_port_type port)
-{
-	int rc = 0;
-	u32 crop_top_left;
-
-	if (port != INPUT_PORT && port != OUTPUT_PORT) {
-		s_vpr_e(inst->sid, "%s: invalid port %d\n", __func__, port);
-		return -EINVAL;
-	}
-
-	crop_top_left = 0;
-	rc = venus_hfi_session_property(inst,
-			HFI_PROP_CROP_COORDINATE_TOP_LEFT,
-			HFI_HOST_FLAGS_NONE,
-			get_hfi_port(inst, port),
-			HFI_PAYLOAD_32_PACKED,
-			&crop_top_left,
-			sizeof(u32));
-	if (rc)
-		return rc;
-	return 0;
-}
-
-static int msm_venc_set_crop_resolution(struct msm_vidc_inst *inst,
+static int msm_venc_set_crop_offsets(struct msm_vidc_inst *inst,
 	enum msm_vidc_port_type port)
 {
 	int rc = 0;
@@ -177,11 +152,11 @@ static int msm_venc_set_crop_resolution(struct msm_vidc_inst *inst,
 		return -EINVAL;
 	}
 
-	/* output buffer resolution is nothing but crop */
+	/* TODO: recheck later */
 	crop = inst->fmts[INPUT_PORT].fmt.pix_mp.width << 16 |
 		inst->fmts[INPUT_PORT].fmt.pix_mp.height;
 	rc = venus_hfi_session_property(inst,
-			HFI_PROP_CROP_RESOLUTION,
+			HFI_PROP_CROP_OFFSETS,
 			HFI_HOST_FLAGS_NONE,
 			get_hfi_port(inst, port),
 			HFI_PAYLOAD_32_PACKED,
@@ -257,14 +232,11 @@ static int msm_venc_set_input_properties(struct msm_vidc_inst *inst)
 		case HFI_PROP_COLOR_FORMAT:
 			rc = msm_venc_set_colorformat(inst, INPUT_PORT);
 			break;
-		case HFI_PROP_ALIGN_RESOLUTION:
+		case HFI_PROP_BITSTREAM_RESOLUTION:
 			rc = msm_venc_set_resolution(inst, INPUT_PORT);
 			break;
-		case HFI_PROP_CROP_COORDINATE_TOP_LEFT:
-			rc = msm_venc_set_crop_top_left(inst, INPUT_PORT);
-			break;
-		case HFI_PROP_CROP_RESOLUTION:
-			rc = msm_venc_set_crop_resolution(inst, INPUT_PORT);
+		case HFI_PROP_CROP_OFFSETS:
+			rc = msm_venc_set_crop_offsets(inst, INPUT_PORT);
 			break;
 		default:
 			d_vpr_e("%s: unknown property %#x\n", __func__,
@@ -300,14 +272,11 @@ static int msm_venc_set_output_properties(struct msm_vidc_inst *inst)
 	for (i = 0; i < ARRAY_SIZE(msm_venc_output_set_prop);
 	     i++) {
 		switch (msm_venc_output_set_prop[i]) {
-		case HFI_PROP_ALIGN_RESOLUTION:
+		case HFI_PROP_BITSTREAM_RESOLUTION:
 			rc = msm_venc_set_resolution(inst, OUTPUT_PORT);
 			break;
-		case HFI_PROP_CROP_COORDINATE_TOP_LEFT:
-			rc = msm_venc_set_crop_top_left(inst, OUTPUT_PORT);
-			break;
-		case HFI_PROP_CROP_RESOLUTION:
-			rc = msm_venc_set_crop_resolution(inst, OUTPUT_PORT);
+		case HFI_PROP_CROP_OFFSETS:
+			rc = msm_venc_set_crop_offsets(inst, OUTPUT_PORT);
 			break;
 		default:
 			d_vpr_e("%s: unknown property %#x\n", __func__,
@@ -826,7 +795,7 @@ int msm_venc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
 			goto err_invalid_fmt;
 
 		/* update crop dimensions */
-		inst->crop.x = inst->crop.y = 0;
+		inst->crop.left = inst->crop.top = 0;
 		inst->crop.width = f->fmt.pix_mp.width;
 		inst->crop.height = f->fmt.pix_mp.height;
 
@@ -988,7 +957,7 @@ int msm_venc_inst_init(struct msm_vidc_inst *inst)
 			inst->buffers.output.extra_count;
 	inst->buffers.output.size = f->fmt.pix_mp.plane_fmt[0].sizeimage;
 
-	inst->crop.x = inst->crop.y = 0;
+	inst->crop.left = inst->crop.top = 0;
 	inst->crop.width = f->fmt.pix_mp.width;
 	inst->crop.height = f->fmt.pix_mp.height;
 

+ 1 - 1
driver/vidc/src/msm_vidc_control.c

@@ -880,7 +880,7 @@ int msm_vidc_v4l2_menu_to_hfi(struct msm_vidc_inst *inst,
 		break;
 	default:
 		s_vpr_e(inst->sid,
-			"%s: invalid ctrl with cap_id\n", cap_id);
+			"%s: invalid ctrl with cap_id %d\n", __func__, cap_id);
 		return -EINVAL;
 	}
 	return 0;

+ 26 - 10
driver/vidc/src/venus_hfi_response.c

@@ -100,8 +100,20 @@ static int handle_session_error(struct msm_vidc_inst *inst,
 	case HFI_ERROR_MAX_SESSIONS:
 		error = "exceeded max sessions";
 		break;
-	case HFI_ERROR_UNSUPPORTED:
-		error = "unsupported bitstream";
+	case HFI_ERROR_UNKNOWN_SESSION:
+		error = "unknown session id";
+		break;
+	case HFI_ERROR_INVALID_STATE:
+		error = "invalid operation for current state";
+		break;
+	case HFI_ERROR_INSUFFICIENT_RESOURCES:
+		error = "insufficient resources";
+		break;
+	case HFI_ERROR_BUFFER_NOT_SET:
+		error = "internal buffers not set";
+		break;
+	case HFI_ERROR_FATAL:
+		error = "fatal error";
 		break;
 	default:
 		error = "unknown";
@@ -274,7 +286,8 @@ static int handle_input_buffer(struct msm_vidc_inst *inst,
 	buf->data_size = buffer->data_size;
 	buf->attr &= ~MSM_VIDC_ATTR_QUEUED;
 	buf->flags = 0;
-	if (buffer->flags & HFI_BUF_FW_FLAG_CORRUPT) {
+	//todo:
+	/*if (buffer->flags & HFI_BUF_FW_FLAG_CORRUPT) {
 		s_vpr_h(inst->sid, "%s: data corrupted\n", __func__);
 		buf->flags |= MSM_VIDC_BUF_FLAG_ERROR;
 	}
@@ -282,7 +295,7 @@ static int handle_input_buffer(struct msm_vidc_inst *inst,
 		s_vpr_e(inst->sid, "%s: unsupported input\n", __func__);
 		buf->flags |= MSM_VIDC_BUF_FLAG_ERROR;
 		// TODO: move inst->state to error state
-	}
+	}*/
 
 	print_vidc_buffer(VIDC_HIGH, "EBD", inst, buf);
 	msm_vidc_vb2_buffer_done(inst, buf);
@@ -326,16 +339,19 @@ static int handle_output_buffer(struct msm_vidc_inst *inst,
 		buf->attr &= ~MSM_VIDC_ATTR_READ_ONLY;
 
 	buf->flags = 0;
-	if (buffer->flags & HFI_BUF_FW_FLAG_KEYFRAME)
-		buf->flags |= MSM_VIDC_BUF_FLAG_KEYFRAME;
+	//todo: moved to HFI_PROP_PICTURE_TYPE
+	/*if (buffer->flags & HFI_BUF_FW_FLAG_KEYFRAME)
+		buf->flags |= MSM_VIDC_BUF_FLAG_KEYFRAME;*/
 	if (buffer->flags & HFI_BUF_FW_FLAG_LAST)
 		buf->flags |= MSM_VIDC_BUF_FLAG_LAST;
-	if (buffer->flags & HFI_BUF_FW_FLAG_CORRUPT)
-		buf->flags |= MSM_VIDC_BUF_FLAG_ERROR;
+	//moved to HFI_INFO_DATA_CORRUPT
+	/*if (buffer->flags & HFI_BUF_FW_FLAG_CORRUPT)
+		buf->flags |= MSM_VIDC_BUF_FLAG_ERROR;*/
 	if (buffer->flags & HFI_BUF_FW_FLAG_CODEC_CONFIG)
 		buf->flags |= MSM_VIDC_BUF_FLAG_CODECCONFIG;
-	if (buffer->flags & HFI_BUF_FW_FLAG_SUBFRAME)
-		buf->flags |= MSM_VIDC_BUF_FLAG_SUBFRAME;
+	//moved to HFI_PROP_SUBFRAME_OUTPUT
+	/*if (buffer->flags & HFI_BUF_FW_FLAG_SUBFRAME)
+		buf->flags |= MSM_VIDC_BUF_FLAG_SUBFRAME;*/
 
 	print_vidc_buffer(VIDC_HIGH, "FBD", inst, buf);
 	msm_vidc_vb2_buffer_done(inst, buf);