Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2100178imu; Thu, 17 Jan 2019 08:23:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN48hHM5HGiYPel6A28n5CDHpZgITeBOGi3PkWe+w4GDzDuInvEQEY3DR0ebCXDPI1PJpCpx X-Received: by 2002:a62:c613:: with SMTP id m19mr15609297pfg.207.1547742188390; Thu, 17 Jan 2019 08:23:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547742188; cv=none; d=google.com; s=arc-20160816; b=iPpuEiaWL77Ou0Hou2PH8xEeQGb+TvEGWZ0WT0ko4VUl0itJ+d1HNCCFfKR83alVAk J9ivSmW3LAkI6KFw/4u1/M+M9bVyMTvnKE8XQfKdypNy6hgx7nd6aNGhT9YrN+0yS0kz cKB7Xd3dBW8YfjF7r0GH644PBF3Z2T0rdPTH5F/bex7T/HaPw7e65wJ494ppJtdEUm3l joTP9a90FA66Q2bZxtKalikx4ry54sA5BghKCTcD4TMk1YA/wHmBFN9MMeSgwV6yqfzo 8yB1bbU0zSJkO5NuwhrjvihZlwmiBuNrIcEmoRtnPjMWjI0xn/RqIzLkX5idfPihdG8U w0yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=TJaSy4d66OCwtAmSCJDYHgEl9smQdDOgylQ4NVN0QXo=; b=qL87JKggez9LaYOpn34vJBYMoru/gpu2i1IicQy62FcjemMwGJOsTw7S4DF+2R8e5L ZStb7UHY53/V+D4RGS/uQzQ2KY02tHZSTJrHuxzE4jfBcojNPbATbR/LoJDG/XWlHYVV Z5OlMblv5d7aYeFRuVFPX8OM4VN48nUK8Anjybg1211GwqYSN82zXB/q5LHNdVhFheIs uzRKhYBB+KOCfmNSEn7g6d9tmSgTvQ3pZipxGib77hmv2dtvJKjWLr6Mmy+BL8gWXF6y eTHbNJYVb0Fe1Os6FTTNSPEHXwktZF498PO4wyctePqxy6QJ4FuguUGD5uSasnA+566j cCIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ID+4hV60; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l135si2016287pga.69.2019.01.17.08.22.30; Thu, 17 Jan 2019 08:23:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ID+4hV60; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729110AbfAQQVJ (ORCPT + 99 others); Thu, 17 Jan 2019 11:21:09 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:37493 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728998AbfAQQVE (ORCPT ); Thu, 17 Jan 2019 11:21:04 -0500 Received: by mail-wm1-f68.google.com with SMTP id g67so1688706wmd.2 for ; Thu, 17 Jan 2019 08:21:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TJaSy4d66OCwtAmSCJDYHgEl9smQdDOgylQ4NVN0QXo=; b=ID+4hV60rYEImVqLh4qgQz1UgmPaRxLzYdRwnU4ZLrAWeZhYUqbByJWdJ5777bmiXZ mSnWIYtg4i51E3WXGfHI6TdGplIp6oVz2BJxqycq9eB45/uW6h7hYimHqgGysFitTX78 U3PSKD/M3i+bJwPqa+g332x9LsIEf/eAvp8PA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TJaSy4d66OCwtAmSCJDYHgEl9smQdDOgylQ4NVN0QXo=; b=FOLkasIL1MoQ3aor8/UUTNoYZ8b0UGOmoZQPs3IQRofgw36XSwTFLDLfmA0McoY4IP OUMTDiqHD6tYV2/G7kY2q4Cg/TxgcwmAurTYOscv0WRZ6V2dH9LLMJw3IZX1R0U2Zc4V z3X3cGdjjH7djNPz0kR+tiqrkJHkKL8LqMLtwHDAufJvt1H3YyNqdc/oyPvIZH0yUOkj VQURVWpyI2kui+/NupjtGKNBmtrCDlUOeBsS6bRD54kejuIXoA2KnuBI7snBwRwMfh5Z 8hRJ8JiwyCxCd+Xk7uwqZoNUTIkoCHB/hPITKHpZ2n793vKeNyXlVuk6pvZ364y1vb93 ednw== X-Gm-Message-State: AJcUukfKpe2JrAXCoD1t1GEsficZ2U9jJoCBFlCU9S7Lw8IKpaDq5i8l ZYHK6QHRwBhLE6TE5igBzdJFqg== X-Received: by 2002:a1c:2856:: with SMTP id o83mr13280390wmo.45.1547742062957; Thu, 17 Jan 2019 08:21:02 -0800 (PST) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id v133sm31124734wmf.19.2019.01.17.08.21.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jan 2019 08:21:02 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Alexandre Courbot , Malathi Gottam , Stanimir Varbanov Subject: [PATCH 03/10] venus: helpers: export few helper functions Date: Thu, 17 Jan 2019 18:20:01 +0200 Message-Id: <20190117162008.25217-4-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190117162008.25217-1-stanimir.varbanov@linaro.org> References: <20190117162008.25217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Here we export few helper function to use them from decoder to implement more granular control needed for stateful Codec API compliance. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 29 ++++++++++++--------- drivers/media/platform/qcom/venus/helpers.h | 7 +++++ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 86105de81af2..f33bbfea3576 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -88,7 +88,7 @@ bool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt) } EXPORT_SYMBOL_GPL(venus_helper_check_codec); -static int venus_helper_queue_dpb_bufs(struct venus_inst *inst) +int venus_helper_queue_dpb_bufs(struct venus_inst *inst) { struct intbuf *buf; int ret = 0; @@ -109,6 +109,7 @@ static int venus_helper_queue_dpb_bufs(struct venus_inst *inst) fail: return ret; } +EXPORT_SYMBOL_GPL(venus_helper_queue_dpb_bufs); int venus_helper_free_dpb_bufs(struct venus_inst *inst) { @@ -287,7 +288,7 @@ static const unsigned int intbuf_types_4xx[] = { HFI_BUFFER_INTERNAL_PERSIST_1, }; -static int intbufs_alloc(struct venus_inst *inst) +int venus_helper_intbufs_alloc(struct venus_inst *inst) { const unsigned int *intbuf; size_t arr_sz, i; @@ -313,11 +314,13 @@ static int intbufs_alloc(struct venus_inst *inst) intbufs_unset_buffers(inst); return ret; } +EXPORT_SYMBOL_GPL(venus_helper_intbufs_alloc); -static int intbufs_free(struct venus_inst *inst) +int venus_helper_intbufs_free(struct venus_inst *inst) { return intbufs_unset_buffers(inst); } +EXPORT_SYMBOL_GPL(venus_helper_intbufs_free); static u32 load_per_instance(struct venus_inst *inst) { @@ -348,7 +351,7 @@ static u32 load_per_type(struct venus_core *core, u32 session_type) return mbs_per_sec; } -static int load_scale_clocks(struct venus_core *core) +int venus_helper_load_scale_clocks(struct venus_core *core) { const struct freq_tbl *table = core->res->freq_tbl; unsigned int num_rows = core->res->freq_tbl_size; @@ -397,6 +400,7 @@ static int load_scale_clocks(struct venus_core *core) dev_err(dev, "failed to set clock rate %lu (%d)\n", freq, ret); return ret; } +EXPORT_SYMBOL_GPL(venus_helper_load_scale_clocks); static void fill_buffer_desc(const struct venus_buffer *buf, struct hfi_buffer_desc *bd, bool response) @@ -481,7 +485,7 @@ static bool is_dynamic_bufmode(struct venus_inst *inst) return caps->cap_bufs_mode_dynamic; } -static int session_unregister_bufs(struct venus_inst *inst) +int venus_helper_unregister_bufs(struct venus_inst *inst) { struct venus_buffer *buf, *n; struct hfi_buffer_desc bd; @@ -498,6 +502,7 @@ static int session_unregister_bufs(struct venus_inst *inst) return ret; } +EXPORT_SYMBOL_GPL(venus_helper_unregister_bufs); static int session_register_bufs(struct venus_inst *inst) { @@ -1018,8 +1023,8 @@ void venus_helper_vb2_stop_streaming(struct vb2_queue *q) if (inst->streamon_out & inst->streamon_cap) { ret = hfi_session_stop(inst); ret |= hfi_session_unload_res(inst); - ret |= session_unregister_bufs(inst); - ret |= intbufs_free(inst); + ret |= venus_helper_unregister_bufs(inst); + ret |= venus_helper_intbufs_free(inst); ret |= hfi_session_deinit(inst); if (inst->session_error || core->sys_error) @@ -1030,7 +1035,7 @@ void venus_helper_vb2_stop_streaming(struct vb2_queue *q) venus_helper_free_dpb_bufs(inst); - load_scale_clocks(core); + venus_helper_load_scale_clocks(core); INIT_LIST_HEAD(&inst->registeredbufs); } @@ -1050,7 +1055,7 @@ int venus_helper_vb2_start_streaming(struct venus_inst *inst) struct venus_core *core = inst->core; int ret; - ret = intbufs_alloc(inst); + ret = venus_helper_intbufs_alloc(inst); if (ret) return ret; @@ -1058,7 +1063,7 @@ int venus_helper_vb2_start_streaming(struct venus_inst *inst) if (ret) goto err_bufs_free; - load_scale_clocks(core); + venus_helper_load_scale_clocks(core); ret = hfi_session_load_res(inst); if (ret) @@ -1079,9 +1084,9 @@ int venus_helper_vb2_start_streaming(struct venus_inst *inst) err_unload_res: hfi_session_unload_res(inst); err_unreg_bufs: - session_unregister_bufs(inst); + venus_helper_unregister_bufs(inst); err_bufs_free: - intbufs_free(inst); + venus_helper_intbufs_free(inst); return ret; } EXPORT_SYMBOL_GPL(venus_helper_vb2_start_streaming); diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 2475f284f396..24faae5abd93 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -18,6 +18,7 @@ #include struct venus_inst; +struct venus_core; bool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt); struct vb2_v4l2_buffer *venus_helper_find_buf(struct venus_inst *inst, @@ -62,4 +63,10 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst); int venus_helper_free_dpb_bufs(struct venus_inst *inst); int venus_helper_power_enable(struct venus_core *core, u32 session_type, bool enable); +int venus_helper_intbufs_alloc(struct venus_inst *inst); +int venus_helper_intbufs_free(struct venus_inst *inst); +int venus_helper_intbufs_realloc(struct venus_inst *inst); +int venus_helper_queue_dpb_bufs(struct venus_inst *inst); +int venus_helper_unregister_bufs(struct venus_inst *inst); +int venus_helper_load_scale_clocks(struct venus_core *core); #endif -- 2.17.1