1. 27 7月, 2015 1 次提交
  2. 22 7月, 2015 5 次提交
    • D
      drm: gc now dead mode_group code · 3fdefa39
      Daniel Vetter 提交于
      Two nice things here:
      - drm_dev_register will truly register everything in the right order
        if the driver doesn't have a ->load callback. Before this we had to
        init the primary mode_group after the device nodes where already
        registered.
      
      - Less things to keep track of when reworking the connector locking,
        yay!
      Reviewed-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      3fdefa39
    • D
      drm: Stop filtering according to mode_group in getresources · 9c7060f7
      Daniel Vetter 提交于
      It's been dead code since forever since mode groups haven't ever been
      implemented. On top of that it's also been non-functional since we
      only ever filtered the getresources ioctl and not any of the others
      nor the mode object lookup code.
      
      Given overwhelming evidence it looks like this isn't a feature we
      need, hence remove it.
      Reviewed-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      9c7060f7
    • D
      drm: Roll out drm_for_each_{plane,crtc,encoder} · e4f62546
      Daniel Vetter 提交于
      Remaining manual work in the drm core&helpers. Nothing special here,
      no surprises.
      Reviewed-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      e4f62546
    • D
      drm: Roll out drm_for_each_connector more · 9a9f5ce8
      Daniel Vetter 提交于
      Now that we also grab the connection_mutex and so fixed the race with
      atomic modeset we can use the iterator there too.
      
      The other special case is drm_connector_unplug_all which would have a
      locking inversion with the sysfs store/show functions if we'd grab the
      mode_config.mutex around the unplug. We could just grab
      connection_mutex instead, but that's a bit too much a dirty trick for
      my taste. Also it's only used by udl, which doesn't do any other kind
      of connector hotplugging, so should be race-free. Hence just stick
      with a comment for now.
      Reviewed-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      9a9f5ce8
    • D
      drm: Add modeset object iterators · 6295d607
      Daniel Vetter 提交于
      And roll them out across drm_* files. The point here isn't code
      prettification (it helps with that too) but that some of these lists
      aren't static any more. And having macros will gives us a convenient
      place to put locking checks into.
      
      I didn't add an iterator for props since that's only used by a
      list_for_each_entry_safe in the driver teardown code.
      
      Search&replace was done with the below cocci spatch. Note that there's
      a bunch more places that didn't match and which would need some manual
      changes, but I've intentially left these out for this mostly automated
      patch.
      
      iterator name drm_for_each_crtc;
      struct drm_crtc *crtc;
      struct drm_device *dev;
      expression head;
      @@
      - list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
      + drm_for_each_crtc (crtc, dev) {
      ...
      }
      
      @@
      iterator name drm_for_each_encoder;
      struct drm_encoder *encoder;
      struct drm_device *dev;
      expression head;
      @@
      - list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
      + drm_for_each_encoder (encoder, dev) {
      ...
      }
      
      @@
      iterator name drm_for_each_fb;
      struct drm_framebuffer *fb;
      struct drm_device *dev;
      expression head;
      @@
      - list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
      + drm_for_each_fb (fb, dev) {
      ...
      }
      
      @@
      iterator name drm_for_each_connector;
      struct drm_connector *connector;
      struct drm_device *dev;
      expression head;
      @@
      - list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
      + drm_for_each_connector (connector, dev) {
      ...
      }
      Reviewed-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      6295d607
  3. 07 7月, 2015 2 次提交
    • Z
      drm: add a check for x/y in drm_mode_setcrtc · 01447e9f
      Zhao Junwang 提交于
      legacy setcrtc ioctl does take a 32 bit value which might indeed
      overflow
      
      the checks of crtc_req->x > INT_MAX and crtc_req->y > INT_MAX aren't
      needed any more with this
      
      v2: -polish the annotation according to Daniel's comment
      
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NZhao Junwang <zhjwpku@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      01447e9f
    • D
      drm: Update plane->fb also for page_flip · 3cb43cc0
      Daniel Vetter 提交于
      The legacy page_flip driver entry point is the only one left which
      requires drivers to update plane->fb themselves. All the other entry
      hooks will patch things up for the driver as needed since no one seems
      to reliable get this right, see e.g. drm_mode_set_config_internal or
      the plane->fb/old_fb handling in drm_mode_atomic_ioctl.
      
      Therefore unify things, which allows us to ditch a TODO from
      drm_atomic_helper_page_flip.
      
      This should also help the atomic transition in i915 since we keep a
      bit of legacy cruft only around because of this special behaviour in
      ->page_flip.
      
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Reviewed-by: NMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      3cb43cc0
  4. 06 7月, 2015 1 次提交
  5. 04 7月, 2015 1 次提交
  6. 02 7月, 2015 1 次提交
  7. 12 6月, 2015 1 次提交
  8. 26 5月, 2015 3 次提交
  9. 22 5月, 2015 6 次提交
  10. 12 5月, 2015 1 次提交
  11. 08 5月, 2015 2 次提交
  12. 07 5月, 2015 1 次提交
  13. 14 4月, 2015 1 次提交
    • M
      drm: Make integer overflow checking cover universal cursor updates (v2) · 3968be94
      Matt Roper 提交于
      Our legacy SetPlane updates perform integer overflow checking on a
      plane's destination rectangle in drm_mode_setplane(), and atomic updates
      handled as part of a drm_atomic_state transaction do the same checking
      in drm_atomic_plane_check().  However legacy cursor updates that get
      routed through universal plane interfaces may bypass this overflow
      checking if the driver's .update_plane is serviced by the transitional
      plane helpers rather than the full atomic plane helpers.
      
      Move the check for destination rectangle integer overflow from the
      drm_mode_setplane() to __setplane_internal() so that it also covers
      cursor operations.
      
      This fixes an issue first noticed with i915 commit:
      
              commit ff42e093
              Author: Daniel Vetter <daniel.vetter@ffwll.ch>
              Date:   Mon Mar 2 16:35:20 2015 +0100
      
                  Revert "drm/i915: Switch planes from transitional helpers to full
                  atomic helpers"
      
      The above revert switched us from full atomic helpers back to the
      transitional helpers, and in doing so we lost the overflow checking here
      for universal cursor updates.  Even though such extreme cursor positions
      are unlikely to actually happen in the wild, we still don't want there
      to be a change of behavior when drivers switch from transitional helpers
      to full helpers.
      
      v2: Move check from setplane ioctl to setplane_internal rather than
          adding an additional copy of the checks to the transitional plane
          helpers.  (Daniel)
      
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Testcase: igt/kms_cursor_crc
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84269Signed-off-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      3968be94
  14. 10 4月, 2015 1 次提交
  15. 08 4月, 2015 1 次提交
  16. 02 4月, 2015 1 次提交
  17. 24 3月, 2015 1 次提交
    • D
      drm: Fixup racy refcounting in plane_force_disable · 8218c3f4
      Daniel Vetter 提交于
      Originally it was impossible to be dropping the last refcount in this
      function since there was always one around still from the idr. But in
      
      commit 83f45fc3
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Wed Aug 6 09:10:18 2014 +0200
      
          drm: Don't grab an fb reference for the idr
      
      we've switched to weak references, broke that assumption but forgot to
      fix it up.
      
      Since we still force-disable planes it's only possible to hit this
      when racing multiple rmfb with fbdev restoring or similar evil things.
      As long as userspace is nice it's impossible to hit the BUG_ON.
      
      But the BUG_ON would most likely be hit from fbdev code, which usually
      invovles the console_lock besides all modeset locks. So very likely
      we'd never get the bug reports if this was hit in the wild, hence
      better be safe than sorry and backport.
      
      Spotted by Matt Roper while reviewing other patches.
      
      [airlied: pull this back into 4.0 - the oops happens there]
      
      Cc: stable@vger.kernel.org
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      8218c3f4
  18. 17 3月, 2015 1 次提交
  19. 10 3月, 2015 5 次提交
    • L
      drm: Check in setcrtc if the primary plane supports the fb pixel format · 7eb5f302
      Laurent Pinchart 提交于
      Drivers implementing the universal planes API report the list of
      supported pixel formats for the primary plane. Make sure the fb passed
      to the setcrtc ioctl is compatible.
      
      Drivers not implementing the universal planes API will have no format
      reported for the primary plane, skip the check in that case.
      Signed-off-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      7eb5f302
    • L
      drm: Share plane pixel format check code between legacy and atomic · ead8610d
      Laurent Pinchart 提交于
      Both the legacy and atomic helpers need to check whether a plane
      supports a given pixel format. The code is currently duplicated, share
      it.
      Signed-off-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      [danvet: Slightly extend the docbook.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ead8610d
    • D
      drm: Fixup racy refcounting in plane_force_disable · 220dd2bc
      Daniel Vetter 提交于
      Originally it was impossible to be dropping the last refcount in this
      function since there was always one around still from the idr. But in
      
      commit 83f45fc3
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Wed Aug 6 09:10:18 2014 +0200
      
          drm: Don't grab an fb reference for the idr
      
      we've switched to weak references, broke that assumption but forgot to
      fix it up.
      
      Since we still force-disable planes it's only possible to hit this
      when racing multiple rmfb with fbdev restoring or similar evil things.
      As long as userspace is nice it's impossible to hit the BUG_ON.
      
      But the BUG_ON would most likely be hit from fbdev code, which usually
      invovles the console_lock besides all modeset locks. So very likely
      we'd never get the bug reports if this was hit in the wild, hence
      better be safe than sorry and backport.
      
      Spotted by Matt Roper while reviewing other patches.
      
      Cc: stable@vger.kernel.org
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      220dd2bc
    • D
      drm: Remove redundant code in the getencoder ioctl · 84428531
      Daniel Vetter 提交于
      When enabling atomic state object for this ioctl in
      
      commit abd69c55
      Author: Daniel Vetter <daniel.vetter@ffwll.ch>
      Date:   Tue Nov 25 23:50:05 2014 +0100
      
          drm: Handle atomic state properly in kms getfoo ioctl
      
      I've forgotten to remove this hunk in one of the later revisions.
      drm_encoder_get_crtc already does this.
      
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: Sean Paul <seanpaul@chromium.org>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      84428531
    • C
      drm: Don't assign fbs for universal cursor support to files · 9a6f5130
      Chris Wilson 提交于
      The internal framebuffers we create to remap legacy cursor ioctls to
      plane operations for the universal plane support shouldn't be linke to
      the file like normal userspace framebuffers. This bug goes back to the
      original universal cursor plane support introduced in
      
      commit 161d0dc1
      Author: Matt Roper <matthew.d.roper@intel.com>
      Date:   Tue Jun 10 08:28:10 2014 -0700
      
          drm: Support legacy cursor ioctls via universal planes when possible (v4)
      
      The isn't too disastrous since fbs are small, we only create one when the
      cursor bo gets changed and ultimately they'll be reaped when the window
      server restarts.
      
      Conceptually we'd want to just pass NULL for file_priv when creating it,
      but the driver needs the file to lookup the underlying buffer object for
      cursor id. Instead let's move the file_priv linking out of
      add_framebuffer_internal() into the addfb ioctl implementation, which is
      the only place it is needed. And also rename the function for a more
      accurate since it only creates the fb, but doesn't add it anywhere.
      
      Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> (fix & commit msg)
      Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> (provider of lipstick)
      Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      9a6f5130
  20. 24 2月, 2015 1 次提交
  21. 23 2月, 2015 1 次提交
  22. 14 2月, 2015 1 次提交
    • R
      drm: add support for tiled/compressed/etc modifier in addfb2 · e3eb3250
      Rob Clark 提交于
      In DRM/KMS we are lacking a good way to deal with tiled/compressed
      formats.  Especially in the case of dmabuf/prime buffer sharing, where
      we cannot always rely on under-the-hood flags passed to driver specific
      gem-create ioctl to pass around these extra flags.
      
      The proposal is to add a per-plane format modifier.  This allows to, if
      necessary, use different tiling patters for sub-sampled planes, etc.
      The format modifiers are added at the end of the ioctl struct, so for
      legacy userspace it will be zero padded.
      
      v1: original
      v1.5: increase modifier to 64b
      
      v2: Incorporate review comments from the big thread, plus a few more.
      
      - Add a getcap so that userspace doesn't have to jump through hoops.
      - Allow modifiers only when a flag is set. That way drivers know when
        they're dealing with old userspace and need to fish out e.g. tiling
        from other information.
      - After rolling out checks for ->modifier to all drivers I've decided
        that this is way too fragile and needs an explicit opt-in flag. So
        do that instead.
      - Add a define (just for documentation really) for the "NONE"
        modifier. Imo we don't need to add mask #defines since drivers
        really should only do exact matches against values defined with
        fourcc_mod_code.
      - Drop the Samsung tiling modifier on Rob's request since he's not yet
        sure whether that one is accurate.
      
      v3:
      - Also add a new ->modifier[] array to struct drm_framebuffer and fill
        it in drm_helper_mode_fill_fb_struct. Requested by Tvrkto Uruslin.
      - Remove TODO in comment and add code comment that modifiers should be
        properly documented, requested by Rob.
      
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Cc: Daniel Stone <daniel@fooishbar.org>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Michel Dänzer <michel@daenzer.net>
      Signed-off-by: Rob Clark <robdclark@gmail.com> (v1.5)
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Reviewed-by: NDaniel Stone <daniels@collabora.com>
      Acked-by: NDave Airlie <airlied@redhat.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      e3eb3250
  23. 28 1月, 2015 1 次提交