Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp605327rwi; Thu, 27 Oct 2022 05:37:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DtKgDZt3JP/x/daxmGja3d3UIcBrD+I0FdzxbLt73J62Z61Q0BAO2BEdYxNh+TgdLs2BJ X-Received: by 2002:a17:907:2cd4:b0:7ad:6a0a:fba4 with SMTP id hg20-20020a1709072cd400b007ad6a0afba4mr8239192ejc.35.1666874238424; Thu, 27 Oct 2022 05:37:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666874238; cv=none; d=google.com; s=arc-20160816; b=dmicReG/W/I7P0dcAR60CtGczvR/sHorpQzHtb6HoIXJl581w/Qo8h2o8e1zHagQyC a3ldlS5qHYCqbHenp8kbvPPl0z5ofw+8Ok5+jBXwn5Vvd+7lLk4sT6GFC3UtmSXhNbhr 3cus1FDvU/0oJCty2+6/0GUekj7V63jwl4uikJIHV4h6R5/1BWxdBBt8HkX596Bf3VG8 tie7CVzV9wHwEF7ohSB6C8bcATgWimisx8z8G4aDkk4nBBwwloUlVIVnXl5WCqIe3R2L mT19vJGCmGda4fdcPQz85pVMgsn3Y5eK4WZSgnePIX7irzOxKub0wU+ek6r42JGM+78k mSBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=U3fC3GCVCWHFA8BK+clsWWx/XGmjOugYN0DfePv7OLM=; b=uaRrXcRcTQcwT1g4Pe5Qkt1V9/vY7eAEortO2jHlTxYGyt4rAcar/IzUoLD/Fhlk0H uzjmOwWbdqnaQ6D/yM0tt7nTjn8FJBeJZG0r+GeR5VuL9vD8s5jnJMIHiP0deDMTmBlR tccIq1/4X1r65XckFbWcrkcNVN/+hD5D6x+JKbw1/wr+PvsntRTr3ZfjruKUcSygYo9+ dRIRdWM2Z3kCVbDAEbNQI+jTT0NyeNR8dTI8zxpm+KLcc/g8xZLB6SienAuUNFwEehaD 52iHLpTa/dzkZy6XR1zlUbzbWLrUrjyvm/siFLTF5fQTymYCAhqm/GynvfOW8200FXqI Rc5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marcan.st header.s=default header.b=u2xvHArO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=marcan.st Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a056402354a00b00461c8f80e30si1637836edd.392.2022.10.27.05.36.33; Thu, 27 Oct 2022 05:37:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@marcan.st header.s=default header.b=u2xvHArO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=marcan.st Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235665AbiJ0Mbv (ORCPT + 99 others); Thu, 27 Oct 2022 08:31:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234137AbiJ0Mbr (ORCPT ); Thu, 27 Oct 2022 08:31:47 -0400 Received: from mail.marcansoft.com (marcansoft.com [212.63.210.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B82D2F614F; Thu, 27 Oct 2022 05:31:44 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: marcan@marcan.st) by mail.marcansoft.com (Postfix) with ESMTPSA id 6E26F3FA55; Thu, 27 Oct 2022 12:31:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=marcan.st; s=default; t=1666873902; bh=DhI7Jpa2fk46YynTb7FAUNf45bUY2pAqyB4/4XUT9U0=; h=Date:To:Cc:References:From:Subject:In-Reply-To; b=u2xvHArOBP4pV4EiGf77kPFgsS7pwRtF9nLL0NudQY1FM2bNADHHOQlFvimFEgeWp Sp5yO/NbMGgHFrIT3EGmAcqWIVU9SFNoQRrvvtF1Ytvt+tzgixM3ewch9Mvf3VkZFy WoFXr/g6sOJpR+MrwYlKm3W+v4acvNsGsDK4iicfq7woJ4bwqlWo7GF+O5V+onGHN4 XCdPsHLtsbdx45Mo1gfsR464EBcuTl6tBHr0jjTuQpnwfZn6WLVJ0847zQIx569Pzz HC4btRypjK7j/82a9NxJgdxiUASE6YWtCBLj0kak9FtKtL94O7qTQF/0z85804uyUe Cn+kA6+gGqPtA== Message-ID: Date: Thu, 27 Oct 2022 21:31:36 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Content-Language: en-US To: Thomas Zimmermann , Maarten Lankhorst , Maxime Ripard , David Airlie , Daniel Vetter , Javier Martinez Canillas Cc: Pekka Paalanen , dri-devel@lists.freedesktop.org, asahi@lists.linux.dev, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20221027101327.16678-1-marcan@marcan.st> From: Hector Martin Subject: Re: [PATCH] drm/simpledrm: Only advertise formats that are supported In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/10/2022 20.08, Thomas Zimmermann wrote: > We currently have two DRM drivers that call drm_fb_build_fourcc_list(): > simpledrm and ofdrm. I've been very careful to keep the format selection > in sync between them. (That's the reason why the helper exists at all.) > If the drivers start to use different logic, it will only become more > chaotic. > > The format array of ofdrm is at [1]. At a minimum, ofdrm should get the > same fix as simpledrm. Looks like this was merged recently, so I didn't see it on my tree (I was basing off of 6.1-rc2). Since this patch is a regression fix, it should be applied to drm-fixes (and automatically picked up by stable folks) soon to be fixed in 6.1, and then we can fix whatever is needed in ofdrm separately in drm-tip. As long as ofdrm is ready for the new behavior prior to the merge of drm-tip with 6.1, there will be no breakage. In this case, the change required to ofdrm is probably just to replace that array with just DRM_FORMAT_XRGB8888 (which should be the only supported fallback format for new drivers) and then to add a test to only expose it for formats for which we actually have conversion helpers, similar to what the the switch() enumerates here. That logic could later be moved into the helper as a refactor. >> /* Primary plane */ >> + switch (format->format) { > > I trust you when you say that ->XRGB8888 is not enough. But > although I've read your replies, I still don't understand why this > switch is necessary. > > Why don't we call drm_fb_build_fourcc_list() with the native > format/formats and let it append a number of formats, such as adding > XRGB888, adding ARGB8888 if necessary, adding ARGB2101010 if necessary. > Each with a elaborate comment why and which userspace needs the format. (?) That would be fine to do, it would just be moving the logic to the helper. That kind of refactoring is better suited for subsequent patches. This is a regression fix, it attempts to minimize the amount of refactoring, which means keeping the logic in simpledrm, to make it easier to review for correctness. Also, that would change the API of that function, which would likely make the merge with the new ofdrm painful. The way things are now, a small fix to ofdrm will make it compatible with both the state before and after this patch, which means the merge will go through painlessly, and then we can just refactor everything once everything is in the same tree. - Hector