1. 05 6月, 2014 2 次提交
  2. 04 6月, 2014 9 次提交
    • D
      drm: Split connection_mutex out of mode_config.mutex (v3) · 6e9f798d
      Daniel Vetter 提交于
      After the split-out of crtc locks from the big mode_config.mutex
      there's still two major areas it protects:
      - Various connector probe states, like connector->status, EDID
        properties, probed mode lists and similar information.
      - The links from connector->encoder and encoder->crtc and other
        modeset-relevant connector state (e.g. properties which control the
        panel fitter).
      
      The later is used by modeset operations. But they don't really care
      about the former since it's allowed to e.g. enable a disconnected VGA
      output or with a mode not in the probed list.
      
      Thus far this hasn't been a problem, but for the atomic modeset
      conversion Rob Clark needs to convert all modeset relevant locks into
      w/w locks. This is required because the order of acquisition is
      determined by how userspace supplies the atomic modeset data. This has
      run into troubles in the detect path since the i915 load detect code
      needs _both_ protections offered by the mode_config.mutex: It updates
      probe state and it needs to change the modeset configuration to enable
      the temporary load detect pipe.
      
      The big deal here is that for the probe/detect users of this lock a
      plain mutex fits best, but for atomic modesets we really want a w/w
      mutex. To fix this lets split out a new connection_mutex lock for the
      modeset relevant parts.
      
      For simplicity I've decided to only add one additional lock for all
      connector/encoder links and modeset configuration states. We have
      piles of different modeset objects in addition to those (like bridges
      or panels), so adding per-object locks would be much more effort.
      
      Also, we're guaranteed (at least for now) to do a full modeset if we
      need to acquire this lock. Which means that fine-grained locking is
      fairly irrelevant compared to the amount of time the full modeset will
      take.
      
      I've done a full audit, and there's just a few things that justify
      special focus:
      - Locking in drm_sysfs.c is almost completely absent. We should
        sprinkle mode_config.connection_mutex over this file a bit, but
        since it already lacks mode_config.mutex this patch wont make the
        situation any worse. This is material for a follow-up patch.
      
      - omap has a omap_framebuffer_flush function which walks the
        connector->encoder->crtc links and is called from many contexts.
        Some look like they don't acquire mode_config.mutex, so this is
        already racy. Again fixing this is material for a separate patch.
      
      - The radeon hot_plug function to retrain DP links looks at
        connector->dpms. Currently this happens without any locking, so is
        already racy. I think radeon_hotplug_work_func should gain
        mutex_lock/unlock calls for the mode_config.connection_mutex.
      
      - Same applies to i915's intel_dp_hot_plug. But again, this is already
        racy.
      
      - i915 load_detect code needs to acquire this lock. Which means the
        w/w dance due to Rob's work will be nicely contained to _just_ this
        function.
      
      I've added fixme comments everywhere where it looks suspicious but in
      the sysfs code. After a quick irc discussion with Dave Airlie it
      sounds like the lack of locking in there is due to sysfs cleanup fun
      at module unload.
      
      v1: original (only compile tested)
      
      v2: missing mutex_init(), etc (from Rob Clark)
      
      v3: i915 needs more care in the conversion:
      - Protect the edp pp logic with the connection_mutex.
      - Use connection_mutex in the backlight code due to
        get_pipe_from_connector.
      - Use drm_modeset_lock_all in suspend/resume paths.
      - Update lock checks in the overlay code.
      
      Cc: Alex Deucher <alexdeucher@gmail.com>
      Cc: Rob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      6e9f798d
    • R
      drm: spiff out FB refcnting traces · 8291272a
      Rob Clark 提交于
      I find myself making this change locally whenever debugging FB reference
      counting.  Which seems a bit silly.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Reviewed-by: NDavid Herrmann <dh.herrmann@gmail.com>
      8291272a
    • R
      drm: add signed-range property type · ebc44cf3
      Rob Clark 提交于
      Like range, but values are signed.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Reviewed-by: NDavid Herrmann <dh.herrmann@gmail.com>
      ebc44cf3
    • R
      drm: add object property type · 98f75de4
      Rob Clark 提交于
      An object property is an id (idr) for a drm mode object.  This
      will allow a property to be used set/get a framebuffer, CRTC, etc.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      98f75de4
    • R
      drm: add extended property types · 5ea22f24
      Rob Clark 提交于
      If we continue to use bitmask for type, we will quickly run out of room
      to add new types.  Split this up so existing part of bitmask range
      continues to function as before, but reserve a chunk of the remaining
      space for an integer type-id.  Wrap this all up in some type-check
      helpers to keep the backwards-compat uglyness contained.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      5ea22f24
    • R
      drm: helpers to find mode objects · a2b34e22
      Rob Clark 提交于
      Add a few more useful helpers to find mode objects.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      a2b34e22
    • J
      drm: drop drm_get_connector_name() and drm_get_encoder_name() · d5ab2b43
      Jani Nikula 提交于
      No longer used or needed as the structs have a name field.
      Acked-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      d5ab2b43
    • J
      drm: replace drm_get_encoder_name() with direct name field use · 83a8cfd3
      Jani Nikula 提交于
      Generated using semantic patch:
      
      @@
      expression E;
      @@
      
      - drm_get_encoder_name(E)
      + E->name
      Acked-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      83a8cfd3
    • J
      drm: replace drm_get_connector_name() with direct name field use · 25933820
      Jani Nikula 提交于
      Generated using semantic patch:
      
      @@
      expression E;
      @@
      
      - drm_get_connector_name(E)
      + E->name
      
      [airlied: regenerated]
      Acked-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NJani Nikula <jani.nikula@intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      25933820
  3. 30 5月, 2014 3 次提交
  4. 16 5月, 2014 1 次提交
  5. 24 4月, 2014 2 次提交
    • D
      drm: Handle ->disable_plane failures correctly · 731cce48
      Daniel Vetter 提交于
      The ->disable_plane hook always had a return value, but only since the
      introduction of primary planes was there any implementation that
      actually failed.
      
      So handle such failures correctly.
      
      Note that drm_plane_force_disable is special: In the modeset cleanup
      case we first disable all crtc, so primary planes should all be freed
      already. And in the fb helper we only reset non-primary planes. Still
      better be paranoid and add an early return.
      
      I don't see how this could happen, but it might fix the fb refcount
      underrun Thierry is seeing. Matt Roper spotted this issue.
      
      Cc: Thierry Reding <treding@nvidia.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      731cce48
    • D
      drm: Simplify fb refcounting rules around ->update_plane · 0fe27f06
      Daniel Vetter 提交于
      The introduction of primary planes has apparently caused a bit of fb
      refcounting fun for people. That makes it a good time to clean up the
      arcane rules and slight differences between ->update_plane and
      ->set_config. The new rules are:
      
      - The core holds a reference for both the new and the old fb (if
        they're non-NULL of course) while calling into the driver through
        either ->update_plane or ->set_config.
      
      - Drivers may not clobber plane->fb if their callback fails. If they
        do that, they need to store a pointer to the old fb in it again.
        When calling into the driver plane->fb still points at the current
        (old) framebuffer.
      
      - The core will update the plane->fb pointer on success. Drivers can
        do that themselves too, but aren't required to any more for the
        primary plane.
      
      - The core will update fb refcounts for the plane->fb pointer,
        presuming the drivers hold up their end of the bargain.
      
      v2: Remove now unused tmpfb (Thierry)
      
      v3: Drop broken changes from drm_mode_setplane (Ville). Also polish
      the commit message a bit.
      
      v4: Also fix up the handling of ->disable_plane in
      drm_plane_force_disable. The issue was that we didn't save plane->fb
      over the ->disable_plane call. Just paranoia, nothing relies on this.
      
      v5: Keep still useful comments about directly calling ->set_config,
      which I should have done for v4 already. Requested by Matt.
      
      Cc: Thierry Reding <treding@nvidia.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      0fe27f06
  6. 02 4月, 2014 7 次提交
  7. 28 3月, 2014 2 次提交
  8. 16 3月, 2014 1 次提交
    • D
      drm/crtc: add sanity checks to create_dumb() · b28cd41f
      David Herrmann 提交于
      Lets make sure some basic expressions are always true:
        bpp != NULL
        width != NULL
        height != NULL
        stride = bpp * width < 2^32
        size = stride * height < 2^32
        PAGE_ALIGN(size) < 2^32
      
      At least the udl driver doesn't check for multiplication-overflows, so
      lets just make sure it will never happen. These checks allow drivers to do
      any 32bit math without having to test for mult-overflows themselves.
      
      The two divisions might hurt performance a bit, but dumb_create() is only
      used for scanout-buffers, so that should be fine. We could use 64bit math
      to avoid the divisions, but that may be slow on 32bit machines.. Or maybe
      there should just be a "safe_mult32()" helper, which currently doesn't
      exist (I think?).
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      b28cd41f
  9. 13 3月, 2014 4 次提交
    • D
      drm: kerneldoc polish for drm_crtc.c · c8e32cc1
      Daniel Vetter 提交于
      - Standardized on "Returns:" Block.
      - Sprinkle missing kerneldoc over all exported functions and all
        ioctls.
      - Add a stern warning that driver's really shouldn't use
        drm_mode_group_init_legacy_group.
      - Usual attempt at more consistency.
      - Add warnings that drm_mode_object_get/put don't do refcounting,
        despite what the names might lead to believe.
      - Try to clarify the framebuffer setup/cleanup functions wrt driver
        private framebuffers - I've fallen recently over this when reviewing
        i915 fbdev patches.
      - Align function parameters where the kerneldoc has been updated.
      - Most of the drm_get_*_name functions aren't thread safe. Add stern
        warnings where this is the case.
      
      Since a lot of the functions in drm_crtc.c are boilerplate to handle
      properties and create default sets of them it might be useful to
      extract all that code into a new file drm_property.c. Especially since
      properties will be used a lot more in the future.
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c8e32cc1
    • D
      drm: move drm_mode related functions into drm_modes.c · 8bd441b2
      Daniel Vetter 提交于
      Makes more sense and gives better grouping in the DocBook function
      reference sections. To make this possible we need to expose two
      functions from drm_crtc.c though. To avoid further namespace pollution
      in the system wide headers create a new internal header for such drm
      internal symbols.
      
      I expect that longer-term we'll add tons more, but since my goal here
      is to polish the kerneldoc that's for another day.
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      8bd441b2
    • D
      drm/doc: Repleace LOCKING kerneldoc sections in drm_modes.c · 63951385
      Daniel Vetter 提交于
      There's not really any value in stating that no locking is needed. And
      even if the comment is useful, a check for the right mutex at the
      beginning of the function is better since that can't be ingored as
      easily as a bit of documentation.
      
      Note that drm_mode_probed_add in drm_crtc.c is also changed, the next
      patch will move this into drm_modes.c
      
      v2: Don't add locking WARN_ONs where it is not strictly required (i.e.
      the two functions to validate/prune mode lists).
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      63951385
    • D
      drm/kms: rip out drm_mode_connector_detach_encoder · 69fa5293
      Daniel Vetter 提交于
      It's only used by imx, and that one gets it wrong - there's no need
      to deteach the encoder before removing it.
      
      And really, neither current drm modesetting code nor all the userspace
      we have can handle dynamic changes in the set of possible encoders for
      a given connector. So let's just remove this before someone starts
      doing something really nasty with it.
      
      As a plus, one less kerneldoc comment to write.
      
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      69fa5293
  10. 13 2月, 2014 1 次提交
  11. 14 1月, 2014 1 次提交
  12. 18 12月, 2013 1 次提交
  13. 06 11月, 2013 3 次提交
  14. 23 10月, 2013 1 次提交
  15. 01 10月, 2013 2 次提交