From patchwork Wed Nov 11 14:37:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11897975 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F2349139F for ; Wed, 11 Nov 2020 14:40:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C78F9207DE for ; Wed, 11 Nov 2020 14:40:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RlEFTHP8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727279AbgKKOkZ (ORCPT ); Wed, 11 Nov 2020 09:40:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727057AbgKKOi0 (ORCPT ); Wed, 11 Nov 2020 09:38:26 -0500 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8B51C0617A7 for ; Wed, 11 Nov 2020 06:38:25 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id l1so2738437wrb.9 for ; Wed, 11 Nov 2020 06:38:25 -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=0wZVM3xTH0rIlT8FcnVb9p0qtohia4y51yWQ3iwO6GE=; b=RlEFTHP8vmaXYUOiuFwsUx3f5yXYa4g1nViurvjIWCCsjb5FcrTms+0V4N/40jOC3e E8h2ZGscS5N5sLWUzfPCDdbCgfKIZ9uGbS+JMjA/ekvNSYu/77CAUSx+VtEJUnMm7l7+ 9hbZdB27+ZpQID+qEcIAaue0h5c5dL4cMa7PRLI0PWZ5waoq5xLOWsJmCc8weFbpMUXQ qwE2AIUHP3MVGb2a6Y8OhIg7alUEkSE2IdoZWwHsSx1Qk5Wbxjbu6zrK2vKV+46N8uv4 5v5gC4o9/Csshq31Znz4/i+Til1zX9EanBktZOG47gD8sSv7d7KD0NylmfrEkzKQO/ej gD9A== 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=0wZVM3xTH0rIlT8FcnVb9p0qtohia4y51yWQ3iwO6GE=; b=rYlg0Y0QFoYb/ErPKNU2w6JzAr+L5wyudE4KhMV3GTC+gV6394WKk02GL/J6jgAptZ yKksPtBgzK9DAN5YQ1Wi7KLWGfKrKKtTu7SJwthk643KwD9lGRW3jvEi+Lsx7ffLvNPW bqd+Ix5JfaOg6cIn1cyMPs74QXzdtTI99UctNTy6F70nIemO7N5T6ek0YfYreJQQebHi 9te6guuBP1NqsipWOICcoTvVZv17jok9wGcbjQZDlzhv5pLUW9N6Gkk9GCcv5u7XOx4X AvheAy+hnrwFhk7oKud4Zeaf0bVqQYUn0SKLouSdh9UsVX1uAp8f9+B5w6Vqcqakj5He 7x/Q== X-Gm-Message-State: AOAM532gojRFXZ0zAgzb8jfgFJvhomaQyErfqsKX8pMWmxAZDvRNlNVW QVHd+LO/RTMz2Ynphn2J/yZtq7FsrdnLS20Q X-Google-Smtp-Source: ABdhPJyPYETqXXhsVmRZfJ5Pt9yt3ddqGh1MaLix9oNs2HvJ1kC7q2qq4bbPe84i1UWicrakUwT0OQ== X-Received: by 2002:a5d:42c9:: with SMTP id t9mr16483576wrr.13.1605105504516; Wed, 11 Nov 2020 06:38:24 -0800 (PST) Received: from localhost.localdomain (hst-221-89.medicom.bg. [84.238.221.89]) by smtp.gmail.com with ESMTPSA id b8sm2991405wrv.57.2020.11.11.06.38.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 06:38:23 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vikash Garodia , Alexandre Courbot , Fritz Koenig , Stanimir Varbanov Subject: [PATCH v2 1/8] venus: hfi: Use correct state in unload resources Date: Wed, 11 Nov 2020 16:37:48 +0200 Message-Id: <20201111143755.24541-2-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201111143755.24541-1-stanimir.varbanov@linaro.org> References: <20201111143755.24541-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org INST_RELEASE_RESOURCES state is set but not used, correct this by enter into INIT state once the unload resources is done. Signed-off-by: Stanimir Varbanov Reviewed-by: Fritz Koenig --- drivers/media/platform/qcom/venus/hfi.c | 2 +- drivers/media/platform/qcom/venus/hfi.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c index 638ed5cfe05e..4c87228e8e1d 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -388,7 +388,7 @@ int hfi_session_unload_res(struct venus_inst *inst) if (ret) return ret; - inst->state = INST_RELEASE_RESOURCES; + inst->state = INST_INIT; return 0; } diff --git a/drivers/media/platform/qcom/venus/hfi.h b/drivers/media/platform/qcom/venus/hfi.h index f25d412d6553..e9c944271cc1 100644 --- a/drivers/media/platform/qcom/venus/hfi.h +++ b/drivers/media/platform/qcom/venus/hfi.h @@ -87,7 +87,6 @@ struct hfi_event_data { #define INST_LOAD_RESOURCES 4 #define INST_START 5 #define INST_STOP 6 -#define INST_RELEASE_RESOURCES 7 struct venus_core; struct venus_inst; From patchwork Wed Nov 11 14:37:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11897977 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD49316C1 for ; Wed, 11 Nov 2020 14:40:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9CE19207BB for ; Wed, 11 Nov 2020 14:40:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vcxHdqLG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727105AbgKKOkZ (ORCPT ); Wed, 11 Nov 2020 09:40:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727063AbgKKOic (ORCPT ); Wed, 11 Nov 2020 09:38:32 -0500 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F196C061A48 for ; Wed, 11 Nov 2020 06:38:27 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id l1so2738509wrb.9 for ; Wed, 11 Nov 2020 06:38:27 -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=zbm0xMtaD/LBGoMU6CYy8HGE1zaoqwvW5S2bS4qwSZ8=; b=vcxHdqLGDJelSVhVlwwgQW4PNlodm6Kt9WQEYwxE0ELHbLx3s1pNqKNO2mYiE+lQet EbiYMzqjHd+xtRJyhR8GwAPxCbLvz00JQHjOKb4AdfU2T9P/SDoQsozaDXbhFIv51n2g nVhrafatWLIfWHbSYFEfb1p9G6Z6jSwizdMcTwuhKiOkPQnME3QhVF28bCdp0R3mXliS xEMANH+P6extWgHhkvFY8SkGGRrxlRzh86eG1xS8pb+Y8t85NS5J07uPclSYTsMghSB8 gGBXjYLbROKdZ7ET5hAp+359+/t9T4si+NAzug9r4xVvdBWoLo3VLzx6JwXym3fk+fFi kUiQ== 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=zbm0xMtaD/LBGoMU6CYy8HGE1zaoqwvW5S2bS4qwSZ8=; b=gnmQUNBYY0+7Iq4DF7DTX0kh4H4F9yjcv9xV/SOUEK57EzD0V/8R6TwMt4NnrzHOzh 5e5bxPY0fyUqicfvWrAc14SbmOJt0xMnqBCuGCxdxmwiXqhyfkT3SGcmRqF3aWNIEDeu xCQPxqlW3RLrEtVtP8UXUp7AKbQA52KmJRAdR3enpiK4E88QNGme2sHyKrd/CeLANNEV 50KXnBmJUIgeNbGRskIFm6D7Fx8NmbgdFaUDl+P/CDRqoYQEudERwhBRqJChxFX0jafQ dqm1m51ALJEvLrgUykv+D0nE5DggHHXZNli/s+zvaP/nxASmZSFrSjd1l6DuXkNlbSmU N/eg== X-Gm-Message-State: AOAM531fdsQvMgkcsWiFmTWysqYUtbQ79MOyD1bJdsu2qtx2omr4E1pH aPUvVkfjrF6vp3mdmQuL+fuPrw== X-Google-Smtp-Source: ABdhPJxdzXy/ZsM+pI+WafdPtpTldiOKB3g52X0jJBAJajeZyDs1QAqpZ1FqrEcbwsIsOstirGpJhQ== X-Received: by 2002:adf:9e08:: with SMTP id u8mr29366032wre.282.1605105506221; Wed, 11 Nov 2020 06:38:26 -0800 (PST) Received: from localhost.localdomain (hst-221-89.medicom.bg. [84.238.221.89]) by smtp.gmail.com with ESMTPSA id b8sm2991405wrv.57.2020.11.11.06.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 06:38:25 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vikash Garodia , Alexandre Courbot , Fritz Koenig , Stanimir Varbanov Subject: [PATCH v2 2/8] venus: helpers: Add a new helper for buffer processing Date: Wed, 11 Nov 2020 16:37:49 +0200 Message-Id: <20201111143755.24541-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201111143755.24541-1-stanimir.varbanov@linaro.org> References: <20201111143755.24541-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The new helper will be used from encoder and decoder drivers to enqueue buffers for processing by firmware. Signed-off-by: Stanimir Varbanov Reviewed-by: Fritz Koenig --- drivers/media/platform/qcom/venus/helpers.c | 20 ++++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 1 + 2 files changed, 21 insertions(+) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index efa2781d6f55..688e3e3e8362 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -1369,6 +1369,26 @@ void venus_helper_vb2_buf_queue(struct vb2_buffer *vb) } EXPORT_SYMBOL_GPL(venus_helper_vb2_buf_queue); +void venus_helper_process_buf(struct vb2_buffer *vb) +{ + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); + struct venus_inst *inst = vb2_get_drv_priv(vb->vb2_queue); + int ret; + + cache_payload(inst, vb); + + if (vb2_start_streaming_called(vb->vb2_queue)) { + ret = is_buf_refed(inst, vbuf); + if (ret) + return; + + ret = session_process_buf(inst, vbuf); + if (ret) + return_buf_error(inst, vbuf); + } +} +EXPORT_SYMBOL_GPL(venus_helper_process_buf); + void venus_helper_buffers_done(struct venus_inst *inst, unsigned int type, enum vb2_buffer_state state) { diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index f36c9f717798..231af29667e7 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -19,6 +19,7 @@ void venus_helper_buffers_done(struct venus_inst *inst, unsigned int type, int venus_helper_vb2_buf_init(struct vb2_buffer *vb); int venus_helper_vb2_buf_prepare(struct vb2_buffer *vb); void venus_helper_vb2_buf_queue(struct vb2_buffer *vb); +void venus_helper_process_buf(struct vb2_buffer *vb); void venus_helper_vb2_stop_streaming(struct vb2_queue *q); int venus_helper_vb2_start_streaming(struct venus_inst *inst); void venus_helper_m2m_device_run(void *priv); From patchwork Wed Nov 11 14:37:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11897965 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB9831391 for ; Wed, 11 Nov 2020 14:40:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80263207BB for ; Wed, 11 Nov 2020 14:40:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GnjXvNlH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727115AbgKKOkV (ORCPT ); Wed, 11 Nov 2020 09:40:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727103AbgKKOid (ORCPT ); Wed, 11 Nov 2020 09:38:33 -0500 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED210C061A4A for ; Wed, 11 Nov 2020 06:38:28 -0800 (PST) Received: by mail-wr1-x444.google.com with SMTP id r17so2779567wrw.1 for ; Wed, 11 Nov 2020 06:38:28 -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=2CVxiw78RvuEwO3JJMPL80Z3ql7fTAJblZZgActuTxc=; b=GnjXvNlHccEzofSPCStx3HQZTpOGU9JVteupoMiWdOT7dr0PNDBfdvXpyggaGk9Qmj xLs+EmoFXmagv5kyKvDL+eCltQJBGxRTSxKsqyjW51wE8GCj8Nqlmni7ziIgF+4uQHCo elNLwXhQJa/CrMhLSHNY+pJc3UINTByhv6tiU+81lrtzWbsyVolO8QbFQafwaPnlI7fp RXDAuV5tLxFog2a63wkAk4hgCQqDddb8Q2Dtj4ggKKu6diUbSRE/kpYV1IYd6ShmA86k QAO13s0JvSL58opvp7GVWl7xQIbRJ6zZ3g9cDuAkrL3W8apbqertuGQZUFwQERhvWSGU TCsg== 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=2CVxiw78RvuEwO3JJMPL80Z3ql7fTAJblZZgActuTxc=; b=QxBxE/mNiooa2SBmjEAqtyq2VaGVQsa6+g+EUYPRjT7HkCsedT/YH84EMNXhRBHtp3 j1sDlqER7uSelLw2/z1xRjUE3EuGLVRcLUN4wg/fHIEsIwbWCv7HBKkmcSJk6j0aM8k4 alqB/7a36bMKn5V3HJ7cF2j5QFEmsR2hWeWiCrqyAASKzH4YK6orLK11hGVe0VX/9Ogi 53g9SdK+SPRaTrZeiQTo7XZmFR72T6gD98MROCREtakeutEBcc0vCqptxl2pk7ItpYhO K8cpqEOaNxdKjZL2fT4pkGXpaAzZZfbJvme2fg6fVAFonWnky3F3eI7w7Fakz7P+lWra yOgg== X-Gm-Message-State: AOAM532LUUmnmrFI4J/sR6Y9ZyIlaIeO++pLFKQoneJMglpbnBAv4QI6 gGp6+h90CTG3fppQu7+/tE1u0Q== X-Google-Smtp-Source: ABdhPJzgjpuQevq0D98kNNwBGspcXhVbH+57+WmmTaTWnZpt8ijERz1XuF3zP4/d5nVBNug9DDgoBw== X-Received: by 2002:a5d:4883:: with SMTP id g3mr30509001wrq.19.1605105507679; Wed, 11 Nov 2020 06:38:27 -0800 (PST) Received: from localhost.localdomain (hst-221-89.medicom.bg. [84.238.221.89]) by smtp.gmail.com with ESMTPSA id b8sm2991405wrv.57.2020.11.11.06.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 06:38:27 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vikash Garodia , Alexandre Courbot , Fritz Koenig , Stanimir Varbanov Subject: [PATCH v2 3/8] venus: hfi_cmds: Allow null buffer address on encoder input Date: Wed, 11 Nov 2020 16:37:50 +0200 Message-Id: <20201111143755.24541-4-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201111143755.24541-1-stanimir.varbanov@linaro.org> References: <20201111143755.24541-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Allow null buffer address for encoder input buffers. This will be used to send null input buffers to signal end-of-stream. Signed-off-by: Stanimir Varbanov Reviewed-by: Fritz Koenig --- drivers/media/platform/qcom/venus/hfi_cmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c index 4f7565834469..2affaa2ed70f 100644 --- a/drivers/media/platform/qcom/venus/hfi_cmds.c +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c @@ -278,7 +278,7 @@ int pkt_session_etb_encoder( struct hfi_session_empty_buffer_uncompressed_plane0_pkt *pkt, void *cookie, struct hfi_frame_data *in_frame) { - if (!cookie || !in_frame->device_addr) + if (!cookie) return -EINVAL; pkt->shdr.hdr.size = sizeof(*pkt); From patchwork Wed Nov 11 14:37:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11897967 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4755B138B for ; Wed, 11 Nov 2020 14:40:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1AC3520829 for ; Wed, 11 Nov 2020 14:40:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CBTrBBAS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727103AbgKKOkV (ORCPT ); Wed, 11 Nov 2020 09:40:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727092AbgKKOic (ORCPT ); Wed, 11 Nov 2020 09:38:32 -0500 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC7B9C061A4D for ; Wed, 11 Nov 2020 06:38:30 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id a65so2555119wme.1 for ; Wed, 11 Nov 2020 06:38:30 -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=TWPvZ8Q5g6TI75wYwlmr663kYENsDmC3EDOVf4VZUws=; b=CBTrBBASaPzbM0zto16rBPP1OtKXcFcWsvhLYI02MALLIPA8DBtqGeNIIaBw2f+BYF LLSdWMMqLd1cSxXQEsUH2BDaLqw9CDkEnwrTTZW+IKADXbZYpeqKuc2AwrkRnbzBJvzQ RffPysPxe41v9IaY+NabRgB08ToFDJIM4T+iuCGZHbRfAx6f9YQYZ4FoGVyO19YkNfuh ayoF4L+aUqUl6J5nhl6ahgS90QBIiFDv2cj+q6JANh/QZ7oPo2hoe6gTHDLZws9wELu8 rylgwYhm1mNBQ9PCWEvkBrWzy1k0xYBYr5egz1ts4u7OvEe1TY4MEstnEl8C8eOmoNIa b/UQ== 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=TWPvZ8Q5g6TI75wYwlmr663kYENsDmC3EDOVf4VZUws=; b=cRbQBmmdlsY96tpelaBllEwJZhaZSTvC2F2eLbogM5wqxaqY7GlLco3vknlp99NqS5 IR15+k/BgAFemkXPbWD9b1bIX8FhCyH/e4U6wttH1ZyDoHPM/69TPrCAoQQFHae371Us wOngugWRpJZUCs4riVHcjOq5nUC63bnMSed5znCRJm7kGQKYQSrDNxuFZ43N4NJzoDcO 3x16RuBI/H+A6TCDqBC9qMqm6rkUuYCp4KgvWlcqaDeoTGEFFNd2ar30D6XFDXatiT4C deXyDcJ6NFB9RFirm7FtyLLFAt3xty5tZYI8788tJLyMdtfQpeO27wCJJb+UKi0Ki3ef mFrQ== X-Gm-Message-State: AOAM532Bd0TErXaOP22k4TXXYnCuEMvZyAakY8n3O7kdR+/8DhRZo3nD xUU69cmOCTc+RW9QhKVSGG2AiA== X-Google-Smtp-Source: ABdhPJzJnrW6sIsYgEniA1h0eOK20YSa2wpZZMzrO2n9cS7E6RV6QQ+uX601nYZo5UQ2XWvRiiHHRQ== X-Received: by 2002:a7b:c4c3:: with SMTP id g3mr4427544wmk.65.1605105509436; Wed, 11 Nov 2020 06:38:29 -0800 (PST) Received: from localhost.localdomain (hst-221-89.medicom.bg. [84.238.221.89]) by smtp.gmail.com with ESMTPSA id b8sm2991405wrv.57.2020.11.11.06.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 06:38:29 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vikash Garodia , Alexandre Courbot , Fritz Koenig , Stanimir Varbanov Subject: [PATCH v2 4/8] venus: helpers: Calculate properly compressed buffer size Date: Wed, 11 Nov 2020 16:37:51 +0200 Message-Id: <20201111143755.24541-5-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201111143755.24541-1-stanimir.varbanov@linaro.org> References: <20201111143755.24541-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org For resolutions below 720p the size of the compressed buffer must be bigger. Correct this by checking the resolution when calculating buffer size and multiply by four. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 688e3e3e8362..490c026b58a3 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -986,6 +986,8 @@ u32 venus_helper_get_framesz(u32 v4l2_fmt, u32 width, u32 height) if (compressed) { sz = ALIGN(height, 32) * ALIGN(width, 32) * 3 / 2 / 2; + if (width < 1280 || height < 720) + sz *= 8; return ALIGN(sz, SZ_4K); } From patchwork Wed Nov 11 14:37:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11897957 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56740138B for ; Wed, 11 Nov 2020 14:39:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 28CFC207BB for ; Wed, 11 Nov 2020 14:39:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VLMQN0tI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726974AbgKKOjY (ORCPT ); Wed, 11 Nov 2020 09:39:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727135AbgKKOih (ORCPT ); Wed, 11 Nov 2020 09:38:37 -0500 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFBF2C0613D4 for ; Wed, 11 Nov 2020 06:38:32 -0800 (PST) Received: by mail-wm1-x343.google.com with SMTP id 23so4217518wmg.1 for ; Wed, 11 Nov 2020 06:38:32 -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=r5xw7T/uN4wozQh78haRdLJ4I1daUv56Z3dNKSCf2g8=; b=VLMQN0tIDckLVw+6qF38MEDotF6daCXyJ7OKxjfAfPo8EUhgsvM/0TuRhMQYk/B4QP HwhUQ0BiTaEkyia3CHO73KIboPDuUNJZ36aYWV9SOaJ1XE82K+VzpR3LLo7CJjFIP3my HSeeMNrytUAJIkZDaawi18M2NKeminEA2e1oxKkoCW3ZSrrRi0KAe4EWoBdAIx5kQThK 5ap2Gota1ktTvgR5MLG2WQOKIi8pH05QZNhy8A2CrqREkcMGeALyUjywgg0uCt4klfa6 xDiSuoEnv4jTiHWhVcjKtrZHLSzX6Ej6TtQ55rBPasHv+VkdyLBDv8aBySvTXcCRZQU8 SEeQ== 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=r5xw7T/uN4wozQh78haRdLJ4I1daUv56Z3dNKSCf2g8=; b=m3ckF4ZRl3tmmKPYKIQNq7GGrrBEV+kj0HCO+2K3H2kpcpK9C8CqxbFddaxvOTLSmK XMNFXy21AshGiKPmjsWcU6OwiQlSCJp6juqYeqdgh1wJTbv5hVLo9Mn7ZrFuGsaQD7eh WPaK02JQhlNMQ7dVl4AliLsj+gzQOqY8DZ7ELpr2oA6v/P5EeqK1Y6pPpgvDT6r64BqV /qBvCuT12VCxG7IpXwlOItJRto+VCg9DEYvHdXm7B9BVeQrIYUhRMD4D2M80nHy1GWQ7 IPt41KeLJj2nlOiG+bCP7Np81IlPjFewHr7Qfb4b1doEBM2zO8VqShk36elH4iGB5lHO UWKA== X-Gm-Message-State: AOAM533N2t3Yg+LFwuQDDwisYRkx+6fwQWm+PIqN9TeMDFQJ9UqC8MRV t07p3LFUHVW5GAW/fRZmi9uBew== X-Google-Smtp-Source: ABdhPJzxKaWj8b6sqgf5Vs79P5cB7jKpRfK/0sIhOL5lxOS8Yc8dWEfG7A+PioenuQlXvGeHwFWQ+g== X-Received: by 2002:a1c:4646:: with SMTP id t67mr4695545wma.40.1605105511450; Wed, 11 Nov 2020 06:38:31 -0800 (PST) Received: from localhost.localdomain (hst-221-89.medicom.bg. [84.238.221.89]) by smtp.gmail.com with ESMTPSA id b8sm2991405wrv.57.2020.11.11.06.38.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 06:38:31 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vikash Garodia , Alexandre Courbot , Fritz Koenig , Stanimir Varbanov Subject: [PATCH v2 5/8] venus: pm_helpers: Check instance state when calculate instance frequency Date: Wed, 11 Nov 2020 16:37:52 +0200 Message-Id: <20201111143755.24541-6-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201111143755.24541-1-stanimir.varbanov@linaro.org> References: <20201111143755.24541-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Skip calculating instance frequency if it is not in running state. Signed-off-by: Stanimir Varbanov Reviewed-by: Fritz Koenig --- drivers/media/platform/qcom/venus/pm_helpers.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index ca99908ca3d3..cc84dc5e371b 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -940,6 +940,9 @@ static unsigned long calculate_inst_freq(struct venus_inst *inst, mbs_per_sec = load_per_instance(inst); + if (inst->state != INST_START) + return 0; + vpp_freq = mbs_per_sec * inst->clk_data.codec_freq_data->vpp_freq; /* 21 / 20 is overhead factor */ vpp_freq += vpp_freq / 20; From patchwork Wed Nov 11 14:37:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11897949 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 517B21746 for ; Wed, 11 Nov 2020 14:39:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2828E20829 for ; Wed, 11 Nov 2020 14:39:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QmA+UejW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727182AbgKKOin (ORCPT ); Wed, 11 Nov 2020 09:38:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727148AbgKKOik (ORCPT ); Wed, 11 Nov 2020 09:38:40 -0500 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8CDCC0617A7 for ; Wed, 11 Nov 2020 06:38:34 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id p19so4221393wmg.0 for ; Wed, 11 Nov 2020 06:38:34 -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=UgCPIURcil9hG01k4XJ9cyq/wEnYTI+F3ySUT22jgJk=; b=QmA+UejWXh4jwqurZUgb6ou4f8RqKFKwIHPWa9zSxdMz7JyAo8H29Pa38ECLkKBAWR xh9XKvbk0hVLiWDczMfNSjCP6D9Tg+Efbz/g2MMwIIXQncQJE3mHzYtV0NJNXaHNWb36 UUehausaXwSZtWsh4v0FGM88ixXTbnMKNwzmLfJU/SAvs0kmELjfVp93j4Felgg1nBSR qSTfw7yFRpTjvwYj1a+veAz/JlrrIAFw0v/qUDZTqIzQZGNX6+h3RkGDtmgKcKTBUxCt PmLACq4VtWWIMAw55T/e+PB2T/kX3YS/0NgcrxOJHpEERSYvcVTa0BpvTadf1I80tds0 gTXA== 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=UgCPIURcil9hG01k4XJ9cyq/wEnYTI+F3ySUT22jgJk=; b=NxVnBrFFc0lKZOEbc6GWNX1RYXOtgM21f9dhnjZA+qPDBroMFbD7NS9Qr8Af+iu6IQ 6dYbDoapS+A8xRm37QYJrKHiT2QBita22+5St6aKVA7DnkF0ObgXBJkJLCRQ/1/FXjZI 1Ki5OV5iMZLUXVhy0S+ni0rGkgTA1ng9O6xfiTIOOk20zwGiUdBioRNDlvOCoWmKF29M nqk0O6Z+SIWFjasCku36VgGAdm2lhiJKwehTMaKRDoo4llbW7atRL+lV8obt63TpcrlD zWPe7LRNpPQeU/LrkqYEMSwlSSV7d8I1gNp6+s0ajA8ujeydIAe6XcgjlN3tRch3DPBa 91cw== X-Gm-Message-State: AOAM531JYx81GarudhHXywGUBJfGzZb3rZusnf6C4hn9BpvgL7wsA4JT 1rMYxoHA25eDGPCQkE4JwqLVrw== X-Google-Smtp-Source: ABdhPJwZ0P1JYmiuBrLn4FSKP2pDFcznHFEgrw+BxDshi/vutcOK5q4S7aw3K9m2bwFXfHuzAOnX+Q== X-Received: by 2002:a7b:cd11:: with SMTP id f17mr4537221wmj.127.1605105513442; Wed, 11 Nov 2020 06:38:33 -0800 (PST) Received: from localhost.localdomain (hst-221-89.medicom.bg. [84.238.221.89]) by smtp.gmail.com with ESMTPSA id b8sm2991405wrv.57.2020.11.11.06.38.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 06:38:32 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vikash Garodia , Alexandre Courbot , Fritz Koenig , Dikshita Agarwal , Stanimir Varbanov Subject: [PATCH v2 6/8] venus: venc: add handling for VIDIOC_ENCODER_CMD Date: Wed, 11 Nov 2020 16:37:53 +0200 Message-Id: <20201111143755.24541-7-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201111143755.24541-1-stanimir.varbanov@linaro.org> References: <20201111143755.24541-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Dikshita Agarwal Add handling for below commands in encoder: 1. V4L2_ENC_CMD_STOP 2. V4L2_ENC_CMD_START Signed-off-by: Dikshita Agarwal Signed-off-by: Stanimir Varbanov Reviewed-by: Fritz Koenig --- drivers/media/platform/qcom/venus/venc.c | 77 +++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 99bfabf90bd2..7512e4a16270 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -507,6 +507,59 @@ static int venc_enum_frameintervals(struct file *file, void *fh, return 0; } +static int venc_encoder_cmd(struct file *file, void *fh, + struct v4l2_encoder_cmd *ec) +{ + struct venus_inst *inst = to_inst(file); + struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx; + struct hfi_frame_data fdata = {0}; + int ret = 0; + + ret = v4l2_m2m_ioctl_try_encoder_cmd(file, fh, ec); + if (ret < 0) + return ret; + + mutex_lock(&inst->lock); + + if (!vb2_is_streaming(&m2m_ctx->cap_q_ctx.q) || + !vb2_is_streaming(&m2m_ctx->out_q_ctx.q)) + goto unlock; + + if (m2m_ctx->is_draining) { + ret = -EBUSY; + goto unlock; + } + + if (ec->cmd == V4L2_ENC_CMD_STOP) { + if (v4l2_m2m_has_stopped(m2m_ctx)) { + ret = 0; + goto unlock; + } + + m2m_ctx->is_draining = true; + + fdata.buffer_type = HFI_BUFFER_INPUT; + fdata.flags |= HFI_BUFFERFLAG_EOS; + fdata.device_addr = 0; + fdata.clnt_data = (u32)-1; + + ret = hfi_session_process_buf(inst, &fdata); + if (ret) + goto unlock; + } + + if (ec->cmd == V4L2_ENC_CMD_START && v4l2_m2m_has_stopped(m2m_ctx)) { + vb2_clear_last_buffer_dequeued(&m2m_ctx->cap_q_ctx.q); + inst->m2m_ctx->has_stopped = false; + venus_helper_process_initial_out_bufs(inst); + venus_helper_process_initial_cap_bufs(inst); + } + +unlock: + mutex_unlock(&inst->lock); + return ret; +} + static const struct v4l2_ioctl_ops venc_ioctl_ops = { .vidioc_querycap = venc_querycap, .vidioc_enum_fmt_vid_cap = venc_enum_fmt, @@ -534,6 +587,8 @@ static const struct v4l2_ioctl_ops venc_ioctl_ops = { .vidioc_enum_frameintervals = venc_enum_frameintervals, .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, .vidioc_unsubscribe_event = v4l2_event_unsubscribe, + .vidioc_try_encoder_cmd = v4l2_m2m_ioctl_try_encoder_cmd, + .vidioc_encoder_cmd = venc_encoder_cmd, }; static int venc_set_properties(struct venus_inst *inst) @@ -946,9 +1001,22 @@ static int venc_start_streaming(struct vb2_queue *q, unsigned int count) static void venc_vb2_buf_queue(struct vb2_buffer *vb) { struct venus_inst *inst = vb2_get_drv_priv(vb->vb2_queue); + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); + struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx; mutex_lock(&inst->lock); - venus_helper_vb2_buf_queue(vb); + + v4l2_m2m_buf_queue(m2m_ctx, vbuf); + + if (!(inst->streamon_out && inst->streamon_cap)) + goto unlock; + + if (v4l2_m2m_has_stopped(m2m_ctx)) + goto unlock; + + venus_helper_process_buf(vb); + +unlock: mutex_unlock(&inst->lock); } @@ -968,6 +1036,7 @@ static void venc_buf_done(struct venus_inst *inst, unsigned int buf_type, struct vb2_v4l2_buffer *vbuf; struct vb2_buffer *vb; unsigned int type; + struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx; if (buf_type == HFI_BUFFER_INPUT) type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; @@ -986,6 +1055,12 @@ static void venc_buf_done(struct venus_inst *inst, unsigned int buf_type, vb->planes[0].data_offset = data_offset; vb->timestamp = timestamp_us * NSEC_PER_USEC; vbuf->sequence = inst->sequence_cap++; + + if ((!bytesused && m2m_ctx->is_draining) || + (vbuf->flags & V4L2_BUF_FLAG_LAST)) { + vbuf->flags |= V4L2_BUF_FLAG_LAST; + v4l2_m2m_mark_stopped(inst->m2m_ctx); + } } else { vbuf->sequence = inst->sequence_out++; } From patchwork Wed Nov 11 14:37:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11897953 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 058971391 for ; Wed, 11 Nov 2020 14:39:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C493D20795 for ; Wed, 11 Nov 2020 14:39:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RFJWXOGA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727217AbgKKOjC (ORCPT ); Wed, 11 Nov 2020 09:39:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727143AbgKKOik (ORCPT ); Wed, 11 Nov 2020 09:38:40 -0500 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7467BC061A52 for ; Wed, 11 Nov 2020 06:38:36 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id p22so2466476wmg.3 for ; Wed, 11 Nov 2020 06:38:36 -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=v6PMbdcIaoeKpv1BZw7/QGsGTQk22a+f7y9ODfXyJpE=; b=RFJWXOGAFWIA2m0DXMEeGx7fabcVR1mMGdq6TnQs1KjP24WoouQwbboYBzRcmp8jpB qi9Ny8SkABPKT9dqzlz26bVcCblnJUVm3OoDDfUZLpTjMg2LgEFlOiRSH4vMjpjZChEl vMu2jvUoBdokjDTEeM9ZhroBqIfQpJWpk2WEumL9qDGbn53+qYvWOKy6TlDbkHDARkBl UcnQGFPQTO+rI14M8It/CepOqeJFw/CpN2K2hf3jyZJGUEesPkpOAX84zNwOTE9wMJql l8iQpQFls1hnJOY9ixraUMmToUy9fCC+2LpceNKAGBwy11muuFWfBlupdTv84X/Mpp01 fpEA== 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=v6PMbdcIaoeKpv1BZw7/QGsGTQk22a+f7y9ODfXyJpE=; b=ELwyxEOFiheMzCSZJDyhXRFFY2hn8yn7UDRPYnl0u8q+AuWpuD4+LaJ5t5RXb+0W2m 4a3aAZn0m46sN21UK8Of8UJKIoTpR0Gx9Wsztanq5igbxespSZ5fxfCK5k1Wqf1uOBiK SJaQCUthdmzSF3TscdcEdAXBegFbFQgD6A5Yj4W4gw49zMbXeE6BVHi7xjMYwRXzOJGJ +tz+3+Xoax028gU4mOjbU1bj+W6YTO4H6SBmfBZOAgIqW6KTr556gJLQUdxUfmeRcdwi BvM8cKgLWYa/bGZ9sZt/N5eRabeJKHKw5UciMVXHeSL8GWVcWJiYnNKh6IPaeh/uSBNb yKQQ== X-Gm-Message-State: AOAM530X+B/aImaAc5JcVrOBzvXdwLjmoxn4s0p9bUmW7zG6gjZv/HUu zXWOC32/BtKwBtRU0+9T5SfpjA== X-Google-Smtp-Source: ABdhPJyfhwZZGvSjEExcYWQXwgso+d1TfwdG22b4x1vmEe3V5gSHol4/2Oyx2YXdpspM14ZNTjwJ3w== X-Received: by 2002:a1c:c302:: with SMTP id t2mr4671828wmf.189.1605105515148; Wed, 11 Nov 2020 06:38:35 -0800 (PST) Received: from localhost.localdomain (hst-221-89.medicom.bg. [84.238.221.89]) by smtp.gmail.com with ESMTPSA id b8sm2991405wrv.57.2020.11.11.06.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 06:38:34 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vikash Garodia , Alexandre Courbot , Fritz Koenig , Stanimir Varbanov Subject: [PATCH v2 7/8] venus: venc: Handle reset encoder state Date: Wed, 11 Nov 2020 16:37:54 +0200 Message-Id: <20201111143755.24541-8-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201111143755.24541-1-stanimir.varbanov@linaro.org> References: <20201111143755.24541-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Redesign the encoder driver to be compliant with stateful encoder spec - specifically adds handling of Reset state. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/venc.c | 155 ++++++++++++++++++----- 1 file changed, 122 insertions(+), 33 deletions(-) diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 7512e4a16270..f1ae89d45a54 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -907,6 +907,54 @@ static int venc_queue_setup(struct vb2_queue *q, return ret; } +static void venc_release_session(struct venus_inst *inst) +{ + int ret, abort = 0; + + mutex_lock(&inst->lock); + + ret = hfi_session_deinit(inst); + abort = (ret && ret != -EINVAL) ? 1 : 0; + + if (inst->session_error) + abort = 1; + + if (abort) + hfi_session_abort(inst); + + venus_pm_load_scale(inst); + INIT_LIST_HEAD(&inst->registeredbufs); + mutex_unlock(&inst->lock); + + venus_pm_release_core(inst); +} + +static int venc_buf_init(struct vb2_buffer *vb) +{ + struct venus_inst *inst = vb2_get_drv_priv(vb->vb2_queue); + + inst->buf_count++; + + return venus_helper_vb2_buf_init(vb); +} + +static void venc_buf_cleanup(struct vb2_buffer *vb) +{ + struct venus_inst *inst = vb2_get_drv_priv(vb->vb2_queue); + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); + struct venus_buffer *buf = to_venus_buffer(vbuf); + + mutex_lock(&inst->lock); + if (vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) + if (!list_empty(&inst->registeredbufs)) + list_del_init(&buf->reg_list); + mutex_unlock(&inst->lock); + + inst->buf_count--; + if (!inst->buf_count) + venc_release_session(inst); +} + static int venc_verify_conf(struct venus_inst *inst) { enum hfi_version ver = inst->core->res->hfi_version; @@ -938,49 +986,57 @@ static int venc_verify_conf(struct venus_inst *inst) static int venc_start_streaming(struct vb2_queue *q, unsigned int count) { struct venus_inst *inst = vb2_get_drv_priv(q); + struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx; int ret; mutex_lock(&inst->lock); - if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) + v4l2_m2m_update_start_streaming_state(m2m_ctx, q); + + if (V4L2_TYPE_IS_OUTPUT(q->type)) inst->streamon_out = 1; else inst->streamon_cap = 1; - if (!(inst->streamon_out & inst->streamon_cap)) { - mutex_unlock(&inst->lock); - return 0; - } + if (inst->streamon_out && inst->streamon_cap && + inst->state == INST_UNINIT) { + venus_helper_init_instance(inst); - venus_helper_init_instance(inst); + inst->sequence_cap = 0; + inst->sequence_out = 0; - inst->sequence_cap = 0; - inst->sequence_out = 0; + ret = venc_init_session(inst); + if (ret) + goto bufs_done; - ret = venc_init_session(inst); - if (ret) - goto bufs_done; + ret = venus_pm_acquire_core(inst); + if (ret) + goto deinit_sess; - ret = venus_pm_acquire_core(inst); - if (ret) - goto deinit_sess; + ret = venc_verify_conf(inst); + if (ret) + goto deinit_sess; - ret = venc_set_properties(inst); - if (ret) - goto deinit_sess; + ret = venus_helper_set_num_bufs(inst, inst->num_input_bufs, + inst->num_output_bufs, 0); + if (ret) + goto deinit_sess; - ret = venc_verify_conf(inst); - if (ret) - goto deinit_sess; + ret = venus_helper_vb2_start_streaming(inst); + if (ret) + goto deinit_sess; - ret = venus_helper_set_num_bufs(inst, inst->num_input_bufs, - inst->num_output_bufs, 0); - if (ret) - goto deinit_sess; + venus_helper_process_initial_out_bufs(inst); + venus_helper_process_initial_cap_bufs(inst); + } else if (V4L2_TYPE_IS_CAPTURE(q->type) && inst->streamon_cap && + inst->streamon_out) { + ret = venus_helper_vb2_start_streaming(inst); + if (ret) + goto bufs_done; - ret = venus_helper_vb2_start_streaming(inst); - if (ret) - goto deinit_sess; + venus_helper_process_initial_out_bufs(inst); + venus_helper_process_initial_cap_bufs(inst); + } mutex_unlock(&inst->lock); @@ -990,15 +1046,43 @@ static int venc_start_streaming(struct vb2_queue *q, unsigned int count) hfi_session_deinit(inst); bufs_done: venus_helper_buffers_done(inst, q->type, VB2_BUF_STATE_QUEUED); - if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) + if (V4L2_TYPE_IS_OUTPUT(q->type)) inst->streamon_out = 0; else inst->streamon_cap = 0; + mutex_unlock(&inst->lock); return ret; } -static void venc_vb2_buf_queue(struct vb2_buffer *vb) +static void venc_stop_streaming(struct vb2_queue *q) +{ + struct venus_inst *inst = vb2_get_drv_priv(q); + struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx; + int ret = -EINVAL; + + mutex_lock(&inst->lock); + + v4l2_m2m_clear_state(m2m_ctx); + + if (V4L2_TYPE_IS_CAPTURE(q->type)) { + ret = hfi_session_stop(inst); + ret |= hfi_session_unload_res(inst); + ret |= venus_helper_unregister_bufs(inst); + ret |= venus_helper_intbufs_free(inst); + } + + venus_helper_buffers_done(inst, q->type, VB2_BUF_STATE_ERROR); + + if (V4L2_TYPE_IS_OUTPUT(q->type)) + inst->streamon_out = 0; + else + inst->streamon_cap = 0; + + mutex_unlock(&inst->lock); +} + +static void venc_buf_queue(struct vb2_buffer *vb) { struct venus_inst *inst = vb2_get_drv_priv(vb->vb2_queue); struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); @@ -1022,11 +1106,12 @@ static void venc_vb2_buf_queue(struct vb2_buffer *vb) static const struct vb2_ops venc_vb2_ops = { .queue_setup = venc_queue_setup, - .buf_init = venus_helper_vb2_buf_init, + .buf_init = venc_buf_init, + .buf_cleanup = venc_buf_cleanup, .buf_prepare = venus_helper_vb2_buf_prepare, .start_streaming = venc_start_streaming, - .stop_streaming = venus_helper_vb2_stop_streaming, - .buf_queue = venc_vb2_buf_queue, + .stop_streaming = venc_stop_streaming, + .buf_queue = venc_buf_queue, }; static void venc_buf_done(struct venus_inst *inst, unsigned int buf_type, @@ -1084,8 +1169,12 @@ static const struct hfi_inst_ops venc_hfi_ops = { .event_notify = venc_event_notify, }; +static void venc_m2m_device_run(void *priv) +{ +} + static const struct v4l2_m2m_ops venc_m2m_ops = { - .device_run = venus_helper_m2m_device_run, + .device_run = venc_m2m_device_run, .job_abort = venus_helper_m2m_job_abort, }; From patchwork Wed Nov 11 14:37:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11897951 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 591BD14C0 for ; Wed, 11 Nov 2020 14:39:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3ADB9207DE for ; Wed, 11 Nov 2020 14:39:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Qzf64FhV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727126AbgKKOjC (ORCPT ); Wed, 11 Nov 2020 09:39:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727150AbgKKOik (ORCPT ); Wed, 11 Nov 2020 09:38:40 -0500 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03C91C061A55 for ; Wed, 11 Nov 2020 06:38:38 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id o15so2763886wru.6 for ; Wed, 11 Nov 2020 06:38:37 -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=DzUjnsp2X4OnTCyXgn/JbY+DNy5G4LB8TIDONuAc8II=; b=Qzf64FhVyFPIfQD1gu6EoyuhzvYG1X3bVXltED54Gqv32hegCwzWHi3W3muW0j04+T jgF9K5kF2vVLRSanLBmu7r32YPYE4t+qTKbOE2uDoby4tKP1z9dD3DLPJK14KCXR4QTc eFR+8+lixZGzRPhGBRbEoXFm55q7HJat3WH2EW0cgpvQUM5ZTEWWbJPYycrVX/3rIesY k90QNUFB4yXAlAxx7o6lA8seBS45akDOwgrR3E4Khpm4kNnL/ecBUeAhHuUvzNhUjx28 QtYZy+mt6U7R+CB10xXZKxvKyabezUpyRU4G2CSa/OUYhKoobPe0APxaBd5zoFnxf/1p x6zA== 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=DzUjnsp2X4OnTCyXgn/JbY+DNy5G4LB8TIDONuAc8II=; b=djMLKAc6jusSCLzJ0ooaPfbc/XlIaN8+YR7sXLrOyowxFhK/4LWBGG663JLFJ0MLhy 8Qn9kriUqHl5187jeTBTFSx9RXv00Xv3T3YitG+D095Xi2sQVj6V1HoKVaAZhtqTGIYf ATGP5Xrac7MDsYxAOO9dCYpf2rVPvYjb/4VB3tFDzxgZRKocPn3taV+fpjnf3cMeF9Ks L+mBfTAGIpxFFXYsNlj356rDgPBvdf7JGlX93hWsYw3Nfap49X0vbq1vxN8MEmG9A5bP F1/F2xBjioGaMfoYuK3EExt8d4Z+W/6NvnLVayYGKJS30hZGLnqSTHSEEopiLA8cIzk6 cTTA== X-Gm-Message-State: AOAM530PQ8eNUWWtaElmFsqpD8MgwqHBHHn0QCuF7yNGpcolsTnrRSgn gILx228zrgsE1wDuC8Sp3f201A== X-Google-Smtp-Source: ABdhPJz3exYiT8GJMsh3/W6jpnBZ3DjMRWetrng5MyjLQM4Di85RFaHmr5jjqSjwNZucXT7uhaHc8Q== X-Received: by 2002:adf:f304:: with SMTP id i4mr17619843wro.268.1605105516778; Wed, 11 Nov 2020 06:38:36 -0800 (PST) Received: from localhost.localdomain (hst-221-89.medicom.bg. [84.238.221.89]) by smtp.gmail.com with ESMTPSA id b8sm2991405wrv.57.2020.11.11.06.38.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 06:38:36 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vikash Garodia , Alexandre Courbot , Fritz Koenig , Stanimir Varbanov Subject: [PATCH v2 8/8] venus: helpers: Delete unused stop streaming helper Date: Wed, 11 Nov 2020 16:37:55 +0200 Message-Id: <20201111143755.24541-9-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201111143755.24541-1-stanimir.varbanov@linaro.org> References: <20201111143755.24541-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org After re-design of encoder driver this helper is not needed anymore. Signed-off-by: Stanimir Varbanov Reviewed-by: Fritz Koenig --- drivers/media/platform/qcom/venus/helpers.c | 43 --------------------- drivers/media/platform/qcom/venus/helpers.h | 1 - 2 files changed, 44 deletions(-) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 490c026b58a3..51c80417f361 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -1406,49 +1406,6 @@ void venus_helper_buffers_done(struct venus_inst *inst, unsigned int type, } EXPORT_SYMBOL_GPL(venus_helper_buffers_done); -void venus_helper_vb2_stop_streaming(struct vb2_queue *q) -{ - struct venus_inst *inst = vb2_get_drv_priv(q); - struct venus_core *core = inst->core; - int ret; - - mutex_lock(&inst->lock); - - if (inst->streamon_out & inst->streamon_cap) { - ret = hfi_session_stop(inst); - ret |= hfi_session_unload_res(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) - ret = -EIO; - - if (ret) - hfi_session_abort(inst); - - venus_helper_free_dpb_bufs(inst); - - venus_pm_load_scale(inst); - INIT_LIST_HEAD(&inst->registeredbufs); - } - - venus_helper_buffers_done(inst, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - VB2_BUF_STATE_ERROR); - venus_helper_buffers_done(inst, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, - VB2_BUF_STATE_ERROR); - - if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) - inst->streamon_out = 0; - else - inst->streamon_cap = 0; - - venus_pm_release_core(inst); - - mutex_unlock(&inst->lock); -} -EXPORT_SYMBOL_GPL(venus_helper_vb2_stop_streaming); - int venus_helper_process_initial_cap_bufs(struct venus_inst *inst) { struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx; diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 231af29667e7..3eae2acbcc8e 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -20,7 +20,6 @@ int venus_helper_vb2_buf_init(struct vb2_buffer *vb); int venus_helper_vb2_buf_prepare(struct vb2_buffer *vb); void venus_helper_vb2_buf_queue(struct vb2_buffer *vb); void venus_helper_process_buf(struct vb2_buffer *vb); -void venus_helper_vb2_stop_streaming(struct vb2_queue *q); int venus_helper_vb2_start_streaming(struct venus_inst *inst); void venus_helper_m2m_device_run(void *priv); void venus_helper_m2m_job_abort(void *priv);