1. 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
  2. 09 1月, 2019 2 次提交
  3. 04 12月, 2018 1 次提交
  4. 21 11月, 2018 1 次提交
  5. 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
  6. 04 10月, 2018 2 次提交
  7. 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
  8. 25 9月, 2018 1 次提交
  9. 12 9月, 2018 1 次提交
  10. 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
  11. 10 9月, 2018 1 次提交
  12. 10 7月, 2018 2 次提交
  13. 05 7月, 2018 2 次提交
  14. 12 6月, 2018 1 次提交
  15. 29 5月, 2018 1 次提交
  16. 11 5月, 2018 1 次提交
  17. 16 3月, 2018 1 次提交
  18. 20 12月, 2017 4 次提交
  19. 07 12月, 2017 1 次提交
  20. 05 12月, 2017 1 次提交
  21. 29 11月, 2017 1 次提交
  22. 23 11月, 2017 1 次提交
  23. 01 11月, 2017 3 次提交
  24. 14 10月, 2017 1 次提交
  25. 02 9月, 2017 1 次提交
  26. 07 8月, 2017 1 次提交
  27. 04 8月, 2017 1 次提交
  28. 03 8月, 2017 1 次提交
  29. 26 7月, 2017 1 次提交
    • D
      drm/fb-helper: Support deferred setup · ca91a275
      Daniel Vetter 提交于
      FB helper code falls back to a 1024x768 mode if no outputs are connected
      or don't report back any modes upon initialization. This can be annoying
      because outputs that are added to FB helper later on can't be used with
      FB helper if they don't support a matching mode.
      
      The fallback is in place because VGA connectors can happen to report an
      unknown connection status even when they are in fact connected.
      
      Some drivers have custom solutions in place to defer FB helper setup
      until at least one output is connected. But the logic behind these
      solutions is always the same and there is nothing driver-specific about
      it, so a better alterative is to fix the FB helper core and add support
      for all drivers automatically.
      
      This patch adds support for deferred FB helper setup. It checks all the
      connectors for their connection status, and if all of them report to be
      disconnected marks the FB helper as needing deferred setup. Whet setup
      is deferred, the FB helper core will automatically retry setup after a
      hotplug event, and it will keep trying until it succeeds.
      
      v2: Rebase onto my entirely reworked fbdev helper locking. One big
      difference is that this version again drops&reacquires the fbdev lock
      (which is now fb_helper->lock, but before this patch series it was
      mode_config->mutex), because register_framebuffer must be able to
      recurse back into fbdev helper code for the initial screen setup.
      
      v3: __drm_fb_helper_initial_config must hold fb_helper->lock upon
      return, I've fumbled that in the deferred setup case (Liviu).
      
      v4: I was blind, redo this all. __drm_fb_helper_initial_config
      shouldn't need to reacquire fb_helper->lock, that just confuses
      callers. I myself got confused by kernel_fb_helper_lock and somehow
      thought it's the same as fb_helper->lock. Tsk.
      
      Also simplify the logic a bit (we don't need two functions to probe
      connectors), we can stick much closer to the existing code. And update
      some comments I've spotted that are outdated.
      
      v5: Don't pass -EAGAIN to drivers, it's just an internal error code
      (Liviu).
      
      v6: Add _and_unlock suffix to clarify locking (Maarten)
      
      Cc: Liviu Dudau <liviu@dudau.co.uk>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Thierry Reding <treding@nvidia.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Tested-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: Thierry Reding <treding@nvidia.com> (v1)
      Reviewed-by: NMaarten Lankhorst <maarten.lankhorst@intel.com>
      Reviewed-by: NLiviu Dudau <liviu@dudau.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20170706130023.28417-3-daniel.vetter@ffwll.chSigned-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ca91a275
  30. 14 7月, 2017 1 次提交
  31. 06 7月, 2017 1 次提交