From patchwork Fri Oct 19 10:57:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10649019 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 BE443112B for ; Fri, 19 Oct 2018 10:59:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB68928A68 for ; Fri, 19 Oct 2018 10:59:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EC5D28A7F; Fri, 19 Oct 2018 10:59:24 +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=BAD_ENC_HEADER,BAYES_00, 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 4BECE28A68 for ; Fri, 19 Oct 2018 10:59:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 53C816E39A; Fri, 19 Oct 2018 10:58:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0626.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::626]) by gabe.freedesktop.org (Postfix) with ESMTPS id 68D626E357 for ; Fri, 19 Oct 2018 10:58:38 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.51) by AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.25; Fri, 19 Oct 2018 10:58:35 +0000 From: Alexandru Gheorghe To: seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, liviu.dudau@arm.com, brian.starkey@arm.com, malidp@foss.arm.com, maxime.ripard@bootlin.com, maarten.lankhorst@linux.intel.com, ayan.halder@arm.com, daniel.vetter@ffwll.ch, raymond.smith@arm.com, david.garbett@arm.com, lisa.wu@arm.com, matt.szczesiak@arm.com, charles.xu@arm.com, james.qian.wang@arm.com Subject: [PATCH v5 5/9] drm: Extend framebuffer_check to handle formats with cpp/char_per_block 0 Date: Fri, 19 Oct 2018 11:57:48 +0100 Message-Id: <20181019105752.17741-6-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> References: <20181019105752.17741-1-alexandru-cosmin.gheorghe@arm.com> MIME-Version: 1.0 X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: LO2P265CA0387.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::15) To AM5PR0802MB2546.eurprd08.prod.outlook.com (2603:10a6:203:a0::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 86fce3c2-e9ce-45ee-5d1f-08d635b1d175 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2546; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2546; 3:aJr198YvQosYcCsmZ+GbHTj/iFxgryI8ZUX7OMMb8i9nU5+TskHo8fi8txGyiAEP6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0x7OWM+sp7LUoXQRNF4HzpxPjywcq5kJqClxqM9rxO+5mfasvOO8bRnyFKbPD06Z47sjWsfNVBojnUKHhZIpp9tRMV9SbZnopyIKanbUx/FBsMJZzdUfhZkFD7cWDGBZcrEkGY/DT5GM0k2T3x1iM/Jyz4slN0/xwb5f00ud5Ir2aKadijr+bEybfiuXrKI/AFCmbf4sXNNT9sba2mpvwrfCCP2FtlihvXjvQkeKSn7S7oGHz4FGY=; 4:OQFAbCUcB8ZH4YS+MBCdUk6f7shlSgeD18Nhx4BUQHj3nLoieE1sobSsL8Itil8U5FykYaKh9cVlYDTU+O6l6HJovuBmZLEqAV3kRQMq5fvVoFo0pt27WDZsK0VWCyRpxzhyz9KomWM31bE6wxokOfFZcb4U0AReCb8ZlylBytnYDRjt0U56fFadUsTuTsw/u05kC8jsvsTvRPTft4vUI1N0NClDreSjpx0tlTJWDo+oNquymTO3/V55FTEFmadOjld85iChw+n39q7bzcrc30jkvA/OyjDPdta83+2X4Tcm1q8tSbF0fk2EHGbpCcfc X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149066)(150057)(6041310)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(201708071742011)(7699051)(76991095); SRVR:AM5PR0802MB2546; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2546; X-Forefront-PRVS: 0830866D19 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(366004)(39860400002)(136003)(346002)(396003)(199004)(189003)(6636002)(11346002)(105586002)(81156014)(81166006)(14444005)(5024004)(50226002)(6306002)(106356001)(4326008)(97736004)(3846002)(476003)(25786009)(6116002)(16586007)(8676002)(53936002)(50466002)(486006)(1076002)(8936002)(316002)(2616005)(956004)(966005)(16526019)(48376002)(36756003)(26005)(478600001)(6486002)(386003)(7696005)(186003)(52116002)(51416003)(68736007)(446003)(5660300001)(305945005)(72206003)(76176011)(7736002)(2906002)(86362001)(575784001)(66066001)(47776003)(6666004)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2546; H:e114479-lin.cambridge.arm.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0802MB2546; 23:5gVaV9B067SWkg0P+AgDFgjn4xZWERrPrdXm8zt?= 82Aw6382KNtXATmPjwcuLnQESMoPBicv0e0/w1BnY3pQhsGfTSKuDKrg9nzyOuOgQ7X6zgGzHkSy9FapExvX0z0OhBiNdPGdbfeVpa0il0ORgzGJLffbW4qylOLaqrWSn8hlBp3bKDcWmh/WA8hpM8+zHR6v3aRbHEcOKea8HKv+op890c0wsbOt8Mu2XUFC9TgoQdXRL1LQ4K4VC3V0Juh/2TPywAZ5b/XyMNHeMrRAf3+fzX9Wy+5N7EAwW1R+m6PIKAfe1W/Ye7P18pHKyimByVxcZ5MAdY4TI6huhS35uF4k/TWCRDFYu9ENLB2nXrkXVh5gF6EMpMpgNwXrDn3gDKnOFY5AdEBWnNCtc57OYBsLq4vZWdwytXza78fk9Icsx00RTgDvzyKdauRW9Pyw6iuql7Y0V2DN0ov1oS76e+67FYDdS68J3YETqLSKXwAlv8oA31x0MYhI9m6DsZ08W0i2L9+hFbedB10PYbY0U9NXvxVi8sSiHHi1gTJecURx13WvXeOnO17mJgpIo204J7t1H4oIv0PsjCt3KylLNvGjxgWWGshhb/2R+mhQTxds9yFAmkYe1W8xtTTE3ikj6C8uZof2ppfgs1WN4pJTbAkjFR5wiAbXqXkMMeu/YAbD03QBxAiqxZtk1UajiTakZI3kIdsuJ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ucW8OaCb/J6RmhENvKbIBH9usmFASxuJQ3fgx5zMvatUMFFFNadbmUI2AhfzYlRBPuEDyav9v6DIJfl+V/8KEy82VhmHpklEytUBgP2PUhLPndwdK9iasijOGnm3Tj4+C+V0HsBEzvzjNhBA34Kns2gJOqyibHS4bhIYpzgBClQhNzFj8ivNWw+4frOFc8rkvk9/UXP5cLgfPCIjLzkEtSh7b+6lOd7Es6A2dZzMSf5B/XynGOTC94bS8j/KnK3cHBmjz0PKgiDI7rbik6a6MgGvcu5dmI6sHVJwr2CcKFcor2dfTQ3SA3yMGk3c8b6WRmst9O67k9c8D8SbW7UYo/xDLHdvHSmce72zjZ6hjsuBFn5Uxx2dCTKe11fWwnXns/UNtWWUMpx+2arqQ+zumbjbPunJgrZwEdFJNeBEYRfA==; 5:sin7uB1nKCVfUF4xCg1b5vPmY4PBtb/bzBpDzX5aKjwYPWZ0CPCGIv/Fil6UUHTwZkJzedYANFsUM+PY2TNR1PaRUXoEo76BsTR4xW9+F5VZhz94OPFduUGnl6nxETIRD6cQ7YAtw0watVjHtwYz++PB5vhM4nsk2W4efhIS1Yk=; 7:XkVRSH6smZuCVWJAQktRgYV+S+H9sB1gZx5ycSohrBkN+DitpMoX591whX6Lyvj0iqQOLT6+BPuYZsD2y4wvUhTZHDB4RXxt0jbygjiqm5IQsSbt/4k4EuD7N3NFcKoWr4A6mpnczPGimBB8F+lHT16P7sPyf6dtQmKqDY9oUTDlds3Jl6tJi1K6pQjkf3duqAjPgQSk/MCtoYT44gzQKAxMa9CeatDi/y5WNrvmXZs+Jus/ulbbxziXg1pzLtIp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2018 10:58:35.6773 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 86fce3c2-e9ce-45ee-5d1f-08d635b1d175 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2546 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: nd@arm.com, Alexandru Gheorghe Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP For formats that are supported only with non-linear modifiers it doesn't make to much sense to define cpp or char_per_block, so that will be set to 0. This patch adds a restriction to force having a modifier attached when cpp/char_per_block is 0, and to bypass checking the pitch restriction. This had been discussed here. [1] https://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&highlight_names=&date=2018-09-13&show_html=true Signed-off-by: Alexandru Gheorghe --- drivers/gpu/drm/drm_framebuffer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 6aca8a1ccdb6..e346d0ad92e0 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -195,8 +195,13 @@ static int framebuffer_check(struct drm_device *dev, for (i = 0; i < info->num_planes; i++) { unsigned int width = fb_plane_width(r->width, info, i); unsigned int height = fb_plane_height(r->height, info, i); + unsigned int block_size = info->char_per_block[i]; u64 min_pitch = drm_format_info_min_pitch(info, i, width); + if (!block_size && (r->modifier[i] == DRM_FORMAT_MOD_LINEAR)) { + DRM_DEBUG_KMS("Format requires non-linear modifier for plane %d\n", i); + return -EINVAL; + } if (!r->handles[i]) { DRM_DEBUG_KMS("no buffer object handle for plane %d\n", i); return -EINVAL; @@ -208,7 +213,7 @@ static int framebuffer_check(struct drm_device *dev, if ((uint64_t) height * r->pitches[i] + r->offsets[i] > UINT_MAX) return -ERANGE; - if (r->pitches[i] < min_pitch) { + if (block_size && r->pitches[i] < min_pitch) { DRM_DEBUG_KMS("bad pitch %u for plane %d\n", r->pitches[i], i); return -EINVAL; }