From patchwork Wed Aug 1 19:12:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 10553283 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 3D52B13BB for ; Thu, 2 Aug 2018 07:19:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 290362AF5B for ; Thu, 2 Aug 2018 07:19:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C9282AF52; Thu, 2 Aug 2018 07:19:27 +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_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C11282AF52 for ; Thu, 2 Aug 2018 07:19:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 051AA6E342; Thu, 2 Aug 2018 07:19:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl0-x244.google.com (mail-pl0-x244.google.com [IPv6:2607:f8b0:400e:c01::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 952296E044 for ; Wed, 1 Aug 2018 19:12:44 +0000 (UTC) Received: by mail-pl0-x244.google.com with SMTP id s17-v6so9240443plp.7 for ; Wed, 01 Aug 2018 12:12:44 -0700 (PDT) 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; bh=4XgQr0v93BmMi0+ykyaOvN9BFSFtuq3EFayKXlWi74s=; b=F6nyW6g8rsmZC0EEbd6PlVOsJeFXctxmBfu6gCZNRv3EgkooSrfzY8c3JafL9ieYgw Y8JtrV3Y/X+EuiPVKMEJoozZuLdhr1ursgQXYcO/QBcauBRruVOOIh+GOzN7Lu3zkQPM Vz2qty1dDK9thQoQP7SC5ngQSJW3bxicjENlPJ5Cbi4gkQ4CS0BsJjffalfOPSXQCE2W PNL80tBvTId/DquuPcx6UOXPN5INWGXWzI39kxns6iEV65ssD/K3qqzmJ5koGFkkK9DY l7dMl+LGav0lj7I2JnD7AjNL6c7MNiKi7uK4g6dl6FqEjDbnwDGZ32IZ0+Tb7HoABoSj 109g== X-Gm-Message-State: AOUpUlGmjkO4WTybiQ3V7iBu0H6f73Sj/1IJpbncrBqB+bUNha1jovSH Wyw6FfTopZ4k08euXeRVAoElhMKE X-Google-Smtp-Source: AAOMgpcwUV9Ax8YPbRajmczg2HWz0QG47JI0B/UG0xc3IEQ1bFL3q4HiFjgn91uBBClkH3xwC/k6pg== X-Received: by 2002:a17:902:bd82:: with SMTP id q2-v6mr9484396pls.178.1533150764185; Wed, 01 Aug 2018 12:12:44 -0700 (PDT) Received: from mappy.world.mentorg.com (c-24-5-209-231.hsd1.ca.comcast.net. [24.5.209.231]) by smtp.googlemail.com with ESMTPSA id u42-v6sm31171336pgn.1.2018.08.01.12.12.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Aug 2018 12:12:43 -0700 (PDT) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: linux-media@vger.kernel.org Subject: [PATCH v3 05/14] gpu: ipu-v3: Allow negative offsets for interlaced scanning Date: Wed, 1 Aug 2018 12:12:18 -0700 Message-Id: <1533150747-30677-6-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533150747-30677-1-git-send-email-steve_longerbeam@mentor.com> References: <1533150747-30677-1-git-send-email-steve_longerbeam@mentor.com> X-Mailman-Approved-At: Thu, 02 Aug 2018 07:19:10 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Steve Longerbeam , "open list:DRM DRIVERS FOR FREESCALE IMX" , open list MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Philipp Zabel The IPU also supports interlaced buffers that start with the bottom field. To achieve this, the the base address EBA has to be increased by a stride length and the interlace offset ILO has to be set to the negative stride. Signed-off-by: Philipp Zabel Signed-off-by: Steve Longerbeam --- drivers/gpu/ipu-v3/ipu-cpmem.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-cpmem.c b/drivers/gpu/ipu-v3/ipu-cpmem.c index e68e473..8cd9e37 100644 --- a/drivers/gpu/ipu-v3/ipu-cpmem.c +++ b/drivers/gpu/ipu-v3/ipu-cpmem.c @@ -269,9 +269,20 @@ EXPORT_SYMBOL_GPL(ipu_cpmem_set_uv_offset); void ipu_cpmem_interlaced_scan(struct ipuv3_channel *ch, int stride) { + u32 ilo, sly; + + if (stride < 0) { + stride = -stride; + ilo = 0x100000 - (stride / 8); + } else { + ilo = stride / 8; + } + + sly = (stride * 2) - 1; + ipu_ch_param_write_field(ch, IPU_FIELD_SO, 1); - ipu_ch_param_write_field(ch, IPU_FIELD_ILO, stride / 8); - ipu_ch_param_write_field(ch, IPU_FIELD_SLY, (stride * 2) - 1); + ipu_ch_param_write_field(ch, IPU_FIELD_ILO, ilo); + ipu_ch_param_write_field(ch, IPU_FIELD_SLY, sly); }; EXPORT_SYMBOL_GPL(ipu_cpmem_interlaced_scan);