From 536cc6c84a41b90d51933a27bdcef4e64719b7ce Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 21 Jan 2019 13:25:51 +0100 Subject: [PATCH] 4.19-stable patches added patches: drm-fb-helper-ignore-the-value-of-fb_var_screeninfo.pixclock.patch selftests-fix-test-errors-related-to-lib.mk-khdr-target.patch --- ...-value-of-fb_var_screeninfo.pixclock.patch | 80 +++++++++ ...errors-related-to-lib.mk-khdr-target.patch | 153 ++++++++++++++++++ queue-4.19/series | 2 + 3 files changed, 235 insertions(+) create mode 100644 queue-4.19/drm-fb-helper-ignore-the-value-of-fb_var_screeninfo.pixclock.patch create mode 100644 queue-4.19/selftests-fix-test-errors-related-to-lib.mk-khdr-target.patch diff --git a/queue-4.19/drm-fb-helper-ignore-the-value-of-fb_var_screeninfo.pixclock.patch b/queue-4.19/drm-fb-helper-ignore-the-value-of-fb_var_screeninfo.pixclock.patch new file mode 100644 index 00000000000..419b89d2aad --- /dev/null +++ b/queue-4.19/drm-fb-helper-ignore-the-value-of-fb_var_screeninfo.pixclock.patch @@ -0,0 +1,80 @@ +From 66a8d5bfb518f9f12d47e1d2dce1732279f9451e Mon Sep 17 00:00:00 2001 +From: Ivan Mironov +Date: Tue, 8 Jan 2019 12:23:53 +0500 +Subject: drm/fb-helper: Ignore the value of fb_var_screeninfo.pixclock + +From: Ivan Mironov + +commit 66a8d5bfb518f9f12d47e1d2dce1732279f9451e upstream. + +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 +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 +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpu/drm/drm_fb_helper.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- 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_va + 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. diff --git a/queue-4.19/selftests-fix-test-errors-related-to-lib.mk-khdr-target.patch b/queue-4.19/selftests-fix-test-errors-related-to-lib.mk-khdr-target.patch new file mode 100644 index 00000000000..36a5eb66ce6 --- /dev/null +++ b/queue-4.19/selftests-fix-test-errors-related-to-lib.mk-khdr-target.patch @@ -0,0 +1,153 @@ +From 211929fd3f7c8de4d541b1cc243b82830e5ea1e8 Mon Sep 17 00:00:00 2001 +From: Shuah Khan +Date: Wed, 12 Dec 2018 20:25:14 -0700 +Subject: selftests: Fix test errors related to lib.mk khdr target + +From: Shuah Khan + +commit 211929fd3f7c8de4d541b1cc243b82830e5ea1e8 upstream. + +Commit b2d35fa5fc80 ("selftests: add headers_install to lib.mk") added +khdr target to run headers_install target from the main Makefile. The +logic uses KSFT_KHDR_INSTALL and top_srcdir as controls to initialize +variables and include files to run headers_install from the top level +Makefile. There are a few problems with this logic. + +1. Exposes top_srcdir to all tests +2. Common logic impacts all tests +3. Uses KSFT_KHDR_INSTALL, top_srcdir, and khdr in an adhoc way. Tests + add "khdr" dependency in their Makefiles to TEST_PROGS_EXTENDED in + some cases, and STATIC_LIBS in other cases. This makes this framework + confusing to use. + +The common logic that runs for all tests even when KSFT_KHDR_INSTALL +isn't defined by the test. top_srcdir is initialized to a default value +when test doesn't initialize it. It works for all tests without a sub-dir +structure and tests with sub-dir structure fail to build. + +e.g: make -C sparc64/drivers/ or make -C drivers/dma-buf + +../../lib.mk:20: ../../../../scripts/subarch.include: No such file or directory +make: *** No rule to make target '../../../../scripts/subarch.include'. Stop. + +There is no reason to require all tests to define top_srcdir and there is +no need to require tests to add khdr dependency using adhoc changes to +TEST_* and other variables. + +Fix it with a consistent use of KSFT_KHDR_INSTALL and top_srcdir from tests +that have the dependency on headers_install. + +Change common logic to include khdr target define and "all" target with +dependency on khdr when KSFT_KHDR_INSTALL is defined. + +Only tests that have dependency on headers_install have to define just +the KSFT_KHDR_INSTALL, and top_srcdir variables and there is no need to +specify khdr dependency in the test Makefiles. + +Fixes: b2d35fa5fc80 ("selftests: add headers_install to lib.mk") +Cc: stable@vger.kernel.org +Signed-off-by: Shuah Khan +Signed-off-by: Greg Kroah-Hartman + + +--- + tools/testing/selftests/android/Makefile | 2 +- + tools/testing/selftests/futex/functional/Makefile | 1 + + tools/testing/selftests/gpio/Makefile | 1 + + tools/testing/selftests/kvm/Makefile | 2 +- + tools/testing/selftests/lib.mk | 8 ++++---- + tools/testing/selftests/networking/timestamping/Makefile | 1 + + tools/testing/selftests/vm/Makefile | 1 + + 7 files changed, 10 insertions(+), 6 deletions(-) + +--- a/tools/testing/selftests/android/Makefile ++++ b/tools/testing/selftests/android/Makefile +@@ -6,7 +6,7 @@ TEST_PROGS := run.sh + + include ../lib.mk + +-all: khdr ++all: + @for DIR in $(SUBDIRS); do \ + BUILD_TARGET=$(OUTPUT)/$$DIR; \ + mkdir $$BUILD_TARGET -p; \ +--- a/tools/testing/selftests/futex/functional/Makefile ++++ b/tools/testing/selftests/futex/functional/Makefile +@@ -19,6 +19,7 @@ TEST_GEN_FILES := \ + TEST_PROGS := run.sh + + top_srcdir = ../../../../.. ++KSFT_KHDR_INSTALL := 1 + include ../../lib.mk + + $(TEST_GEN_FILES): $(HEADERS) +--- a/tools/testing/selftests/gpio/Makefile ++++ b/tools/testing/selftests/gpio/Makefile +@@ -9,6 +9,7 @@ EXTRA_OBJS := ../gpiogpio-event-mon-in.o + EXTRA_OBJS += ../gpiogpio-hammer-in.o ../gpiogpio-utils.o ../gpiolsgpio-in.o + EXTRA_OBJS += ../gpiolsgpio.o + ++KSFT_KHDR_INSTALL := 1 + include ../lib.mk + + all: $(BINARIES) +--- a/tools/testing/selftests/kvm/Makefile ++++ b/tools/testing/selftests/kvm/Makefile +@@ -1,6 +1,7 @@ + all: + + top_srcdir = ../../../../ ++KSFT_KHDR_INSTALL := 1 + UNAME_M := $(shell uname -m) + + LIBKVM = lib/assert.c lib/elf.c lib/io.c lib/kvm_util.c lib/sparsebit.c +@@ -40,4 +41,3 @@ $(OUTPUT)/libkvm.a: $(LIBKVM_OBJ) + + all: $(STATIC_LIBS) + $(TEST_GEN_PROGS): $(STATIC_LIBS) +-$(STATIC_LIBS):| khdr +--- a/tools/testing/selftests/lib.mk ++++ b/tools/testing/selftests/lib.mk +@@ -16,18 +16,18 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT) + TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED)) + TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES)) + ++ifdef KSFT_KHDR_INSTALL + top_srcdir ?= ../../../.. + include $(top_srcdir)/scripts/subarch.include + ARCH ?= $(SUBARCH) + +-all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) +- + .PHONY: khdr + khdr: + make ARCH=$(ARCH) -C $(top_srcdir) headers_install + +-ifdef KSFT_KHDR_INSTALL +-$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES):| khdr ++all: khdr $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) ++else ++all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) + endif + + .ONESHELL: +--- a/tools/testing/selftests/networking/timestamping/Makefile ++++ b/tools/testing/selftests/networking/timestamping/Makefile +@@ -6,6 +6,7 @@ TEST_PROGS := hwtstamp_config rxtimestam + all: $(TEST_PROGS) + + top_srcdir = ../../../../.. ++KSFT_KHDR_INSTALL := 1 + include ../../lib.mk + + clean: +--- a/tools/testing/selftests/vm/Makefile ++++ b/tools/testing/selftests/vm/Makefile +@@ -24,6 +24,7 @@ TEST_GEN_FILES += virtual_address_range + + TEST_PROGS := run_vmtests + ++KSFT_KHDR_INSTALL := 1 + include ../lib.mk + + $(OUTPUT)/userfaultfd: LDLIBS += -lpthread diff --git a/queue-4.19/series b/queue-4.19/series index 37edc2dbbc4..5c26ef1e633 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -95,3 +95,5 @@ loop-avoid-circular-locking-dependency-between-loop_ctl_mutex-and-bd_mutex.patch loop-get-rid-of-nested-acquisition-of-loop_ctl_mutex.patch loop-fix-double-mutex_unlock-loop_ctl_mutex-in-loop_control_ioctl.patch loop-drop-caches-if-offset-or-block_size-are-changed.patch +drm-fb-helper-ignore-the-value-of-fb_var_screeninfo.pixclock.patch +selftests-fix-test-errors-related-to-lib.mk-khdr-target.patch -- 2.47.2