From patchwork Tue Jul 6 12:40:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 470447 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4959446jao; Tue, 6 Jul 2021 05:47:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzusU9FjZi9nlYFLao1eIRujGfHsivyaIX88sjVqonP4+Vk5ay4vWcaQ7g4OHphdTdaHkiy X-Received: by 2002:a92:d246:: with SMTP id v6mr13553283ilg.191.1625575647006; Tue, 06 Jul 2021 05:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625575647; cv=none; d=google.com; s=arc-20160816; b=IJX0zMWRdr6DLZiClWU+v7eXNWLPNvoem4uhh2knrtWmGVRKUJPjJPrYNidubFFTQi xOs64qGyZrn6GUK5uP+FWw/GMraJMUBx2J1+oaRvNQl/WsLrOIpx4LAt4czgaUJzU+It AHX52zGEFwTTMllt1os0ujakcejgdHNCIrnBIj9nnFmRIzyFApxTlT1p9hDVfC6dBK4c IRPt0EWV9ffH+FkwJ6s2jfmN7znEmeA25wxvCAxq6SRXLAvbfGqFRdDFPM+ba7aWly+9 /YfH1vSxsYYL7Lb/nTeIYMxfjlb1DfmI7mSczJMujnAXNr7aLCVHSG83blgFebUX0Uak G92w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hRu/rrECnrx/6rDYLkqHGSqwS0EdaL46bywJDkHS8nI=; b=XrTWQ4s2Iq4Ku+XuXxqEA227lpFTQ+1Kpc74+FNY8iw6/mL1M7vUym9ef/k6e1sNGF sGOZ2aA1ARSgTxTFs+P4IO+M+jYgOl15Y9ZE/i4S+vRfkQB8lGVDSQ8s1JgNt68yZ9XM KRVmp+GUYzRcS+Il4Jd3ykJ+1oIv7czloXMYHHFv3Nx0VQ3S0jKvcTosrpZzn3ah/KII hRnvUzIcWEb2kMJu7sLu//WuS87ubj0BTiihUUE6jyEG2VqjfTUBC450E29oeGI39Md1 6Rj32RhMZZ6WVbCyyO3mGkHhFEUCshDc8wiYYcGqxt3Ec8ZDalRjTWcuFmbvoa9uuewl OUxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="A/Mi8xG/"; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v10si142748jal.77.2021.07.06.05.47.22; Tue, 06 Jul 2021 05:47:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="A/Mi8xG/"; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236741AbhGFMsy (ORCPT + 17 others); Tue, 6 Jul 2021 08:48:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240788AbhGFMsl (ORCPT ); Tue, 6 Jul 2021 08:48:41 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58020C0225A9 for ; Tue, 6 Jul 2021 05:41:12 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id k16-20020a05600c1c90b02901f4ed0fcfe7so2152398wms.5 for ; Tue, 06 Jul 2021 05:41:12 -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=hRu/rrECnrx/6rDYLkqHGSqwS0EdaL46bywJDkHS8nI=; b=A/Mi8xG/jIlYJ+6yfkfZ/NNXm7mu7DHNJaeqjA+dLchP0zt4JrHU9eIL3h+/nvEr79 T1rC+ILs46rmaj89/17s9Bg+OsODYSOuDRDNtkcF6rFcBoW3uKNU9YiyG2DL79HEwatj 7d4EVG1bqR3Dxi8vxrTYFK9aBpJIqLS1+Zi2HeiO1KXQOXJvx8P7gZm3I1ekA/rGBMn+ Rq8KoRCf9vd7rZk/4eWP5MBLWASDB77A1UsDSsoo7eeAnIfH6MV8UTStV1FvV9X4bb+J nSHPdPYcWYbHd6lO57Bgi8cZuUSWvN5fk7B+JkXC7f+6W7u+rPkQ3pqYxNp0JKRPUKbK Mmag== 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:mime-version:content-transfer-encoding; bh=hRu/rrECnrx/6rDYLkqHGSqwS0EdaL46bywJDkHS8nI=; b=IRuDiQ8GTEy7Mq4ICINJmyEuryxRDD1dyxmZlHT8E9PKpcMYHFAVn8ji3zB9e7QpHm ArFKSaBRQGZ3CKq9GXYy5FiFRerspH2qCfRdoojIV0vjKw/BM1v2HbHVN2Irw9PuXV2x Z9Wew3HtX7kAi2qMIrtgcFe0UixaoD0kpeIJf6BnReNEeec76KgA7UT3UBz0DfycmEoU 8KnNYvrDSwXP8L3wcu5DpeM6jFYO2VrRHgj0ftzvmu4mQ5ihpUgTYV6BwNEmUJP76rhw ezfrzs/Zx2TZ1oxrYvI5+WBUHPNi8T+ZPx1d0XXN0HlfRhmaZRDpz/adFxYV2n9MMTr0 ARJQ== X-Gm-Message-State: AOAM530lhQceLg2HB1dDOhA2dywJTMgj554KU/csZgJfwD/Be4BLb0VY yuO920ZJw+7wOxc4zrClBPf1oQ== X-Received: by 2002:a05:600c:2f17:: with SMTP id r23mr168794wmn.185.1625575270808; Tue, 06 Jul 2021 05:41:10 -0700 (PDT) Received: from localhost.localdomain (hst-221-27.medicom.bg. [84.238.221.27]) by smtp.gmail.com with ESMTPSA id n18sm2585979wms.3.2021.07.06.05.41.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jul 2021 05:41:10 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-api@vger.kernel.org Cc: Hans Verkuil , Stanimir Varbanov Subject: [PATCH v2 5/5] venus: Add a handling of QC10C compressed format Date: Tue, 6 Jul 2021 15:40:34 +0300 Message-Id: <20210706124034.773503-6-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210706124034.773503-1-stanimir.varbanov@linaro.org> References: <20210706124034.773503-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 shouldn't be possible to discpver by the client if the decoded bitstream is not 10-bits. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 23 ++------------------- drivers/media/platform/qcom/venus/vdec.c | 19 ++++++++++++++--- 2 files changed, 18 insertions(+), 24 deletions(-) -- 2.25.1 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 49d720fd9a9d..b48bf52481ba 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -563,6 +563,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; } @@ -1675,27 +1677,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 989a75dc5bf0..c4d5bde860d7 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) @@ -1496,7 +1509,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);