1. 16 5月, 2014 1 次提交
  2. 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
  3. 02 4月, 2014 7 次提交
  4. 28 3月, 2014 2 次提交
  5. 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
  6. 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
  7. 13 2月, 2014 1 次提交
  8. 14 1月, 2014 1 次提交
  9. 18 12月, 2013 1 次提交
  10. 06 11月, 2013 3 次提交
  11. 23 10月, 2013 1 次提交
  12. 01 10月, 2013 6 次提交
  13. 04 9月, 2013 1 次提交
  14. 02 9月, 2013 2 次提交
    • D
      drm: fix DRM_IOCTL_MODE_GETFB handle-leak · 101b96f3
      David Herrmann 提交于
      DRM_IOCTL_MODE_GETFB is used to retrieve information about a given
      framebuffer ID. It is a read-only helper and was thus declassified for
      unprivileged access in:
      
        commit a14b1b42
        Author: Mandeep Singh Baines <mandeep.baines@gmail.com>
        Date:   Fri Jan 20 12:11:16 2012 -0800
      
            drm: remove master fd restriction on mode setting getters
      
      However, alongside width, height and stride information,
      DRM_IOCTL_MODE_GETFB also passes back a handle to the underlying buffer of
      the framebuffer. This handle allows users to mmap() it and read or write
      into it. Obviously, this should be restricted to DRM-Master.
      
      With the current setup, *any* process with access to /dev/dri/card0 (which
      means any process with access to hardware-accelerated rendering) can
      access the current screen framebuffer and modify it ad libitum.
      
      For backwards-compatibility reasons we want to keep the
      DRM_IOCTL_MODE_GETFB call unprivileged. Besides, it provides quite useful
      information regarding screen setup. So we simply test whether the caller
      is the current DRM-Master and if not, we return 0 as handle, which is
      always invalid. A following DRM_IOCTL_GEM_CLOSE on this handle will fail
      with EINVAL, but we accept this. Users shouldn't test for errors during
      GEM_CLOSE, anyway. And it is still better as a failing MODE_GETFB call.
      
      v2: add capable(CAP_SYS_ADMIN) check for compatibility with i-g-t
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      101b96f3
    • S
      drm: Add drm_bridge · 3b336ec4
      Sean Paul 提交于
      This patch adds the notion of a drm_bridge. A bridge is a chained
      device which hangs off an encoder. The drm driver using the bridge
      should provide the association between encoder and bridge. Once a
      bridge is associated with an encoder, it will participate in mode
      set, and dpms (via the enable/disable hooks).
      Signed-off-by: NSean Paul <seanpaul@chromium.org>
      Acked-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      3b336ec4
  15. 30 8月, 2013 2 次提交
  16. 21 8月, 2013 2 次提交
  17. 19 8月, 2013 1 次提交
  18. 28 6月, 2013 1 次提交
    • D
      drm: add hotspot support for cursors. · 4c813d4d
      Dave Airlie 提交于
      So it looks like for virtual hw cursors on QXL we need to inform
      the "hw" device what the cursor hotspot parameters are. This
      makes sense if you think the host has to draw the cursor and interpret
      clicks from it. However the current modesetting interface doesn't support
      passing the hotspot information from userspace.
      
      This implements a new cursor ioctl, that takes the hotspot info as well,
      userspace can try calling the new interface and if it gets -ENOSYS it means
      its on an older kernel and can just fallback.
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      4c813d4d
  19. 25 6月, 2013 1 次提交
    • D
      drm: fix fb leak in setcrtc · 5cef29aa
      Daniel Vetter 提交于
      Drivers are allowed (actually have to) disable unrelated crtcs in
      their ->set_config callback (when we steal all the connectors from
      that crtc). If they do that they'll clear crtc->fb to NULL.
      
      Which results in a refcount leak, since the drm core is keeping track
      of that reference.
      
      To fix this track the old fb of all crtcs and adjust references for
      all of them. Of course, since we only hold an additional reference for
      the fb for the current crtc we need to increase refcounts before we
      drop the old one.
      
      This approach has the benefit that it inches us a bit closer to an
      atomic modeset world, where we want to update the config of all crtcs
      in one step.
      
      This regression has been introduce in the framebuffer refcount
      conversion, specifically in
      
      commit b0d12325
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Tue Dec 11 01:07:12 2012 +0100
      
          drm: refcounting for crtc framebuffers
      Reported-by: NRussell King <linux@arm.linux.org.uk>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      5cef29aa