Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4633313pxv; Tue, 6 Jul 2021 05:48:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqCrhCddjrUAwlXKrbqj8rFE9Mowc1c/6C8CNY5s68bSxk5JE3I71VGYUcHETZB039zt+4 X-Received: by 2002:a6b:794b:: with SMTP id j11mr15500377iop.129.1625575700934; Tue, 06 Jul 2021 05:48:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625575700; cv=none; d=google.com; s=arc-20160816; b=gtZ+pyhlPYiZLbHeb/9yqToQpHnL3q0uDnWMQuBwgyjnyj8zgWjpwMNkq20KdRIrfX 1oWs/D880JaPZ4/kPl83zJp/ramivAkVi+0hDmatAQiOK/aC3XdVqv6XfpNxZ3VNsv9d qQ82BAgb1rYFVnPECOoBXrgbRjMNsJj5+RYJ7t68WTVubdcTfVfs7XvF4UBDvuUshX9B mBgvPLMI6e7NkBA9UXTI64cuoiWotZ1wy6TFyURJ8b/Rwh2QZq5TAEQ0LDD00EMpnVHQ fFr/RMgnp91toFzVtRfFjlIEI9Z8RNFiG2+f63gBottOU39R1ZqCq5mM6LxWHFpiNa73 h/Qw== 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=wVdhDumcEWP3hilx1SKLJhr9OXceTL4TNMK8K8Q3GQSWZpJ0r+vTFrYXHLleX0kvPd tiorzeG2s+7eX/RK4GgFCfxesa4B0wL2VSw8gLRRJB+chad0gSaUaX0BA1K75mi6pQHX U0seVtgKpScXsBlqE/C+R7dsIh7XGODcgHmfN73gEt0+AjNtSM/djcGXlP8+9nDseJ9s tLor4IJguSMLXw+ZQhLU8mt/LqvCHhPles995pCrt2ZB/Irh99ufE8yiOzCSjrIFWHWw xGcvNR86hhWF6AgV584g7rMasoLt6NKJ/gDUltOPSlYgzlsn8uCinFxZoZRdWTLGhkT0 h8uA== 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-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i13si20161143ilm.45.2021.07.06.05.48.09; Tue, 06 Jul 2021 05:48:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237295AbhGFMsx (ORCPT + 99 others); Tue, 6 Jul 2021 08:48:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240814AbhGFMsl (ORCPT ); Tue, 6 Jul 2021 08:48:41 -0400 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 57F87C0225A8 for ; Tue, 6 Jul 2021 05:41:12 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id t14-20020a05600c198eb029020c8aac53d4so4193626wmq.1 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=sSygWGd3MAqWpCOy4JfvkJbGssKMBy58lIfm0cjH9EdP93nHsaG/nEx7XWs4WtHemq OZ/EABSQnb0THKeBRkNIbGXX0TNjSJYBZvZJH1PO9ZY14q/YHI8b/tWMDa/yEIE/pwaY MB+SyCya5Y3N+26feMYP21m6oUvWOm4siL/3peXd65EWpX6isSf097U3aYjXVxAML6fJ k1Pt401PTFK4pM3q9/Occ5MmLAH8zAa0IVMeKPMT1q4q6OQm7VE3tqoKx3NgpBaC3NfS 88p6GeMGKZZl7ICjfb+KEwpGDMYOSQu2ye9HsPRgcj8hyWaH/pXsMOBC2zqy35orAcES LFgg== X-Gm-Message-State: AOAM532/sAYUhRa/6AvsGk4NA7dTtOVyUhc2TgwKMHSFVeCC6MnsXzq7 qavgPs9k0BeuHvGer1LQIZrm4Q== 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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); -- 2.25.1