1. 03 4月, 2019 3 次提交
  2. 28 3月, 2019 1 次提交
  3. 27 3月, 2019 4 次提交
  4. 26 3月, 2019 1 次提交
    • D
      drm/fbdev: Make skip_vt_switch the default · 8782c647
      Daniel Vetter 提交于
      KMS drivers really should all be able to restore their display state
      on resume without fbcon helping out. So make this the default.
      
      Since I'm not entirely foolish, make it only a default, which drivers
      can still override. That way when the inevitable regression report
      happens I can fix things up with a one-liner plus FIXME comment that
      someone should fix up the suspend/resume code in that driver.
      
      But at least all new drivers won't be broken by accident as soon as
      you turn off fbcon because "suspend/resume worked when I tested it".
      
      v2: Keep this for radeon because of
      
      commit 18c437ca
      Author: Alex Deucher <alexander.deucher@amd.com>
      Date:   Tue Nov 14 17:19:29 2017 -0500
      
          Revert "drm/radeon: dont switch vt on suspend"
      
      Thanks to Michel Dänzer for pointing this one out.
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Cc: Michel Dänzer <michel@daenzer.net>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Maxime Ripard <maxime.ripard@bootlin.com>
      Cc: Sean Paul <sean@poorly.run>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Cc: Sandy Huang <hjc@rock-chips.com>
      Cc: "Heiko Stübner" <heiko@sntech.de>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: "Christian König" <christian.koenig@amd.com>
      Cc: Samuel Li <Samuel.Li@amd.com>
      Cc: "Michel Dänzer" <michel.daenzer@amd.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Junwei Zhang <Jerry.Zhang@amd.com>
      Cc: Huang Rui <ray.huang@amd.com>
      Cc: Shirish S <shirish.s@amd.com>
      Cc: Daniel Stone <daniels@collabora.com>
      Cc: "Noralf Trønnes" <noralf@tronnes.org>
      Cc: intel-gfx@lists.freedesktop.org
      Cc: nouveau@lists.freedesktop.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-rockchip@lists.infradead.org
      Reviewed-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Acked-by: NHeiko Stuebner <heiko@sntech.de>
      Tested-by: NHeiko Stuebner <heiko@sntech.de>
      Reviewed-by: NSamuel Li <samuel.li@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20181127173424.301-1-daniel.vetter@ffwll.ch
      8782c647
  5. 21 2月, 2019 1 次提交
  6. 04 2月, 2019 1 次提交
  7. 29 1月, 2019 1 次提交
    • N
      drm/fb-helper: generic: Fix drm_fbdev_client_restore() · 78de14c2
      Noralf Trønnes 提交于
      If fbdev setup has failed, lastclose will give a NULL pointer deref:
      
      [   77.794295] [drm:drm_lastclose]
      [   77.794414] [drm:drm_lastclose] driver lastclose completed
      [   77.794660] Unable to handle kernel NULL pointer dereference at virtual address 00000014
      [   77.809460] pgd = b376b71b
      [   77.818275] [00000014] *pgd=175ba831, *pte=00000000, *ppte=00000000
      [   77.830813] Internal error: Oops: 17 [#1] ARM
      [   77.840963] Modules linked in: mi0283qt mipi_dbi tinydrm raspberrypi_hwmon gpio_backlight backlight snd_bcm2835(C) bcm2835_rng rng_core
      [   77.865203] CPU: 0 PID: 527 Comm: lt-modetest Tainted: G         C        5.0.0-rc1+ #1
      [   77.879525] Hardware name: BCM2835
      [   77.889185] PC is at restore_fbdev_mode+0x20/0x164
      [   77.900261] LR is at drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0x9c
      [   78.002446] Process lt-modetest (pid: 527, stack limit = 0x7a3d5c14)
      [   78.291030] Backtrace:
      [   78.300815] [<c04f2d0c>] (restore_fbdev_mode) from [<c04f4708>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0x9c)
      [   78.319095]  r9:d8a8a288 r8:d891acf0 r7:d7697910 r6:00000000 r5:d891ac00 r4:d891ac00
      [   78.334432] [<c04f46b4>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c04f47e8>] (drm_fbdev_client_restore+0x18/0x20)
      [   78.353296]  r8:d76978c0 r7:d7697910 r6:d7697950 r5:d7697800 r4:d891ac00 r3:c04f47d0
      [   78.368689] [<c04f47d0>] (drm_fbdev_client_restore) from [<c051b6b4>] (drm_client_dev_restore+0x7c/0xc0)
      [   78.385982] [<c051b638>] (drm_client_dev_restore) from [<c04f8fd0>] (drm_lastclose+0xc4/0xd4)
      [   78.402332]  r8:d76978c0 r7:d7471080 r6:c0e0c088 r5:d8a85e00 r4:d7697800
      [   78.416688] [<c04f8f0c>] (drm_lastclose) from [<c04f9088>] (drm_release+0xa8/0x10c)
      [   78.431929]  r5:d8a85e00 r4:d7697800
      [   78.442989] [<c04f8fe0>] (drm_release) from [<c02640c4>] (__fput+0x104/0x1c8)
      [   78.457740]  r8:d5ccea10 r7:d96cfb10 r6:00000008 r5:d74c1b90 r4:d8a8a280
      [   78.472043] [<c0263fc0>] (__fput) from [<c02641ec>] (____fput+0x18/0x1c)
      [   78.486363]  r10:00000006 r9:d7722000 r8:c01011c4 r7:00000000 r6:c0ebac6c r5:d892a340
      [   78.501869]  r4:d8a8a280
      [   78.512002] [<c02641d4>] (____fput) from [<c013ef1c>] (task_work_run+0x98/0xac)
      [   78.527186] [<c013ee84>] (task_work_run) from [<c010cc54>] (do_work_pending+0x4f8/0x570)
      [   78.543238]  r7:d7722030 r6:00000004 r5:d7723fb0 r4:00000000
      [   78.556825] [<c010c75c>] (do_work_pending) from [<c0101034>] (slow_work_pending+0xc/0x20)
      [   78.674256] ---[ end trace 70d3a60cf739be3b ]---
      
      Fix by using drm_fb_helper_lastclose() which checks if fbdev is in use.
      
      Fixes: 9060d7f4 ("drm/fb-helper: Finish the generic fbdev emulation")
      Cc: stable@vger.kernel.org
      Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
      Reviewed-by: NGerd Hoffmann <kraxel@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190125150300.33268-1-noralf@tronnes.org
      78de14c2
  8. 17 1月, 2019 1 次提交
  9. 11 1月, 2019 1 次提交
    • L
      drm/fb-helper: Scale back depth to supported maximum · f4bd542b
      Linus Walleij 提交于
      The following happened when migrating an old fbdev driver to DRM:
      
      The Integrator/CP PL111 supports 16BPP but only ARGB1555/ABGR1555
      or XRGB1555/XBGR1555 i.e. the maximum depth is 15.
      
      This makes the initialization of the framebuffer fail since
      the code in drm_fb_helper_single_fb_probe() assigns the same value
      to sizes.surface_bpp and sizes.surface_depth. I.e. it simply assumes
      a 1-to-1 mapping between BPP and depth, which is true in most cases
      but not for this hardware that only support odd formats.
      
      To support the odd case of a driver supporting 16BPP with only 15
      bits of depth, this patch will make the code loop over the formats
      supported on the primary plane on each CRTC managed by the FB
      helper and cap the depth to the maximum supported on any primary
      plane.
      
      On the PL110 Integrator, this makes drm_mode_legacy_fb_format()
      select DRM_FORMAT_XRGB1555 which is acceptable for this driver, and
      thus we get framebuffer, penguin and console on the Integrator/CP.
      
      Cc: Noralf Trønnes <noralf@tronnes.org>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190110114049.10618-1-linus.walleij@linaro.org
      f4bd542b
  10. 10 1月, 2019 2 次提交
    • I
      drm/fb-helper: Ignore the value of fb_var_screeninfo.pixclock · 66a8d5bf
      Ivan Mironov 提交于
      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: NIvan Mironov <mironov.ivan@gmail.com>
      Cc: stable@vger.kernel.org
      Fixes: 79e53945 ("DRM: i915: add mode setting support")
      Fixes: 771fe6b9 ("drm/radeon: introduce kernel modesetting for radeon hardware")
      Fixes: 785b93ef ("drm/kms: move driver specific fb common code to helper functions (v2)")
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190108072353.28078-3-mironov.ivan@gmail.com
      66a8d5bf
    • I
      drm/fb-helper: Partially bring back workaround for bugs of SDL 1.2 · 62d85b3b
      Ivan Mironov 提交于
      SDL 1.2 sets all fields related to the pixel format to zero in some
      cases[1]. Prior to commit db05c481 ("drm: fb-helper: Reject all
      pixel format changing requests"), there was an unintentional workaround
      for this that existed for more than a decade. First in device-specific DRM
      drivers, then here in drm_fb_helper.c.
      
      Previous code containing this workaround just ignores pixel format fields
      from userspace code. Not a good thing either, as this way, driver may
      silently use pixel format different from what client actually requested,
      and this in turn will lead to displaying garbage on the screen. I think
      that returning EINVAL to userspace in this particular case is the right
      option, so I decided to left code from problematic commit untouched
      instead of just reverting it entirely.
      
      Here is the steps required to reproduce this problem exactly:
      	1) Compile fceux[2] with SDL 1.2.15 and without GTK or OpenGL
      	   support. SDL should be compiled with fbdev support (which is
      	   on by default).
      	2) Create /etc/fb.modes with following contents (values seems
      	   not used, and just required to trigger problematic code in
      	   SDL):
      
      		mode "test"
      		    geometry 1 1 1 1 1
      		    timings 1 1 1 1 1 1 1
      		endmode
      
      	3) Create ~/.fceux/fceux.cfg with following contents:
      
      		SDL.Hotkeys.Quit = 27
      		SDL.DoubleBuffering = 1
      
      	4) Ensure that screen resolution is at least 1280x960 (e.g.
      	   append "video=Virtual-1:1280x960-32" to the kernel cmdline
      	   for qemu/QXL).
      
      	5) Try to run fceux on VT with some ROM file[3]:
      
      		# ./fceux color_test.nes
      
      [1] SDL 1.2.15 source code, src/video/fbcon/SDL_fbvideo.c,
          FB_SetVideoMode()
      [2] http://www.fceux.com
      [3] Example ROM: https://github.com/bokuweb/rustynes/blob/master/roms/color_test.nesReported-by: Nsaahriktu <mail@saahriktu.org>
      Suggested-by: Nsaahriktu <mail@saahriktu.org>
      Cc: stable@vger.kernel.org
      Fixes: db05c481 ("drm: fb-helper: Reject all pixel format changing requests")
      Signed-off-by: NIvan Mironov <mironov.ivan@gmail.com>
      [danvet: Delete misleading comment.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190108072353.28078-2-mironov.ivan@gmail.com
      Link: https://patchwork.freedesktop.org/patch/msgid/20190108072353.28078-2-mironov.ivan@gmail.com
      62d85b3b
  11. 09 1月, 2019 2 次提交
  12. 04 12月, 2018 1 次提交
  13. 21 11月, 2018 1 次提交
  14. 02 11月, 2018 1 次提交
    • A
      drm/fourcc: Add char_per_block, block_w and block_h in drm_format_info · 042bf753
      Alexandru Gheorghe 提交于
      For some pixel formats .cpp structure in drm_format info it's not
      enough to describe the peculiarities of the pixel layout, for example
      tiled formats or packed formats at bit level.
      
      What's implemented here is to add three new members to drm_format_info
      that could describe such formats:
      
      - char_per_block[3]
      - block_w[3]
      - block_h[3]
      
      char_per_block will be put in a union alongside cpp, for transparent
      compatibility  with the existing format descriptions.
      
      Regarding, block_w and block_h they are intended to be used through
      their equivalent getters drm_format_info_block_width /
      drm_format_info_block_height, the reason of the getters is to abstract
      the fact that for normal formats block_w and block_h will be unset/0,
      but the methods will be returning 1.
      
      Additionally, convenience function drm_format_info_min_pitch had been
      added that computes the minimum required pitch for a given pixel
      format and buffer width.
      
      Using that the following drm core functions had been updated to
      generically handle both block and non-block formats:
      
      - drm_fb_cma_get_gem_addr: for block formats it will just return the
        beginning of the block.
      - framebuffer_check: Use the newly added drm_format_info_min_pitch.
      - drm_gem_fb_create_with_funcs: Use the newly added
        drm_format_info_min_pitch.
      - In places where is not expecting to handle block formats, like fbdev
        helpers I just added some warnings in case the block width/height
        are greater than 1.
      
      Changes since v3:
       - Add helper function for computing the minimum required pitch.
       - Improve/cleanup documentation
      
      Changes since v8:
       - Fixed build on 32bits arm architectures, with:
      
      -       return DIV_ROUND_UP((u64)buffer_width * info->char_per_block[plane],
      +       return DIV_ROUND_UP_ULL((u64)buffer_width * info->char_per_block[plane],
      Reviewed-by: NBrian Starkey <brian.starkey@arm.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NAlexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20181101170055.5433-1-alexandru-cosmin.gheorghe@arm.com
      042bf753
  15. 04 10月, 2018 2 次提交
  16. 02 10月, 2018 1 次提交
    • N
      drm/cma-helper: Fix crash in fbdev error path · 4d4c2d89
      Noralf Trønnes 提交于
      Sergey Suloev reported a crash happening in drm_client_dev_hotplug()
      when fbdev had failed to register.
      
      [    9.124598] vc4_hdmi 3f902000.hdmi: ASoC: Failed to create component debugfs directory
      [    9.147667] vc4_hdmi 3f902000.hdmi: vc4-hdmi-hifi <-> 3f902000.hdmi mapping ok
      [    9.155184] vc4_hdmi 3f902000.hdmi: ASoC: no DMI vendor name!
      [    9.166544] vc4-drm soc:gpu: bound 3f902000.hdmi (ops vc4_hdmi_ops [vc4])
      [    9.173840] vc4-drm soc:gpu: bound 3f806000.vec (ops vc4_vec_ops [vc4])
      [    9.181029] vc4-drm soc:gpu: bound 3f004000.txp (ops vc4_txp_ops [vc4])
      [    9.188519] vc4-drm soc:gpu: bound 3f400000.hvs (ops vc4_hvs_ops [vc4])
      [    9.195690] vc4-drm soc:gpu: bound 3f206000.pixelvalve (ops vc4_crtc_ops [vc4])
      [    9.203523] vc4-drm soc:gpu: bound 3f207000.pixelvalve (ops vc4_crtc_ops [vc4])
      [    9.215032] vc4-drm soc:gpu: bound 3f807000.pixelvalve (ops vc4_crtc_ops [vc4])
      [    9.274785] vc4-drm soc:gpu: bound 3fc00000.v3d (ops vc4_v3d_ops [vc4])
      [    9.290246] [drm] Initialized vc4 0.0.0 20140616 for soc:gpu on minor 0
      [    9.297464] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
      [    9.304600] [drm] Driver supports precise vblank timestamp query.
      [    9.382856] vc4-drm soc:gpu: [drm:drm_fb_helper_fbdev_setup [drm_kms_helper]] *ERROR* Failed to set fbdev configuration
      [   10.404937] Unable to handle kernel paging request at virtual address 00330a656369768a
      [   10.441620] [00330a656369768a] address between user and kernel address ranges
      [   10.449087] Internal error: Oops: 96000004 [#1] PREEMPT SMP
      [   10.454762] Modules linked in: brcmfmac vc4 drm_kms_helper cfg80211 drm rfkill smsc95xx brcmutil usbnet drm_panel_orientation_quirks raspberrypi_hwmon bcm2835_dma crc32_ce pwm_bcm2835 bcm2835_rng virt_dma rng_core i2c_bcm2835 ip_tables x_tables ipv6
      [   10.477296] CPU: 2 PID: 45 Comm: kworker/2:1 Not tainted 4.19.0-rc5 #3
      [   10.483934] Hardware name: Raspberry Pi 3 Model B Rev 1.2 (DT)
      [   10.489966] Workqueue: events output_poll_execute [drm_kms_helper]
      [   10.596515] Process kworker/2:1 (pid: 45, stack limit = 0x000000007e8924dc)
      [   10.603590] Call trace:
      [   10.606259]  drm_client_dev_hotplug+0x5c/0xb0 [drm]
      [   10.611303]  drm_kms_helper_hotplug_event+0x30/0x40 [drm_kms_helper]
      [   10.617849]  output_poll_execute+0xc4/0x1e0 [drm_kms_helper]
      [   10.623616]  process_one_work+0x1c8/0x318
      [   10.627695]  worker_thread+0x48/0x428
      [   10.631420]  kthread+0xf8/0x128
      [   10.634615]  ret_from_fork+0x10/0x18
      [   10.638255] Code: 54000220 f9401261 aa1303e0 b4000141 (f9400c21)
      [   10.644456] ---[ end trace c75b4a4b0e141908 ]---
      
      The reason for this is that drm_fbdev_cma_init() removes the drm_client
      when fbdev registration fails, but it doesn't remove the client from the
      drm_device client list. So the client list now has a pointer that points
      into the unknown and we have a 'use after free' situation.
      
      Split drm_client_new() into drm_client_init() and drm_client_add() to fix
      removal in the error path.
      
      Fixes: 894a677f ("drm/cma-helper: Use the generic fbdev emulation")
      Reported-by: NSergey Suloev <ssuloev@orpaltech.com>
      Cc: Stefan Wahren <stefan.wahren@i2se.com>
      Cc: Eric Anholt <eric@anholt.net>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NNoralf Trønnes <noralf@tronnes.org>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20181001194536.57756-1-noralf@tronnes.org
      4d4c2d89
  17. 25 9月, 2018 1 次提交
  18. 12 9月, 2018 1 次提交
  19. 11 9月, 2018 1 次提交
    • D
      drm/fb: Stop leaking physical address · 6be8f3bd
      Daniel Vetter 提交于
      For buffer sharing, use dma-buf instead. We can't set smem_start to 0
      unconditionally since that's used by the fbdev mmap default
      implementation. And we have plenty of userspace which would like to
      keep that working.
      
      This might break legit userspace - if it does we need to look at a
      case-by-cases basis how to handle that. Worst case I expect overrides
      for only specific drivers, since anything remotely modern should be
      using dma-buf/prime now (which is about 7 years old now for DRM
      drivers).
      
      This issue was uncovered because Noralf's rework to implement a
      generic fb_probe also implements it's own fb_mmap callback. Which
      means smem_start didn't have to be set anymore, which blew up some
      blob in userspace rather badly.
      Acked-by: NSean Paul <seanpaul@chromium.org>
      Cc: Gustavo Padovan <gustavo@padovan.org>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Sean Paul <sean@poorly.run>
      Cc: David Airlie <airlied@linux.ie>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Noralf Trønnes <noralf@tronnes.org>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20180822085405.10787-4-daniel.vetter@ffwll.ch
      6be8f3bd
  20. 10 9月, 2018 1 次提交
  21. 10 7月, 2018 2 次提交
  22. 05 7月, 2018 2 次提交
  23. 12 6月, 2018 1 次提交
  24. 29 5月, 2018 1 次提交
  25. 11 5月, 2018 1 次提交
  26. 16 3月, 2018 1 次提交
  27. 20 12月, 2017 4 次提交