OSDN Git Service

msm: vidc: Enabling DPB-OPB split for NV12 color format
authorPraneeth Paladugu <ppaladug@codeaurora.org>
Tue, 5 Apr 2016 00:13:33 +0000 (17:13 -0700)
committerJeevan Shriram <jshriram@codeaurora.org>
Thu, 19 May 2016 23:07:21 +0000 (16:07 -0700)
Video firmware will send a HFI_PIC_STRUCT field in sequence changed
event, which indicates whether the clip is interlaced or progressive.
If the color format is NV12 and the clip is interlaced, DPB mode
would be combined NV12 while the DPB mode is split i.e. DPB is in
UBWC and OPB is in NV12. Also combining the pic struct change and
bit depth change into a single event to the userspace.

CRs-fixed: 1017209
Change-Id: Ife71e31622a53d0ea4cc418d434998e710352e10
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
drivers/media/platform/msm/vidc/hfi_response_handler.c
drivers/media/platform/msm/vidc/msm_vidc.c
drivers/media/platform/msm/vidc/msm_vidc_common.c
drivers/media/platform/msm/vidc/msm_vidc_internal.h
drivers/media/platform/msm/vidc/vidc_hfi_api.h
drivers/media/platform/msm/vidc/vidc_hfi_helper.h
include/uapi/linux/videodev2.h
include/uapi/media/msm_vidc.h

