1. 11 6月, 2013 1 次提交
    • V
      drm: Print pretty names for pixel formats · 6ba6d03e
      Ville Syrjälä 提交于
      Rather than just printing the pixel format as a hex number, decode the
      fourcc into human readable form, and also decode the LE vs. BE flag.
      
      Keep printing the raw hex number too in case it contains non-printable
      characters.
      
      Some examples what the new drm_get_format_name() produces:
      DRM_FORMAT_XRGB8888: "XR24 little-endian (0x34325258)"
      DRM_FORMAT_YUYV: "YUYV little-endian (0x56595559)"
      DRM_FORMAT_RGB565|DRM_FORMAT_BIG_ENDIAN: "RG16 big-endian (0xb6314752)"
      Unprintable characters: "D??? big-endian (0xff7f0244)"
      
      v2: Fix patch author
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      6ba6d03e
  2. 30 4月, 2013 2 次提交
    • V
      drm: Kill user_modes list and the associated ioctls · c55b6b3d
      Ville Syrjälä 提交于
      There is no way to use modes added to the user_modes list. We never
      look at the contents of said list in the kernel, and the only operations
      userspace can do are attach and detach. So the only "benefit" of this
      interface is wasting kernel memory.
      
      Fortunately it seems no real user space application ever used these
      ioctls. So just kill them.
      
      Also remove the prototypes for the non-existing drm_mode_addmode_ioctl()
      and drm_mode_rmmode_ioctl() functions.
      
      v2: Use drm_noop instead of completely removing the ioctls
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      c55b6b3d
    • V
      drm: Silence some sparse warnings · ea9cbb06
      Ville Syrjälä 提交于
      drivers/gpu/drm/drm_pci.c:155:5: warning: symbol 'drm_pci_set_busid' was not declared. Should it be static?
      drivers/gpu/drm/drm_pci.c:197:5: warning: symbol 'drm_pci_set_unique' was not declared. Should it be static?
      drivers/gpu/drm/drm_pci.c:269:5: warning: symbol 'drm_pci_agp_init' was not declared. Should it be static?
      
      drivers/gpu/drm/drm_crtc.c:181:1: warning: symbol 'drm_get_dirty_info_name' was not declared. Should it be static?
      drivers/gpu/drm/drm_crtc.c:1123:5: warning: symbol 'drm_mode_group_init' was not declared. Should it be static?
      
      drivers/gpu/drm/drm_modes.c:918:6: warning: symbol 'drm_mode_validate_clocks' was not declared. Should it be static?
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      ea9cbb06
  3. 26 4月, 2013 2 次提交
  4. 12 4月, 2013 1 次提交
  5. 08 3月, 2013 1 次提交
  6. 22 2月, 2013 2 次提交
  7. 14 2月, 2013 1 次提交
    • 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
  8. 21 1月, 2013 5 次提交
    • D
      drm: revamp framebuffer cleanup interfaces · 36206361
      Daniel Vetter 提交于
      We have two classes of framebuffer
      - Created by the driver (atm only for fbdev), and the driver holds
        onto the last reference count until destruction.
      - Created by userspace and associated with a given fd. These
        framebuffers will be reaped when their assoiciated fb is closed.
      
      Now these two cases are set up differently, the framebuffers are on
      different lists and hence destruction needs to clean up different
      things. Also, for userspace framebuffers we remove them from any
      current usage, whereas for internal framebuffers it is assumed that
      the driver has done this already.
      
      Long story short, we need two different ways to cleanup such drivers.
      Three functions are involved in total:
      - drm_framebuffer_remove: Convenience function which removes the fb
        from all active usage and then drops the passed-in reference.
      - drm_framebuffer_unregister_private: Will remove driver-private
        framebuffers from relevant lists and drop the corresponding
        references. Should be called for driver-private framebuffers before
        dropping the last reference (or like for a lot of the drivers where
        the fbdev is embedded someplace else, before doing the cleanup
        manually).
      - drm_framebuffer_cleanup: Final cleanup for both classes of fbs,
        should be called by the driver's ->destroy callback once the last
        reference is gone.
      
      This patch just rolls out the new interfaces and updates all drivers
      (by adding calls to drm_framebuffer_unregister_private at all the
      right places)- no functional changes yet. Follow-on patches will move
      drm core code around and update the lifetime management for
      framebuffers, so that we are no longer required to keep framebuffers
      alive by locking mode_config.mutex.
      
      I've also updated the kerneldoc already.
      
      vmwgfx seems to again be a bit special, at least I haven't figured out
      how the fbdev support in that driver works. It smells like it's
      external though.
      
      v2: The i915 driver creates another private framebuffer in the
      load-detect code. Adjust its cleanup code, too.
      Reviewed-by: NRob Clark <rob@ti.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      36206361
    • D
      drm: create drm_framebuffer_lookup · 786b99ed
      Daniel Vetter 提交于
      And replace all fb lookups with it. Also add a WARN to
      drm_mode_object_find since that is now no longer the blessed interface
      to look up an fb. And add kerneldoc to both functions.
      
      This only updates all callsites, but immediately drops the acquired
      refence again. Hence all callers still rely on the fact that a mode fb
      can't disappear while they're holding the struct mutex. Subsequent
      patches will instate proper use of refcounts, and then rework the rmfb
      and unref code to no longer serialize fb destruction with the
      mode_config lock. We don't want that since otherwise a compositor
      might end up stalling for a few frames in rmfb.
      
      v2: Don't use kref_get_unless_zero - Greg KH doesn't like that kind of
      interface.
      Reviewed-by: NRob Clark <rob@ti.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      786b99ed
    • D
      drm: revamp locking around fb creation/destruction · 4b096ac1
      Daniel Vetter 提交于
      Well, at least step 1. The goal here is that framebuffer objects can
      survive outside of the mode_config lock, with just a reference held
      as protection. The first step to get there is to introduce a special
      fb_lock which protects fb lookup, creation and destruction, to make
      them appear atomic.
      
      This new fb_lock can nest within the mode_config lock. But the idea is
      (once the reference counting part is completed) that we only quickly
      take that fb_lock to lookup a framebuffer and grab a reference,
      without any other locks involved.
      
      vmwgfx is the only driver which does framebuffer lookups itself, also
      wrap those calls to drm_mode_object_find with the new lock.
      
      Also protect the fb_list walking in i915 and omapdrm with the new lock.
      
      As a slight complication there's also the list of user-created fbs
      attached to the file private. The problem now is that at fclose() time
      we need to walk that list, eventually do a modeset call to remove the
      fb from active usage (and are required to be able to take the
      mode_config lock), but in the end we need to grab the new fb_lock to
      remove the fb from the list. The easiest solution is to add another
      mutex to protect this per-file list.
      
      Currently that new fbs_lock nests within the modeset locks and so
      appears redudant. But later patches will switch around this sequence
      so that taking the modeset locks in the fb destruction path is
      optional in the fastpath. Ultimately the goal is that addfb and rmfb
      do not require the mode_config lock, since otherwise they have the
      potential to introduce stalls in the pageflip sequence of a compositor
      (if the compositor e.g. switches to a fullscreen client or if it
      enables a plane). But that requires a few more steps and hoops to jump
      through.
      
      Note that framebuffer creation/destruction is now double-protected -
      once by the fb_lock and in parts by the idr_lock. The later would be
      unnecessariy if framebuffers would have their own idr allocator. But
      that's material for another patch (series).
      
      v2: Properly initialize the fb->filp_head list in _init, otherwise the
      newly added WARN to check whether the fb isn't on a fpriv list any
      more will fail for driver-private objects.
      
      v3: Fixup two error-case unlock bugs spotted by Richard Wilbur.
      Reviewed-by: NRob Clark <rob@ti.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      4b096ac1
    • D
      drm: add per-crtc locks · 29494c17
      Daniel Vetter 提交于
      *drumroll*
      
      The basic idea is to protect per-crtc state which can change without
      touching the output configuration with separate mutexes, i.e.  all the
      input side state to a crtc like framebuffers, cursor settings or plane
      configuration. Holding such a crtc lock gives a read-lock on all the
      other crtc state which can be changed by e.g. a modeset.
      
      All non-crtc state is still protected by the mode_config mutex.
      Callers that need to change modeset state of a crtc (e.g. dpms or
      set_mode) need to grab both the mode_config lock and nested within any
      crtc locks.
      
      Note that since there can only ever be one holder of the mode_config
      lock we can grab the subordinate crtc locks in any order (if we need
      to grab more than one of them). Lockdep can handle such nesting with
      the mutex_lock_nest_lock call correctly.
      
      With this functions that only touch connectors/encoders but not crtcs
      only need to take the mode_config lock. The biggest such case is the
      output probing, which means that we can now pageflip and move cursors
      while the output probe code is reading an edid.
      
      Most cases neatly fall into the three buckets:
      - Only touches connectors and similar output state and so only needs
        the mode_config lock.
      - Touches the global configuration and so needs all locks.
      - Only touches the crtc input side and so only needs the crtc lock.
      
      But a few cases that need special consideration:
      
      - Load detection which requires a crtc. The mode_config lock already
        prevents a modeset change, so we can use any unused crtc as we like
        to do load detection. The only thing to consider is that such
        temporary state changes don't leak out to userspace through ioctls
        that only take the crtc look (like a pageflip). Hence the load
        detect code needs to grab the crtc of any output pipes it touches
        (but only if it touches state used by the pageflip or cursor
        ioctls).
      
      - Atomic pageflip when moving planes. The first case is sane hw, where
        planes have a fixed association with crtcs - nothing needs to be
        done there. More insane^Wflexible hw needs to have plane->crtc
        mapping which is separately protect with a lock that nests within
        the crtc lock. If the plane is unused we can just assign it to the
        current crtc and continue. But if a plane is already in use by
        another crtc we can't just reassign it.
      
        Two solution present themselves: Either go back to a slow-path which
        takes all modeset locks, potentially incure quite a hefty delay. Or
        simply disallowing such changes in one atomic pageflip - in general
        the vblanks of two crtcs are not synced, so there's no sane way to
        atomically flip such plane changes accross more than one crtc. I'd
        heavily favour the later approach, going as far as mandating it as
        part of the ABI of such a new a nuclear pageflip.
      
        And if we _really_ want such semantics, we can always get them by
        introducing another pageflip mutex between the mode_config.mutex and
        the individual crtc locks. Pageflips crossing more than one crtc
        would then need to take that lock first, to lock out concurrent
        multi-crtc pageflips.
      
      - Optimized global modeset operations: We could just take the
        mode_config lock and then lazily lock all crtc which are affected by
        a modeset operation. This has the advantage that pageflip could
        continue unhampered on unaffected crtc. But if e.g. global resources
        like plls need to be reassigned and so affect unrelated crtcs we can
        still do that - nested locking works in any order.
      
      This patch just adds the locks and takes them in drm_modeset_lock_all,
      no real locking changes yet.
      
      v2: Need to initialize the new lock in crtc_init and lock it righ
      away, for otherwise the modeset_unlock_all below will try to unlock a
      not-locked mutex.
      Reviewed-by: NRob Clark <rob@ti.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      29494c17
    • D
      drm: add drm_modeset_lock|unlock_all · 84849903
      Daniel Vetter 提交于
      This is the first step towards introducing the new modeset locking
      scheme. The plan is to put helper functions into place at all the
      right places step-by-step, so that the final patch to switch on the
      new locking scheme doesn't need to touch every single driver.
      
      This helper here will serve as the shotgun solutions for all places
      where a more fine-grained locking isn't (yet) implemented.
      
      v2: Fixup kerneldoc for unlock_all.
      Reviewed-by: NRob Clark <rob@ti.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      84849903
  9. 20 1月, 2013 2 次提交
  10. 01 12月, 2012 1 次提交
    • R
      drm: remove legacy drm_connector_property fxns · 58495563
      Rob Clark 提交于
      Replace references to and remove the connector property fxns, which
      have been superseded with the more general object property fxns:
      
        + drm_connector_attach_property -> drm_object_attach_property
        + drm_connector_property_set_value -> drm_object_property_set_value
        + drm_connector_property_get_value -> drm_object_property_get_value
      Signed-off-by: NRob Clark <rob@ti.com>
      58495563
  11. 29 11月, 2012 1 次提交
  12. 20 11月, 2012 4 次提交
    • D
      drm: don't start the poll engine in probe_single_connector · 905bc9ff
      Daniel Vetter 提交于
      Actually there's a reason this stuff is there, and it's called
      
      commit e58f637b
      Author: Chris Wilson <chris@chris-wilson.co.uk>
      Date:   Fri Aug 20 09:13:36 2010 +0100
      
          drm/kms: Add a module parameter to disable polling
      
      The idea has been that users can enable/disable polling at runtime. So
      the quick hack has been to just re-enable the output polling if xrandr
      asks for the latest state of the connectors.
      
      The problem with that hack is that when we force connectors to another
      state than what would be detected, we nicely ping-pong:
      - Userspace calls probe, gets the forced state, but polling starts
        again.
      - Polling notices that the state is actually different, wakes up
        userspace.
      - Repeat.
      
      As that commit already explains, the right fix would be to make the
      locking more fine-grained, so that hotplug detection on one output
      does not interfere with cursor updates on another crtc.
      
      But that is way too much work. So let's just safe this gross hack by
      caching the last-seen state of drm_kms_helper_poll for that driver,
      and only fire up the poll engine again if it changed from off to on.
      
      v2: Fixup the edge detection of drm_kms_helper_poll.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49907Tested-by: NTvrtko Ursulin <tvrtko.ursulin@onelan.co.uk>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      905bc9ff
    • D
      drm: run the hpd irq event code directly · 69787f7d
      Daniel Vetter 提交于
      All drivers already have a work item to run the hpd code, so we don't
      need to launch a new one in the helper code. Dave Airlie mentioned
      that the cancel+re-queue might paper over DP related hpd ping-pongs,
      hence why this is split out.
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      69787f7d
    • D
      drm: handle HPD and polled connectors separately · 816da85a
      Daniel Vetter 提交于
      Instead of reusing the polling code for hpd handling, split them up.
      This has a few consequences:
      - Don't touch HPD capable connectors in the poll loop.
      - Only touch HPD capable connectors in drm_helper_hpd_irq_event.
      - We could run the HPD handling directly (because all callers already
        use their own work item), but for easier bisect that happens in it's
        own patch.
      
      The ultimate goal is that drivers grow some smarts about which
      connectors have received a hotplug event and only call the detect code
      of that connector. But that's a second step.
      
      v2: s/hdp/hpd/, noticed by Adam Jackson. I can't type.
      
      v3: Split out the work item removal as requested by Dave Airlie. This
      results in a temporary mode_config.hpd_irq_work item to keep things
      the same.
      
      v4: In the hpd_irq_event handler don't bail out if other bits than HPD
      are set. This is useful where e.g. hpd is unreliably, but mostly
      works. Drivers can then set both HPD and POLL flags, and users get the
      best of both worlds: Quick hotplug feedback if the hpd works, but
      still reliable detection with the polling. The poll loop already works
      the same, and doesn't bail if HPD is set.
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      816da85a
    • S
      drm: get cea video id code for a given display mode · a4799037
      Stephane Marchesin 提交于
      This patch adds support for getting CEA Video ID Code for a given
      display mode after matching with edid_cea_modes list. Its index in
      the list added with one, gives the desired code.
      
      This exported function will be used by hdmi drivers for composing
      AVI info frame data.
      Signed-off-by: NStephane Marchesin <marcheu@chromium.org>
      Signed-off-by: NRahul Sharma <rahul.sharma@samsung.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      a4799037
  13. 07 11月, 2012 1 次提交
  14. 03 10月, 2012 2 次提交
  15. 02 10月, 2012 2 次提交
    • R
      drm: support for rotated scanout · 7c80e128
      Rob Clark 提交于
      For drivers that can support rotated scanout, the extra parameter
      checking in drm-core, while nice, tends to get confused.  To solve
      this drivers can set the crtc or plane invert_dimensions field so
      that the dimension checking takes into account the rotation that
      the driver is performing.
      
      v1: original
      v2: remove invert_dimensions from plane, at Ville's suggestion.
          Userspace can give rotated src coordinates, so invert_dimensions
          is not required for planes.
      Signed-off-by: NRob Clark <rob@ti.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      7c80e128
    • R
      drm: refcnt drm_framebuffer (v4.1) · f7eff60e
      Rob Clark 提交于
      This simplifies drm fb lifetime, and if the crtc/plane needs to hold
      a ref to the fb when disabling a pipe until the next vblank, this
      avoids the need to make disabling an overlay synchronous.  This is a
      problem that shows up when userspace is using a drm plane to
      implement a hw cursor.. making overlay disable synchronous causes
      a performance problem when x11 is rapidly enabling/disabling the
      hw cursor.  But not making it synchronous opens up a race condition
      for crashing if userspace turns around and immediately deletes the
      fb.  Refcnt'ing the fb makes it possible to solve this problem.
      
      v1: original
      v2: add drm_framebuffer_remove() which is called in all paths where
          fb->funcs->destroy() was directly called before.  This cleans
          up the CRTCs/planes that the fb was attached to.  You should
          only directly use drm_framebuffer_unreference() if you are also
          using drm_framebuffer_reference() to keep a ref to the fb.
      v3: add comment explaining the fb refcount
      v4: remove duplicate 'list_del(&fb->filp_head)'
      
      [airlied: v4.1: fix local rejection]
      Signed-off-by: NRob Clark <rob@ti.com>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      f7eff60e
  16. 26 9月, 2012 1 次提交
  17. 17 9月, 2012 1 次提交
  18. 24 8月, 2012 2 次提交
  19. 22 8月, 2012 1 次提交
  20. 20 7月, 2012 1 次提交
  21. 12 6月, 2012 1 次提交
    • P
      drm: increase DRM_OBJECT_MAX_PROPERTY to 24 · fe456168
      Paulo Zanoni 提交于
      Before Kernel 3.5, no one was checking for the return value of
      drm_connector_attach_property, so we never noticed that we were unable
      to create some properties. Commit "drm: WARN() when
      drm_connector_attach_property fails" added a WARN when we fail to
      create a property, and the transition from "connector properties" to
      "object properties" changed the warning message a little bit.
      
      On i915 machines with many TV connectors we hit the maximum number of
      properties (since each TV connector uses a lot of properties), so we
      get a few backtraces in our logs. This commit increases the maximum
      number of properties to 24 hoping we'll have enough room for
      everybody.
      
      Chris suggested that we convert this code to "lists", but I believe
      this conversion can come after we make sure people's dmesgs are not
      spammed by our driver.
      Signed-off-by: NPaulo Zanoni <paulo.r.zanoni@intel.com>
      Reported-by: NDave Jones <davej@redhat.com>
      Tested-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDave Airlie <airlied@redhat.com>
      fe456168
  22. 22 5月, 2012 4 次提交
  23. 17 5月, 2012 1 次提交