From patchwork Mon Feb 13 13:06:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benoit Parrot X-Patchwork-Id: 9569571 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E4656601E7 for ; Mon, 13 Feb 2017 13:07:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8EE926E81 for ; Mon, 13 Feb 2017 13:07:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBC1C27F60; Mon, 13 Feb 2017 13:07:40 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22E0326E81 for ; Mon, 13 Feb 2017 13:07:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753596AbdBMNHY (ORCPT ); Mon, 13 Feb 2017 08:07:24 -0500 Received: from fllnx210.ext.ti.com ([198.47.19.17]:10276 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753576AbdBMNHN (ORCPT ); Mon, 13 Feb 2017 08:07:13 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v1DD77eF004927; Mon, 13 Feb 2017 07:07:07 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v1DD73ek015854; Mon, 13 Feb 2017 07:07:06 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.294.0; Mon, 13 Feb 2017 07:07:03 -0600 Received: from uda0869644a.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v1DD71XP008199; Mon, 13 Feb 2017 07:07:04 -0600 From: Benoit Parrot To: Hans Verkuil , Mauro Carvalho Chehab , CC: , Tomi Valkeinen , Jyri Sarha , Peter Ujfalusi Subject: [Patch 1/2] media: ti-vpe: vpdma: add support for user specified stride Date: Mon, 13 Feb 2017 07:06:57 -0600 Message-ID: <20170213130658.31907-2-bparrot@ti.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170213130658.31907-1-bparrot@ti.com> References: <20170213130658.31907-1-bparrot@ti.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch introduce the needed vpdma API changes to support user space specified stride instead of forcing a driver calculated one. Signed-off-by: Benoit Parrot --- drivers/media/platform/ti-vpe/vpdma.c | 14 ++++---------- drivers/media/platform/ti-vpe/vpdma.h | 6 +++--- drivers/media/platform/ti-vpe/vpe.c | 6 ++++-- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/ti-vpe/vpdma.c b/drivers/media/platform/ti-vpe/vpdma.c index 23472e3784ff..e2cf2b90e500 100644 --- a/drivers/media/platform/ti-vpe/vpdma.c +++ b/drivers/media/platform/ti-vpe/vpdma.c @@ -801,17 +801,17 @@ static void dump_dtd(struct vpdma_dtd *dtd) * flags: VPDMA flags to configure some descriptor fileds */ void vpdma_add_out_dtd(struct vpdma_desc_list *list, int width, - const struct v4l2_rect *c_rect, + int stride, const struct v4l2_rect *c_rect, const struct vpdma_data_format *fmt, dma_addr_t dma_addr, int max_w, int max_h, enum vpdma_channel chan, u32 flags) { - vpdma_rawchan_add_out_dtd(list, width, c_rect, fmt, dma_addr, + vpdma_rawchan_add_out_dtd(list, width, stride, c_rect, fmt, dma_addr, max_w, max_h, chan_info[chan].num, flags); } EXPORT_SYMBOL(vpdma_add_out_dtd); void vpdma_rawchan_add_out_dtd(struct vpdma_desc_list *list, int width, - const struct v4l2_rect *c_rect, + int stride, const struct v4l2_rect *c_rect, const struct vpdma_data_format *fmt, dma_addr_t dma_addr, int max_w, int max_h, int raw_vpdma_chan, u32 flags) { @@ -821,7 +821,6 @@ void vpdma_rawchan_add_out_dtd(struct vpdma_desc_list *list, int width, int channel, next_chan; struct v4l2_rect rect = *c_rect; int depth = fmt->depth; - int stride; struct vpdma_dtd *dtd; channel = next_chan = raw_vpdma_chan; @@ -833,8 +832,6 @@ void vpdma_rawchan_add_out_dtd(struct vpdma_desc_list *list, int width, depth = 8; } - stride = ALIGN((depth * width) >> 3, VPDMA_STRIDE_ALIGN); - dma_addr += rect.top * stride + (rect.left * depth >> 3); dtd = list->next; @@ -882,7 +879,7 @@ EXPORT_SYMBOL(vpdma_rawchan_add_out_dtd); * contribute to the client) */ void vpdma_add_in_dtd(struct vpdma_desc_list *list, int width, - const struct v4l2_rect *c_rect, + int stride, const struct v4l2_rect *c_rect, const struct vpdma_data_format *fmt, dma_addr_t dma_addr, enum vpdma_channel chan, int field, u32 flags, int frame_width, int frame_height, int start_h, int start_v) @@ -892,7 +889,6 @@ void vpdma_add_in_dtd(struct vpdma_desc_list *list, int width, int depth = fmt->depth; int channel, next_chan; struct v4l2_rect rect = *c_rect; - int stride; struct vpdma_dtd *dtd; channel = next_chan = chan_info[chan].num; @@ -904,8 +900,6 @@ void vpdma_add_in_dtd(struct vpdma_desc_list *list, int width, depth = 8; } - stride = ALIGN((depth * width) >> 3, VPDMA_STRIDE_ALIGN); - dma_addr += rect.top * stride + (rect.left * depth >> 3); dtd = list->next; diff --git a/drivers/media/platform/ti-vpe/vpdma.h b/drivers/media/platform/ti-vpe/vpdma.h index 131700c112b2..7e611501c291 100644 --- a/drivers/media/platform/ti-vpe/vpdma.h +++ b/drivers/media/platform/ti-vpe/vpdma.h @@ -242,16 +242,16 @@ void vpdma_add_sync_on_channel_ctd(struct vpdma_desc_list *list, void vpdma_add_abort_channel_ctd(struct vpdma_desc_list *list, int chan_num); void vpdma_add_out_dtd(struct vpdma_desc_list *list, int width, - const struct v4l2_rect *c_rect, + int stride, const struct v4l2_rect *c_rect, const struct vpdma_data_format *fmt, dma_addr_t dma_addr, int max_w, int max_h, enum vpdma_channel chan, u32 flags); void vpdma_rawchan_add_out_dtd(struct vpdma_desc_list *list, int width, - const struct v4l2_rect *c_rect, + int stride, const struct v4l2_rect *c_rect, const struct vpdma_data_format *fmt, dma_addr_t dma_addr, int max_w, int max_h, int raw_vpdma_chan, u32 flags); void vpdma_add_in_dtd(struct vpdma_desc_list *list, int width, - const struct v4l2_rect *c_rect, + int stride, const struct v4l2_rect *c_rect, const struct vpdma_data_format *fmt, dma_addr_t dma_addr, enum vpdma_channel chan, int field, u32 flags, int frame_width, int frame_height, int start_h, int start_v); diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c index f0156b7759e9..2dd67232b3bc 100644 --- a/drivers/media/platform/ti-vpe/vpe.c +++ b/drivers/media/platform/ti-vpe/vpe.c @@ -1085,7 +1085,8 @@ static void add_out_dtd(struct vpe_ctx *ctx, int port) vpdma_set_max_size(ctx->dev->vpdma, VPDMA_MAX_SIZE1, MAX_W, MAX_H); - vpdma_add_out_dtd(&ctx->desc_list, q_data->width, &q_data->c_rect, + vpdma_add_out_dtd(&ctx->desc_list, q_data->width, + q_data->bytesperline[VPE_LUMA], &q_data->c_rect, vpdma_fmt, dma_addr, MAX_OUT_WIDTH_REG1, MAX_OUT_HEIGHT_REG1, p_data->channel, flags); } @@ -1169,7 +1170,8 @@ static void add_in_dtd(struct vpe_ctx *ctx, int port) if (p_data->vb_part && fmt->fourcc == V4L2_PIX_FMT_NV12) frame_height /= 2; - vpdma_add_in_dtd(&ctx->desc_list, q_data->width, &q_data->c_rect, + vpdma_add_in_dtd(&ctx->desc_list, q_data->width, + q_data->bytesperline[VPE_LUMA], &q_data->c_rect, vpdma_fmt, dma_addr, p_data->channel, field, flags, frame_width, frame_height, 0, 0); }