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; From patchwork Wed Jun 12 01:16:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 10988397 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 C67E014C0 for ; Wed, 12 Jun 2019 01:25:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1BAF28306 for ; Wed, 12 Jun 2019 01:25:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A03B42837D; Wed, 12 Jun 2019 01:25:34 +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 16CE828306 for ; Wed, 12 Jun 2019 01:25:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3A85C8800A; Wed, 12 Jun 2019 01:25:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id C6A9F891D6 for ; Wed, 12 Jun 2019 01:25:32 +0000 (UTC) Received: by mail-pf1-x441.google.com with SMTP id s11so8543059pfm.12 for ; Tue, 11 Jun 2019 18:25:32 -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=/4mZhjz2dkfafdy2bqfClO5VTqYAkHEFd5uOF7sABt0=; b=gwnaaUoP52UHFGFFNPoPYbR6MTfY0Z5xMbjbHoHPoFccoBFO4LnuYtDxt1vG+oHogE +hTBO63fjJFDugtmzwpNs2I705W3CrUEvJM54UyLGxhW6iN+P8OAC7KEKLrW0sl/Lesf 74SJ3a7svlCZr9dZLBQe4Mw2Hf9oD87jQHoF1kstQg2R6ux7ZqW7Wv4NvkYEWZbS76gQ TGu+5LdBpUbKgHJ05KtepXShkRT7KV6zbQ5AqSVKctPKE2iyGokYqg5xillf0mSd7kDe Pw78U+z+hwXLuL+oVgoGTOokIsTrubrs0OOlCSpnT/oxkrJ/TYNTkmZtbo91XyIeLA+i ZzEA== X-Gm-Message-State: APjAAAXRclc4PUp8vhrxZn8zGps5G39irSQyy/L02uLorJwRD+Qphyql NXLPXAXHCscsU84Z3VlRYis= X-Google-Smtp-Source: APXvYqx8w3UNZJYyEfyesl8GJz44ySL1V6YwpvRUhn3tlhK/Vom10lrDEoqmya0nS0qFRQcHkUOFAA== X-Received: by 2002:a17:90a:290b:: with SMTP id g11mr29801294pjd.122.1560302225650; Tue, 11 Jun 2019 18:17:05 -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.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 18:17:05 -0700 (PDT) From: Steve Longerbeam To: Philipp Zabel Subject: [PATCH 2/3] gpu: ipu-v3: image-convert: Fix input bytesperline for packed formats Date: Tue, 11 Jun 2019 18:16:56 -0700 Message-Id: <20190612011657.12119-2-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190612011657.12119-1-slongerbeam@gmail.com> References: <20190612011657.12119-1-slongerbeam@gmail.com> 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:in-reply-to:references; bh=/4mZhjz2dkfafdy2bqfClO5VTqYAkHEFd5uOF7sABt0=; b=PmVQmVsONHga6z7L+7IIh6Vn/kPjgNT39RFZMidKSw3Pgd/4JDPThUO75CI9v/y44p CecZm6fAk7kAc/6KJJ2TC/0a2uH5FikGxfqcCFyimpHf/N9hXZ1ErtF870SdTKdGIwM2 BY07MsFVyL9kUD155wafDB6U621Vj+775KUvYStLxHoNpiZULS67vpHLWfo8CoZEx2Jm jhmb15UNv70f9hPKn7B9FLK0adghG3I/eJVS4tsA+fn+Cg6xwPL8ORyr87boMRkPg5cf FdDkHxtnXxH5asbRveQGAFLr5nPthyykU2pHMDlKujuK/iZbRsTHykR9f4KBamyhsP9C Qoww== 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 input bytesperline calculation for packed pixel formats was incorrect. The min/max clamping values must be multiplied by the packed bits-per-pixel. This was causing corrupted converted images when the input format was RGB4 (probably also other input packed formats). Fixes: d966e23d61a2c ("gpu: ipu-v3: image-convert: fix bytesperline adjustment") Reported-by: Harsha Manjula Mallikarjun Suggested-by: Harsha Manjula Mallikarjun Signed-off-by: Steve Longerbeam --- drivers/gpu/ipu-v3/ipu-image-convert.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c index 36eb4c77ad91..4dfdbd1adf0d 100644 --- a/drivers/gpu/ipu-v3/ipu-image-convert.c +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c @@ -1933,7 +1933,9 @@ void ipu_image_convert_adjust(struct ipu_image *in, struct ipu_image *out, 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_in, MAX_W, w_align_in); + ((2 << w_align_in) * infmt->bpp) >> 3, + (MAX_W * infmt->bpp) >> 3, + w_align_in); in->pix.sizeimage = infmt->planar ? (in->pix.height * in->pix.bytesperline * infmt->bpp) >> 3 : in->pix.height * in->pix.bytesperline; From patchwork Wed Jun 12 01:16:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 10988399 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 0F4D414C0 for ; Wed, 12 Jun 2019 01:26:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0D27288C4 for ; Wed, 12 Jun 2019 01:26:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E24C5288CB; Wed, 12 Jun 2019 01:26:25 +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 970CA288C4 for ; Wed, 12 Jun 2019 01:26:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C77D489218; Wed, 12 Jun 2019 01:26:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id 79BBA89218 for ; Wed, 12 Jun 2019 01:26:23 +0000 (UTC) Received: by mail-pg1-x542.google.com with SMTP id n2so7944461pgp.11 for ; Tue, 11 Jun 2019 18:26:23 -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=UeBUMK8zne5r7f1B94AFloQ1yKIBEwqxYhdWNW1rcVE=; b=VCiQwkavKav2dflCZeQsPFUlf496Zm2vVtQsvx5nVXdLWDHZRYkNllXLKuElxmnIST vwR0KCpSxcOdyunnrqHb7lebpBpnOPUpGyf8qUc+omHpRyKFYB/eko8OQb4IrZTFKxH+ 2U7qZgxd1Suu6bLS1FcjLf1IavXkuWNvkjvTSNDPXdWqWwJh1v3lNpK9bwIUm4gR15Zh 1/gMijTQJJ1wncg77gmXfTVUuiB1hCgTW+xzAn44IFWgrmTRqwW9/ctR9lGDTk+HmgsT ef3GAiz2txVx02QFWDi1HeCq0Pr79YodL1VZxT8iuEZ+xnBerZu8+w7TVlBDBYF5ec7F ZtWg== X-Gm-Message-State: APjAAAURvv29a93HrDAFsOworHZ70yahpUXRQiY6OksfHF1iclVhW2eM u6SgYsi0AFzArbV/NBT0YWA= X-Google-Smtp-Source: APXvYqyntFmaxAJbB17U4xr3GVjEA8ueDHeFxsQX18ZK8YIFTCP+Ma8Wk0S8hW5kzNdVIgLGkWK4ew== X-Received: by 2002:a17:90a:5887:: with SMTP id j7mr9058636pji.136.1560302226962; Tue, 11 Jun 2019 18:17:06 -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.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 18:17:06 -0700 (PDT) From: Steve Longerbeam To: Philipp Zabel Subject: [PATCH 3/3] gpu: ipu-v3: image-convert: Fix image downsize coefficients Date: Tue, 11 Jun 2019 18:16:57 -0700 Message-Id: <20190612011657.12119-3-slongerbeam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190612011657.12119-1-slongerbeam@gmail.com> References: <20190612011657.12119-1-slongerbeam@gmail.com> 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:in-reply-to:references; bh=UeBUMK8zne5r7f1B94AFloQ1yKIBEwqxYhdWNW1rcVE=; b=Mc/O/i/G8dA9XR5Z2xuOdd78Q3EZA8MUm/uNTtjjqL7M9eg6OoaPGsm3+vX5liu8Eu OjaofnIGVXtsD846o0FACmuimMFXHM7GW8NNtNXbQkJuGLHCEAoHFxvY3cPW3eHif7mv rCh7+o9qUbJdHA63GM4lKNQXVZWl6FF6gUIwkYE+apHfaUJIm7rhwH99Tcc805aAf8Ad Wmm9UBPe0z9REZ10l5vmksImiWRxacTHAIOrYR7rU5KPpOc6DmNfO75z0k/g/gJWEJmB tcZiNGiayqBoTJd1l81xwR5dqG1SP0w0UVDu8/iYmV8+FEMWBYSNuT1/JCxkjuVqJ//n RS/A== 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 of the IC downsizer unit in both dimensions must be <= 1024 before being passed to the IC resizer unit. This was causing corrupted images when: input_dim > 1024, and input_dim / 2 < output_dim < input_dim Some broken examples were 1920x1080 -> 1024x768 and 1920x1080 -> 1280x1080. Fixes: 70b9b6b3bcb21 ("gpu: ipu-v3: image-convert: calculate per-tile resize coefficients") Signed-off-by: Steve Longerbeam --- drivers/gpu/ipu-v3/ipu-image-convert.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c index 4dfdbd1adf0d..e744f3527ce1 100644 --- a/drivers/gpu/ipu-v3/ipu-image-convert.c +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c @@ -400,12 +400,14 @@ static int calc_image_resize_coefficients(struct ipu_image_convert_ctx *ctx, if (WARN_ON(resized_width == 0 || resized_height == 0)) return -EINVAL; - while (downsized_width >= resized_width * 2) { + while (downsized_width > 1024 || + downsized_width >= resized_width * 2) { downsized_width >>= 1; downsize_coeff_h++; } - while (downsized_height >= resized_height * 2) { + while (downsized_height > 1024 || + downsized_height >= resized_height * 2) { downsized_height >>= 1; downsize_coeff_v++; }