Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2295437lqt; Mon, 22 Apr 2024 07:08:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQ9j28vlqxKRhbmlQynRklV4eI+DJtgIjAjEUNwQpMhZPpvYedALBCRzzUwlRI5aQiaM+ic0FqYrEC3AyDT3aE4/cjK6zHW/7WdJVR4Q== X-Google-Smtp-Source: AGHT+IFuQRutqTgdo4nTaxXPOR1LBMiCkoCW7+8bWGia5LzSJi+RPnRAAu0RExFNvN98Ha7UwDRT X-Received: by 2002:a17:902:d486:b0:1e4:32b9:c39d with SMTP id c6-20020a170902d48600b001e432b9c39dmr12362212plg.13.1713794909962; Mon, 22 Apr 2024 07:08:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713794909; cv=pass; d=google.com; s=arc-20160816; b=DSAN1H5ktnSRDqRcRDT66YlXEVLCZ8etxnE6uZAx6NGUH3UCKogUBFgbDy3g4yAR/3 zNfUXtiwX7ipQ7csOUZqAfgZncgzGO1uJOsGrTlJRdipb5WS9Yen9+eHh4oIGzRFJe6Q Q1GCOEheyKlDoppqsFNDvJzuTyj+uQCFuxVkpsH0/0SsaXgtBk1yvq8J1jlfjbosoyYM zXSV6DSpTsQ43WpRouexPKGxam5dkQtKk3jOUu753x/jrS21eNHlZ+i7aGPDb7rJ3m9L I67av0D3qMUSAtJhtr3WaJ7Z0dvEjCK3bdpjlyu+4yjbZEJy2GbmzMjTAdRmbki+KGvo TSjg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:mail-followup-to:message-id:subject:cc:to:from :date; bh=0drWE1DZSTcu7PxA5ApK4Ud7x6Fi1le4RvRBHAizoNI=; fh=uqxnVl3eKKaimGSwELim82merZBYCFci9s3fUVov3k4=; b=Emth0JNjl7S5ouoo1bTJkt8/AdGFTRZL2sSkOo8aSQoiKnEJbxrn0EwLzSVQdNiPb6 bUYWtRPg3OmouVGLMLeyqIILDg8aPkGrpHLRXCY2NtsWTxnqgGGxYj0kNLXq/Pil6p5u 6xnyHD5aTFlSCaK55bv1FtoH5nE4gVzdx9/iKnI8fRsYVwnqg1Ge3ixWXI/ShMuGtc++ MXrgcf+WXaPTnf+1gjCfBHgxh5bWV5gzl0QczZBp+OJQKPPzuZ2yh4j5/iJNVHg4uEkr CXGT/cmKqnTBtlXgpF/U2gLqGnCeiYZ+NyhW4O8x/NiMiXMukftGbYab8SF3Ek/XnURi v/fA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-153508-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153508-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e10-20020a170903240a00b001e49428f32fsi8155950plo.252.2024.04.22.07.08.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 07:08:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153508-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-153508-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153508-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4CA5C2828E1 for ; Mon, 22 Apr 2024 13:58:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 171D5150997; Mon, 22 Apr 2024 13:58:40 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9836514F128 for ; Mon, 22 Apr 2024 13:58:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713794319; cv=none; b=dUdf0VvIMoaoecmC1Eeqtb4wDd+kl1ilSTO+WSft+yQGXzAk2iu1qn7WQu1/4v+7KUv/ET7k8S0Nayi6cTAH5SqKizz0Hl8s1Ad1No0czafWUtGIiwEXhD8fGXy0CyKQuBh/wH0U069GEUhM7aGO5xYEpz/sl1Fks/HjOU1N3Zk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713794319; c=relaxed/simple; bh=AhIzPpS4/x0BXMalxZulG6AWY5tEbwV7bUsloM23qZI=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=kMnbETI7Y7S4V1V2JOfo16gD2fieRkEWRkv+sDB6DhjnZrWcQ5HUiCvR2ahN7Yi3Ph0pG7urCX1R1gt+96Ya77fgflPHgBx7sxanQ2ZnKwULYqkqPBy76D+0fW7Wzj27py8YRI+3034mU4/eZx+TLA8imj11FTMHqmJCerGUqQo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ryuBV-0004mi-PP; Mon, 22 Apr 2024 15:58:17 +0200 Received: from [2a0a:edc0:2:b01:1d::c5] (helo=pty.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ryuBU-00Dhch-1z; Mon, 22 Apr 2024 15:58:16 +0200 Received: from mol by pty.whiteo.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1ryuBT-0089hS-37; Mon, 22 Apr 2024 15:58:15 +0200 Date: Mon, 22 Apr 2024 15:58:15 +0200 From: Michael Olbrich To: dri-devel@lists.freedesktop.org, David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Ville =?utf-8?B?U3lyasOkbMOk?= , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: graphics@pengutronix.de Subject: Reliably selecting non-CEA modes on Intel graphics (and maybe others) Message-ID: Mail-Followup-To: dri-devel@lists.freedesktop.org, David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Ville =?utf-8?B?U3lyasOkbMOk?= , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-kernel@vger.kernel.org, graphics@pengutronix.de Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mol@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Hi, In short: I have a HDMI monitor attached to Intel graphics. I'm trying to set a non-CEA mode but the driver always maps it to the corresponding CEA mode. More specifically, the monitor has two 1920x1080@60 modes in the EDID: 1. The CEA mode with VIC 16 2. A custom DTD mode with exactly the same timings (this is the preferred mode). From a userspace perspective, the two modes are mostly identical, except for the 16:9 aspect ratio flag in the CEA mode and the preferred type in the other. I want to select the second (preferred) mode, but that does not seem possible: intel_hdmi_compute_avi_infoframe() tries to determine which VIC should be added to the avi infoframe and if limited or full range is used. It uses various DRM helpers here but in the end drm_match_cea_mode() is called. And here lies the problem: The mode provided by the userspace has explicitly no aspect ratio. But here, it is interpreted as "the aspect ration is undefined". So matching ignored the aspect ratio and the CEA mode with VIC 16 is found and limited range is used. The commit that introduces this fuzzy matching 357768cc9e3fdacf6551da0ae1483bc87dbcb4e8 ("drm/edid: Fix cea mode aspect ratio handling") made sense at the time. The capability DRM_CLIENT_CAP_ASPECT_RATIO that exposes aspect ratios to userspace was introduced later in the same merge request, from what I can tell 7595bda2fb4378ccbb8db1d0e8de56d15ea7f7fa ("drm: Add DRM client cap for aspect-ratio"). Am I missing something here, or is it just not possible to select the non-CEA mode right now? In my specific example, the selected CEA mode is actually supported by the monitor, but as far as I can tell, the CEA mode is used even if the monitor does not support it at all. I've only tested this on Intel, but I assume that other drivers that use the same helpers have the same problem. So how can this be fixed? I've considered matching the aspect ratio based on the DRM_CLIENT_CAP_ASPECT_RATIO capability, but I'm not sure if that is valid. The documentation is limited and I found nothing that describes what the userspace should do here. Or would a new capability make sense here? Or something entirely different? I'm not sure how I should proceed here. Any help would be appreciated. Regards, Michael -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |