Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37819C43387 for ; Thu, 17 Jan 2019 03:03:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F20A320675 for ; Thu, 17 Jan 2019 03:03:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZYFPkxrm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727669AbfAQDDd (ORCPT ); Wed, 16 Jan 2019 22:03:33 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:47089 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727595AbfAQDDd (ORCPT ); Wed, 16 Jan 2019 22:03:33 -0500 Received: by mail-lf1-f66.google.com with SMTP id y14so6574687lfg.13 for ; Wed, 16 Jan 2019 19:03:31 -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:mime-version :content-transfer-encoding; bh=I5Uffw3QnEltW0RPTxKrrHGIvqebA9rM+MG6Ps21pCk=; b=ZYFPkxrm07dn6Lv8kT/eYeMz8YmPOG89bRVpZf9Bhm78kKbMDXz/sk8FF9aK8msOfq 6Uu5JeEzst63IjXt+Ws0IfnqkbzUbJi+jm7/tPvtZ22fG5z5C3PDAW5+UpSrm3+FG4ur SeMljD1Qfrt2HVFGqyREyMFhVU+2X/ghhUNpXF36MLMjtmZvxfrZLKTpb1clNBeS/hm4 5tWB3CtKxMf+4wcnb0HVV3pO121b0DZM/Kwk8AS6jSI3avxKSdcXQd/iP/7UcIueZAru xuj/Nl3iDeDHiuJR6zqIpWJzYB3SE7QLCtoApeGLkonmWRi99wHjwG+KeE45ZYdelv7I SAtw== 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:mime-version :content-transfer-encoding; bh=I5Uffw3QnEltW0RPTxKrrHGIvqebA9rM+MG6Ps21pCk=; b=eIcI2tohPzZaOJfMelNw7BtJ4D2lxHTIU8DSmUDwXGASUySynrxWu9gT1JSePlaMZV iQ4CVQsq7VNUgI20AIsS3W0zZObo0MEzCszwScY2OYNNruNYaC9xULT3ign9nArxQgsZ CKAEP3iu+r7CbLE3/11Q04an9KOnV09dgm2b+2/3bevP6SwhBwIzPqmD8jCeKW5RTgQo b6IS1U+mcnQziX1zjHZys0sujTIamRER0rRiR0FDHc/zYx1fQHXPwV5Xei3pBrPpgrIa /2mrvu/JqxD0azabX43rqH2YVwOgJH50kd5saUQF/m70+puOYxxN9ISXcRN7c8Zzfoxn Z77w== X-Gm-Message-State: AJcUukdG4stpoDGmgeBDwkjmEUizn/HrtLZL35VbgZRMAYdS01BC3mBp iYyJ4tVrpD3uDsx6VRFj+IGBphE/ X-Google-Smtp-Source: ALg8bN6lAgu/xsPSMYZaq6hJEjHm8A/lIhLikTJ6iTNd0irsGPU0cX3MuD/cZIKlidSxzxs8Nm0jIg== X-Received: by 2002:a19:3fcf:: with SMTP id m198mr8765934lfa.106.1547694210770; Wed, 16 Jan 2019 19:03:30 -0800 (PST) Received: from localhost.localdomain (pool-109-191-228-208.is74.ru. [109.191.228.208]) by smtp.gmail.com with ESMTPSA id a19sm42175lfi.57.2019.01.16.19.03.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 19:03:29 -0800 (PST) From: Ivan Mironov To: stable@vger.kernel.org Cc: Ivan Mironov , Daniel Vetter Subject: [PATCH] drm/fb-helper: Ignore the value of fb_var_screeninfo.pixclock Date: Thu, 17 Jan 2019 08:02:33 +0500 Message-Id: <20190117030234.23204-1-mironov.ivan@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org commit 66a8d5bfb518f9f12d47e1d2dce1732279f9451e upstream. Backported by adjusting patch context. 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. 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 Cc: stable@vger.kernel.org # 4.14.x Cc: stable@vger.kernel.org # 4.19.x Cc: stable@vger.kernel.org # 4.20.x Fixes: 79e539453b34e ("DRM: i915: add mode setting support") Fixes: 771fe6b912fca ("drm/radeon: introduce kernel modesetting for radeon hardware") Fixes: 785b93ef8c309 ("drm/kms: move driver specific fb common code to helper functions (v2)") Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20190108072353.28078-3-mironov.ivan@gmail.com --- 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 ad6812baa611..f1259a0c2883 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -1578,9 +1578,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; + } + /* * Changes struct fb_var_screeninfo are currently not pushed back * to KMS, hence fail if different settings are requested. -- 2.20.1