From patchwork Tue Oct 5 08:10:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 12535759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FDC9C433EF for ; Tue, 5 Oct 2021 08:11:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF82461131 for ; Tue, 5 Oct 2021 08:11:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233372AbhJEINW (ORCPT ); Tue, 5 Oct 2021 04:13:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233320AbhJEINA (ORCPT ); Tue, 5 Oct 2021 04:13:00 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2E8CC061745 for ; Tue, 5 Oct 2021 01:11:09 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id z20so23700993edc.13 for ; Tue, 05 Oct 2021 01:11:09 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=5aa4vZiuIFSCPHF4dxekm5eLMC5HcT+Pb9Hlo0UAubI=; b=JYzfxac7W+813vz3g6oISyCSz1sLUD4TZXUQfbe+Ap5PzbUCz8pDjLyYvazAS9erlY z3K037RE8QB+HZ06Sx1KP5VYA3uMLdY0lVEwCZ6ldhl56L4hZ83AuoJe1MF/JL6P0fWD Z0jgWVbjUB/K9WrR7rDiJ7+W+p12mI6/Z4WfeQLMeQUw7JoaR1C5WmOitJJLH39zviF4 rb6k5R+5hRqp7cDpsRqIgyRwmb1eSxOjrD1F2ofrkbv4IPj9lI90PPbTORFgOzRvZNeG ADejhdeUFvn6QQWdkOy52Yva9v9+FJgvUiXUmHRD9UCKGxJTlL2ClW4TWOar75Mia6Jj XHWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5aa4vZiuIFSCPHF4dxekm5eLMC5HcT+Pb9Hlo0UAubI=; b=gPrvU4E7ymlkqXMq6/olhyHlOao46U/wexwIduAsIlBpiD9+PamTH79blUusyEkFHq hLEgFHtRgGj6g8XjW+hf0Z8b57ocVCzY3Jwz4epadGe7PBDMvz5CTIlyuOmxh66++flM JTNE8X+ILCsBkeByFHCGjsWJZFjx0dZvlsT18WM0USsstbabVvO5QzBw5ypZqbpPclqv wZs+DziMoDxGyCcfXKpRyU7y8Pm0qpoHpes/PYxvImXgZbM63ouH5IfrfIz9ehC51/cO e7PZrZRlkkSh4xOanY/KQBGHb9qscJrWov7iXuuC832ISvjlG0DvQ4jjDCWNsTjHObKv 0ZWQ== X-Gm-Message-State: AOAM532G3HRgbjISAQxLK9jGj+CIxEb6s6LAPkYdF+mvu8HiMdb+gvE5 mp0GVvP3fgVGs8NXD4VU+d3q8sa1LVdt1A== X-Google-Smtp-Source: ABdhPJyNuhS5/OGQl3GyNzyK2Qf/kZaKWCLVmzcZORm7DqQ8n6orub/P2fkp4YteNMOvh/Ssi7bouQ== X-Received: by 2002:a17:906:aed1:: with SMTP id me17mr23060476ejb.474.1633421466458; Tue, 05 Oct 2021 01:11:06 -0700 (PDT) Received: from localhost.localdomain ([84.238.208.199]) by smtp.gmail.com with ESMTPSA id f1sm3096258edz.47.2021.10.05.01.11.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 01:11:06 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org, Dikshita Agarwal , Stanimir Varbanov Subject: [PATCH v5 1/7] venus: firmware: enable no tz fw loading for sc7280 Date: Tue, 5 Oct 2021 11:10:42 +0300 Message-Id: <20211005081048.3095252-2-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> References: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Dikshita Agarwal Enable no tz FW loading and add routine to reset XTSS. Signed-off-by: Dikshita Agarwal Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/firmware.c | 42 ++++++++++++++----- .../media/platform/qcom/venus/hfi_venus_io.h | 2 + 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/platform/qcom/venus/firmware.c index 227bd3b3f84c..14b6f1d05991 100644 --- a/drivers/media/platform/qcom/venus/firmware.c +++ b/drivers/media/platform/qcom/venus/firmware.c @@ -27,7 +27,12 @@ static void venus_reset_cpu(struct venus_core *core) { u32 fw_size = core->fw.mapped_mem_size; - void __iomem *wrapper_base = core->wrapper_base; + void __iomem *wrapper_base; + + if (IS_V6(core)) + wrapper_base = core->wrapper_tz_base; + else + wrapper_base = core->wrapper_base; writel(0, wrapper_base + WRAPPER_FW_START_ADDR); writel(fw_size, wrapper_base + WRAPPER_FW_END_ADDR); @@ -35,11 +40,17 @@ static void venus_reset_cpu(struct venus_core *core) writel(fw_size, wrapper_base + WRAPPER_CPA_END_ADDR); writel(fw_size, wrapper_base + WRAPPER_NONPIX_START_ADDR); writel(fw_size, wrapper_base + WRAPPER_NONPIX_END_ADDR); - writel(0x0, wrapper_base + WRAPPER_CPU_CGC_DIS); - writel(0x0, wrapper_base + WRAPPER_CPU_CLOCK_CONFIG); - /* Bring ARM9 out of reset */ - writel(0, wrapper_base + WRAPPER_A9SS_SW_RESET); + if (IS_V6(core)) { + /* Bring XTSS out of reset */ + writel(0, wrapper_base + WRAPPER_TZ_XTSS_SW_RESET); + } else { + writel(0x0, wrapper_base + WRAPPER_CPU_CGC_DIS); + writel(0x0, wrapper_base + WRAPPER_CPU_CLOCK_CONFIG); + + /* Bring ARM9 out of reset */ + writel(0, wrapper_base + WRAPPER_A9SS_SW_RESET); + } } int venus_set_hw_state(struct venus_core *core, bool resume) @@ -56,7 +67,9 @@ int venus_set_hw_state(struct venus_core *core, bool resume) if (resume) { venus_reset_cpu(core); } else { - if (!IS_V6(core)) + if (IS_V6(core)) + writel(1, core->wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET); + else writel(1, core->wrapper_base + WRAPPER_A9SS_SW_RESET); } @@ -162,12 +175,19 @@ static int venus_shutdown_no_tz(struct venus_core *core) u32 reg; struct device *dev = core->fw.dev; void __iomem *wrapper_base = core->wrapper_base; + void __iomem *wrapper_tz_base = core->wrapper_tz_base; - /* Assert the reset to ARM9 */ - reg = readl_relaxed(wrapper_base + WRAPPER_A9SS_SW_RESET); - reg |= WRAPPER_A9SS_SW_RESET_BIT; - writel_relaxed(reg, wrapper_base + WRAPPER_A9SS_SW_RESET); - + if (IS_V6(core)) { + /* Assert the reset to XTSS */ + reg = readl_relaxed(wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET); + reg |= WRAPPER_XTSS_SW_RESET_BIT; + writel_relaxed(reg, wrapper_tz_base + WRAPPER_TZ_XTSS_SW_RESET); + } else { + /* Assert the reset to ARM9 */ + reg = readl_relaxed(wrapper_base + WRAPPER_A9SS_SW_RESET); + reg |= WRAPPER_A9SS_SW_RESET_BIT; + writel_relaxed(reg, wrapper_base + WRAPPER_A9SS_SW_RESET); + } /* Make sure reset is asserted before the mapping is removed */ mb(); diff --git a/drivers/media/platform/qcom/venus/hfi_venus_io.h b/drivers/media/platform/qcom/venus/hfi_venus_io.h index 300c6e47e72f..9735a246ce36 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus_io.h +++ b/drivers/media/platform/qcom/venus/hfi_venus_io.h @@ -149,6 +149,8 @@ /* Wrapper TZ 6xx */ #define WRAPPER_TZ_BASE_V6 0x000c0000 #define WRAPPER_TZ_CPU_STATUS_V6 0x10 +#define WRAPPER_TZ_XTSS_SW_RESET 0x1000 +#define WRAPPER_XTSS_SW_RESET_BIT BIT(0) /* Venus AON */ #define AON_BASE_V6 0x000e0000 From patchwork Tue Oct 5 08:10:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 12535755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AC7FC43217 for ; Tue, 5 Oct 2021 08:11:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7AEEB61354 for ; Tue, 5 Oct 2021 08:11:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233583AbhJEINP (ORCPT ); Tue, 5 Oct 2021 04:13:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233449AbhJEINF (ORCPT ); Tue, 5 Oct 2021 04:13:05 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5426CC061753 for ; Tue, 5 Oct 2021 01:11:10 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id x7so72933049edd.6 for ; Tue, 05 Oct 2021 01:11:10 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=reI8ABKa2KHEbOGggLGunLye63rXdf1D0uQhMOxGYnY=; b=pGU9xu0PqdSMZwD3kdcpIhPxDzI/x4iZSEkBZc04MY/NVKHQMyu/q2A6QXug9Vsyy9 hUZUbHRUtnyQVAlcjx/lilVe5C2vkBbJZKyi0F2joKJjrOUkNz1tuythCuj0X3M+JYDE o9dlKU0oet0xwKEb42nfm+5vwYKpwlFWlXTVeSMWfXy/l4xM+oAt/18Y4O8k4B27QwKt JyMBJDxU6Rc+L+N3R7xv4JtYuxDq0BQ+UgLUP873X0yf3yVkTczN3dLYdC/fgETAtiFt c0Sm+MECHNf8SKImScVpHl4IZema/iGVuxtuz8z3fff2hWLVQje9dnDlnJBLvWQwMuri uV2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=reI8ABKa2KHEbOGggLGunLye63rXdf1D0uQhMOxGYnY=; b=NOsQs73rEGnEZNLjEDo2lmXCQ5yYjme/3xxXOAHJscerguVgehmcx6eTb20OURJ3aL AZT1ouzHBs/KEf2T0McG7ctN4YlS2CZ/8w/mtwckG69q4Xfy1arGceLnNQktdwQIxDTE C2OBG83Onr8v/WgmmrOQ5mglZ2K0LU73fvwwIsZE+1yqHDBYw7ynFFdT13Yx4MmSF/hD k6UoNWAHNSpq5Qj1jxRrCBrfUEZRUrYES6StYfk6PRAZE2Zi4KkY1/9L2zUl08zZcMvS Y7Myl9Bo5yG3Q6e2f8isrxGq2wSuZquandwD7i/NAy3ejTnE7D8RoUdIkj3jMSrcddqA VFCQ== X-Gm-Message-State: AOAM533KN4VTG1g4qDSc0ZQYMniiq/DhcWeAS0hIlAfUIuXz4MtzfqX9 M/seQmuMHjJJOsMyicP4sqTU6P1vxEABmA== X-Google-Smtp-Source: ABdhPJwEcX5Ebgfd6f2zznhuqDPUF/IzTPbNME5jqOmROJTWaH2/zbtZIFMFPICGjBUaMacPEKuPKA== X-Received: by 2002:a50:9dcd:: with SMTP id l13mr23920971edk.90.1633421467352; Tue, 05 Oct 2021 01:11:07 -0700 (PDT) Received: from localhost.localdomain ([84.238.208.199]) by smtp.gmail.com with ESMTPSA id f1sm3096258edz.47.2021.10.05.01.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 01:11:07 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org, Dikshita Agarwal , Mansur Alisha Shaik , Stanimir Varbanov Subject: [PATCH v5 2/7] media: venus: core: Add sc7280 DT compatible and resource data Date: Tue, 5 Oct 2021 11:10:43 +0300 Message-Id: <20211005081048.3095252-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> References: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Dikshita Agarwal Adds a sm7280 compatible binding to the venus core. Co-developed-by: Mansur Alisha Shaik Signed-off-by: Mansur Alisha Shaik Signed-off-by: Dikshita Agarwal Signed-off-by: Stanimir Varbanov --- Added Mansur's Signed-off-by Sort alphabetically the new compatible string drivers/media/platform/qcom/venus/core.c | 52 ++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 7e54c5d571dc..e5af4d74e504 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -734,12 +734,64 @@ static const struct venus_resources sm8250_res = { .fwname = "qcom/vpu-1.0/venus.mdt", }; +static const struct freq_tbl sc7280_freq_table[] = { + { 0, 460000000 }, + { 0, 424000000 }, + { 0, 335000000 }, + { 0, 240000000 }, + { 0, 133333333 }, +}; + +static const struct bw_tbl sc7280_bw_table_enc[] = { + { 1944000, 1896000, 0, 3657000, 0 }, /* 3840x2160@60 */ + { 972000, 968000, 0, 1848000, 0 }, /* 3840x2160@30 */ + { 489600, 618000, 0, 941000, 0 }, /* 1920x1080@60 */ + { 244800, 318000, 0, 480000, 0 }, /* 1920x1080@30 */ +}; + +static const struct bw_tbl sc7280_bw_table_dec[] = { + { 2073600, 2128000, 0, 3831000, 0 }, /* 4096x2160@60 */ + { 1036800, 1085000, 0, 1937000, 0 }, /* 4096x2160@30 */ + { 489600, 779000, 0, 998000, 0 }, /* 1920x1080@60 */ + { 244800, 400000, 0, 509000, 0 }, /* 1920x1080@30 */ +}; + +static const struct reg_val sm7280_reg_preset[] = { + { 0xb0088, 0 }, +}; + +static const struct venus_resources sc7280_res = { + .freq_tbl = sc7280_freq_table, + .freq_tbl_size = ARRAY_SIZE(sc7280_freq_table), + .reg_tbl = sm7280_reg_preset, + .reg_tbl_size = ARRAY_SIZE(sm7280_reg_preset), + .bw_tbl_enc = sc7280_bw_table_enc, + .bw_tbl_enc_size = ARRAY_SIZE(sc7280_bw_table_enc), + .bw_tbl_dec = sc7280_bw_table_dec, + .bw_tbl_dec_size = ARRAY_SIZE(sc7280_bw_table_dec), + .clks = {"core", "bus", "iface"}, + .clks_num = 3, + .vcodec0_clks = {"vcodec_core", "vcodec_bus"}, + .vcodec_clks_num = 2, + .vcodec_pmdomains = { "venus", "vcodec0" }, + .vcodec_pmdomains_num = 2, + .opp_pmdomain = (const char *[]) { "cx", NULL }, + .vcodec_num = 1, + .hfi_version = HFI_VERSION_6XX, + .vmem_id = VIDC_RESOURCE_NONE, + .vmem_size = 0, + .vmem_addr = 0, + .dma_mask = 0xe0000000 - 1, + .fwname = "qcom/vpu-2.0/venus.mbn", +}; + static const struct of_device_id venus_dt_match[] = { { .compatible = "qcom,msm8916-venus", .data = &msm8916_res, }, { .compatible = "qcom,msm8996-venus", .data = &msm8996_res, }, { .compatible = "qcom,sdm845-venus", .data = &sdm845_res, }, { .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, }, { .compatible = "qcom,sc7180-venus", .data = &sc7180_res, }, + { .compatible = "qcom,sc7280-venus", .data = &sc7280_res, }, { .compatible = "qcom,sm8250-venus", .data = &sm8250_res, }, { } }; From patchwork Tue Oct 5 08:10:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 12535747 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58812C433FE for ; Tue, 5 Oct 2021 08:11:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F90D61372 for ; Tue, 5 Oct 2021 08:11:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233382AbhJEINC (ORCPT ); Tue, 5 Oct 2021 04:13:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233321AbhJEINA (ORCPT ); Tue, 5 Oct 2021 04:13:00 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4371C061749 for ; Tue, 5 Oct 2021 01:11:09 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id b8so40628588edk.2 for ; Tue, 05 Oct 2021 01:11:09 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=yiKrIzBiKlW3d0EztEYlz/TsXaJItbUI5JDPiVLlN/g=; b=YmIChPJXJMaKsNpip6EixH2hiIiMBjlqpIVxWPX4NrD1wNja+xWPabsHk8wLRgNtjc yjbqkxRmJCOcI0yOjaxlJ2Y+yrNSr5WqpSNCLeIaKsqrl91e+PzDxJ1/Q4Pzz91XaWa3 jzO4KM0zkTIKH28RAtZ+tDkkam1rWSM1TCJ86zpwMf2cGHo8Z7IVv4mgYuD6Sh+dG6a+ VrE2cFJM4aF7BXW7eSfWaQM2c26pwvqbWTYrvdeM8t6d6+V7uTfgjHn5sJaQfZrsQde8 vF2LURw1AzgGzdIMm4h3nsX3+8caNM25fgYOiNMPCB5S9B79IT4AZHoGnPx1657jMHEp k4eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yiKrIzBiKlW3d0EztEYlz/TsXaJItbUI5JDPiVLlN/g=; b=jDkz4qb2ZpufuEekQUxRMmqUDkQBtkQJyF/vvWJ2zA1L+6/W/atYuiuJ8E6eRMWhy7 7V/JuMzofvvAmp4uTI/95i74YYcXhzc1fFjGSVAuNUNcS5Jaez3CgX5oHXd9+t5C5ohi iVXxXRv/l5DwjHD/2QlV3ojAJ35s039fGElaaWE4zLPi9ubHPAKC6xmEHSaWkv1wSwzk 6n5453SeNMa5ZUaIyUc+7E8tUwxQXhohm2hV0MxRVb499pK8CgAlr/O0K7Wggi8Y5qqv wc8HkHvf7NfJ1wtj4YUKKeuyi4cDp8KfX9MoAlZgeD3FZAawbuMtbEDvmXbjSNkgKc5I GkRw== X-Gm-Message-State: AOAM5321+hm8OHKmNcgIbKEDTVO5RH2vBDbJAj20dTVlc6wVaJKS4b4D okkirxlKraLBTwvWhpSBNYINpMI1lubf5g== X-Google-Smtp-Source: ABdhPJwJhu3jjo/3YXeQJcXgRFl6tItMWzZAqXsrRZo1PPfuyGlAD0IoFfE1hMBVYWR+E7TfseDzSQ== X-Received: by 2002:a17:906:c18d:: with SMTP id g13mr22603666ejz.518.1633421468198; Tue, 05 Oct 2021 01:11:08 -0700 (PDT) Received: from localhost.localdomain ([84.238.208.199]) by smtp.gmail.com with ESMTPSA id f1sm3096258edz.47.2021.10.05.01.11.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 01:11:07 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org, Dikshita Agarwal , Stanimir Varbanov Subject: [PATCH v5 3/7] media: venus: Add num_vpp_pipes to resource structure Date: Tue, 5 Oct 2021 11:10:44 +0300 Message-Id: <20211005081048.3095252-4-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> References: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Dikshita Agarwal V6 HW can have vpp pipes as 1 or 4, add num_vpp_pipes to resource struture to differentiate. Signed-off-by: Dikshita Agarwal Acked-by: Stanimir Varbanov Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.c | 2 ++ drivers/media/platform/qcom/venus/core.h | 1 + drivers/media/platform/qcom/venus/helpers.c | 2 +- drivers/media/platform/qcom/venus/hfi_platform.c | 13 ------------- drivers/media/platform/qcom/venus/hfi_platform.h | 2 -- drivers/media/platform/qcom/venus/hfi_platform_v6.c | 6 ------ 6 files changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index e5af4d74e504..de7b32caa8b8 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -727,6 +727,7 @@ static const struct venus_resources sm8250_res = { .vcodec_num = 1, .max_load = 7833600, .hfi_version = HFI_VERSION_6XX, + .num_vpp_pipes = 4, .vmem_id = VIDC_RESOURCE_NONE, .vmem_size = 0, .vmem_addr = 0, @@ -778,6 +779,7 @@ static const struct venus_resources sc7280_res = { .opp_pmdomain = (const char *[]) { "cx", NULL }, .vcodec_num = 1, .hfi_version = HFI_VERSION_6XX, + .num_vpp_pipes = 1, .vmem_id = VIDC_RESOURCE_NONE, .vmem_size = 0, .vmem_addr = 0, diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 5ec851115eca..62228cc6b032 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -68,6 +68,7 @@ struct venus_resources { const char * const resets[VIDC_RESETS_NUM_MAX]; unsigned int resets_num; enum hfi_version hfi_version; + u8 num_vpp_pipes; u32 max_load; unsigned int vmem_id; u32 vmem_size; diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 8012f5c7bf34..1f46a6f4456a 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -583,7 +583,7 @@ static int platform_get_bufreq(struct venus_inst *inst, u32 buftype, return -EINVAL; params.version = version; - params.num_vpp_pipes = hfi_platform_num_vpp_pipes(version); + params.num_vpp_pipes = inst->core->res->num_vpp_pipes; if (is_dec) { params.width = inst->width; diff --git a/drivers/media/platform/qcom/venus/hfi_platform.c b/drivers/media/platform/qcom/venus/hfi_platform.c index f5b4e1f4764f..f16f8962273c 100644 --- a/drivers/media/platform/qcom/venus/hfi_platform.c +++ b/drivers/media/platform/qcom/venus/hfi_platform.c @@ -66,16 +66,3 @@ hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec, u32 session_ return freq; } -u8 hfi_platform_num_vpp_pipes(enum hfi_version version) -{ - const struct hfi_platform *plat; - - plat = hfi_platform_get(version); - if (!plat) - return 0; - - if (plat->num_vpp_pipes) - return plat->num_vpp_pipes(); - - return 0; -} diff --git a/drivers/media/platform/qcom/venus/hfi_platform.h b/drivers/media/platform/qcom/venus/hfi_platform.h index 2dbe608c53af..1dcf4085928c 100644 --- a/drivers/media/platform/qcom/venus/hfi_platform.h +++ b/drivers/media/platform/qcom/venus/hfi_platform.h @@ -52,7 +52,6 @@ struct hfi_platform { unsigned long (*codec_lp_freq)(u32 session_type, u32 codec); void (*codecs)(u32 *enc_codecs, u32 *dec_codecs, u32 *count); const struct hfi_plat_caps *(*capabilities)(unsigned int *entries); - u8 (*num_vpp_pipes)(void); int (*bufreq)(struct hfi_plat_buffers_params *params, u32 session_type, u32 buftype, struct hfi_buffer_requirements *bufreq); }; @@ -67,5 +66,4 @@ unsigned long hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 code u32 session_type); unsigned long hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec, u32 session_type); -u8 hfi_platform_num_vpp_pipes(enum hfi_version version); #endif diff --git a/drivers/media/platform/qcom/venus/hfi_platform_v6.c b/drivers/media/platform/qcom/venus/hfi_platform_v6.c index d8243b22568a..c10618e44f5d 100644 --- a/drivers/media/platform/qcom/venus/hfi_platform_v6.c +++ b/drivers/media/platform/qcom/venus/hfi_platform_v6.c @@ -322,17 +322,11 @@ static unsigned long codec_lp_freq(u32 session_type, u32 codec) return 0; } -static u8 num_vpp_pipes(void) -{ - return 4; -} - const struct hfi_platform hfi_plat_v6 = { .codec_vpp_freq = codec_vpp_freq, .codec_vsp_freq = codec_vsp_freq, .codec_lp_freq = codec_lp_freq, .codecs = get_codecs, .capabilities = get_capabilities, - .num_vpp_pipes = num_vpp_pipes, .bufreq = hfi_plat_bufreq_v6, }; From patchwork Tue Oct 5 08:10:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 12535749 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 336A3C433EF for ; Tue, 5 Oct 2021 08:11:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B77561165 for ; Tue, 5 Oct 2021 08:11:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233438AbhJEINF (ORCPT ); Tue, 5 Oct 2021 04:13:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233352AbhJEINB (ORCPT ); Tue, 5 Oct 2021 04:13:01 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B448AC061745 for ; Tue, 5 Oct 2021 01:11:10 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id v18so73971142edc.11 for ; Tue, 05 Oct 2021 01:11:10 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=Ls8RstZxqwEUsOoWPu8ndBv6d6AzlNnldZDH8PTFT0s=; b=nO4PomRi8oyFYlAiKXx3pgeRDpA6tK4u/+itS+BRrE3bXCb44RNKaDruBFZ49gqxZU dfwndLroqe4h5ihs8+0PLL3U8FcjbkLNr4JTAhvoT4/wNPPRaXmRK1D9qHByepPzOvwz sigWiLZIMlmuVAMOVYW4CoB/Y2iEyrgdJUMX1V7vHvOMV75yhgIQY57oOvSpKTp9QCmc 0H2He5ZxubbvMovD+e/2Fz5WTqiVkDMIcw3mdNnZCEsbow/CxIdKnZ0OCdVVfKiaCpJl ZkghlpXCH3t38FKJPT4w8H1JD6wgQOgzoqplAF2d9s8UOiYx+Ii06g+vTi7EahvV7zFM aMkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ls8RstZxqwEUsOoWPu8ndBv6d6AzlNnldZDH8PTFT0s=; b=upc4M9lvJa6xQB3wZ8jv/DXhzHved8E5RGz2MOomwhOrkJTaRNW/fMs+wyzDrpv4Tf h6rwIhnuxtXg70o6+nm9rvIN6WhTjuRQJC6NSpCcGDM2pAyXs33LFlJb56c0r+TRK8UD WsFMFqpeGEgkeQcY2QGdDxy5E47JUjlW4OZ7dVfjIvwe5tJv0N4BuW+lLLiX38LQKvZ1 Jm+eqGQFyhO4mRJd280gy+sJ1II/Ir1oS5oq07wKlhzq+LOAyoxdt9BFBpqi+y9s6X6Y B6Vi7O5TaR/fh0ZzWJ8bbrK/7lKOpcpfa9IR4xJMFDDpFjF4MXlGMRgionFPbyWPihTw JGlg== X-Gm-Message-State: AOAM5323oxPxRE8O8m340TUUkNvu1a5Zg9+Xn4dpJ8Uk73WLC9dmi4xg n8kzhH7DuTJNS45QMG3Dj2uR4X0Azht9zA== X-Google-Smtp-Source: ABdhPJyckDi2ds1mQmeg1dj3SRksmDbvdNoYJGhzAFsHs7NmG8BLc4++eLGXCqVX3PoAxzTNmoyyEA== X-Received: by 2002:a17:906:6dd4:: with SMTP id j20mr22885943ejt.316.1633421468984; Tue, 05 Oct 2021 01:11:08 -0700 (PDT) Received: from localhost.localdomain ([84.238.208.199]) by smtp.gmail.com with ESMTPSA id f1sm3096258edz.47.2021.10.05.01.11.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 01:11:08 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org, Dikshita Agarwal , Mansur Alisha Shaik , Stanimir Varbanov Subject: [PATCH v5 4/7] media: venus: hfi: Skip AON register programming for V6 1pipe Date: Tue, 5 Oct 2021 11:10:45 +0300 Message-Id: <20211005081048.3095252-5-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> References: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Dikshita Agarwal AON register programming is used to set NOC to low power mode during V6 power off sequence. However AON register memory map is not applicable to 1pipe, hence skipping AON register programming. Co-developed-by: Mansur Alisha Shaik Signed-off-by: Mansur Alisha Shaik Co-developed-by: Vikash Garodia Signed-off-by: Vikash Garodia Signed-off-by: Dikshita Agarwal Acked-by: Stanimir Varbanov Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi_venus.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index ce98c523b3c6..3a75a27632fb 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -551,6 +551,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev) if (IS_V6(hdev->core)) { writel(0x3, cpu_cs_base + CPU_CS_X2RPMH_V6); + if (hdev->core->res->num_vpp_pipes == 1) + goto skip_aon_mvp_noc; + writel(0x1, aon_base + AON_WRAPPER_MVP_NOC_LPI_CONTROL); ret = readl_poll_timeout(aon_base + AON_WRAPPER_MVP_NOC_LPI_STATUS, val, @@ -560,6 +563,7 @@ static int venus_halt_axi(struct venus_hfi_device *hdev) if (ret) return -ETIMEDOUT; +skip_aon_mvp_noc: mask_val = (BIT(2) | BIT(1) | BIT(0)); writel(mask_val, wrapper_base + WRAPPER_DEBUG_BRIDGE_LPI_CONTROL_V6); From patchwork Tue Oct 5 08:10:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 12535751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1A19C4332F for ; Tue, 5 Oct 2021 08:11:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8D04D611C5 for ; Tue, 5 Oct 2021 08:11:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233344AbhJEIND (ORCPT ); Tue, 5 Oct 2021 04:13:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233363AbhJEINC (ORCPT ); Tue, 5 Oct 2021 04:13:02 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADFD1C061766 for ; Tue, 5 Oct 2021 01:11:11 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id dj4so75681408edb.5 for ; Tue, 05 Oct 2021 01:11:11 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=F0rxTAIDQUC00gIGQ2hZRmANNTx894FvV5JJnWTgTsY=; b=ralaYkL5Xw7qbWeLgFH9tju3bNrClp1qrs40/XNH+JU1eDpEbbLPT2ItFrp/WwdzY7 X86qpw1ZLWfkBOY0nbQkOvUh+gmdd390wSlCufXebSRTBfI0BXQOcXSzKoyrgD4WOWUw ETvXsXHT2FzybdlBglxdaHCP4Nx6aR1p3CZF9xsL5Ww1Vk0GE4vD3Xj89ZmXVfYg7pdM MPOEvzOkVtIvMzDrml3C1ZXf3VLfb4GQHuK8wCiTp8q6GI7JFEKnUkvio5tXyUdtxT0h rRNqznL4oRzNcNX2RjMlTjr7H4xgRegF5MDf15vLE7k+yt7CjiFJYMm0rBLS3Zv+QWBO OMnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=F0rxTAIDQUC00gIGQ2hZRmANNTx894FvV5JJnWTgTsY=; b=T+t8b4QquEFM4anntMIhFXvof7U+GFE2JY42iCOucr3zc06XfX7ZCSMD3AG9/EwiOY puXZN1n7HVHdSpf34V/ALkfsDwjQZFPW5htCqJuFd+GNqdSV+/lL4cRQWwVNqBeww6o0 Jy2TW0nTeXylM5ZcMVA5dbgedansIEX8I/OYpjC9BQ6favticYiQ2uQGH5RuIoSm3g/B LY08Suw+wHEeaWfwKa16R/yJOqWANy7PJ/Ap8GPUBfi+Wpc9hGzM+Qgu3b/9S7Cb/Jf5 gRIDkP3EkiVEMkPjCdBC5jZFmwcVKPpdQio+5EouQz9goLj7whH1fjQQZH+UsS1NeMdj YF6g== X-Gm-Message-State: AOAM532G5n1L0wG3s9B87TmqsD1+fuZ6Gc20U2rPzl7+6gg/YIcQYVXN ahvpXgSpD01rm3QCqwYXI86RlS7HtBX8DQ== X-Google-Smtp-Source: ABdhPJzHG6QcpyJuJ3Le4bg387qad0Rbw6o1l3Bs2pO2kHXim+gSQAUu37bwJlYnOzNwoJGKqEXOZQ== X-Received: by 2002:a17:906:f2cd:: with SMTP id gz13mr15507022ejb.278.1633421470068; Tue, 05 Oct 2021 01:11:10 -0700 (PDT) Received: from localhost.localdomain ([84.238.208.199]) by smtp.gmail.com with ESMTPSA id f1sm3096258edz.47.2021.10.05.01.11.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 01:11:09 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org, Dikshita Agarwal , Stanimir Varbanov Subject: [PATCH v5 5/7] venus: vdec: set work route to fw Date: Tue, 5 Oct 2021 11:10:46 +0300 Message-Id: <20211005081048.3095252-6-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> References: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Dikshita Agarwal Set work route to FW based on num of vpp pipes. Signed-off-by: Dikshita Agarwal Signed-off-by: Stanimir Varbanov --- Added space after 'if' Return directly hfi_session_set_property drivers/media/platform/qcom/venus/hfi_cmds.c | 7 +++++++ drivers/media/platform/qcom/venus/hfi_helper.h | 5 +++++ drivers/media/platform/qcom/venus/vdec.c | 17 +++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c index 60f4b8e4b8d0..5aea07307e02 100644 --- a/drivers/media/platform/qcom/venus/hfi_cmds.c +++ b/drivers/media/platform/qcom/venus/hfi_cmds.c @@ -1299,6 +1299,13 @@ pkt_session_set_property_6xx(struct hfi_session_set_property_pkt *pkt, pkt->shdr.hdr.size += sizeof(u32) + sizeof(*cq); break; } + case HFI_PROPERTY_PARAM_WORK_ROUTE: { + struct hfi_video_work_route *in = pdata, *wr = prop_data; + + wr->video_work_route = in->video_work_route; + pkt->shdr.hdr.size += sizeof(u32) + sizeof(*wr); + break; + } default: return pkt_session_set_property_4xx(pkt, cookie, ptype, pdata); } diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h index bec4feb63ceb..253911272b4c 100644 --- a/drivers/media/platform/qcom/venus/hfi_helper.h +++ b/drivers/media/platform/qcom/venus/hfi_helper.h @@ -448,6 +448,7 @@ #define HFI_PROPERTY_PARAM_MVC_BUFFER_LAYOUT 0x100f #define HFI_PROPERTY_PARAM_MAX_SESSIONS_SUPPORTED 0x1010 #define HFI_PROPERTY_PARAM_WORK_MODE 0x1015 +#define HFI_PROPERTY_PARAM_WORK_ROUTE 0x1017 /* * HFI_PROPERTY_CONFIG_COMMON_START @@ -873,6 +874,10 @@ struct hfi_video_work_mode { u32 video_work_mode; }; +struct hfi_video_work_route { + u32 video_work_route; +}; + struct hfi_h264_vui_timing_info { u32 enable; u32 fixed_framerate; diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index c129b061a325..88cd9e46c333 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -656,6 +656,19 @@ static int vdec_set_properties(struct venus_inst *inst) return 0; } +static int vdec_set_work_route(struct venus_inst *inst) +{ + u32 ptype = HFI_PROPERTY_PARAM_WORK_ROUTE; + struct hfi_video_work_route wr; + + if (!IS_V6(inst->core)) + return 0; + + wr.video_work_route = inst->core->res->num_vpp_pipes; + + return hfi_session_set_property(inst, ptype, &wr); +} + #define is_ubwc_fmt(fmt) (!!((fmt) & HFI_COLOR_FORMAT_UBWC_BASE)) static int vdec_output_conf(struct venus_inst *inst) @@ -1042,6 +1055,10 @@ static int vdec_start_output(struct venus_inst *inst) if (ret) return ret; + ret = vdec_set_work_route(inst); + if (ret) + return ret; + ret = vdec_output_conf(inst); if (ret) return ret; From patchwork Tue Oct 5 08:10:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 12535757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9474AC4321E for ; Tue, 5 Oct 2021 08:11:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 89AD461165 for ; Tue, 5 Oct 2021 08:11:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233615AbhJEINR (ORCPT ); Tue, 5 Oct 2021 04:13:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233411AbhJEINE (ORCPT ); Tue, 5 Oct 2021 04:13:04 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB288C061749 for ; Tue, 5 Oct 2021 01:11:13 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id l7so51632643edq.3 for ; Tue, 05 Oct 2021 01:11:13 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=NmNy3i7s7hkAq0MWmGrwqRoyEBYaUhWJOlMgIBRIabE=; b=fRACUKHw5J6LBEjmv2sBLsFdyXBxC1V9ozedco1OMNDzAl2bKFx6eb3sF3bDF+dtZu nefergbhHmFMtaYDeK1LUm0ZOe1kISlmPKer5r1mhbds1hc6AnWhuM/296wWt0aK/zeS mQ0Y6owfsq534Ab2sc527Da0KqLgGKvY8tQTtxe5fAhtpkNuYr/YeTd0MtrOL1h7UZWb h8vNuf99nhynEXtUls0jIx3MADIdVXZ3R2AtGDuBAz26X+tYnT8RI9M0I9+keBJrQFju faPnfz9mW7zhXmyNeIt/l7V3jA7nc6m53qPaeXagQJKbkcKfTVlxWyhTtu2qSTkomP9B lZkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NmNy3i7s7hkAq0MWmGrwqRoyEBYaUhWJOlMgIBRIabE=; b=TlsEM+M8iLY1ILuFLZh3kZ4Gl/hijYc+Kmf6UvudtqYyHfSrPVokWKOjbCswR5wazC KcY8DvzT4vW3vjXkyvLa2JUS/TnVH2e+cnze98O+JjqEXg3jv3qAohmfIjlX19pDWeZY LfQt2uugZuVs+jpwX88czaKnreg+1kIo4KHNSrmKK5tUAHwCGp16GQUL1MdbqMOwV9r5 77uMePozHISV0Zw1Ezboe4wZLvDAOLA8JtVXDw8Ut5LIAkznYoZb9bsWmmpa46U6bIia Acv3/S5TwgqChsdMyNfveqtBrR82215EvEkq2aiqUEWpKwfQ7jPs+VuDC43lpTq6blPt yX9Q== X-Gm-Message-State: AOAM530XpD2aAsMXM/8WtCGsMk5QdZvY66yzCtmHWDrLXKTTYN8JUSk6 MlMRq7TCy7jH4o8EsD6iP3ps4S1DOM08Kw== X-Google-Smtp-Source: ABdhPJwdwDEJtPktwVHX9sOtwHiTTPPRYYotLxL1VjtHR6zfxAmt+iMGKvW+R0kGohFIKPWPSURNsQ== X-Received: by 2002:a17:906:8e0c:: with SMTP id rx12mr23105415ejc.423.1633421471283; Tue, 05 Oct 2021 01:11:11 -0700 (PDT) Received: from localhost.localdomain ([84.238.208.199]) by smtp.gmail.com with ESMTPSA id f1sm3096258edz.47.2021.10.05.01.11.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 01:11:11 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org, Dikshita Agarwal , Mansur Alisha Shaik , Stanimir Varbanov Subject: [PATCH v5 6/7] media: venus: helpers: update NUM_MBS macro calculation Date: Tue, 5 Oct 2021 11:10:47 +0300 Message-Id: <20211005081048.3095252-7-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> References: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Dikshita Agarwal Consider alignment while calculating NUM_MBS. Co-developed-by: Mansur Alisha Shaik Signed-off-by: Mansur Alisha Shaik Signed-off-by: Dikshita Agarwal Signed-off-by: Stanimir Varbanov --- Dropped changes in the patch which are not related to it drivers/media/platform/qcom/venus/helpers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 1f46a6f4456a..196a24892176 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -18,8 +18,8 @@ #include "hfi_platform.h" #include "hfi_parser.h" -#define NUM_MBS_720P (((1280 + 15) >> 4) * ((720 + 15) >> 4)) -#define NUM_MBS_4K (((4096 + 15) >> 4) * ((2304 + 15) >> 4)) +#define NUM_MBS_720P (((ALIGN(1280, 16)) >> 4) * ((ALIGN(736, 16)) >> 4)) +#define NUM_MBS_4K (((ALIGN(4096, 16)) >> 4) * ((ALIGN(2304, 16)) >> 4)) struct intbuf { struct list_head list; From patchwork Tue Oct 5 08:10:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 12535753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53C96C433EF for ; Tue, 5 Oct 2021 08:11:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D14D61165 for ; Tue, 5 Oct 2021 08:11:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233289AbhJEINN (ORCPT ); Tue, 5 Oct 2021 04:13:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233363AbhJEINE (ORCPT ); Tue, 5 Oct 2021 04:13:04 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1C1CC061745 for ; Tue, 5 Oct 2021 01:11:13 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id p11so22270870edy.10 for ; Tue, 05 Oct 2021 01:11:13 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=uxY6ejfvYQo+Xeiis9nW6znCc784F580RAf/At/05f0=; b=JU6CFK/h5KiubJfPEKppyr6cQnhD3o43JAUNk9e1wkT6s1zsbqcC3ivrpye9qQJrDq HlBMNlbZUtRggVvwVxUZIaVi1hVt6bX+2L8bd263GRO/z1eEuDB5K52s2K8+cNHehP6p 4jZktgdkyFw4TgGFvyKOp0X8HnoparfD5UkqsvSvyz3u0h5T++ZQQhIByoA9twDVhCbF FQ/IaP7cq71JV0IIMnVXrPivGHa+99C3GktsnmTpfqDqmxl80jx8I+nRATjENlDfEnrW Fbqef5OuSOQF88SAjUhDVI9YsCHNlrLHaSOCsM2/nlYxqxOIqZj+Y0UpX02l6Pv3ThIH rmLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uxY6ejfvYQo+Xeiis9nW6znCc784F580RAf/At/05f0=; b=ww562mV+WIJzhRBFwePV+mDMT2Jx+O4O+iqwqhuNS7X0CxYsdy3CNaR+6/AFqkuBfa Kn7j33Fpkt5ljcDhwd6t6Larzq1PnAd3SweDInl246IIKVMmtAuHd9Dr44KJOcUSOd4f j9TFZBiskNcM5ESEwDurcoNxGHGVMTVQpk6RBHh5ImJZ8cdXWrdJa5aqliZhJyRDaQmY 8d13ZiEjmGu6xPTtkImZc5MTqyN0N5T2syP//k4khbkcIYHOg5eiR9GrzjqKcseHMMva GnuOxXGEfLScslGsPn3ya0UIP9sgKjn9/QZw7loub7OGwjaBFZ3QgqOXs8sLjUSFKDLY XP9A== X-Gm-Message-State: AOAM532rKaaM62Zoci+3GwatLUVT7a3U3EresywMPMM8l9uUEdg7H0TP I8VGPTbpU+tarqTt0EWkO9Rq8LIhNbCT0Q== X-Google-Smtp-Source: ABdhPJxyZwNgFrsDqgs7ALVwLND0RGj7pz2UpjJ+f8CHVgFPzqmg6gX5AkGpEQpAM3rHl6lGKUsmwg== X-Received: by 2002:a17:906:165a:: with SMTP id n26mr22215783ejd.236.1633421472196; Tue, 05 Oct 2021 01:11:12 -0700 (PDT) Received: from localhost.localdomain ([84.238.208.199]) by smtp.gmail.com with ESMTPSA id f1sm3096258edz.47.2021.10.05.01.11.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 01:11:11 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org, Dikshita Agarwal , Stanimir Varbanov Subject: [PATCH v5 7/7] media: venus: Set buffer to FW based on FW min count requirement. Date: Tue, 5 Oct 2021 11:10:48 +0300 Message-Id: <20211005081048.3095252-8-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> References: <20211005081048.3095252-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Dikshita Agarwal - Get the min buffer count required by FW from source event change and use the same value to decide actual buffer count and for buffer size calculation. - Setup DPB and OPB buffers after session continue incase of reconfig. Signed-off-by: Dikshita Agarwal Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 1 + drivers/media/platform/qcom/venus/helpers.c | 8 +++++++- .../media/platform/qcom/venus/hfi_helper.h | 9 +++++++++ drivers/media/platform/qcom/venus/hfi_msgs.c | 7 +++++++ .../platform/qcom/venus/hfi_plat_bufs_v6.c | 6 ++++-- drivers/media/platform/qcom/venus/vdec.c | 20 ++++++++++++------- 6 files changed, 41 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 62228cc6b032..a3f077f64be0 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -409,6 +409,7 @@ struct venus_inst { u32 width; u32 height; struct v4l2_rect crop; + u32 fw_min_cnt; u32 out_width; u32 out_height; u32 colorspace; diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 196a24892176..7f2f5b91caaa 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -623,9 +623,15 @@ int venus_helper_get_bufreq(struct venus_inst *inst, u32 type, if (req) memset(req, 0, sizeof(*req)); + if (type == HFI_BUFFER_OUTPUT || type == HFI_BUFFER_OUTPUT2) + req->count_min = inst->fw_min_cnt; + ret = platform_get_bufreq(inst, type, req); - if (!ret) + if (!ret) { + if (type == HFI_BUFFER_OUTPUT || type == HFI_BUFFER_OUTPUT2) + inst->fw_min_cnt = req->count_min; return 0; + } ret = hfi_session_get_property(inst, ptype, &hprop); if (ret) diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h index 253911272b4c..2daa88e3df9f 100644 --- a/drivers/media/platform/qcom/venus/hfi_helper.h +++ b/drivers/media/platform/qcom/venus/hfi_helper.h @@ -167,6 +167,7 @@ #define HFI_PROPERTY_PARAM_VDEC_RECOVERY_POINT_SEI_EXTRADATA 0x120300c #define HFI_PROPERTY_PARAM_VDEC_THUMBNAIL_MODE 0x120300d #define HFI_PROPERTY_PARAM_VDEC_FRAME_ASSEMBLY 0x120300e +#define HFI_PROPERTY_PARAM_VDEC_DPB_COUNTS 0x120300e #define HFI_PROPERTY_PARAM_VDEC_VC1_FRAMEDISP_EXTRADATA 0x1203011 #define HFI_PROPERTY_PARAM_VDEC_VC1_SEQDISP_EXTRADATA 0x1203012 #define HFI_PROPERTY_PARAM_VDEC_TIMESTAMP_EXTRADATA 0x1203013 @@ -915,6 +916,14 @@ struct hfi_extradata_input_crop { u32 height; }; +struct hfi_dpb_counts { + u32 max_dpb_count; + u32 max_ref_frames; + u32 max_dec_buffering; + u32 max_reorder_frames; + u32 fw_min_cnt; +}; + #define HFI_COLOR_FORMAT_MONOCHROME 0x01 #define HFI_COLOR_FORMAT_NV12 0x02 #define HFI_COLOR_FORMAT_NV21 0x03 diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c b/drivers/media/platform/qcom/venus/hfi_msgs.c index 9a2bdb002edc..df96db3761a7 100644 --- a/drivers/media/platform/qcom/venus/hfi_msgs.c +++ b/drivers/media/platform/qcom/venus/hfi_msgs.c @@ -32,6 +32,7 @@ static void event_seq_changed(struct venus_core *core, struct venus_inst *inst, struct hfi_colour_space *colour_info; struct hfi_buffer_requirements *bufreq; struct hfi_extradata_input_crop *crop; + struct hfi_dpb_counts *dpb_count; u8 *data_ptr; u32 ptype; @@ -110,6 +111,12 @@ static void event_seq_changed(struct venus_core *core, struct venus_inst *inst, event.input_crop.height = crop->height; data_ptr += sizeof(*crop); break; + case HFI_PROPERTY_PARAM_VDEC_DPB_COUNTS: + data_ptr += sizeof(u32); + dpb_count = (struct hfi_dpb_counts *)data_ptr; + event.buf_count = dpb_count->fw_min_cnt; + data_ptr += sizeof(*dpb_count); + break; default: break; } diff --git a/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c b/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c index 479178b0600d..ea25c451222b 100644 --- a/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c +++ b/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c @@ -1164,7 +1164,7 @@ static int output_buffer_count(u32 session_type, u32 codec) output_min_count = 6; break; case V4L2_PIX_FMT_VP9: - output_min_count = 9; + output_min_count = 11; break; case V4L2_PIX_FMT_H264: case V4L2_PIX_FMT_HEVC: @@ -1213,6 +1213,8 @@ static int bufreq_dec(struct hfi_plat_buffers_params *params, u32 buftype, } out_min_count = output_buffer_count(VIDC_SESSION_TYPE_DEC, codec); + /* Max of driver and FW count */ + out_min_count = max(out_min_count, bufreq->count_min); bufreq->type = buftype; bufreq->region_size = 0; @@ -1237,7 +1239,7 @@ static int bufreq_dec(struct hfi_plat_buffers_params *params, u32 buftype, } else if (buftype == HFI_BUFFER_INTERNAL_SCRATCH(version)) { bufreq->size = dec_ops->scratch(width, height, is_interlaced); } else if (buftype == HFI_BUFFER_INTERNAL_SCRATCH_1(version)) { - bufreq->size = dec_ops->scratch1(width, height, out_min_count, + bufreq->size = dec_ops->scratch1(width, height, VB2_MAX_FRAME, is_secondary_output, num_vpp_pipes); } else if (buftype == HFI_BUFFER_INTERNAL_PERSIST_1) { diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 88cd9e46c333..41c5a353fcae 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -986,23 +986,23 @@ static int vdec_start_capture(struct venus_inst *inst) if (ret) goto err; + venus_pm_load_scale(inst); + + inst->next_buf_last = false; + ret = venus_helper_alloc_dpb_bufs(inst); if (ret) goto err; - ret = venus_helper_queue_dpb_bufs(inst); + ret = hfi_session_continue(inst); if (ret) goto free_dpb_bufs; - ret = venus_helper_process_initial_cap_bufs(inst); + ret = venus_helper_queue_dpb_bufs(inst); if (ret) goto free_dpb_bufs; - venus_pm_load_scale(inst); - - inst->next_buf_last = false; - - ret = hfi_session_continue(inst); + ret = venus_helper_process_initial_cap_bufs(inst); if (ret) goto free_dpb_bufs; @@ -1409,6 +1409,11 @@ static void vdec_event_change(struct venus_inst *inst, inst->crop.height = ev_data->height; } + inst->fw_min_cnt = ev_data->buf_count; + /* overwriting this to 11 for vp9 due to fw bug */ + if (inst->hfi_codec == HFI_VIDEO_CODEC_VP9) + inst->fw_min_cnt = 11; + inst->out_width = ev_data->width; inst->out_height = ev_data->height; @@ -1512,6 +1517,7 @@ static void vdec_inst_init(struct venus_inst *inst) inst->crop.top = 0; inst->crop.width = inst->width; inst->crop.height = inst->height; + inst->fw_min_cnt = 8; inst->out_width = frame_width_min(inst); inst->out_height = frame_height_min(inst); inst->fps = 30;