1. 08 7月, 2014 3 次提交
    • D
      drm/fb_helper: allow adding/removing connectors later · 65c2a89c
      Dave Airlie 提交于
      This is required to get fbcon probing to work on new connectors,
      callers should acquire the mode config lock before calling these.
      Reviewed-by: NTodd Previte <tprevite@gmail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      65c2a89c
    • T
      drm: Introduce drm_fb_helper_prepare() · 10a23102
      Thierry Reding 提交于
      To implement hotplug detection in a race-free manner, drivers must call
      drm_kms_helper_poll_init() before hotplug events can be triggered. Such
      events can be triggered right after any of the encoders or connectors
      are initialized. At the same time, if the drm_fb_helper_hotplug_event()
      helper is used by a driver, then the poll helper requires some parts of
      the FB helper to be initialized to prevent a crash.
      
      At the same time, drm_fb_helper_init() requires information that is not
      necessarily available at such an early stage (number of CRTCs and
      connectors), so it cannot be used yet.
      
      Add a new helper, drm_fb_helper_prepare(), that initializes the bare
      minimum needed to allow drm_kms_helper_poll_init() to execute and any
      subsequent hotplug events to be processed properly.
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      10a23102
    • D
      drm/fb-helper: Fix hpd vs. initial config races · 50c3dc97
      Daniel Vetter 提交于
      Some drivers need to be able to have a perfect race-free fbcon setup.
      Current drivers only enable hotplug processing after the call to
      drm_fb_helper_initial_config which leaves a tiny but important race.
      
      This race is especially noticable on embedded platforms where the
      driver itself enables the voltage for the hdmi output, since only then
      will monitors (after a bit of delay, as usual) respond by asserting
      the hpd pin.
      
      Most of the infrastructure is already there with the split-out
      drm_fb_helper_init. And drm_fb_helper_initial_config already has all
      the required locking to handle concurrent hpd events since
      
      commit 53f1904b
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Thu Mar 20 14:26:35 2014 +0100
      
          drm/fb-helper: improve drm_fb_helper_initial_config locking
      
      The only missing bit is making drm_fb_helper_hotplug_event save
      against concurrent calls of drm_fb_helper_initial_config. The only
      unprotected bit is the check for fb_helper->fb.
      
      With that drivers can first initialize the fb helper, then enabel
      hotplug processing and then set up the initial config all in a
      completely race-free manner. Update kerneldoc and convert i915 as a
      proof of concept.
      
      Feature requested by Thierry since his tegra driver atm reliably boots
      slowly enough to misses the hotplug event for an external hdmi screen,
      but also reliably boots to quickly for the hpd pin to be asserted when
      the fb helper calls into the hdmi ->detect function.
      
      Cc: Thierry Reding <treding@nvidia.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      50c3dc97
  2. 19 6月, 2014 2 次提交
  3. 05 6月, 2014 2 次提交
  4. 04 6月, 2014 1 次提交
  5. 29 4月, 2014 2 次提交
  6. 04 4月, 2014 1 次提交
  7. 02 4月, 2014 2 次提交
    • M
      drm: Replace crtc fb with primary plane fb (v3) · f4510a27
      Matt Roper 提交于
      Now that CRTC's have a primary plane, there's no need to track the
      framebuffer in the CRTC.  Replace all references to the CRTC fb with the
      primary plane's fb.
      
      This patch was generated by the Coccinelle semantic patching tool using
      the following rules:
      
              @@ struct drm_crtc C; @@
              -   (C).fb
              +   C.primary->fb
      
              @@ struct drm_crtc *C; @@
              -   (C)->fb
              +   C->primary->fb
      
      v3: Generate patch via coccinelle.  Actual removal of crtc->fb has been
          moved to a subsequent patch.
      
      v2: Fixup several lingering crtc->fb instances that were missed in the
          first patch iteration.  [Rob Clark]
      Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      f4510a27
    • M
      drm: Add support for multiple plane types (v2) · e27dde3e
      Matt Roper 提交于
      The DRM core currently only tracks "overlay"-style planes.  Start
      refactoring the plane handling to allow other plane types (primary and
      cursor) to also be placed on the DRM plane list.
      
      v2: Add drm_for_each_legacy_plane() iterator to smooth transition
          of drivers with plane loops.
      Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      e27dde3e
  8. 22 3月, 2014 1 次提交
    • D
      drm/fb-helper: improve drm_fb_helper_initial_config locking · 53f1904b
      Daniel Vetter 提交于
      The locking in drm_fb_helper_initial_config is a bit troublesome for a
      few reasons:
      
      - We can't just wrap the entire function up into modeset locks since
        the fbdev registration might call down into fbcon code, which then
        through our ->set_par implementation needs to be able to grab all
        modeset locks. So we'd have a neat deadlock.
      
      - This implies though that all current callers don't hold any modeset
        locks by necessity, so we have free reign to grab any modeset locks
        we need to grab.
      
      - The private state of the fbdev helper doesn't need any protection
        through locks, since once we have the fbdev registered it is mostly
        invariant or protected through the modeset locking in ->set_par and
        other callbacks. We can fully rely on driver having non-racy setup
        sequences here. For the initial config computation we actually may
        not grab locks since drivers which provide their own magic sauce
        (like i915) might need to grab locks themselves.
      
      - We should grab locks though when we probe outputs. Currently there's
        not much risk, but already now userspace could start poking at sysfs
        files and so probe concurrently. I expect that in the future driver
        init will be much more async, and since probing is really
        time-consuming this is a prime candidate.
      
      - We must not hold any crtc->mutex locks while calling probe functions
        since those might need to lock a crtc for e.g. load detection. i915
        is such a driver.
      
      Also it's the probing calls which hit upon piles of new locking
      asserts I've recently added in
      
      commit 62ff94a5
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Thu Jan 23 22:18:47 2014 +0100
      
          drm/crtc-helper: remove LOCKING from kerneldoc
      
      and
      
      commit 63951385
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Thu Jan 23 15:14:15 2014 +0100
      
          drm/doc: Repleace LOCKING kerneldoc sections in drm_modes.c
      
      Hence the right fix is to grab the mode_config mutex, but only that
      and only right around the probe calls.
      
      It seems to be sufficient to shut up all the locking WARNINGs I see on
      i915 and nouveau in drm_fb_helper_initial_config.
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Tested-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      53f1904b
  9. 17 3月, 2014 2 次提交
  10. 13 3月, 2014 1 次提交
  11. 13 2月, 2014 1 次提交
  12. 18 12月, 2013 1 次提交
    • P
      drm: do not steal the display if we have a master · 520edd13
      Paulo Zanoni 提交于
      Sometimes we want to disable all the screens on a system, because that
      will allow the graphics card to be put into low-power states. The
      problem is that, for example, while all screens are disabled, if we
      get a hotplug interrupt, fbcon will decide to set a mode instead of
      keeping everything disabled, which will remove us from our low power
      states.
      
      Let's assume that if there's a DRM master, it will be able to do
      whatever is appropriate when we get the hotplug.
      
      This problem can be reproduced by the runtime PM test program from
      intel-gpu-tools: we disable all the screens so the graphics device can
      be put into D3, then something triggers a hotplug interrupt, fbcon
      sets a mode and breaks our test suite. The problem can be reproduced
      more easily by the "i2c" subtest.
      
      Other approaches considered for the problem:
          - Return "false" if "bound == 0" and the caller of
            drm_fb_helper_is_bound is a hotplug handler. This would break
            the case where the machine boots with no outputs connected, then
            the user plugs a monitor.
          - Add a new IOCTL to force fbcon to not set modes. This would keep
            all the current applications behaving the same, but adding a new
            IOCTL is not always the greatest idea.
          - Return false only if "dev->primary->master && bound == 0". This
            was my first implementation, but Chris suggested we should do
            the check irrespective of the "bound" variable.
      
      Thanks to Daniel Vetter for the investigation, ideas and the
      implementation of the hotplug alternative.
      
      v2: - Do the check first, irrespective of "bound".
          - Cc dri-devel
      
      Cc: dri-devel@lists.freedesktop.org
      Credits-to: Daniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      520edd13
  13. 12 10月, 2013 1 次提交
    • D
      drm: Add separate Kconfig option for fbdev helpers · 92b6f89f
      Daniel Vetter 提交于
      For drivers which might want to disable fbdev legacy support.
      
      Select the new option in all drivers for now, so this shouldn't result
      in any change. Drivers need some work anyway to make fbdev support
      optional (if they have it implemented, that is), so the recommended
      way to expose this is by adding per-driver options. At least as long
      as most drivers don't support disabling the fbdev support.
      
      v2: Update for new drm drivers msm and rcar-du. Note that Rob's msm
      driver can already take advantage of this, which allows us to build
      msm without any fbdev depencies in the kernel!
      
      v3: Move the MODULE_* stuff from the fbdev helper file to
      drm_crtc_helper.c.
      
      Cc: David Herrmann <dh.herrmann@gmail.com>
      Cc: Rob Clark <robdclark@gmail.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Acked-by: NDave Airlie <airlied@linux.ie>
      Reviewed-by: NChon Ming Lee <chon.ming.lee@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      92b6f89f
  14. 10 10月, 2013 1 次提交
  15. 01 10月, 2013 3 次提交
  16. 19 9月, 2013 1 次提交
    • D
      drm/fb-helper: don't sleep for screen unblank when an oops is in progress · 928c2f0c
      Daniel Vetter 提交于
      Otherwise the system will burn even brighter and worse, leave the user
      wondering what's going on exactly.
      
      Since we already have a panic handler which will (try) to restore the
      entire fbdev console mode, we can just bail out.  Inspired by a patch from
      Konstantin Khlebnikov.  The callchain leading to this, cut&pasted from
      Konstantin's original patch:
      
      callstack:
      panic()
      bust_spinlocks(1)
      unblank_screen()
      vc->vc_sw->con_blank()
      fbcon_blank()
      fb_blank()
      info->fbops->fb_blank()
      drm_fb_helper_blank()
      drm_fb_helper_dpms()
      drm_modeset_lock_all()
      mutex_lock(&dev->mode_config.mutex)
      
      Note that the entire locking in the fb helper around panic/sysrq and kdbg
      is ...  non-existant.  So we have a decent change of blowing up
      everything.  But since reworking this ties in with funny concepts like the
      fbdev notifier chain or the impressive things which happen around
      console_lock while oopsing, I'll leave that as an exercise for braver
      souls than me.
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Konstantin Khlebnikov <khlebnikov@openvz.org>
      Cc: Dave Airlie <airlied@gmail.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      928c2f0c
  17. 17 6月, 2013 3 次提交
  18. 12 4月, 2013 1 次提交
  19. 27 3月, 2013 1 次提交
  20. 14 2月, 2013 10 次提交
    • D
      drm/fb-helper: don't sleep for screen unblank when an oopps is in progress · 1b1d5397
      Daniel Vetter 提交于
      Otherwise the system will burn even brighter and worse, leave the user
      wondering what's going on exactly.
      
      Since we already have a panic handler which will (try) to restore the
      entire fbdev console mode, we can just bail out. Inspired by a patch
      from Konstantin Khlebnikov. The callchain leading to this, cut&pasted
      from Konstantin's original patch:
      
      callstack:
      panic()
      bust_spinlocks(1)
      unblank_screen()
      vc->vc_sw->con_blank()
      fbcon_blank()
      fb_blank()
      info->fbops->fb_blank()
      drm_fb_helper_blank()
      drm_fb_helper_dpms()
      drm_modeset_lock_all()
      mutex_lock(&dev->mode_config.mutex)
      
      Note that the entire locking in the fb helper around panic/sysrq and
      kdbg is ... non-existant. So we have a decent change of blowing up
      everything. But since reworking this ties in with funny concepts like
      the fbdev notifier chain or the impressive things which happen around
      console_lock while oopsing, I'll leave that as an exercise for braver
      souls than me.
      
      v2: Drop the -EBUSY return value I've copied, we don't need it since
      the we'll take care of things ourselves anyway.
      
      Cc: Konstantin Khlebnikov <khlebnikov@openvz.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      References: https://patchwork.kernel.org/patch/1878181/Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      1b1d5397
    • D
      drm/fb-helper: improve kerneldoc · 207fd329
      Daniel Vetter 提交于
      Now that the fbdev helper interface for drivers is trimmed down,
      update the kerneldoc for all the remaining exported functions.
      
      I've tried to beat the DocBook a bit by reordering the function
      references a bit into a more sensible ordering. But that didn't work
      out at all. Hence just extend the in-code DOC: section a bit.
      
      Also remove the LOCKING: sections - especially for the setup functions
      they're totally bogus. But that's not a documentation problem, but
      simply an artifact of the current rather hazardous locking around drm
      init and even more so around fbdev setup ...
      
      v2: Some further improvements:
      - Also add documentation for drm_fb_helper_single_add_all_connectors,
        Dave Airlie didn't want me to kill this one from the fb helper
        interface.
      - Update docs for drm_fb_helper_fill_var/fix - they should be used
        from the driver's ->fb_probe callback to setup the fbdev info
        structure.
      - Clarify what the ->fb_probe callback should all do - it needs to
        setup both the fbdev info and allocate the drm framebuffer used as
        backing storage.
      - Add basic documentaation for the drm_fb_helper_funcs driver callback
        vfunc.
      
      v3: Implement clarifications Laurent Pinchart suggested in his review.
      
      v4: Fix another mispelling Laurent spotted.
      
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Acked-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      207fd329
    • D
      drm/fb-helper: streamline drm_fb_helper_single_fb_probe · 8acf658a
      Daniel Vetter 提交于
      No need to check whether we've allocated a new fb since we're not
      always doing that. Also, we always need to register the fbdev and add
      it to the panic notifier.
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      8acf658a
    • D
      drm/fb-helper: directly call set_par from the hotplug handler · 2180c3c7
      Daniel Vetter 提交于
      The idea behind calling down into the driver's ->fb_probe function on each
      hotplug seems to be able to reallocate the backing storage (if e.g. a screen
      with higher resolution gets added). But that requires quite a bit of work in the
      fb helper itself, since currently we limit new screens to the currently
      allocated fb. An no kms driver supports fbdev fb resizing.
      
      So don't bother and start to simplify the code by calling drm_fb_helper_set_par
      directly from the fbdev hotplug function, since that's the only thing left in
      drm_fb_helper_single_fb_probe which does not concern itself with fb allocation
      and initial setup. Follow-on patches will streamline the initial setup
      code.
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      2180c3c7
    • D
      drm/fb-helper: fixup set_config semantics · 7e53f3a4
      Daniel Vetter 提交于
      While doing the modeset rework for drm/i915 I've noticed that the fb
      helper is very liberal with the semantics of the ->set_config
      interface:
      - It doesn't bother clearing stale modes (e.g. when unplugging a
        screen).
      - It unconditionally sets the fb, even if no mode will be set on a
        given crtc.
      - The initial setup is a bit fun since we need to pick crtcs to decide
        the desired fb size, but also should set the modeset->fb pointer.
        Explain what's going on in the fixup code after the fb is allocated.
      
      The crtc helper didn't really care, but the new i915 modeset
      infrastructure did, so I've had to add a bunch of special-cases to
      catch this.
      
      Fix this all up and enforce the interface by converting the checks in
      drm/i915/intel_display.c to BUG_ONs.
      
      v2: Fix commit message spell fail spotted by Rob Clark.
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      7e53f3a4
    • D
      drm/fb-helper: don't disable everything in initial_config · 76a39dbf
      Daniel Vetter 提交于
      This should be done in the drivers for two reasons:
      - it gets in the way of fastboot efforts
      - it links the fb helpers with the crtc helpers instead of going
        through the real interface vfuncs, forcing i915 to fake all the
        ->disable callbacks used by the crtc helper to avoid ugly Oopsen
      
      v2: Resolve conflicts since drivers still call
      drm_fb_helper_single_add_all_connectors.
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      76a39dbf
    • D
      drm/fb-helper: unexport drm_fb_helper_single_fb_probe · de1ace5b
      Daniel Vetter 提交于
      Not called by anyone, and really, shouldn't be. Drivers are supposed
      either drm_fb_helper_initial_config or drm_fb_helper_hotplug_event.
      Originally this was done differently, but is now consolidated in the
      helper functions and no longer done by drivers directly.
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      de1ace5b
    • D
      drm/fb-helper: unexport drm_fb_helper_panic · 43c8a849
      Daniel Vetter 提交于
      It doesn't even show up in any header files and only used iternally.
      Originally it was (ab)used to restore the fbcon on lastclose, but that
      died with
      
      commit e8e7a2b8
      Author: Dave Airlie <airlied@redhat.com>
      Date:   Thu Apr 21 22:18:32 2011 +0100
      
          drm/i915: restore only the mode of this driver on lastclose (v2)
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      43c8a849
    • D
      drm/fb-helper: kill drm_fb_helper_restore · d21bf469
      Daniel Vetter 提交于
      It's only used internally for the sysrq and panic handlers provided by
      the drm fb helper implementation. Hence just inline it, kill the
      export and remove the confusing kerneldoc. Driver's are supposed to
      call drm_fb_helper_restore_fbdev_mode on lastclose.
      
      Note that locking is totally fubar - the sysrq case doesn't take any
      locks at all. The panic handler probably shouldn't take any locks
      since it'll only make things worse. Otoh it's probably better to
      switch things over to the atomic modeset callbacks (and disable the
      panic handler for those drivers which don't implement it).
      
      But that's both better done in separate patches.
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d21bf469
    • D
      drm: review locking for drm_fb_helper_restore_fbdev_mode · 6aed8ec3
      Daniel Vetter 提交于
      ... it's required. Fix up exynos and the cma helper, and add a
      corresponding WARN_ON to drm_fb_helper_restore_fbdev_mode.
      
      Note that tegra calls the fbdev cma helper restore function also from
      it's driver-load callback. Which is a bit against current practice,
      since usually the call is only from ->lastclose, and initial setup is
      done by drm_fb_helper_initial_config.
      
      Also add the relevant drm DocBook entry.
      
      v2: Add promised WARN to restore_fbdev_mode.
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      6aed8ec3