index 5787be1..467e9d9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -108,6 +108,7 @@ static int hfi_process_sess_evt_seq_changed(u32 device_id,
        struct hfi_frame_size *frame_sz;
        struct hfi_profile_level *profile_level;
        struct hfi_bit_depth *pixel_depth;
+       struct hfi_pic_struct *pic_struct;
        u8 *data_ptr;
        int prop_id;
        enum msm_vidc_pixel_depth luma_bit_depth, chroma_bit_depth;
@@ -193,6 +194,17 @@ static int hfi_process_sess_evt_seq_changed(u32 device_id,
                                        chroma_bit_depth);
                                data_ptr += sizeof(struct hfi_bit_depth);
                                break;
+                       case HFI_PROPERTY_PARAM_VDEC_PIC_STRUCT:
+                               data_ptr = data_ptr + sizeof(u32);
+                               pic_struct = (struct hfi_pic_struct *) data_ptr;
+                               event_notify.pic_struct =
+                                       pic_struct->progressive_only;
+                               dprintk(VIDC_DBG,
+                                       "Progressive only flag: %d\n",
+                                               pic_struct->progressive_only);
+                               data_ptr +=
+                                       sizeof(struct hfi_pic_struct);
+                               break;
                        default:
                                dprintk(VIDC_ERR,
                                        "%s cmd: %#x not supported\n",
index 561c6c3..8224cbc 100644 (file)
@@ -1177,6 +1177,7 @@ void *msm_vidc_open(int core_id, int session_type)
        inst->core = core;
        inst->bit_depth = MSM_VIDC_BIT_DEPTH_8;
        inst->instant_bitrate = 0;
+       inst->pic_struct = MSM_VIDC_PIC_STRUCT_PROGRESSIVE;
 
        for (i = SESSION_MSG_INDEX(SESSION_MSG_START);
                i <= SESSION_MSG_INDEX(SESSION_MSG_END); i++) {
index ae0e391..52919d7 100644 (file)
@@ -44,8 +44,6 @@
                V4L2_EVENT_MSM_VIDC_PORT_SETTINGS_CHANGED_INSUFFICIENT
 #define V4L2_EVENT_RELEASE_BUFFER_REFERENCE \
                V4L2_EVENT_MSM_VIDC_RELEASE_BUFFER_REFERENCE
-#define V4L2_EVENT_SEQ_BITDEPTH_CHANGED_INSUFFICIENT \
-               V4L2_EVENT_MSM_VIDC_PORT_SETTINGS_BITDEPTH_CHANGED_INSUFFICIENT
 
 #define MAX_SUPPORTED_INSTANCES 16
 
@@ -1023,8 +1021,8 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
        int event = V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT;
        struct v4l2_event seq_changed_event = {0};
        int rc = 0;
-       bool bit_depth_changed = false;
        struct hfi_device *hdev;
+       u32 *ptr = NULL;
 
        if (!event_notify) {
                dprintk(VIDC_WARN, "Got an empty event from hfi\n");
@@ -1144,23 +1142,46 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
                break;
        }
 
+       /* Bit depth and pic struct changed event are combined into a single
+        * event (insufficient event) for the userspace. Currently bitdepth
+        * changes is only for HEVC and interlaced support is for all
+        * codecs except HEVC
+        * event data is now as follows:
+        * u32 *ptr = seq_changed_event.u.data;
+        * ptr[0] = height
+        * ptr[1] = width
+        * ptr[2] = flag to indicate bit depth or/and pic struct changed
+        * ptr[3] = bit depth
+        * ptr[4] = pic struct (progressive or interlaced)
+        */
+
+       ptr = (u32 *)seq_changed_event.u.data;
+       ptr[2] = 0x0;
+       ptr[3] = inst->bit_depth;
+       ptr[4] = inst->pic_struct;
+
+       if (inst->bit_depth != event_notify->bit_depth) {
+               inst->bit_depth = event_notify->bit_depth;
+               ptr[2] |= V4L2_EVENT_BITDEPTH_FLAG;
+               ptr[3] = inst->bit_depth;
+               event = V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT;
+               dprintk(VIDC_DBG,
+                       "V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT due to bit-depth change\n");
+       }
+
+       if (inst->pic_struct != event_notify->pic_struct) {
+               inst->pic_struct = event_notify->pic_struct;
+               event = V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT;
+               ptr[2] |= V4L2_EVENT_PICSTRUCT_FLAG;
+               ptr[4] = inst->pic_struct;
+               dprintk(VIDC_DBG,
+                       "V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT due to pic-struct change\n");
+       }
+
        if (event == V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT) {
                dprintk(VIDC_DBG, "V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT\n");
                inst->reconfig_height = event_notify->height;
                inst->reconfig_width = event_notify->width;
-
-               if (inst->bit_depth != event_notify->bit_depth) {
-                       inst->bit_depth = event_notify->bit_depth;
-                       bit_depth_changed = true;
-                       seq_changed_event.u.data[0] = inst->bit_depth;
-                       event = V4L2_EVENT_SEQ_BITDEPTH_CHANGED_INSUFFICIENT;
-                       dprintk(VIDC_DBG,
-                                       "V4L2_EVENT_SEQ_BITDEPTH_CHANGED_INSUFFICIENT\n");
-               } else {
-                       dprintk(VIDC_DBG,
-                                       "V4L2_EVENT_SEQ_CHANGED_INSUFFICIENT\n");
-               }
-
                inst->in_reconfig = true;
        } else {
                dprintk(VIDC_DBG, "V4L2_EVENT_SEQ_CHANGED_SUFFICIENT\n");
index cf51ebc..428b6ed 100644 (file)
@@ -292,6 +292,7 @@ struct msm_vidc_inst {
        unsigned long instant_bitrate;
        u32 buffers_held_in_driver;
        atomic_t in_flush;
+       u32 pic_struct;
 };
 
 extern struct msm_vidc_drv *vidc_driver;
index dcaf9ce..063208b 100644 (file)
@@ -1338,6 +1338,7 @@ struct msm_vidc_cb_event {
        u32 hal_event_type;
        ion_phys_addr_t packet_buffer;
        ion_phys_addr_t extra_data_buffer;
+       u32 pic_struct;
 };
 
 struct msm_vidc_cb_data_done {
index 04f006c..ad438d9 100644 (file)
@@ -291,6 +291,9 @@ struct hfi_buffer_info {
        (HFI_PROPERTY_PARAM_VDEC_COMMON_START + 0x003)
 #define  HFI_PROPERTY_PARAM_VDEC_PIXEL_BITDEPTH                                \
        (HFI_PROPERTY_PARAM_VDEC_COMMON_START + 0x007)
+#define  HFI_PROPERTY_PARAM_VDEC_PIC_STRUCT                            \
+       (HFI_PROPERTY_PARAM_VDEC_COMMON_START + 0x009)
+
 
 #define HFI_PROPERTY_CONFIG_VDEC_COMMON_START                          \
        (HFI_DOMAIN_BASE_VDEC + HFI_ARCH_COMMON_OFFSET + 0x4000)
@@ -419,6 +422,10 @@ struct hfi_buffer_info {
 #define HFI_PROPERTY_CONFIG_VPE_OPERATIONS                             \
        (HFI_PROPERTY_CONFIG_VPE_COMMON_START + 0x002)
 
+struct hfi_pic_struct {
+       u32 progressive_only;
+};
+
 struct hfi_bitrate {
        u32 bit_rate;
        u32 layer_id;
index 21901f9..354d2ab 100644 (file)
@@ -2080,12 +2080,19 @@ struct v4l2_streamparm {
 #define V4L2_EVENT_MOTION_DET                  6
 #define V4L2_EVENT_PRIVATE_START               0x08000000
 
+#define V4L2_EVENT_BITDEPTH_FLAG       0x1
+#define V4L2_EVENT_PICSTRUCT_FLAG      0x2
+
 #define V4L2_EVENT_MSM_VIDC_START      (V4L2_EVENT_PRIVATE_START + 0x00001000)
 #define V4L2_EVENT_MSM_VIDC_FLUSH_DONE (V4L2_EVENT_MSM_VIDC_START + 1)
 #define V4L2_EVENT_MSM_VIDC_PORT_SETTINGS_CHANGED_SUFFICIENT   \
                (V4L2_EVENT_MSM_VIDC_START + 2)
 #define V4L2_EVENT_MSM_VIDC_PORT_SETTINGS_CHANGED_INSUFFICIENT \
                (V4L2_EVENT_MSM_VIDC_START + 3)
+/*
+ * Bitdepth changed insufficient is deprecated now, however retaining
+ * to prevent changing the values of the other macros after bitdepth
+ */
 #define V4L2_EVENT_MSM_VIDC_PORT_SETTINGS_BITDEPTH_CHANGED_INSUFFICIENT \
                (V4L2_EVENT_MSM_VIDC_START + 4)
 #define V4L2_EVENT_MSM_VIDC_SYS_ERROR  (V4L2_EVENT_MSM_VIDC_START + 5)
index ac36b23..eaf2f5e 100644 (file)
@@ -225,4 +225,9 @@ enum msm_vidc_pixel_depth {
        MSM_VIDC_BIT_DEPTH_10,
        MSM_VIDC_BIT_DEPTH_UNSUPPORTED = 0XFFFFFFFF,
 };
+
+/*enum msm_vidc_pic_struct */
+#define MSM_VIDC_PIC_STRUCT_MAYBE_INTERLACED 0x0
+#define MSM_VIDC_PIC_STRUCT_PROGRESSIVE 0x1
+
 #endif