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 DD5EEC3DA7A for ; Thu, 5 Jan 2023 18:49:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BEDAB10E28F; Thu, 5 Jan 2023 18:49:12 +0000 (UTC) Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7600010E491 for ; Thu, 5 Jan 2023 18:49:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Xmgs2fiIVsEd0dEfkDOextiBC0dOcvbmhfxJyVme0JE=; b=NEVMx3zI/xw8aCtuJTjLkqYUiX uu6ji0KyY3hVVwHLwFy+Ntup6DpF8FsRKvid/LnMHl4w6KeWa5MF606kIqmqWT3hXeoryD+fKJ7GI PxBgoaXtdw88aqMIJRkfNofRKK5Oz6ZGDxqCm08R2OyLg6J29Q09ZNBKQVOdJWQRTmVbkhC6DqcC9 y5msfxbE4KBRefv793+QDLigNtQ5yemgbtCl3lCXPC6U+ayaZlqo8Jev/8itkWMivOarQ1P3A7bQz a8KuMua+oSJcHQnIi+DIMIIUVj0XD6afl+J0fImmQeiLmM9tzbt1/uKhY5r28ToOU4l+fXfdfi7q4 ZAy/XNRQ==; Received: from [187.36.234.139] (helo=[192.168.1.195]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1pDVIW-000Ib0-41; Thu, 05 Jan 2023 19:49:04 +0100 Message-ID: Date: Thu, 5 Jan 2023 15:48:59 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH] drm/gem: Check for valid formats Content-Language: en-US To: Simon Ser References: <20230103125322.855089-1-mcanal@igalia.com> <7104fc80-f996-8fce-eb72-b29ba4ff438e@igalia.com> <5d2ed13c-2317-bc77-68d1-ce3099382f68@igalia.com> From: =?UTF-8?Q?Ma=c3=adra_Canal?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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: Melissa Wen , =?UTF-8?Q?Andr=c3=a9_Almeida?= , dri-devel@lists.freedesktop.org, Thomas Zimmermann Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 1/5/23 15:36, Simon Ser wrote: > On Thursday, January 5th, 2023 at 19:30, Maíra Canal wrote: > >>>>> I think to really make sure we have consensus it'd be good to extend this >>>>> to a series which removes all the callers to drm_any_plane_has_format() >>>>> from the various drivers, and then unexports that helper. That way your >>>>> series here will have more eyes on it :-) >>>> >>>> I took a look at the callers to drm_any_plane_has_format() and there are only >>>> 3 callers (amdgpu, i915 and vmwgfx). They all use drm_any_plane_has_format() >>>> before calling drm_framebuffer_init(). So, I'm not sure I could remove >>>> drm_any_plane_has_format() from those drivers. Maybe adding this same check >>>> to drm_gem_fb_init() and refactor the drivers to make them use drm_gem_fb_init(), >>>> but I guess this would be part of a different series. >>> >>> Well vmwgfx still not yet using gem afaik, so that doesn't work. >>> >>> But why can't we move the modifier check int drm_framebuffer_init()? >>> That's kinda where it probably should be anyway, there's nothing gem >>> bo specific in the code you're adding. >> >> >> I'm not sure if this would correct the problem that I was trying to fix initially. >> I was trying to make sure that the drivers pass on the >> igt@kms_addfb_basic@addfb25-bad-modifier IGT test by making sure that the addfb >> ioctl returns the error. >> >> By moving the modifier check to the drm_framebuffer_init(), the test would still >> fail. > > Hm, why is that? The ADDFB2 IOCTL impl calls drm_framebuffer_init(). From what I can see, ADDFB2 IOCTL calls drm_internal_framebuffer_create() [1], then drm_internal_framebuffer_create() calls the fb_create hook [2]. I'm not sure here ADDFB2 implicitly calls drm_framebuffer_init(), but I'm probably missing something. Also, by looking at this file, I realize that maybe it would be better to add the check on framebuffer_check(), but I don't know how does it sound to Daniel. [1] https://cgit.freedesktop.org/drm/drm-misc/tree/drivers/gpu/drm/drm_framebuffer.c#n346 [2] https://cgit.freedesktop.org/drm/drm-misc/tree/drivers/gpu/drm/drm_framebuffer.c#n321 Best Regards, - Maíra Canal