media: venus: helpers: add helper function to set actual buffer size
authorStanimir Varbanov <stanimir.varbanov@linaro.org>
Thu, 5 Jul 2018 13:03:49 +0000 (09:03 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 25 Jul 2018 12:51:33 +0000 (08:51 -0400)
Add and use a helper function to set actual buffer size for
particular buffer type. This is also preparation to use
the second decoder output.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/qcom/venus/helpers.c
drivers/media/platform/qcom/venus/helpers.h
drivers/media/platform/qcom/venus/vdec.c

index 29cc847..6fd7458 100644 (file)
@@ -546,6 +546,18 @@ int venus_helper_set_dyn_bufmode(struct venus_inst *inst)
 }
 EXPORT_SYMBOL_GPL(venus_helper_set_dyn_bufmode);
 
+int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype)
+{
+       const u32 ptype = HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL;
+       struct hfi_buffer_size_actual bufsz;
+
+       bufsz.type = buftype;
+       bufsz.size = bufsize;
+
+       return hfi_session_set_property(inst, ptype, &bufsz);
+}
+EXPORT_SYMBOL_GPL(venus_helper_set_bufsize);
+
 static void delayed_process_buf_func(struct work_struct *work)
 {
        struct venus_buffer *buf, *n;
index 52b961e..cd306bd 100644 (file)
@@ -41,6 +41,7 @@ int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs,
                              unsigned int output_bufs);
 int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt);
 int venus_helper_set_dyn_bufmode(struct venus_inst *inst);
+int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype);
 void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf);
 void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx);
 void venus_helper_init_instance(struct venus_inst *inst);
index ef5b14b..b30f10b 100644 (file)
@@ -708,7 +708,6 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count)
 {
        struct venus_inst *inst = vb2_get_drv_priv(q);
        struct venus_core *core = inst->core;
-       u32 ptype;
        int ret;
 
        mutex_lock(&inst->lock);
@@ -738,13 +737,8 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count)
                goto deinit_sess;
 
        if (core->res->hfi_version == HFI_VERSION_3XX) {
-               struct hfi_buffer_size_actual buf_sz;
-
-               ptype = HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL;
-               buf_sz.type = HFI_BUFFER_OUTPUT;
-               buf_sz.size = inst->output_buf_size;
-
-               ret = hfi_session_set_property(inst, ptype, &buf_sz);
+               ret = venus_helper_set_bufsize(inst, inst->output_buf_size,
+                                              HFI_BUFFER_OUTPUT);
                if (ret)
                        goto deinit_sess;
        }