diff mbox series

[v2,15/29] venus: helpers: rename a helper function and use buffer mode from caps

Message ID 20180515075859.17217-16-stanimir.varbanov@linaro.org
State Superseded
Headers show
Series [v2,01/29] venus: hfi_msgs: correct pointer increment | expand

Commit Message

Stanimir Varbanov May 15, 2018, 7:58 a.m. UTC
Rename is_reg_unreg_needed() to better name is_dynamic_bufmode() and
use buffer mode from enumerated per codec capabilities.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

---
 drivers/media/platform/qcom/venus/helpers.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

-- 
2.14.1

Comments

Tomasz Figa May 31, 2018, 7:59 a.m. UTC | #1
On Tue, May 15, 2018 at 5:06 PM Stanimir Varbanov
<stanimir.varbanov@linaro.org> wrote:
>

> Rename is_reg_unreg_needed() to better name is_dynamic_bufmode() and

> use buffer mode from enumerated per codec capabilities.

>

> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

> ---

>  drivers/media/platform/qcom/venus/helpers.c | 21 +++++++++++----------

>  1 file changed, 11 insertions(+), 10 deletions(-)

>

> diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c

> index 2b21f6ed7502..1eda19adbf28 100644

> --- a/drivers/media/platform/qcom/venus/helpers.c

> +++ b/drivers/media/platform/qcom/venus/helpers.c

> @@ -354,18 +354,19 @@ session_process_buf(struct venus_inst *inst, struct vb2_v4l2_buffer *vbuf)

>         return 0;

>  }

>

> -static inline int is_reg_unreg_needed(struct venus_inst *inst)

> +static inline int is_dynamic_bufmode(struct venus_inst *inst)


nit: Could be made bool.

>  {

> -       if (inst->session_type == VIDC_SESSION_TYPE_DEC &&

> -           inst->core->res->hfi_version == HFI_VERSION_3XX)

> -               return 0;

> +       struct venus_core *core = inst->core;

> +       struct venus_caps *caps;

>

> -       if (inst->session_type == VIDC_SESSION_TYPE_DEC &&

> -           inst->cap_bufs_mode_dynamic &&

> -           inst->core->res->hfi_version == HFI_VERSION_1XX)

> +       caps = venus_caps_by_codec(core, inst->hfi_codec, inst->session_type);

> +       if (!caps)

>                 return 0;

>

> -       return 1;

> +       if (caps->cap_bufs_mode_dynamic)

> +               return 1;

> +

> +       return 0;


nit: return caps->cap_bufs_mode_dynamic;

Best regards,
Tomasz
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
index 2b21f6ed7502..1eda19adbf28 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -354,18 +354,19 @@  session_process_buf(struct venus_inst *inst, struct vb2_v4l2_buffer *vbuf)
 	return 0;
 }
 
-static inline int is_reg_unreg_needed(struct venus_inst *inst)
+static inline int is_dynamic_bufmode(struct venus_inst *inst)
 {
-	if (inst->session_type == VIDC_SESSION_TYPE_DEC &&
-	    inst->core->res->hfi_version == HFI_VERSION_3XX)
-		return 0;
+	struct venus_core *core = inst->core;
+	struct venus_caps *caps;
 
-	if (inst->session_type == VIDC_SESSION_TYPE_DEC &&
-	    inst->cap_bufs_mode_dynamic &&
-	    inst->core->res->hfi_version == HFI_VERSION_1XX)
+	caps = venus_caps_by_codec(core, inst->hfi_codec, inst->session_type);
+	if (!caps)
 		return 0;
 
-	return 1;
+	if (caps->cap_bufs_mode_dynamic)
+		return 1;
+
+	return 0;
 }
 
 static int session_unregister_bufs(struct venus_inst *inst)
@@ -374,7 +375,7 @@  static int session_unregister_bufs(struct venus_inst *inst)
 	struct hfi_buffer_desc bd;
 	int ret = 0;
 
-	if (!is_reg_unreg_needed(inst))
+	if (is_dynamic_bufmode(inst))
 		return 0;
 
 	list_for_each_entry_safe(buf, n, &inst->registeredbufs, reg_list) {
@@ -394,7 +395,7 @@  static int session_register_bufs(struct venus_inst *inst)
 	struct venus_buffer *buf;
 	int ret = 0;
 
-	if (!is_reg_unreg_needed(inst))
+	if (is_dynamic_bufmode(inst))
 		return 0;
 
 	list_for_each_entry(buf, &inst->registeredbufs, reg_list) {