Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7573023imu; Fri, 28 Dec 2018 00:34:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/W7CqYjeW/oIi7CaKfaUFyWSW18mNPIYSMRxYS8k3x+TU7jy3BLm7o8Ve6rcfSerYFOEfx6 X-Received: by 2002:a62:3c1:: with SMTP id 184mr27481453pfd.56.1545986074706; Fri, 28 Dec 2018 00:34:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545986074; cv=none; d=google.com; s=arc-20160816; b=Rgq1vxQR8Pgk3WxG2LWYtETOvBR2/xCjuZO4qFkAr1wnSTVsFS6qf8NSYOZvk7eKHa qK7aCTI1PS4y0Boj7pPeAcip6/stDHAYfq+JAr28oGwMGsrvM/MBwNMKDefZBQTnuUhK MPNTmQ/oXOM16f6gTnYR0dCD29G41lswFhaFZ4FCN7Qdq+I1ZQcob2nmIYTBzkPH4NlN +D3U7HsUYRrNhCOWkOjnGCMIPaM260rcFpSd1XHMmmdgkfJk7iXhtKi0jzbSvOxoB2xA Njs3sUeSpK+kqhLy0O0LAAbqOdH8kRLuDinvGTDqZ51rG2vz30qcbLL8OJZpQAXX6nO6 vFZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=URbOQWmYlI+0we5iK6KytIpNXXKBn6Nr5IN7n0Yz/s8=; b=X8Adf80icskLIeR8GcIHR4PIcebSqdc0F/Fi9ZIhQoDKriMNfumJnyOuNsGxBPdWk+ CUar+I8aj8ghWm/QEodu/kyTbQFClR9JUsVXPGZCjDaKLt0yi8M1OqnH647mqa7n1l7K rvjZl3i++VD15RZ6Ba+x2tihsqU2rNeOHHaodAwpJN6h2nI5rKJJ+95sk+SZBduOi+I2 j1l6A6NboURxpwHHUzb1LiZsjVz9dna/3fcGyDBcaavfG1GuO/qYA4D0Cv4JfXe+y18m QK4qCQez+bCM3QEZqlHZhnBVd8b91DzEfEimTghxrqn0sefDhxTxv9xiHJ4gvJc8MMJD S5xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JVc7p2vg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z71si24865575pgd.490.2018.12.28.00.34.20; Fri, 28 Dec 2018 00:34:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JVc7p2vg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733202AbeL0XNx (ORCPT + 99 others); Thu, 27 Dec 2018 18:13:53 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:37465 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728466AbeL0XNw (ORCPT ); Thu, 27 Dec 2018 18:13:52 -0500 Received: by mail-lj1-f193.google.com with SMTP id t18-v6so17388205ljd.4 for ; Thu, 27 Dec 2018 15:13:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=URbOQWmYlI+0we5iK6KytIpNXXKBn6Nr5IN7n0Yz/s8=; b=JVc7p2vg47jpzOp1VljS0TkPW59iHI/nLLd2aFl1zYJPD0ElkCthJDPXWi2kODYSZ+ uvgswzmwjELV6Aoph7uZWMQIU7f1J0Sf8jaCkX5M+y7WhKKctgqGikyn/RfTZ3JKeoJE OPjgzPF/crqisdav7/kIDwtbh3OxgH2eOjpjXI3NrRqZlPvMtEPN8yxZc0LXHDXi0T7N LRMfEokWRKuZnfz0WrS/1yO7+N6C/ZNRRFvOHTZP618eF7vaHh3wKWQM+th5fdVhrsYz UrCRxCXUjMhn5XHcu4otUZEvBQZpM3lIhZnrvNTXLgS9M7H/ex3cXlJlBR+FcK4k2oSz PTRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=URbOQWmYlI+0we5iK6KytIpNXXKBn6Nr5IN7n0Yz/s8=; b=OcyuqbeA0/QP7gE6KzZihmjc8pqihugHacYzNO9wNlyof4ZZD/ads7CV5PunKCOSl/ w5hBx3HnUiw0ajpzYDeaCTADykbHW6lMyAnuib2Cmpzsj28B20t4OpAQq0jPLUYIU9ad hoWUzuNqktp07himKSTiJJ01Nzc+241rpjq35u/RV7UIXbryQ0vkKOQxdB7tARt02Tvf 04yk1k4pIydA+YxyyoGgNJJ27XGeCw8y10zmpMw+PTXP8jL1qkSUZMnqMhfODmEgyUlm tBN6PAETRLI7ct4BpeyAbzGui4ydKJ1wisxLJJq5fOXnW7GT4Zjc6LjYjybNLnb2KZMW c8qA== X-Gm-Message-State: AJcUukfGfsImUnlW620Bq+Crx2tg2SRYLMfkQQdszDk4nfmi2DP55+qu QmcpRMZwd1T4pZz3N9tOwH0= X-Received: by 2002:a2e:302:: with SMTP id 2-v6mr14038206ljd.137.1545952429555; Thu, 27 Dec 2018 15:13:49 -0800 (PST) Received: from localhost.localdomain (pool-109-191-228-208.is74.ru. [109.191.228.208]) by smtp.gmail.com with ESMTPSA id r4sm7834626lfe.60.2018.12.27.15.13.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Dec 2018 15:13:49 -0800 (PST) From: Ivan Mironov To: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , saahriktu , Eugeniy Paltsev , Ivan Mironov Subject: [PATCH v1 2/2] drm/fb-helper: Ignore the value of fb_var_screeninfo.pixclock Date: Fri, 28 Dec 2018 04:13:08 +0500 Message-Id: <20181227231308.16904-3-mironov.ivan@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181227231308.16904-1-mironov.ivan@gmail.com> References: <20181227231308.16904-1-mironov.ivan@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Strict requirement of pixclock to be zero breaks support of SDL 1.2 which contains hardcoded table of supported video modes with non-zero pixclock values[1]. To better understand which pixclock values are considered valid and how driver should handle these values, I briefly examined few existing fbdev drivers and documentation in Documentation/fb/. And it looks like there are no strict rules on that and actual behaviour varies: * some drivers treat (pixclock == 0) as "use defaults" (uvesafb.c); * some treat (pixclock == 0) as invalid value which leads to -EINVAL (clps711x-fb.c); * some pass converted pixclock value to hardware (uvesafb.c); * some are trying to find nearest value from predefined table (vga16fb.c, video_gx.c). Given this, I believe that it should be safe to just ignore this value if changing is not supported. It seems that any portable fbdev application which was not written only for one specific device working under one specific kernel version should not rely on any particular behaviour of pixclock anyway. However, while enabling SDL1 applications to work out of the box when there is no /etc/fb.modes with valid settings, this change affects the video mode choosing logic in SDL. Depending on current screen resolution, contents of /etc/fb.modes and resolution requested by application, this may lead to user-visible difference (not always): image will be displayed in a right way, but it will be aligned to the left instead of center. There is no "right behaviour" here as well, as emulated fbdev, opposing to old fbdev drivers, simply ignores any requsts of video mode changes with resolutions smaller than current. Feel free to NAK this patch if you think that it causes breakage of user-space =). The easiest way to reproduce this problem is to install sdl-sopwith[2], remove /etc/fb.modes file if it exists, and then try to run sopwith from console without X. At least in Fedora 29, sopwith may be simply installed from standard repositories. [1] SDL 1.2.15 source code, src/video/fbcon/SDL_fbvideo.c, vesa_timings [2] http://sdl-sopwith.sourceforge.net/ Signed-off-by: Ivan Mironov --- drivers/gpu/drm/drm_fb_helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index aff576c3c4fb..b95a0c23c7c8 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -1690,9 +1690,14 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, struct drm_fb_helper *fb_helper = info->par; struct drm_framebuffer *fb = fb_helper->fb; - if (var->pixclock != 0 || in_dbg_master()) + if (in_dbg_master()) return -EINVAL; + if (var->pixclock != 0) { + DRM_DEBUG("fbdev emulation doesn't support changing the pixel clock, value of pixclock is ignored\n"); + var->pixclock = 0; + } + if ((drm_format_info_block_width(fb->format, 0) > 1) || (drm_format_info_block_height(fb->format, 0) > 1)) return -EINVAL; -- 2.20.1