From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B639EC4332F for ; Thu, 23 Dec 2021 16:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349326AbhLWQ5P (ORCPT ); Thu, 23 Dec 2021 11:57:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349310AbhLWQ5N (ORCPT ); Thu, 23 Dec 2021 11:57:13 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E340C061401 for ; Thu, 23 Dec 2021 08:57:13 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id bg2-20020a05600c3c8200b0034565c2be15so6024320wmb.0 for ; Thu, 23 Dec 2021 08:57:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=x19kNH14ExPsQ28C6SlBYVGa8akiQhXJZ1zBC3AV6iQ=; b=M227YuJRwIPX/CPb7Lg+WOaaHsKzAMYXB/Da0yMQGvxGa0saRVV+di4RqWZbiRK50Q trtNNAA5U+lBSeLSDkBTYNHzvTkoRut7yqBa7TwaK2JiNuabxmv5BOwtUV4KRi5pR2ah +So40Cr4Iob4Tt6iSivBaTYonKePYDmJoO96G2315qHEemCOzvUnpTMv67mZ828dG624 KlLSAQZAPCK0t6oW5/w0P/ratE8Q/gOGGcfxxVQgmWw9mxWxwPnvkTDBy6VlAIJ/qwC5 FqwkC9EauN7+/9F2aBN7XWx0UBUkBy4Fy8msCrRtBKZG4HbI823JZ/pJxnGPdlZrGi+r XB+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=x19kNH14ExPsQ28C6SlBYVGa8akiQhXJZ1zBC3AV6iQ=; b=UNnrsTfYjrzkHOCfDvFMqj3vJoWV2las/jzyw5GRmP9+31D3hmt619Rste9ALvIBY5 w3bpr6hmIIoau/2cmqj1ZbeXU4gb/Vj0oWsbCwFvM0kANDcHVYuBG5g6DY+WDM9CLqG5 rA9BAXEjd6RJ2/NRWq1QUNpqBE3ILaDb0xaXsJXxh8PvmxBz0ksW8ZTIb9aK+E+Ya/Ii vmDA5LgUE8lLlp6sO0BE1hHiEem1sB2cxXgwgGONFFq+MOuyvEQBrsqAxsPLGGkKiahH u9lXWcxK6VXUYm6zfjLjmqCmmhFqBgvu45/uH9SQsYebsil88e7DJGu+kgNP+YgTmddz IxTg== X-Gm-Message-State: AOAM533rCoPL7Zny1Qr5wBaSBQYqLP/TNCL06hmdqFf4DUhrT/kn4B67 1q43ADDmS0lxixZXCioVtnY= X-Google-Smtp-Source: ABdhPJx0hYSOm4vDZR/gdV0QEOZLF2E0+HdDedp9MlR3fSt42MKgNwt3bY/4NeUgqZTjBr+NJEe+5g== X-Received: by 2002:a1c:1d0d:: with SMTP id d13mr2448580wmd.78.1640278632133; Thu, 23 Dec 2021 08:57:12 -0800 (PST) Received: from elementary ([217.113.240.86]) by smtp.gmail.com with ESMTPSA id u23sm4893233wmc.7.2021.12.23.08.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Dec 2021 08:57:11 -0800 (PST) Date: Thu, 23 Dec 2021 17:57:06 +0100 From: =?iso-8859-1?Q?Jos=E9_Exp=F3sito?= To: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Cc: Simon Ser , airlied@linux.ie, alexandre.torgue@foss.st.com, benjamin.gaignard@linaro.org, linux-stm32@st-md-mailman.stormreply.com, marex@denx.de, linux-imx@nxp.com, intel-gfx@lists.freedesktop.org, tzimmermann@suse.de, s.hauer@pengutronix.de, rodrigo.vivi@intel.com, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, yannick.fertre@foss.st.com, linux-kernel@vger.kernel.org, philippe.cornu@foss.st.com, mcoquelin.stm32@gmail.com, dmitry.baryshkov@linaro.org, shawnguo@kernel.org Subject: Re: [PATCH v2 1/6] =?iso-8859-1?Q?drm=2Fpl?= =?iso-8859-1?Q?ane=3A_Make_format=5Fmod=5Fsupported_truly=A0optional?= Message-ID: <20211223165706.GA11019@elementary> References: <20211222090552.25972-1-jose.exposito89@gmail.com> <20211222090552.25972-2-jose.exposito89@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks for your reviews :) I'll wait a couple of days to see if somebody else wants to comment and I'll send v3 adding the reviewed by tags and fixing the compiler warning. On Thu, Dec 23, 2021 at 05:03:19PM +0200, Ville Syrjälä wrote: > Another related thing that might be worth checking is whether > drivers generally do anything to validate the modifiers in > the addfb2 ioctl. Looks like i915 and amdgpu are the only ones > to use drm_any_plane_has_format() for that, so all the other > drivers must either be checking it manually (or they're just > potentially broken when handed unexpected modifiers by evil > userspace). I'm pretty new to this subsystem, so please correct me if I'm wrong, but after looking into a couple of drivers I think you are right, this check is missing in some drivers. This possible bug reminds me of this ToDo task [1]: > Many drivers wrap drm_gem_fb_create() only to check for valid formats. For > atomic drivers we could check for valid formats by calling > drm_plane_check_pixel_format() against all planes, and pass if any plane > supports the format. For non-atomic that's not possible since like the format > list for the primary plane is fake and we'd therefor reject valid formats. I had a look to the Raspberry Pi driver (mainly because I'm trying to understand it) and it looks like the check is missing. Other drivers, for example Mali, are checking the format modifier manually. I'll try to do some actual testing during Christmas and see how it goes. José Expósito [1] https://www.kernel.org/doc/html/latest/gpu/todo.html#drm-framebuffer-funcs-and-drm-mode-config-funcs-fb-create-cleanup From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BEEC1C433F5 for ; Thu, 23 Dec 2021 16:57:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A3BD910E133; Thu, 23 Dec 2021 16:57:14 +0000 (UTC) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by gabe.freedesktop.org (Postfix) with ESMTPS id A1BD910E133; Thu, 23 Dec 2021 16:57:13 +0000 (UTC) Received: by mail-wm1-x32d.google.com with SMTP id n10-20020a7bc5ca000000b00345c520d38eso3218547wmk.1; Thu, 23 Dec 2021 08:57:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=x19kNH14ExPsQ28C6SlBYVGa8akiQhXJZ1zBC3AV6iQ=; b=M227YuJRwIPX/CPb7Lg+WOaaHsKzAMYXB/Da0yMQGvxGa0saRVV+di4RqWZbiRK50Q trtNNAA5U+lBSeLSDkBTYNHzvTkoRut7yqBa7TwaK2JiNuabxmv5BOwtUV4KRi5pR2ah +So40Cr4Iob4Tt6iSivBaTYonKePYDmJoO96G2315qHEemCOzvUnpTMv67mZ828dG624 KlLSAQZAPCK0t6oW5/w0P/ratE8Q/gOGGcfxxVQgmWw9mxWxwPnvkTDBy6VlAIJ/qwC5 FqwkC9EauN7+/9F2aBN7XWx0UBUkBy4Fy8msCrRtBKZG4HbI823JZ/pJxnGPdlZrGi+r XB+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=x19kNH14ExPsQ28C6SlBYVGa8akiQhXJZ1zBC3AV6iQ=; b=bNT20AVbejhPM5A/f4FGUYLg/C64ITOoZujhpbmJDat7zxQLjS1WIKx++OfKB9nzTQ H81N2UnPTqNUP+Tw7wR/LyrftANRfk+YGgHphJJKTY5XRz6t1PX2nu9l/h/3D6HQiDWn CkbHneOu0BTtDictpN+8c73GD8eOfsjHZVAuvjLkEH8ezAcNQZ7s/+bUnJ83JF2NIC5U bwLguiHD/JamY30OZWEJnG8hHkWeChUrBVLwsfqC1Xwmqg9SNkVCtEO31cjvROtiE3Zu NMhlqqgFx7TkUFJK70IEASCRvsqfYnwmiF8xhJtIx4F/xjKZYWES+G1HI9NmxTGWMY0E bmug== X-Gm-Message-State: AOAM533VePLOzssk6Y6JEzINFLO/PU/pyCTjTwTRpWzAcaJ3MadFPG66 oeg9BE3vkVf1B5Yqf43R3LA= X-Google-Smtp-Source: ABdhPJx0hYSOm4vDZR/gdV0QEOZLF2E0+HdDedp9MlR3fSt42MKgNwt3bY/4NeUgqZTjBr+NJEe+5g== X-Received: by 2002:a1c:1d0d:: with SMTP id d13mr2448580wmd.78.1640278632133; Thu, 23 Dec 2021 08:57:12 -0800 (PST) Received: from elementary ([217.113.240.86]) by smtp.gmail.com with ESMTPSA id u23sm4893233wmc.7.2021.12.23.08.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Dec 2021 08:57:11 -0800 (PST) Date: Thu, 23 Dec 2021 17:57:06 +0100 From: =?iso-8859-1?Q?Jos=E9_Exp=F3sito?= To: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [PATCH v2 1/6] =?iso-8859-1?Q?drm=2Fpl?= =?iso-8859-1?Q?ane=3A_Make_format=5Fmod=5Fsupported_truly=A0optional?= Message-ID: <20211223165706.GA11019@elementary> References: <20211222090552.25972-1-jose.exposito89@gmail.com> <20211222090552.25972-2-jose.exposito89@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, mcoquelin.stm32@gmail.com, kernel@pengutronix.de, s.hauer@pengutronix.de, tzimmermann@suse.de, airlied@linux.ie, intel-gfx@lists.freedesktop.org, alexandre.torgue@foss.st.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, yannick.fertre@foss.st.com, linux-imx@nxp.com, benjamin.gaignard@linaro.org, rodrigo.vivi@intel.com, dmitry.baryshkov@linaro.org, shawnguo@kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, philippe.cornu@foss.st.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Thanks for your reviews :) I'll wait a couple of days to see if somebody else wants to comment and I'll send v3 adding the reviewed by tags and fixing the compiler warning. On Thu, Dec 23, 2021 at 05:03:19PM +0200, Ville Syrjälä wrote: > Another related thing that might be worth checking is whether > drivers generally do anything to validate the modifiers in > the addfb2 ioctl. Looks like i915 and amdgpu are the only ones > to use drm_any_plane_has_format() for that, so all the other > drivers must either be checking it manually (or they're just > potentially broken when handed unexpected modifiers by evil > userspace). I'm pretty new to this subsystem, so please correct me if I'm wrong, but after looking into a couple of drivers I think you are right, this check is missing in some drivers. This possible bug reminds me of this ToDo task [1]: > Many drivers wrap drm_gem_fb_create() only to check for valid formats. For > atomic drivers we could check for valid formats by calling > drm_plane_check_pixel_format() against all planes, and pass if any plane > supports the format. For non-atomic that's not possible since like the format > list for the primary plane is fake and we'd therefor reject valid formats. I had a look to the Raspberry Pi driver (mainly because I'm trying to understand it) and it looks like the check is missing. Other drivers, for example Mali, are checking the format modifier manually. I'll try to do some actual testing during Christmas and see how it goes. José Expósito [1] https://www.kernel.org/doc/html/latest/gpu/todo.html#drm-framebuffer-funcs-and-drm-mode-config-funcs-fb-create-cleanup From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7FDDAC433F5 for ; Thu, 23 Dec 2021 16:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zHqwFFo6DPweUGe8cdmmny4yS7z/3LG3lWPKeiWrOSg=; b=W7liirBS6ApWZ8 LEB7tLLhUFyNFOiMK57dIj+rnWyDGSj7PYW76FbaHqLWkgtalyPYsnvM2g/MnZD8lItEm7552lWOh b5i7jbW0PZdbapUz2VO4Cu8dYLC6y4N68dA5aA6VrZYQ1IxIUVaSXu/ym5lYDVpou/b5ifZIHkDuw hUcuCmVsNbW6oIDhd+LdMkHkJTFCik2joTVAI8Ktzo09VCXVxaS4TmTpe2aP4mdB8NKtwxm66yqJM 7aGjNFOlwYj8bvaaQh7Nj+B9Me2DEfDPREVTXVwnfDSvEwZYFHHL5//IC588sQRZUniAFOuwLIQsP TttvtgJAJ9kgrgqEP+Xg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0RP3-00D7JP-PW; Thu, 23 Dec 2021 16:57:17 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0RP0-00D7J4-4n for linux-arm-kernel@lists.infradead.org; Thu, 23 Dec 2021 16:57:15 +0000 Received: by mail-wm1-x335.google.com with SMTP id g191-20020a1c9dc8000000b0032fbf912885so3550117wme.4 for ; Thu, 23 Dec 2021 08:57:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=x19kNH14ExPsQ28C6SlBYVGa8akiQhXJZ1zBC3AV6iQ=; b=M227YuJRwIPX/CPb7Lg+WOaaHsKzAMYXB/Da0yMQGvxGa0saRVV+di4RqWZbiRK50Q trtNNAA5U+lBSeLSDkBTYNHzvTkoRut7yqBa7TwaK2JiNuabxmv5BOwtUV4KRi5pR2ah +So40Cr4Iob4Tt6iSivBaTYonKePYDmJoO96G2315qHEemCOzvUnpTMv67mZ828dG624 KlLSAQZAPCK0t6oW5/w0P/ratE8Q/gOGGcfxxVQgmWw9mxWxwPnvkTDBy6VlAIJ/qwC5 FqwkC9EauN7+/9F2aBN7XWx0UBUkBy4Fy8msCrRtBKZG4HbI823JZ/pJxnGPdlZrGi+r XB+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=x19kNH14ExPsQ28C6SlBYVGa8akiQhXJZ1zBC3AV6iQ=; b=aXmvk7Vq8B1laS8SoR9V8TDux4pVUV8+jPlGEiPoiwscpIE3EsdwewtT8cQW9XCuOI jTJO/abt+QZRYdlEtL5T9z3F7Et4khvuiaJPvZr7TkDpKdG+LpJnbgN2k9kyMYX4VBAX M00uoR/Dos+xS3A6eYpJjdVP5x32vP4sFherRxpZWs5rpntW+K8qrNOb9EneneYnvk23 CRY4HxaJKyAIIeie9nMetA7+SfKePK1XrxI/ovTIPVpZzup5TmX/9T96+kLPOa8I44G9 g6dcmO66Pe5zCoarqO0r6H/L+hX2quW00oM5gi8j5gaWUYB9JlsAXflJgu8DU/ltYbYg M69A== X-Gm-Message-State: AOAM531IYB+iJSCe3LIIxMQb8JIadUzkjafgTLtq9v3+5ZTS1DfQozOD JifoVSq4p5c1NwrsUpMIFIM= X-Google-Smtp-Source: ABdhPJx0hYSOm4vDZR/gdV0QEOZLF2E0+HdDedp9MlR3fSt42MKgNwt3bY/4NeUgqZTjBr+NJEe+5g== X-Received: by 2002:a1c:1d0d:: with SMTP id d13mr2448580wmd.78.1640278632133; Thu, 23 Dec 2021 08:57:12 -0800 (PST) Received: from elementary ([217.113.240.86]) by smtp.gmail.com with ESMTPSA id u23sm4893233wmc.7.2021.12.23.08.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Dec 2021 08:57:11 -0800 (PST) Date: Thu, 23 Dec 2021 17:57:06 +0100 From: =?iso-8859-1?Q?Jos=E9_Exp=F3sito?= To: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Cc: Simon Ser , airlied@linux.ie, alexandre.torgue@foss.st.com, benjamin.gaignard@linaro.org, linux-stm32@st-md-mailman.stormreply.com, marex@denx.de, linux-imx@nxp.com, intel-gfx@lists.freedesktop.org, tzimmermann@suse.de, s.hauer@pengutronix.de, rodrigo.vivi@intel.com, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, yannick.fertre@foss.st.com, linux-kernel@vger.kernel.org, philippe.cornu@foss.st.com, mcoquelin.stm32@gmail.com, dmitry.baryshkov@linaro.org, shawnguo@kernel.org Subject: Re: [PATCH v2 1/6] =?iso-8859-1?Q?drm=2Fpl?= =?iso-8859-1?Q?ane=3A_Make_format=5Fmod=5Fsupported_truly=A0optional?= Message-ID: <20211223165706.GA11019@elementary> References: <20211222090552.25972-1-jose.exposito89@gmail.com> <20211222090552.25972-2-jose.exposito89@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211223_085714_258425_D73EDCFC X-CRM114-Status: GOOD ( 17.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Thanks for your reviews :) I'll wait a couple of days to see if somebody else wants to comment and I'll send v3 adding the reviewed by tags and fixing the compiler warning. On Thu, Dec 23, 2021 at 05:03:19PM +0200, Ville Syrj=E4l=E4 wrote: > Another related thing that might be worth checking is whether > drivers generally do anything to validate the modifiers in > the addfb2 ioctl. Looks like i915 and amdgpu are the only ones > to use drm_any_plane_has_format() for that, so all the other > drivers must either be checking it manually (or they're just > potentially broken when handed unexpected modifiers by evil > userspace). I'm pretty new to this subsystem, so please correct me if I'm = wrong, but after looking into a couple of drivers I think you are right, this check is missing in some drivers. This possible bug reminds me of this ToDo task [1]: > Many drivers wrap drm_gem_fb_create() only to check for valid formats. For > atomic drivers we could check for valid formats by calling > drm_plane_check_pixel_format() against all planes, and pass if any plane > supports the format. For non-atomic that's not possible since like the fo= rmat > list for the primary plane is fake and we'd therefor reject valid formats. I had a look to the Raspberry Pi driver (mainly because I'm trying to understand it) and it looks like the check is missing. Other drivers, for example Mali, are checking the format modifier manually. I'll try to do some actual testing during Christmas and see how it goes. Jos=E9 Exp=F3sito [1] https://www.kernel.org/doc/html/latest/gpu/todo.html#drm-framebuffer-fu= ncs-and-drm-mode-config-funcs-fb-create-cleanup _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4485BC433FE for ; Mon, 10 Jan 2022 13:24:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3738314B430; Mon, 10 Jan 2022 13:24:16 +0000 (UTC) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by gabe.freedesktop.org (Postfix) with ESMTPS id A1BD910E133; Thu, 23 Dec 2021 16:57:13 +0000 (UTC) Received: by mail-wm1-x32d.google.com with SMTP id n10-20020a7bc5ca000000b00345c520d38eso3218547wmk.1; Thu, 23 Dec 2021 08:57:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=x19kNH14ExPsQ28C6SlBYVGa8akiQhXJZ1zBC3AV6iQ=; b=M227YuJRwIPX/CPb7Lg+WOaaHsKzAMYXB/Da0yMQGvxGa0saRVV+di4RqWZbiRK50Q trtNNAA5U+lBSeLSDkBTYNHzvTkoRut7yqBa7TwaK2JiNuabxmv5BOwtUV4KRi5pR2ah +So40Cr4Iob4Tt6iSivBaTYonKePYDmJoO96G2315qHEemCOzvUnpTMv67mZ828dG624 KlLSAQZAPCK0t6oW5/w0P/ratE8Q/gOGGcfxxVQgmWw9mxWxwPnvkTDBy6VlAIJ/qwC5 FqwkC9EauN7+/9F2aBN7XWx0UBUkBy4Fy8msCrRtBKZG4HbI823JZ/pJxnGPdlZrGi+r XB+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=x19kNH14ExPsQ28C6SlBYVGa8akiQhXJZ1zBC3AV6iQ=; b=bNT20AVbejhPM5A/f4FGUYLg/C64ITOoZujhpbmJDat7zxQLjS1WIKx++OfKB9nzTQ H81N2UnPTqNUP+Tw7wR/LyrftANRfk+YGgHphJJKTY5XRz6t1PX2nu9l/h/3D6HQiDWn CkbHneOu0BTtDictpN+8c73GD8eOfsjHZVAuvjLkEH8ezAcNQZ7s/+bUnJ83JF2NIC5U bwLguiHD/JamY30OZWEJnG8hHkWeChUrBVLwsfqC1Xwmqg9SNkVCtEO31cjvROtiE3Zu NMhlqqgFx7TkUFJK70IEASCRvsqfYnwmiF8xhJtIx4F/xjKZYWES+G1HI9NmxTGWMY0E bmug== X-Gm-Message-State: AOAM533VePLOzssk6Y6JEzINFLO/PU/pyCTjTwTRpWzAcaJ3MadFPG66 oeg9BE3vkVf1B5Yqf43R3LA= X-Google-Smtp-Source: ABdhPJx0hYSOm4vDZR/gdV0QEOZLF2E0+HdDedp9MlR3fSt42MKgNwt3bY/4NeUgqZTjBr+NJEe+5g== X-Received: by 2002:a1c:1d0d:: with SMTP id d13mr2448580wmd.78.1640278632133; Thu, 23 Dec 2021 08:57:12 -0800 (PST) Received: from elementary ([217.113.240.86]) by smtp.gmail.com with ESMTPSA id u23sm4893233wmc.7.2021.12.23.08.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Dec 2021 08:57:11 -0800 (PST) Date: Thu, 23 Dec 2021 17:57:06 +0100 From: =?iso-8859-1?Q?Jos=E9_Exp=F3sito?= To: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Message-ID: <20211223165706.GA11019@elementary> References: <20211222090552.25972-1-jose.exposito89@gmail.com> <20211222090552.25972-2-jose.exposito89@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailman-Approved-At: Mon, 10 Jan 2022 13:24:14 +0000 Subject: Re: [Intel-gfx] =?iso-8859-1?q?=5BPATCH_v2_1/6=5D_drm/plane=3A_Make_?= =?iso-8859-1?q?format=5Fmod=5Fsupported_truly=A0optional?= X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marex@denx.de, mcoquelin.stm32@gmail.com, kernel@pengutronix.de, s.hauer@pengutronix.de, tzimmermann@suse.de, airlied@linux.ie, Simon Ser , intel-gfx@lists.freedesktop.org, alexandre.torgue@foss.st.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, yannick.fertre@foss.st.com, linux-imx@nxp.com, benjamin.gaignard@linaro.org, dmitry.baryshkov@linaro.org, shawnguo@kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, philippe.cornu@foss.st.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Thanks for your reviews :) I'll wait a couple of days to see if somebody else wants to comment and I'll send v3 adding the reviewed by tags and fixing the compiler warning. On Thu, Dec 23, 2021 at 05:03:19PM +0200, Ville Syrjälä wrote: > Another related thing that might be worth checking is whether > drivers generally do anything to validate the modifiers in > the addfb2 ioctl. Looks like i915 and amdgpu are the only ones > to use drm_any_plane_has_format() for that, so all the other > drivers must either be checking it manually (or they're just > potentially broken when handed unexpected modifiers by evil > userspace). I'm pretty new to this subsystem, so please correct me if I'm wrong, but after looking into a couple of drivers I think you are right, this check is missing in some drivers. This possible bug reminds me of this ToDo task [1]: > Many drivers wrap drm_gem_fb_create() only to check for valid formats. For > atomic drivers we could check for valid formats by calling > drm_plane_check_pixel_format() against all planes, and pass if any plane > supports the format. For non-atomic that's not possible since like the format > list for the primary plane is fake and we'd therefor reject valid formats. I had a look to the Raspberry Pi driver (mainly because I'm trying to understand it) and it looks like the check is missing. Other drivers, for example Mali, are checking the format modifier manually. I'll try to do some actual testing during Christmas and see how it goes. José Expósito [1] https://www.kernel.org/doc/html/latest/gpu/todo.html#drm-framebuffer-funcs-and-drm-mode-config-funcs-fb-create-cleanup