From patchwork Thu Mar 3 15:06:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 547997 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C638AC43219 for ; Thu, 3 Mar 2022 15:06:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234286AbiCCPHb (ORCPT ); Thu, 3 Mar 2022 10:07:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234277AbiCCPH3 (ORCPT ); Thu, 3 Mar 2022 10:07:29 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00182190B42 for ; Thu, 3 Mar 2022 07:06:43 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id d3so8327394wrf.1 for ; Thu, 03 Mar 2022 07:06:43 -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 :mime-version:content-transfer-encoding; bh=rQ54PimOa9JA0PjxA9klTjXL5mIT6EoCvMFNlDkpoz0=; b=EiqkcueE7gsmrKt7OzyIXsnSf9qqkyvZ000cMatAKsHOlcK04TysYrt9+L1DDm2K9J uAQNKatyln8o345a/9vZuweQKIJNRuqH/oz4N53/kWYYHPusgRueY8/SoD71zdB5fTG3 554Zkt9aPuAle+EdY64Bv4Z3GgzZtbJYgpv19c5pdGdRajdZeMBOwUGgAhYtQkqJMcsc 0Cxrvias7rdf1c+l67rynX7TisjLnMerFwK9Z/0MlJ9H0pPdC7qkT/mWdxK8Jt61D7lR r7GcDzPSrPUZHyw6K+ga1CbI6+4GEpzNTObdAUXRK2zNgTz2Auum6rcsNPOXKFCCddoE D8VQ== 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=rQ54PimOa9JA0PjxA9klTjXL5mIT6EoCvMFNlDkpoz0=; b=GdYCzmKdKX4f7bcqr7Y802IowM988xO9+gSZbKBF6tardOuf5ue+lMlC4Ex5409SdE XOFxIVtbCWKbJtmNOfBfhTLKUy2L0OltY4W9o1+U4yId0xQVSDCYH7RAwwDdps3ylVhn pUgoP1pAwzK90BYxDVHpa2i1jdnIRksuOrEUzp/EIY4i6dQLjDlUr6cRLROQTyUKUPMB 8Joa3VRXTq+VjuxunZdSeRsXUz9cZe8jQBbxsyvSAEp9en57/7FvZuodCPvn04RzQ+3n Og7/igao60FNUHZDb4XR7m9uQm8dj4e+w5BUBFzlCRU7+hx0bflGLA4OUbGEqvLwLi63 2OtA== X-Gm-Message-State: AOAM533ytU7i6ZhGfaNC7+ZFeJX0bE9xfr37Q58VLx5m6l7dxLbr0SCq bt4oIDEQIQqMM4ZTbm337lxKXYHckyshLkp6 X-Google-Smtp-Source: ABdhPJybx3yj8om8NebDZZaiHVbt388RYGiyXHwMMRg8WhzQotdbNH4Zh12X3DiwH1zR0c6TbZ42lw== X-Received: by 2002:a5d:4a45:0:b0:1f0:5e70:1088 with SMTP id v5-20020a5d4a45000000b001f05e701088mr2024924wrs.258.1646320002269; Thu, 03 Mar 2022 07:06:42 -0800 (PST) Received: from localhost.localdomain (hst-221-14.medicom.bg. [84.238.221.14]) by smtp.gmail.com with ESMTPSA id o16-20020a05600c511000b0038141b4a4edsm10757072wms.38.2022.03.03.07.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 07:06:41 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Cc: hverkuil-cisco@xs4all.nl, Nicolas Dufresne , Stanimir Varbanov Subject: [PATCH v4 1/6] v4l: Add Qualcomm custom compressed pixel formats Date: Thu, 3 Mar 2022 17:06:31 +0200 Message-Id: <20220303150636.577063-2-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303150636.577063-1-stanimir.varbanov@linaro.org> References: <20220303150636.577063-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add custom Qualcomm raw compressed pixel formats. They are used in Qualcomm SoCs to optimize the interconnect bandwidth. Signed-off-by: Stanimir Varbanov Acked-by: Hans Verkuil --- .../media/v4l/pixfmt-reserved.rst | 19 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++ include/uapi/linux/videodev2.h | 2 ++ 3 files changed, 23 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst index 2f2133b4cd9c..929bd0dc0ba3 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-reserved.rst @@ -245,6 +245,25 @@ please make a proposal on the linux-media mailing list. - Non-compressed, tiled two-planar format used by Mediatek MT8183. This is an opaque intermediate format and the MDP3 hardware can be used to convert it to other formats. + * .. _V4L2-PIX-FMT-QC08C: + + - ``V4L2_PIX_FMT_QC08C`` + - 'QC08C' + - Compressed Macro-tile 8-Bit YUV420 format used by Qualcomm platforms. + It is an opaque intermediate format. The used compression is lossless + and it is used by various multimedia hardware blocks like GPU, display + controllers, ISP and video accelerators. + It contains four planes for progressive video and eight planes for + interlaced video. + * .. _V4L2-PIX-FMT-QC10C: + + - ``V4L2_PIX_FMT_QC10C`` + - 'QC10C' + - Compressed Macro-tile 10-Bit YUV420 format used by Qualcomm platforms. + It is an opaque intermediate format. The used compression is lossless + and it is used by various multimedia hardware blocks like GPU, display + controllers, ISP and video accelerators. + It contains four planes for progressive video. .. raw:: latex diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 642cb90f457c..b20ef7989ab8 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1439,6 +1439,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_PIX_FMT_SE401: descr = "GSPCA SE401"; break; case V4L2_PIX_FMT_S5C_UYVY_JPG: descr = "S5C73MX interleaved UYVY/JPEG"; break; case V4L2_PIX_FMT_MT21C: descr = "Mediatek Compressed Format"; break; + case V4L2_PIX_FMT_QC08C: descr = "QCOM Compressed 8-bit Format"; break; + case V4L2_PIX_FMT_QC10C: descr = "QCOM Compressed 10-bit Format"; break; default: if (fmt->description[0]) return; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index df8b9c486ba1..e710903185bd 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -744,6 +744,8 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I') /* Intel Planar Greyscale 10-bit and Depth 16-bit */ #define V4L2_PIX_FMT_CNF4 v4l2_fourcc('C', 'N', 'F', '4') /* Intel 4-bit packed depth confidence information */ #define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* BTTV 8-bit dithered RGB */ +#define V4L2_PIX_FMT_QC08C v4l2_fourcc('Q', '0', '8', 'C') /* Qualcomm 8-bit compressed */ +#define V4L2_PIX_FMT_QC10C v4l2_fourcc('Q', '1', '0', 'C') /* Qualcomm 10-bit compressed */ /* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */ #define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */ From patchwork Thu Mar 3 15:06:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 547996 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E9F8C433EF for ; Thu, 3 Mar 2022 15:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234311AbiCCPHf (ORCPT ); Thu, 3 Mar 2022 10:07:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234302AbiCCPHc (ORCPT ); Thu, 3 Mar 2022 10:07:32 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E83E41903ED for ; Thu, 3 Mar 2022 07:06:46 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id r65so3342606wma.2 for ; Thu, 03 Mar 2022 07:06:46 -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 :mime-version:content-transfer-encoding; bh=yAEFbpvN98ptmknkKWl0O8Ur86W+dj9ENZyY+Bs86R0=; b=o0pUsgTFfo0mMtoKAT6V2y6BbiJGS+D4eRwMFOQ3RVlyAN5pQgIOWsTGvLg6/NuKQi kbvz0eEqR0aDrvgCXts5123oTxoIu91hg5E8ZCEb5OiomSuIE9d+W8IMcDR6r2xf1Mz0 Yty5i/UOYoj+1yj7SD6xjoyzwRsCxrrHQVoZljv+Jcmt0VNw4WXjrmfG2kpj7gJJyDvX LJbzgi/F79jhBdDtpIkoOJiTr+l//Eu1PpySZnDzENY1rLpztIf2azft/NmplAY3Pn7i K0kW6IzaFpZQDiunYOohxvHnuIe+ANIHvdYzhT4nq2UEe2hMYXlBiFqbtK392P/9SEvc 3eHA== 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=yAEFbpvN98ptmknkKWl0O8Ur86W+dj9ENZyY+Bs86R0=; b=wrWN4KhIGgT/Nnp5OH01JDrE/nQqZMRE3ykywuY24SCZXGTRVgZttH/j9AyRzeU4PT 5OohXZX88JbYVUcobVDpAHaIP2VkespYKuHnJGpJmZSO+zo/d1Ii+61NAIzHLKzdjRuQ OVC9Y4BRi1004opr1aXKOfE1xN4vhca5EZA6aRtOwF4htOot0rtUGD4zGWpr6+p6WqPc gCh0I0mKYnu585cuARbGGEs+F3aEdneKE7AnhLcN1nRTHDZ+NeGIr9BCde2R2iLtLbxl YUy2wzw+7ctis28JKEEeuqtiPcBEihojtlXQN4j8PCg5b6DA3NTfFDxKCOOfFXYVZvcs KOeA== X-Gm-Message-State: AOAM533cYX5NWCHIaraO5fnKq5bFm8XMfLtML0897zZJEEpzxICtQEXl KL+M/4kH2AkkI+9tvBd6gMFiYemR9k1LfOgm X-Google-Smtp-Source: ABdhPJxJh+wjb/RhDLyVmVFa0rNu+SxFuWa1mMy7fQFAVaLREDjlrqbwyIo4DN/yfR6L1iyH6bpRnA== X-Received: by 2002:a05:600c:1552:b0:381:c7ac:84b1 with SMTP id f18-20020a05600c155200b00381c7ac84b1mr3956478wmg.77.1646320005316; Thu, 03 Mar 2022 07:06:45 -0800 (PST) Received: from localhost.localdomain (hst-221-14.medicom.bg. [84.238.221.14]) by smtp.gmail.com with ESMTPSA id o16-20020a05600c511000b0038141b4a4edsm10757072wms.38.2022.03.03.07.06.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 07:06:44 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Cc: hverkuil-cisco@xs4all.nl, Nicolas Dufresne , Stanimir Varbanov Subject: [PATCH v4 4/6] venus: hfi_platform: Correct supported compressed format Date: Thu, 3 Mar 2022 17:06:34 +0200 Message-Id: <20220303150636.577063-5-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303150636.577063-1-stanimir.varbanov@linaro.org> References: <20220303150636.577063-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org In multistream mode HFI supports TP10_UBWC on output2. Correct this in supported formats capabilities list. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi_platform_v4.c | 4 ++-- drivers/media/platform/qcom/venus/hfi_platform_v6.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/qcom/venus/hfi_platform_v4.c b/drivers/media/platform/qcom/venus/hfi_platform_v4.c index 3f7f5277a50e..e3f0a90a567b 100644 --- a/drivers/media/platform/qcom/venus/hfi_platform_v4.c +++ b/drivers/media/platform/qcom/venus/hfi_platform_v4.c @@ -55,7 +55,7 @@ static const struct hfi_plat_caps caps[] = { .fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12}, .fmts[4] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21}, .fmts[5] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_P010}, - .fmts[6] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_YUV420_TP10}, + .fmts[6] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_YUV420_TP10_UBWC}, .num_fmts = 7, }, { .codec = HFI_VIDEO_CODEC_VP8, @@ -106,7 +106,7 @@ static const struct hfi_plat_caps caps[] = { .fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12}, .fmts[4] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21}, .fmts[5] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_P010}, - .fmts[6] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_YUV420_TP10}, + .fmts[6] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_YUV420_TP10_UBWC}, .num_fmts = 7, }, { .codec = HFI_VIDEO_CODEC_MPEG2, diff --git a/drivers/media/platform/qcom/venus/hfi_platform_v6.c b/drivers/media/platform/qcom/venus/hfi_platform_v6.c index c10618e44f5d..4e8af645f8b9 100644 --- a/drivers/media/platform/qcom/venus/hfi_platform_v6.c +++ b/drivers/media/platform/qcom/venus/hfi_platform_v6.c @@ -55,7 +55,7 @@ static const struct hfi_plat_caps caps[] = { .fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12}, .fmts[4] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21}, .fmts[5] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_P010}, - .fmts[6] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_YUV420_TP10}, + .fmts[6] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_YUV420_TP10_UBWC}, .num_fmts = 7, }, { .codec = HFI_VIDEO_CODEC_VP8, @@ -106,7 +106,7 @@ static const struct hfi_plat_caps caps[] = { .fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12}, .fmts[4] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21}, .fmts[5] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_P010}, - .fmts[6] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_YUV420_TP10}, + .fmts[6] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_YUV420_TP10_UBWC}, .num_fmts = 7, }, { .codec = HFI_VIDEO_CODEC_MPEG2, From patchwork Thu Mar 3 15:06:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 547995 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C1C9C433FE for ; Thu, 3 Mar 2022 15:06:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234343AbiCCPHl (ORCPT ); Thu, 3 Mar 2022 10:07:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234307AbiCCPHe (ORCPT ); Thu, 3 Mar 2022 10:07:34 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CBF91903FB for ; Thu, 3 Mar 2022 07:06:48 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id bg16-20020a05600c3c9000b00380f6f473b0so5501264wmb.1 for ; Thu, 03 Mar 2022 07:06:48 -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 :mime-version:content-transfer-encoding; bh=RaGrefX44rEm0wu9mMJuIgGrRaikvNDSwTTA6I5onmc=; b=iQLNGn0tWI4UbbLemKwJopKnPXIK6nheNzTzHrT8vkbpBGYU/hUG56HnYeriqvXwBn ukQV4uk2XqPg1IYY2gQ7dA7zCxVQA9VAefi89ro1B74a8yukKgHhylzRLQKi4rcVh6UF NI7bvak1fBKABNQHpdM+MqV1a3R0qX/5xamzlcsDctZNb6jr+eOuwxgjOMdkwfwM+iRg otvzcIZJ05YXu31osASP0SQH4UAI5x4W7rmj74EOPCvO5edl6eofBwlPdZ4J7DyWdZ7t sIxsnRYXia+pZlL6teoLO4fjKrIP1P7cG+q/Qv/Zac7Tnd+79P1RnByWsBuSUnoodgW2 hvPQ== 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=RaGrefX44rEm0wu9mMJuIgGrRaikvNDSwTTA6I5onmc=; b=UCt1haCKQqEutKPMcOrHTS7wHBTR5Nf4h070a7ocAl1rRrpnpzFRE1/RmfZok1oSZC nHP85OEwvuGgoHP93xTXUhsTuafVekNVkPTbIN/YANA2/4WzyG1UZDY/hsmNvPbhSicK zbMVPDX+sZyaP1/jMny/lXkK2InPEVehcTLHREL0xupLDG5VXcvnAu9zMrN7Kr0g9w6G ZGZa5im3sWBrqoMKTbiv34gFBVkZ3MllbjfLCERN0p/kX3mH4ky2qgYJt4sbnCZ8KSo6 vwNr8WhPVzbX1BdYFzE4LI7stwIlFM4lCg6bqxZwA9yFWUVhlFqsKF+h2H9H2OrggWVp 0G/Q== X-Gm-Message-State: AOAM531MYHmHZJiQ3zM3EEV/fwiIcL3Yqe6d+QrFt7B3ILRIvWQ4I3r/ eD4xucZLQa6y6qiq4J19qyb7rfKh3uPz9DgX X-Google-Smtp-Source: ABdhPJyeVXsvKvr0st8E02wJKuejqcviu/T7Pj+MD4OwIM0plwJp9ylK47fRvkVMZ/n3NArQdUWyfg== X-Received: by 2002:a05:600c:35c4:b0:381:782e:9645 with SMTP id r4-20020a05600c35c400b00381782e9645mr4130136wmq.63.1646320006414; Thu, 03 Mar 2022 07:06:46 -0800 (PST) Received: from localhost.localdomain (hst-221-14.medicom.bg. [84.238.221.14]) by smtp.gmail.com with ESMTPSA id o16-20020a05600c511000b0038141b4a4edsm10757072wms.38.2022.03.03.07.06.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 07:06:45 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Cc: hverkuil-cisco@xs4all.nl, Nicolas Dufresne , Stanimir Varbanov Subject: [PATCH v4 5/6] venus: Add a handling of QC10C compressed format Date: Thu, 3 Mar 2022 17:06:35 +0200 Message-Id: <20220303150636.577063-6-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303150636.577063-1-stanimir.varbanov@linaro.org> References: <20220303150636.577063-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This adds QC10C compressed pixel format in the Venus driver, and make it possible to discover from v4l2 clients. Note: The QC10C format will be enumerable via VIDIOC_ENUM_FMT when the bitstream is 10-bits and the headers are parsed. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 26 ++++----------------- drivers/media/platform/qcom/venus/vdec.c | 19 ++++++++++++--- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 7144747398b6..f5a938455d7c 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -594,6 +594,8 @@ static u32 to_hfi_raw_fmt(u32 v4l2_fmt) return HFI_COLOR_FORMAT_NV21; case V4L2_PIX_FMT_QC08C: return HFI_COLOR_FORMAT_NV12_UBWC; + case V4L2_PIX_FMT_QC10C: + return HFI_COLOR_FORMAT_YUV420_TP10_UBWC; default: break; } @@ -1176,7 +1178,8 @@ int venus_helper_set_format_constraints(struct venus_inst *inst) if (!IS_V6(inst->core)) return 0; - if (inst->opb_fmt == HFI_COLOR_FORMAT_NV12_UBWC) + if (inst->opb_fmt == HFI_COLOR_FORMAT_NV12_UBWC || + inst->opb_fmt == HFI_COLOR_FORMAT_YUV420_TP10_UBWC) return 0; pconstraint.buffer_type = HFI_BUFFER_OUTPUT2; @@ -1747,27 +1750,6 @@ int venus_helper_get_out_fmts(struct venus_inst *inst, u32 v4l2_fmt, if (!caps) return -EINVAL; - if (inst->bit_depth == VIDC_BITDEPTH_10 && - inst->session_type == VIDC_SESSION_TYPE_DEC) { - found_ubwc = - find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT, - HFI_COLOR_FORMAT_YUV420_TP10_UBWC); - found = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT2, - HFI_COLOR_FORMAT_NV12); - if (found_ubwc && found) { - /* - * Hard-code DPB buffers to be 10bit UBWC and decoder - * output buffers in 8bit NV12 until V4L2 is able to - * expose compressed/tiled formats to applications. - */ - *out_fmt = HFI_COLOR_FORMAT_YUV420_TP10_UBWC; - *out2_fmt = HFI_COLOR_FORMAT_NV12; - return 0; - } - - return -EINVAL; - } - if (ubwc) { ubwc_fmt = fmt | HFI_COLOR_FORMAT_UBWC_BASE; found_ubwc = find_fmt_from_caps(caps, HFI_BUFFER_OUTPUT, diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index eb02e45a512b..c8261c6cb0fb 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -35,6 +35,10 @@ static const struct venus_format vdec_formats[] = { .num_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, }, { + .pixfmt = V4L2_PIX_FMT_QC10C, + .num_planes = 1, + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + },{ .pixfmt = V4L2_PIX_FMT_NV12, .num_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, @@ -114,6 +118,10 @@ find_format(struct venus_inst *inst, u32 pixfmt, u32 type) !venus_helper_check_format(inst, fmt[i].pixfmt)) return NULL; + if (V4L2_TYPE_IS_CAPTURE(type) && fmt[i].pixfmt == V4L2_PIX_FMT_QC10C && + !(inst->bit_depth == VIDC_BITDEPTH_10)) + return NULL; + return &fmt[i]; } @@ -133,11 +141,16 @@ find_format_by_index(struct venus_inst *inst, unsigned int index, u32 type) if (fmt[i].type != type) continue; - if (V4L2_TYPE_IS_OUTPUT(type)) + if (V4L2_TYPE_IS_OUTPUT(type)) { valid = venus_helper_check_codec(inst, fmt[i].pixfmt); - else if (V4L2_TYPE_IS_CAPTURE(type)) + } else if (V4L2_TYPE_IS_CAPTURE(type)) { valid = venus_helper_check_format(inst, fmt[i].pixfmt); + if (fmt[i].pixfmt == V4L2_PIX_FMT_QC10C && + !(inst->bit_depth == VIDC_BITDEPTH_10)) + valid = false; + } + if (k == index && valid) break; if (valid) @@ -1537,7 +1550,7 @@ static const struct hfi_inst_ops vdec_hfi_ops = { static void vdec_inst_init(struct venus_inst *inst) { inst->hfi_codec = HFI_VIDEO_CODEC_H264; - inst->fmt_out = &vdec_formats[7]; + inst->fmt_out = &vdec_formats[8]; inst->fmt_cap = &vdec_formats[0]; inst->width = frame_width_min(inst); inst->height = ALIGN(frame_height_min(inst), 32);