From patchwork Tue Jun 4 09:37:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Courbot X-Patchwork-Id: 10974513 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B69DB2D49 for ; Tue, 4 Jun 2019 09:38:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A399420000 for ; Tue, 4 Jun 2019 09:38:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97789287CB; Tue, 4 Jun 2019 09:38:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4AD4C20000 for ; Tue, 4 Jun 2019 09:38:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fx+1a8PJDMc+QGkWsCATg36tQOjIRqfJNJr8B9rH7jw=; b=UpW0P2MNFR2/kK w5cooYRis2f2EL76mO5MVyrj7ak0K5uRzawdMKC9lSU0oJ3Lo0I7+XgYu4pPnOfegSttuh8hSgfSG 5wmLzztWUDgX84hfzOAcXD4vStuZJux1GO6RhhViByyTiwmWKgITSU/xXqx/LY6jIrrGRUZ50Gkqp SsCg/a+P6bI8agml2A7JlpWRhmen4pdT7Tlz43CqkRXNHqioJZoQyRPniMPGt2nZoRj1MfV7ECUIG r9rdxZUgqqV3gG+5id+WCl3IugaH9igscrLeBgJ4RPGCZmgfXLofQnUVyNrs04Tz/ICHakH1azo4/ hT9YpGq/VIjsP7PvtqxQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hY5tS-00018G-Tr; Tue, 04 Jun 2019 09:38:10 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hY5tP-00013E-Ef for linux-mediatek@lists.infradead.org; Tue, 04 Jun 2019 09:38:09 +0000 Received: by mail-pg1-x543.google.com with SMTP id w34so10002333pga.12 for ; Tue, 04 Jun 2019 02:38:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kfKR4zIJY5Q7mLLSSnEqtRMlxyZNbSUA1f1fGIbLQtA=; b=SqKAjRwGPeznbRHq14yh+MdKPzB2UlkQq+rY79BVw0o99j5riYGogmLQWyRGa4CV9D yXU+nzbphMJin777kMGmpYxmiOt3guezpTWJ80gMOevfTZm/ve7AXEsdxR1ynh36o1q3 TBq7U2o8GgviftlEn+OeJATftUgCrWBanShTU= 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=kfKR4zIJY5Q7mLLSSnEqtRMlxyZNbSUA1f1fGIbLQtA=; b=hvbR280LcjY7oh9W772tIvjewRytvpHUjW7zirVMO5OUNdrDWuqadpP7CODLxD2geR 95JTSiS4DroCT6gxi2ubKPvlfUtVanVJMBtUL097Lq6HtivmtXGcNTRbFK2kGftAis9W 3hjbz4Dl1azZjy4+QQSd1vyqrYPEVHZSUGW2t/SMAxhxZpHd06XEcqB0J6LEZ+h6JL85 80afDZWumHU840EYXgJHWIVzO+xTS532mDg0fb3lwrRL8ox4yaUUC85bcCejgsQGJM1B n2r57U3hmIfoA+wEvUD3ElgcNtTSwlWlxDxla6bFivgDA1i+jhk3d2+2SmXeqyRkXN+v gODg== X-Gm-Message-State: APjAAAXX6Rn13yI7JYyTHe9MCrIPT/WGs4W6rLWli7jEHTkWPbmOTMZ6 vxxC5fjPB/EOnUc0JE74ivm2+w== X-Google-Smtp-Source: APXvYqyWS5dM/l4M3+5y02FrXWl3FHdeFzRApJLhFiUHB9nkoj0cukopH+788acAn59bdd3teuxmBg== X-Received: by 2002:a17:90a:cf0b:: with SMTP id h11mr29074586pju.90.1559641087044; Tue, 04 Jun 2019 02:38:07 -0700 (PDT) Received: from acourbot.tok.corp.google.com ([2401:fa00:4:4:9712:8cf1:d0f:7d33]) by smtp.gmail.com with ESMTPSA id j7sm17431588pfa.184.2019.06.04.02.38.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Jun 2019 02:38:06 -0700 (PDT) From: Alexandre Courbot To: Tiffany Lin , Andrew-CT Chen , Mauro Carvalho Chehab , Yunfei Dong , Hans Verkuil Subject: [PATCH 5/5] media: mtk-vcodec: support single-buffer frames Date: Tue, 4 Jun 2019 18:37:37 +0900 Message-Id: <20190604093737.172599-6-acourbot@chromium.org> X-Mailer: git-send-email 2.22.0.rc1.311.g5d7573a151-goog In-Reply-To: <20190604093737.172599-1-acourbot@chromium.org> References: <20190604093737.172599-1-acourbot@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190604_023807_619995_4EDA76E9 X-CRM114-Status: GOOD ( 10.36 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Alexandre Courbot , linux-media@vger.kernel.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Yunfei Dong MT8183 will use a multi-planar format backed by a single buffer. Adapt the existing code to be able to handle such frames instead of assuming each frame is backed by two buffers. Signed-off-by: Yunfei Dong Co-developed-by: Alexandre Courbot Signed-off-by: Alexandre Courbot [acourbot: refactor, cleanup and split] --- drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c index 131a8117ece2..6b99b877a3b4 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c @@ -117,8 +117,9 @@ static struct vb2_buffer *get_display_buffer(struct mtk_vcodec_ctx *ctx) if (dstbuf->used) { vb2_set_plane_payload(&dstbuf->vb.vb2_buf, 0, ctx->picinfo.fb_sz[0]); - vb2_set_plane_payload(&dstbuf->vb.vb2_buf, 1, - ctx->picinfo.fb_sz[1]); + if (ctx->q_data[MTK_Q_DATA_DST].fmt->num_planes == 2) + vb2_set_plane_payload(&dstbuf->vb.vb2_buf, 1, + ctx->picinfo.fb_sz[1]); mtk_v4l2_debug(2, "[%d]status=%x queue id=%d to done_list %d", @@ -389,7 +390,8 @@ static void mtk_vdec_worker(struct work_struct *work) vdec_if_decode(ctx, NULL, NULL, &res_chg); clean_display_buffer(ctx); vb2_set_plane_payload(&dst_buf_info->vb.vb2_buf, 0, 0); - vb2_set_plane_payload(&dst_buf_info->vb.vb2_buf, 1, 0); + if (ctx->q_data[MTK_Q_DATA_DST].fmt->num_planes == 2) + vb2_set_plane_payload(&dst_buf_info->vb.vb2_buf, 1, 0); dst_buf->flags |= V4L2_BUF_FLAG_LAST; v4l2_m2m_buf_done(&dst_buf_info->vb, VB2_BUF_STATE_DONE); clean_free_buffer(ctx); @@ -1320,7 +1322,8 @@ static void vb2ops_vdec_stop_streaming(struct vb2_queue *q) while ((dst_buf = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx))) { vb2_set_plane_payload(&dst_buf->vb2_buf, 0, 0); - vb2_set_plane_payload(&dst_buf->vb2_buf, 1, 0); + if (ctx->q_data[MTK_Q_DATA_DST].fmt->num_planes == 2) + vb2_set_plane_payload(&dst_buf->vb2_buf, 1, 0); v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_ERROR); }