From patchwork Wed Jun 12 01:16:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 10988395 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 8CC6514B6 for ; Wed, 12 Jun 2019 01:24:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F18B288C4 for ; Wed, 12 Jun 2019 01:24:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63732288CB; Wed, 12 Jun 2019 01:24:33 +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 101B0288C4 for ; Wed, 12 Jun 2019 01:24:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A4F46891E3; Wed, 12 Jun 2019 01:24:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by gabe.freedesktop.org (Postfix) with ESMTPS id 577C7891D6 for ; Wed, 12 Jun 2019 01:24:29 +0000 (UTC) Received: by mail-pl1-x644.google.com with SMTP id b7so839316pls.6 for ; Tue, 11 Jun 2019 18:24:29 -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; bh=Y+UdVFpKtToAwMpoojIPPMwSl93o12ffMgVZ1H7mtl0=; b=XBjr38sMwsxJlWewjLn4cqu7M76dScqTE9mABSJmWrQclIW22ZDuMOvwWAbcpJJDaV vLobm2iW66bKwL6EPcRQ2+LyLblzlHb5vPXEYnz7pno9Xq89v3sJ6d6mOgm1sir9Esic iCHzm5kkzm01E63K4RsK2XQ4JfJMPR8pvnQcausix1xjKZvUHsVFoByfcG1EuTf4/LWO LBF8ZDMzhCr/I51WFXEJOAsgRteRZSi0OnUOMqR0Jfd9h3ZwDQYQcGv473wB4guGMVRD 8eN5MHNfoLKlM72V+1q6w3tSbRWw1dqA650fSEfrxcTTc4UNIrUSewIa/0yNardVzrVf 3+ig== X-Gm-Message-State: APjAAAW+clXXFT36ahVwxEmEbC3IhN9AS4b2QHw/TNCJbFyISGk1p9/V LwcPsoYiNdXSEgCTyxRdaC0= X-Google-Smtp-Source: APXvYqxR5efuvwybOL9xJecB56NAS7Qtog+UTb5ZkWMaesBYdMmalfp6I+k64C3dYE6NO9uoto9mQw== X-Received: by 2002:a17:902:848b:: with SMTP id c11mr56329787plo.217.1560302223851; Tue, 11 Jun 2019 18:17:03 -0700 (PDT) Received: from mappy.world.mentorg.com (c-107-3-185-39.hsd1.ca.comcast.net. [107.3.185.39]) by smtp.gmail.com with ESMTPSA id y22sm13257015pgj.38.2019.06.11.18.17.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 18:17:03 -0700 (PDT) From: Steve Longerbeam To: Philipp Zabel Subject: [PATCH 1/3] gpu: ipu-v3: image-convert: Fix input bytesperline width/height align Date: Tue, 11 Jun 2019 18:16:55 -0700 Message-Id: <20190612011657.12119-1-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Y+UdVFpKtToAwMpoojIPPMwSl93o12ffMgVZ1H7mtl0=; b=D7wTl0xJ9F9JNFbnpTSHd+uoY6rphqSDyENrPDTK9vqlDIunQWMaqUioQjDoy8GOn4 PRfOm6EUnzHx8fFcmQABEkb4Ub/N40sRuuAjchjz62qc2+rsm/3QrItPVf/khd6FJSdq EClNsiNub7upjMZbKe7DPBkqOy+tkJNTRJK3FpcloYfk+K2DlvzWAz5Z7FZNE2KdtQJ1 NKz64kYmroru5tlFuqKGNb/g16+K+53I3kk8Vrd6fx4RTRlC+FZSkwwmBicr30wBqCaa fcT0BEmLoSKGtoOcpq6AzEMPZoknHBg9Dat/rMYiX+S+3tO5Nk21z1JIgXQFJ5QTzGPf Dj7w== 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: open list , "open list:DRM DRIVERS FOR FREESCALE IMX" , Steve Longerbeam MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The output width and height alignment values were being used in the input bytesperline calculation. Fix by separating local vars w_align and h_align into w_align_in, h_align_in, w_align_out, and h_align_out. Fixes: d966e23d61a2c ("gpu: ipu-v3: image-convert: fix bytesperline adjustment") Signed-off-by: Steve Longerbeam --- drivers/gpu/ipu-v3/ipu-image-convert.c | 32 +++++++++++++++++--------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c index 36e88434513a..36eb4c77ad91 100644 --- a/drivers/gpu/ipu-v3/ipu-image-convert.c +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c @@ -1876,7 +1876,8 @@ void ipu_image_convert_adjust(struct ipu_image *in, struct ipu_image *out, enum ipu_rotate_mode rot_mode) { const struct ipu_image_pixfmt *infmt, *outfmt; - u32 w_align, h_align; + u32 w_align_out, h_align_out; + u32 w_align_in, h_align_in; infmt = get_format(in->pix.pixelformat); outfmt = get_format(out->pix.pixelformat); @@ -1908,22 +1909,31 @@ void ipu_image_convert_adjust(struct ipu_image *in, struct ipu_image *out, } /* align input width/height */ - w_align = ilog2(tile_width_align(IMAGE_CONVERT_IN, infmt, rot_mode)); - h_align = ilog2(tile_height_align(IMAGE_CONVERT_IN, infmt, rot_mode)); - in->pix.width = clamp_align(in->pix.width, MIN_W, MAX_W, w_align); - in->pix.height = clamp_align(in->pix.height, MIN_H, MAX_H, h_align); + w_align_in = ilog2(tile_width_align(IMAGE_CONVERT_IN, infmt, + rot_mode)); + h_align_in = ilog2(tile_height_align(IMAGE_CONVERT_IN, infmt, + rot_mode)); + in->pix.width = clamp_align(in->pix.width, MIN_W, MAX_W, + w_align_in); + in->pix.height = clamp_align(in->pix.height, MIN_H, MAX_H, + h_align_in); /* align output width/height */ - w_align = ilog2(tile_width_align(IMAGE_CONVERT_OUT, outfmt, rot_mode)); - h_align = ilog2(tile_height_align(IMAGE_CONVERT_OUT, outfmt, rot_mode)); - out->pix.width = clamp_align(out->pix.width, MIN_W, MAX_W, w_align); - out->pix.height = clamp_align(out->pix.height, MIN_H, MAX_H, h_align); + w_align_out = ilog2(tile_width_align(IMAGE_CONVERT_OUT, outfmt, + rot_mode)); + h_align_out = ilog2(tile_height_align(IMAGE_CONVERT_OUT, outfmt, + rot_mode)); + out->pix.width = clamp_align(out->pix.width, MIN_W, MAX_W, + w_align_out); + out->pix.height = clamp_align(out->pix.height, MIN_H, MAX_H, + h_align_out); /* set input/output strides and image sizes */ in->pix.bytesperline = infmt->planar ? - clamp_align(in->pix.width, 2 << w_align, MAX_W, w_align) : + clamp_align(in->pix.width, 2 << w_align_in, MAX_W, + w_align_in) : clamp_align((in->pix.width * infmt->bpp) >> 3, - 2 << w_align, MAX_W, w_align); + 2 << w_align_in, MAX_W, w_align_in); in->pix.sizeimage = infmt->planar ? (in->pix.height * in->pix.bytesperline * infmt->bpp) >> 3 : in->pix.height * in->pix.bytesperline;