1. 08 7月, 2014 3 次提交
    • F
      drm/omap: remove null test before kfree · d2c87e2d
      Fabian Frederick 提交于
      Fix checkpatch warning:
      WARNING: kfree(NULL) is safe this check is probably not required
      
      Cc: David Airlie <airlied@linux.ie>
      Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
      Signed-off-by: NFabian Frederick <fabf@skynet.be>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      d2c87e2d
    • D
      drm/gem: remove misleading gfp parameter to get_pages() · 0cdbe8ac
      David Herrmann 提交于
      drm_gem_get_pages() currently allows passing a 'gfp' parameter that is
      passed to shmem combined with mapping_gfp_mask(). Given that the default
      mapping_gfp_mask() is GFP_HIGHUSER, it is _very_ unlikely that anyone will
      ever make use of that parameter. In fact, all drivers currently pass
      redundant flags or 0.
      
      This patch removes the 'gfp' parameter. The only reason to keep it is to
      remove flags like __GFP_WAIT. But in its current form, it can only be used
      to add flags. So to remove __GFP_WAIT, you'd have to drop it from the
      mapping_gfp_mask, which again is stupid as this mask is used by shmem-core
      for other allocations, too.
      
      If any driver ever requires that parameter, we can introduce a new helper
      that takes the raw 'gfp' parameter. The caller'd be responsible to combine
      it with mapping_gfp_mask() in a suitable way. The current
      drm_gem_get_pages() helper would then simply use mapping_gfp_mask() and
      call the new helper. This is what shmem_read_mapping_pages{_gfp,} does
      right now.
      
      Moreover, the gfp-zone flag-usage is not obvious: If you pass a modified
      zone, shmem core will WARN() or even BUG(). In other words, the following
      must be true for 'gfp' passed to shmem_read_mapping_pages_gfp():
          gfp_zone(mapping_gfp_mask(mapping)) == gfp_zone(gfp)
      Add a comment to drm_gem_read_pages() explaining that constraint.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      0cdbe8ac
    • D
      drm/omap: use __GFP_DMA32 for shmem-backed gem · ab5a60c3
      David Herrmann 提交于
      OMAP requires bo-pages to be in the DMA32 zone. Explicitly request this by
      setting __GFP_DMA32 as mapping-gfp-mask during shmem initialization. This
      drops HIGHMEM from the gfp-mask and uses DMA32 instead. shmem-core takes
      care to relocate pages during swap-in in case they have been loaded into
      the wrong zone.
      
      It is _not_ possible to pass __GFP_DMA32 to shmem_read_mapping_page_gfp()
      as the page might have already been swapped-in at that time. The zone-mask
      must be set during initialization and be kept constant for now.
      
      Remove the now superfluous TODO in omap_gem.c.
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Tested-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      ab5a60c3
  2. 05 6月, 2014 2 次提交
  3. 04 6月, 2014 1 次提交
    • 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
  4. 15 4月, 2014 9 次提交
  5. 14 4月, 2014 8 次提交
    • T
      drm/omap: fix missing unref to fb's buf object · 5e19c06d
      Tomi Valkeinen 提交于
      omap_fbdev_create() takes a reference to the fb's gem object with
      omap_gem_get_paddr(). However, it never releases it with
      omap_gem_put_paddr().
      
      This patch adds the missing omap_gem_put_paddr() to omap_fbdev_free().
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      5e19c06d
    • G
      drm/omap: fix plane rotation · d4586604
      Grazvydas Ignotas 提交于
      Plane rotation with omapdrm is currently broken.
      It seems omap_plane_mode_set() expects width and height in screen
      coordinates, so pass it like that.
      Signed-off-by: NGrazvydas Ignotas <notasas@gmail.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      d4586604
    • T
      drm/omap: fix enabling/disabling of video pipeline · 506096a1
      Tomi Valkeinen 提交于
      At the moment the omap_crtc_pre_apply() handles the enabling, disabling
      and configuring of encoders and panels separately from the CRTC (i.e.
      the overlay manager).
      
      However, this doesn't work correctly. The encoder driver has to be in
      control of its video input (i.e. the crtc) for correct operation.
      
      This problem causes bugs with (at least) HDMI: the HDMI encoder supplies
      pixel clock for DISPC, and DISPC supplies video stream for HDMI. The
      current code first enables the HDMI encoder, and CRTC after that.
      However, the encoder expects the video stream to start during the
      encoder's enable, and if it doesn't, there will be sync lost errors.
      
      The encoder enables its video source by calling src->enable(), and this
      call goes to omapdrm (omap_crtc_enable), but omapdrm doesn't do anything
      in that function. Similarly for disable, which goes to
      omap_crtc_disable().
      
      This patch moves the code to setup and enable/disable the crtc to
      omap_crtc_enable. and omap_crtc_disable().
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      506096a1
    • T
      drm/omap: fix missing disable for unused encoder · c7aef12f
      Tomi Valkeinen 提交于
      When an encoder is no longer connected to a crtc, the driver will leave
      the encoder enabled.
      
      This patch adds code to track the encoder used for a crtc, and when the
      encoder changes, the old one is disabled.
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      c7aef12f
    • T
      drm/omap: fix race issue when unloading omapdrm · e2f8fd74
      Tomi Valkeinen 提交于
      At module unload, omap_fbdev_free() gets called which releases the
      framebuffers. However, the framebuffers are still used by crtcs, and
      will be released only later at vsync. The driver doesn't wait for this,
      and goes on to release the rest of the resources, which often
      causes a crash.
      
      This patchs adds a omap_crtc_flush() function which waits until the crtc
      has finished with its apply queue and page flips.
      
      The function utilizes a simple polling while-loop, as the performance is
      not an issue here.
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      e2f8fd74
    • T
      drm/omap: fix DMM driver (un)registration · ea7e3a66
      Tomi Valkeinen 提交于
      At the moment the DMM driver is never unregistered, even if it's
      registered in the omapdrm module's init function. This means we'll get
      errors when reloading the omapdrm module.
      
      Fix this by unregistering the DMM driver properly, and also change the
      module init to fail if DMM driver cannot be registered, simplifying the
      unregister path as we don't need to keep the state whether we registered
      the DMM driver or not.
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      ea7e3a66
    • T
      drm/omap: fix uninit order in pdev_remove() · 707cf58a
      Tomi Valkeinen 提交于
      When unloading omapdrm driver, the omapdrm platform device is
      uninitialized last, after the displays have been disconnected omap_crtc
      callbacks have been removed. As the omapdrm pdev uninitialization needs
      the features uninitialized in earlier steps, a crash is guaranteed.
      
      This patch fixes the uninitialize order so that the omapdrm pdev is
      removed first.
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      707cf58a
    • T
      drm/omap: fix output enable/disable sequence · 2ec8e378
      Tomi Valkeinen 提交于
      At the moment it's quite easy to get the following errors when the HDMI
      output is enabled or disabled:
      
      [drm:omap_crtc_error_irq] *ERROR* tv: errors: 00008000
      
      The reason for the errors is that the omapdrm driver doesn't properly
      handle the sync-lost irqs that happen when enabling the DIGIT crtc,
      which is used for HDMI and analog TV. The driver does disable the
      sync-lost irq properly, but it fails to wait until the output has been
      fully enabled (i.e. the first vsync), so the sync-lost errors are still
      seen occasionally.
      
      This patch makes the omapdrm act the same way as the omapfb does:
      
      - When enabling a display, we'll wait for the first vsync.
      - When disabling a display, we'll wait for framedone if available, or
        odd and even vsyncs.
      
      These changes make sure the output is fully enabled or disabled at the
      end of the function.
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      Reported-by: NSanjay Singh Rawat <sanjay.rawat@linaro.org>
      Reviewed-by: NRob Clark <robdclark@gmail.com>
      2ec8e378
  6. 02 4月, 2014 1 次提交
    • 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
  7. 31 3月, 2014 1 次提交
  8. 16 3月, 2014 1 次提交
    • D
      drm: use anon-inode instead of relying on cdevs · 6796cb16
      David Herrmann 提交于
      DRM drivers share a common address_space across all character-devices of a
      single DRM device. This allows simple buffer eviction and mapping-control.
      However, DRM core currently waits for the first ->open() on any char-dev
      to mark the underlying inode as backing inode of the device. This delayed
      initialization causes ugly conditions all over the place:
        if (dev->dev_mapping)
          do_sth();
      
      To avoid delayed initialization and to stop reusing the inode of the
      char-dev, we allocate an anonymous inode for each DRM device and reset
      filp->f_mapping to it on ->open().
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      6796cb16
  9. 05 3月, 2014 1 次提交
    • T
      OMAPDSS: convert pixel clock to common videomode style · d8d78941
      Tomi Valkeinen 提交于
      omapdss has its own video-timings struct, but we want to move the common
      videomode.
      
      The first step is to change the omapdss's pixelclock unit from kHz to
      Hz. Also, omapdss uses "pixel_clock" field name, whereas the common
      videomode uses "pixelclock" field name. This patch changes the field
      name also, as that makes it easy to spot any non-converted pixel_clock
      uses.
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      d8d78941
  10. 14 1月, 2014 1 次提交
  11. 09 1月, 2014 6 次提交
    • A
      drm/omap: Enable DT support for DMM · 3d232346
      Archit Taneja 提交于
      Enable use of DT for DMM/Tiler.
      
      Originally worked on by Andy Gross <andygro@gmail.com>
      
      Cc: Andy Gross <andygro@gmail.com>
      Cc: DRI Development <dri-devel@lists.freedesktop.org>
      Signed-off-by: NArchit Taneja <archit@ti.com>
      [tomi.valkeinen@ti.com: use of_match_ptr()]
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      3d232346
    • A
      drm/omap: fix: change dev_unload order · 80e4ed54
      Archit Taneja 提交于
      The current dev_unload order uninits the irqs too early.
      
      In the current sequence, it's possible that a crtc queues work(apply_worker)
      to display a buffer, which registers to omap_crtc_apply_irq to notfiy the
      completion of the configuration we applied.
      
      Calling drm_vblank_cleanup and omap_drm_irq_uninstall here causes the crtc's
      apply handler to never get called, which results in an incorrect state of the
      apply_irq.registered parameter.
      
      This condition occurs where there is no mode set via omapdrm, and dev_lastclose
      tries to set a default fb mode via drm_fb_helper_restore_fbdev_mode. The apply
      work scheduled by restore_fbdev_mode is very close in time to the disabling of
      the irq handler, and hence leads to a race condition. We move the irq cleanup
      at the end of the unload sequence to prevent this.
      
      Also, the call to flush_workqueue is removed since it's called internally by
      destroy_workqueue.
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      80e4ed54
    • A
      drm/omap: fix: disable encoder before destroying it · ec72a81e
      Archit Taneja 提交于
      Currently, an encoder is disabled only when an apply work is queued for the
      corresponding crtc. This works fine for the paths where userspace explicitly
      disables crtc, this results in disabling the omapdss device in the crtc's
      pre_apply function.
      
      However, when the omapdrm module is removed, there is no work queued to ensure
      that the encoder is disabled. This can result in an enabled omapdss device when
      removing omapdrm. omapdss is left in an inconsistent state, and that prevents us
      from using that omapdss device being used again.
      
      Disable enabled encoders in omap_encoder_destroy, we could consider a better
      place for doing this later.
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      ec72a81e
    • A
      drm/omap: fix: disconnect devices when omapdrm module is removed · cc823bdc
      Archit Taneja 提交于
      At omapdrm probe, we install manager ops and connect omapdss devices. This
      needs to be undone when omapdrm module is removed so that omapdss is in a
      clean state. This ensures that we can re-insert omapdrm module, or some other
      module which uses omapdss(like omapfb/omap_vout).
      
      Currently, omapdrm's remove neither uninstalls manager ops, or disconnects
      omapdss devices. We make sure that this is done in pdev_remove.
      
      omapdrm establishes connections for omap_dss_device devices when probed. It
      should also be responsible to disconnect the devices. Keeping the devices
      connected can prevent the panel driver modules from unloading, it also causes
      issues when we try to remove or re-insert omapdrm module.
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      cc823bdc
    • A
      drm/omap: fix: Defer probe if an omapdss device requests for it at connect · 3a01ab25
      Archit Taneja 提交于
      With the omapdss device model changes. omapdrm is required to call dssdriver's
      connect() op to register a panel. This is currently done in omap_modeset_init()
      
      A call to connect() can fail if the omapdss panels or the encoders(HDMI/DPI)
      they connect to have some resource(like regulators, I2C adapter) missing. If
      this happens, the correct approach is to defer omapdrm's probe.
      
      omapdrm currently ignores those panels which return a non zero value when
      connected. This could result in omapdrm ignoring all panels on an omap board.
      
      The right approach would be for omapdrm to request for probe deferral when a
      panel's connect op returns -EPROBE_DEFER.
      
      In order to do this, we need to call connect() much earlier during omapdrm's
      probe to prevent too many things are already done by then. We now connect the
      panels during pdev_probe(), before anything else is initialized, so that we
      don't need to undo too many things if a defer was requested.
      
      Now when we enter omap_modeset_init(), we have a set of panels that have been
      connected. We now proceed with registering only those panels that are already
      connected.
      
      A special case has to be considered when no panels are available to connect when
      omapdrm probes. In this case too, we defer probe and expect that a panel will be
      available to connect the next time.
      
      Checking whether the panel has a driver or whether it has get_timing/read_edid
      ops in omap_modeset_init() are redundant with the new display model. These can
      be removed since a dssdev device will always have a driver associated with it,
      and all dssdev drivers have a get_timings op.
      
      This will mainly fix cases when omapdrm is built-in the kernel, since that's
      generally where resources like regulators or I2C are unavailable because of
      probe order dependencies.
      
      In particular this fixes boot with omapdrm built-in on an omap4 panda ES board.
      The regulators used by HDMI(provided by I2C based TWL regulators) aren't
      initialized because I2C isn't initialized, I2C isn't initialized as it's pins
      are not configured because pinctrl is yet to probe.
      Signed-off-by: NArchit Taneja <archit@ti.com>
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      3a01ab25
    • T
      drm/omap: fix (un)registering irqs inside an irq handler · 6da9f891
      Tomi Valkeinen 提交于
      omapdrm (un)registers irqs inside an irq handler. The problem is that
      the (un)register function uses dispc_runtime_get/put() to enable the
      clocks, and those functions are not irq safe by default.
      
      This was kind of fixed in 48664b21
      (OMAPDSS: DISPC: set irq_safe for runtime PM), which makes dispc's
      runtime calls irq-safe.
      
      However, using pm_runtime_irq_safe in dispc makes the parent of dispc,
      dss, always enabled, effectively preventing PM for the whole DSS module.
      
      This patch makes omapdrm behave better by adding new irq (un)register
      functions that do not use dispc_runtime_get/put, and using those
      functions in interrupt context. Thus we can make dispc again
      non-irq-safe, allowing proper PM.
      Signed-off-by: NTomi Valkeinen <tomi.valkeinen@ti.com>
      Cc: Rob Clark <robdclark@gmail.com>
      6da9f891
  12. 18 12月, 2013 4 次提交
  13. 31 10月, 2013 1 次提交
  14. 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