Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3381142imu; Mon, 7 Jan 2019 02:14:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/WfeR9x2A9vPisO6xssfqMWgfh779691UNk6E05OLJCC/84MiqcR+uZiG8c6HMq/reNcRPE X-Received: by 2002:a62:53c5:: with SMTP id h188mr61665071pfb.190.1546856059346; Mon, 07 Jan 2019 02:14:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546856059; cv=none; d=google.com; s=arc-20160816; b=0s/B/rJWNsHUMUSgNN1CmJHlI07h33qP4xRC1CCL8JiHx5TiW6ClawIvGFsMldcaW5 SGJAu/dq74sYLVWHM3H/vhHBHHmmqshwGE8x7seiEsHrwg/MxKo716d7Gqbetj0hCyAw 3GL+jCDxyekDl0Q88vkVQCKUweFPT/mWtSa7Rb1bjEM+UyH7XoqUJYCZ+nUDoOIhSsNu k0gPJfx24jThIgyU6exlXi9Gcf/kX/mwAxGqgLjYzHZ5eiLr4Rf9vjBueRg5ueCmafX6 Ubu8L9NiFQHCGpZYOLu3gDMNmbJuJ50VtzdDXa8irvVDMRUVo5trQa42JKtRmuzkiqaN qSIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=qUkbCEmsntdfIG+umww963vUUwTtYgwvxVwPjf2SD/8=; b=RJooC1Rf4AmwVB8oxEBdBwN5PKXFUAK9RjQmJfcwpjicSND51kqgDWe3/MEDeL3l2a ZXjZzhwqmf3zJX3sOD/4d8GZSsQeG8bRnkJkpk33avtpblefLonFwzWD4eQ61HpklneG +pCqF1X62Vf0GtdFSNvArH9hSXSfWx9Rb1/y90DZmzXJMYkFs5bkz8V4E6kmR+aRQEkN 06mfHL1wqJolO5Co+KhxPD90g+E6BXAnm5TFMWyaOWNjHFmFdQt+U/LLovcV2rMNYNcv Tup6GplAkh3jmkHvHn8Y1kM0QkeFmaOj4zvESZtz01sKbb/s7C5I3K1eCAPYvBkn48K2 AsoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=DZct6zBL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s38si10411201pga.38.2019.01.07.02.14.04; Mon, 07 Jan 2019 02:14:19 -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=fail header.i=@ffwll.ch header.s=google header.b=DZct6zBL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727034AbfAGKLZ (ORCPT + 99 others); Mon, 7 Jan 2019 05:11:25 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:34668 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726878AbfAGKK2 (ORCPT ); Mon, 7 Jan 2019 05:10:28 -0500 Received: by mail-ed1-f67.google.com with SMTP id b3so334639ede.1 for ; Mon, 07 Jan 2019 02:10:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=qUkbCEmsntdfIG+umww963vUUwTtYgwvxVwPjf2SD/8=; b=DZct6zBL6cO8bvOVvbgRzCoic5h4bzwzfjIDjukSlHsl9iCEC/r7y+qPl0mZkDmJaw pUhf5jZ1bSGT2eP1G+ROOHv4+96/8QuuJ0O1EjTVw42j/f4S3aYsLLkZkngcFVu807Lh aGWpsa+ltf8mm4tN7ZXhQluGA/cM56qbyFPIc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=qUkbCEmsntdfIG+umww963vUUwTtYgwvxVwPjf2SD/8=; b=SAzmZnWoaJ9tcRxc4fX8OZGzTZqhEeM9Ca0MSoTmXuH310b0upDXkea7jQy1xzbk/x RW4ycHyAD6G6A/gNj2EZzjzelcVNniW1SWRtvf+yNWp73xTlYDJjgFjxpNMkRvIc8Kan lcqnRqY2RYP68sUaw1IGRQJ7NRhSNW6tOtpQNFyq4Efry5INIoKELXyDL6WiacfHIdD/ S7TRk+FN3/BO0UmJOZgvWmzo6iMyml++r/ysCgu9vTWlgN9P53GepkwFr7b0uggTX/UV 8lK3kXv6kjxbbR5/JCyxeKCPaLRKKmwK8Py79Ema4UB/3igOsLG1TKjvtN8DINA+Xe8U hsTQ== X-Gm-Message-State: AA+aEWa58TDI0UVm0n/7VlCiGir/Qnh2bphy2VQhjxaolBghrHkhbinQ ov3MgP31b+pySt/lZtIJGtpaVg== X-Received: by 2002:a17:906:6a9b:: with SMTP id p27-v6mr47172326ejr.235.1546855825787; Mon, 07 Jan 2019 02:10:25 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id gk8-v6sm19867143ejb.42.2019.01.07.02.10.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Jan 2019 02:10:25 -0800 (PST) Date: Mon, 7 Jan 2019 11:10:22 +0100 From: Daniel Vetter To: Ivan Mironov Cc: Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , saahriktu , Eugeniy Paltsev Subject: Re: [PATCH v1 2/2] drm/fb-helper: Ignore the value of fb_var_screeninfo.pixclock Message-ID: <20190107101022.GA21184@phenom.ffwll.local> Mail-Followup-To: Ivan Mironov , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , saahriktu , Eugeniy Paltsev References: <20181227231308.16904-1-mironov.ivan@gmail.com> <20181227231308.16904-3-mironov.ivan@gmail.com> <20181228120652.GR9058@dvetter-linux.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 4.18.0-2-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 05, 2019 at 09:21:21PM +0500, Ivan Mironov wrote: > On Fri, 2018-12-28 at 13:06 +0100, Daniel Vetter wrote: > > On Fri, Dec 28, 2018 at 04:13:08AM +0500, Ivan Mironov wrote: > > > 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 =). > > > > It's a regression, we don't nack regression fixes :-) > > > > > 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 > > > > I thought this is also a regression fix, so also needs Fixes: and cc: > > stable? > > -Daniel > > This particular patch fixes a bug that existed for 10 years unnoticed. > Are "Fixes:" and "Cc: stable" really required? > > "pixclock != 0" check was introduced in this file by 785b93ef8c309 > ("drm/kms: move driver specific fb common code to helper functions > (v2)"). But actually similar code existed in the device-specific > drivers even earlier. Afaui 785b93ef8c309 broke existing userspace. Broken userspace, but existing userspace, and hence we need to fix this regression. That's the rules with linux upstream, existing userspace is never allowed to break, even if it does really stupid things. Hence Cc: stable. -Daniel > > > > > > --- > > > 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 > > > > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch