Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4860065imb; Thu, 7 Mar 2019 02:11:00 -0800 (PST) X-Google-Smtp-Source: APXvYqximwEEFnqguFg1skY7rEOPN6MZez4ViuXYqMqEH+Nv4iTEyp+fylGu+kBAGkfuGTwlbRs3 X-Received: by 2002:a17:902:3124:: with SMTP id w33mr11807441plb.43.1551953460394; Thu, 07 Mar 2019 02:11:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551953460; cv=none; d=google.com; s=arc-20160816; b=qQBGVqNT2v7aEvckSdQMNg6n7DlGO/pIHH3ouIfOyvHNR1td17wWFRLmfdsedbjNkC tbTwTWjMn7YDBvvEeZ2cI/LcN+yYD8/PfWfgfySxE8Q5WQFACsSeKwwjmVL9LXBw+SQ7 xwE0vrjwqsHp79w7ctiza874VQvSCzSMDe6PpoufKmHoXOo0el1cZn1k9gZYK070Cx0v 8vXxa977q1RY2DF/8TfOS7jsjrtUmBaqaa+odQlEGZtI4MYNU9TT7lALOzJAFNs5D5Gv uRzvEGR0jakTK6vWpX5fb65NNTsfNJMYb3Eq0TemWCzIuFIM92NXA92Tn0Mt6OPuQLxz i6Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5sX6LtKYPemC5pxq/RpX/MsLxT2rPUIXMH4WhcH+7PQ=; b=Voz0n12+J+meemG/s+rqLlp+CR0gOsPCY42+yI5mr+VBR9WGOb9JO2jfz0TuGDWmZn EBiPbRW59U/lzTC+c7kBWeW6mD44fmCr55Y6+tnTcf36+wd3tYv+gkCtCYHuIb8MA55b pPOyFixkpVLrlypGuRBaxgTFFU2Jy9oLMHPSD2yXpwtArxkV8uHVHF0UANwchMgdp6Nl Y17qpyoboX/B7r2mIgDI5i0geeKc75wAWwPuXX3mVub0X1PcJi0c2zBsoKgEiObfB2B1 imWcrDuQ9lLIA/oKsQRYqLsM3uIL3/B4nOeKFuWZWu2bSQAffPZjcM268XHZvrFHmxwc VkNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si3876414pfi.288.2019.03.07.02.10.45; Thu, 07 Mar 2019 02:11:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726409AbfCGKKI (ORCPT + 99 others); Thu, 7 Mar 2019 05:10:08 -0500 Received: from regular1.263xmail.com ([211.150.99.136]:48100 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726268AbfCGKKF (ORCPT ); Thu, 7 Mar 2019 05:10:05 -0500 Received: from randy.li?rock-chips.com (unknown [192.168.167.139]) by regular1.263xmail.com (Postfix) with ESMTP id 635AD484; Thu, 7 Mar 2019 18:03:36 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from randy-pc.lan (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P17008T140071111993088S1551952999924990_; Thu, 07 Mar 2019 18:03:36 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: randy.li@rock-chips.com X-SENDER: randy.li@rock-chips.com X-LOGIN-NAME: randy.li@rock-chips.com X-FST-TO: linux-media@vger.kernel.org X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 From: Randy Li To: linux-media@vger.kernel.org Cc: Randy Li , ayaka@soulik.info, hverkuil@xs4all.nl, maxime.ripard@bootlin.com, joro@8bytes.org, linux-kernel@vger.kernel.org, jernej.skrabec@gmail.com, nicolas@ndufresne.ca, paul.kocialkowski@bootlin.com, linux-rockchip@lists.infradead.org, thomas.petazzoni@bootlin.com, mchehab@kernel.org, ezequiel@collabora.com, linux-arm-kernel@lists.infradead.org, posciak@chromium.org, groeck@chromium.org Subject: [PATCH v2 3/6] [TEST]: rockchip: mpp: support qptable Date: Thu, 7 Mar 2019 18:03:13 +0800 Message-Id: <20190307100316.925-4-randy.li@rock-chips.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190307100316.925-1-randy.li@rock-chips.com> References: <20190307100316.925-1-randy.li@rock-chips.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I don't care, I don't want to store buffers for a session. I just want to use it to verify the FFmpeg. I want the memory region !!! It can save more time if those data are prepared in userspace. Signed-off-by: Randy Li --- drivers/staging/rockchip-mpp/mpp_dev_common.c | 3 +-- drivers/staging/rockchip-mpp/mpp_dev_vdpu2.c | 3 +++ drivers/staging/rockchip-mpp/vdpu2/mpeg2.c | 19 +++++++++++++------ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rockchip-mpp/mpp_dev_common.c b/drivers/staging/rockchip-mpp/mpp_dev_common.c index c43304c3e7b8..1291b642179e 100644 --- a/drivers/staging/rockchip-mpp/mpp_dev_common.c +++ b/drivers/staging/rockchip-mpp/mpp_dev_common.c @@ -1193,8 +1193,7 @@ static int rockchip_mpp_queue_init(void *priv, struct vb2_queue *src_vq, src_vq->io_modes = VB2_MMAP | VB2_DMABUF; src_vq->drv_priv = session; src_vq->mem_ops = &vb2_dma_contig_memops; - src_vq->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | - DMA_ATTR_NO_KERNEL_MAPPING; + src_vq->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES; src_vq->buf_struct_size = sizeof(struct v4l2_m2m_buffer); src_vq->min_buffers_needed = 1; src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; diff --git a/drivers/staging/rockchip-mpp/mpp_dev_vdpu2.c b/drivers/staging/rockchip-mpp/mpp_dev_vdpu2.c index ce98aa15025e..00413936623e 100644 --- a/drivers/staging/rockchip-mpp/mpp_dev_vdpu2.c +++ b/drivers/staging/rockchip-mpp/mpp_dev_vdpu2.c @@ -147,6 +147,9 @@ static int rkvdpu_s_fmt_vid_out_mplane(struct file *filp, void *priv, if (sizes >= SZ_16M) return -EINVAL; + /* For those slice header data */ + pix_mp->plane_fmt[pix_mp->num_planes - 1].sizeimage += SZ_1M; + session->fmt_out = *pix_mp; /* Copy the pixel format information from OUTPUT to CAPUTRE */ diff --git a/drivers/staging/rockchip-mpp/vdpu2/mpeg2.c b/drivers/staging/rockchip-mpp/vdpu2/mpeg2.c index d32958c4cb20..c12d1a8ef2da 100644 --- a/drivers/staging/rockchip-mpp/vdpu2/mpeg2.c +++ b/drivers/staging/rockchip-mpp/vdpu2/mpeg2.c @@ -52,7 +52,7 @@ static const u8 intra_default_q_matrix[64] = { static void mpeg2_dec_copy_qtable(u8 * qtable, const struct v4l2_ctrl_mpeg2_quantization *ctrl) { - int i, n; + int i; if (!qtable || !ctrl) return; @@ -111,21 +111,22 @@ int rkvdpu_mpeg2_gen_reg(struct mpp_session *session, void *regs, struct vb2_v4l2_buffer *src_buf) { const struct v4l2_ctrl_mpeg2_slice_params *params; - const struct v4l2_ctrl_mpeg2_quantization *quantization; const struct v4l2_mpeg2_sequence *sequence; const struct v4l2_mpeg2_picture *picture; + const struct v4l2_ctrl_mpeg2_quantization *quantization; struct vdpu2_regs *p_regs = regs; + void *qtable = NULL; + size_t stream_len = 0; params = rockchip_mpp_get_cur_ctrl(session, V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS); - quantization = rockchip_mpp_get_cur_ctrl(session, - V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION); - if (!params) return -EINVAL; sequence = ¶ms->sequence; picture = ¶ms->picture; + quantization = rockchip_mpp_get_cur_ctrl(session, + V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION); init_hw_cfg(p_regs); @@ -202,7 +203,13 @@ int rkvdpu_mpeg2_gen_reg(struct mpp_session *session, void *regs, p_regs->sw64.rlc_vlc_base = vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0); p_regs->sw122.strm_start_bit = params->data_bit_offset; - p_regs->sw51.stream_len = vb2_get_plane_payload(&src_buf->vb2_buf, 0); + stream_len = vb2_get_plane_payload(&src_buf->vb2_buf, 0); + p_regs->sw51.stream_len = stream_len; + + qtable = vb2_plane_vaddr(&src_buf->vb2_buf, 0) + ALIGN(stream_len, 8); + mpeg2_dec_copy_qtable(qtable, quantization); + p_regs->sw61.qtable_base = p_regs->sw64.rlc_vlc_base + + ALIGN(stream_len, 8); return 0; } -- 2.20.1