linux_dsm_epyc7002/drivers/gpu/drm/gma500
Dave Airlie 122387a53e Merge tag 'topic/atomic-helpers-2014-11-09' of git://anongit.freedesktop.org/drm-intel into drm-next
So here's my atomic series, finally all debugged&reviewed. Sean Paul has
done a full detailed pass over it all, and a lot of other people have
commented and provided feedback on some parts. Rob Clark also converted
msm over the w/e and seems happy. The only small thing is that Rob wants
to export the wait_for_vblank, which imo makes sense. Since there's other
stuff still to do I think we should apply Rob's patch (once it has grown
appropriate kerneldoc) later on top of this.

This is just the core<->driver interface plus a big pile of helpers. Short
recap of the main ideas:

- There are essentially three helper libraries in this patch set:

  * Transitional helpers to use the new plane callbacks for legacy plane
    updates and in the crtc helper's ->mode_set callback. These helpers are
    only temporarily used to convert drivers to atomic, but they allow a
    nice separation between changing the driver backend and switching to
    the atomic commit logic.

  * Legacy helpers to implement all the legacy driver entry points
    (page_flip, set_config, plane vfuncs) on top of the new atomic driver
    interface. These are completely driver agnostic. The reason for having
    the legacy support as helpers is that drivers can switch step-by-step.
    And they could e.g. even keep the legacy page_flip code around for some
    old platforms where converting to full-blown atomic isn't worth it.

  * Atomic helpers which implement the various new ->atomic_* driver
    interfaces in terms of the revised crtc helper and new plane helper
    hooks.

- The revised crtc helper implemenation essentially implements all the
  lessons learned in the i915 modeset rework (when using the atomic helpers
  only):

  * Enable/disable sequence for a given config are always the same and
    callbacks are always called in the same order. This contrast starkly
    with the crtc helpers, where the sequence of operations is heavily
    dependent on the previous config.

    One corollary of this is that if the configuration of a crtc only
    partially changes (e.g. a connector moves in a cloned config) the
    helper code will still disable/enable the full display pipeline. This
    is the only way to ensure that the enable/disable sequence is always
    the same.

  * It won't call disable or enable hooks more than once any more because
    it lost track of state, thanks to the atomic state tracking. And if
    drivers implement the ->reset hook properly (by either resetting the hw
    or reading out the hw state into the atomic structures) this even
    extends to the hardware state. So no more disable-me-harder kind of
    nonsense.

  * The only thing missing is the hw state readout/cross-check support, but
    if drivers have hw state readout support in their ->reset handlers it's
    simple to extend that to cross-check the hw state.

  * The crtc->mode_set callback is gone and its replacement only sets crtc
    timings and no longer updates the primary plane state. This way we can
    finally implement primary planes properly.

- The new plane helpers should be suitable enough for pretty much
  everything, and a perfect fit for hardware with GO bits. Even if they
  don't fit the atomic helper library is rather flexible and exports all
  the functions for the individual steps to drivers. So drivers can pick
  what matches and implement their own magic for everything else.

- A big difference compared to all previous atomic series is that this one
  doesn't implement async commit in a generic way. Imo driver requirements
  for that are too diverse to create anything reasonable sane which would
  actually work on a reasonable amount of different drivers. Also, we've
  never had a helper library for page_flips even, so it's really hard to
  know what might work and what's stupid without a bit of experience in the form
  of a few driver implementations.

  I think with the current flexibility for drivers to pick individual
  stages and existing helpers like drm_flip_queue it's rather easy though
  to implement proper async commit.

- There's a few other differences of minor importance to earlier atomic
  series:

  * Common/generic properties are parsed in the callers/core and not in
    drivers, and passed to drivers by directly setting the right members in
    atomic state structures. That greatly simplifies all the transitional
    and legacy helpers an removes a lot of boilerplate code.

  * There's no crazy trylock mode used for the async commit since these
    helpers don't do async commit. A simple ordered flip queue of atomic
    state updates should be sufficient for preventing concurrent hw access
    anyway, as long as synchronous updates stall correctly with e.g.
    flush_work_queue or similar function. Abusing locks to enforce ordering
    isn't a good idea imo anyway.

  * These helpers reuse the existing ->mode_fixup hooks in the atomic_check
    callback. Which means that drivers need to adapat and move a lot less code
    into their atomic_check callbacks.

Now this isn't everything needed in the drm core and helpers for full
atomic support. But it's enough to start with converting drivers, and
except for actually testing multiplane and multicrtc updates also enough to
implement full atomic updates. Still missing are:

- Per-plane locking. Since these helpers here encapsulate the locking
  completely this should be fairly easy to implement.

- fbdev support for atomic_check/commit, so that multi-pipe finally works
  sanely in fbcon.

- Adding and decoding shared/core properties. That just needs to be rebased
  from Rob's latest patch series, with minor adjustments so that the
  decoding happens in the core instead of in drivers.

- Actually adding the atomic ioctl. Again just rebasing Rob's latest patch
  should be all that's needed.

- Resolving how to deal with DPMS in atomic. Atomic is a good excuse to fix up
  the crazy semantics dpms currently has. I'm floating an RFC about this topic
  already.

- Finally I couldn't test connector/encoder stealing properly since my test
  vehicle here doesn't allow a connector on different crtcs. So drivers
  which support this might see some surprises in that area. There is no semantic
  change though in how encoder stealing and assignment works (or at least no
  intended one), so I think the risk is minimal.

As just mentioned I've done a fake conversion of an existing driver using
crtc helpers to debug the helper code and validate the smooth transition
approach. And that smooth transition was the really big motivation for
this. It seems to actually work and consists of 3 phases:

Phase 1: Rework driver backend for crtc/plane helpers

The requirement here is that universal plane support is already implement. If
universal plane support isn't implement yet it might be better though to just do
it as part of this phase, directly using the new plane helpers. There are two
big things to do:

- Split up the existing ->update/disable_plane hooks into check/commit
  hooks and extract the crtc-wide prep/flush parts (like setting/clearing
  GO bits).

- The other big change is to split the crtc->mode_set hook into the plane
  update (done using the plane helpers) and the crtc setup in a new
  ->mode_set_nofb hook.

When phase 1 is complete the driver implements all the new callbacks which
push the software state into hardware, but still using all the legacy entry
points and crtc helpers. The transitional helpers serve as impendance
mismatch here.

Phase 2: Rework state handling

This consists of rolling out the state handling helpers for planes, crtcs
and connectors and reviewing all ->mode_fixup and similar hooks to make
sure they don't depend upon implicit global state which might change in the
atomic world. Any such code must be moved into ->atomic_check functions which
just rely on the free-standing atomic state update structures.

This phase also adds a few small pieces of fixup code to make sure the
atomic state doesn't get out of sync in the legacy driver callbacks.

Phase 3: Roll out atomic support

Now it's just about replacing vfuncs with the ones provided by the helper
and filling out the small missing pieces (like atomic_check logic or async
commit support needed for page_flips). Due to the prep work in phase 1 no
changes to the driver backend functions should be required, and because of
the prep work in phase 2 atomic implementations can be rolled out
step-by-step. So if async commit ins't implemented yet page_flip can be
implemented with the legacy functions without wreaking havoc in the other
operations.

* tag 'topic/atomic-helpers-2014-11-09' of git://anongit.freedesktop.org/drm-intel:
  drm/atomic: Refcounting for plane_state->fb
  drm: Docbook integration and over sections for all the new helpers
  drm/atomic-helpers: functions for state duplicate/destroy/reset
  drm/atomic-helper: implement ->page_flip
  drm/atomic-helpers: document how to implement async commit
  drm/atomic: Integrate fence support
  drm/atomic-helper: implementatations for legacy interfaces
  drm: Atomic crtc/connector updates using crtc/plane helper interfaces
  drm/crtc-helper: Transitional functions using atomic plane helpers
  drm/plane-helper: transitional atomic plane helpers
  drm: Add atomic/plane helpers
  drm: Global atomic state handling
  drm: Add atomic driver interface definitions for objects
  drm/modeset_lock: document trylock_only in kerneldoc
  drm: fixup kerneldoc in drm_crtc.h
  drm: Pull drm_crtc.h into the kerneldoc template
  drm: Move drm_crtc_init from drm_crtc.h to drm_plane_helper.h
2014-11-10 09:59:16 +10:00
..
accel_2d.c drm: Kill DRM_HZ 2013-12-18 11:33:24 +10:00
backlight.c drivers/gpu/drm/gma500/backlight.c: fix a defined-but-not-used warning for do_gma_backlight_set() 2014-01-23 16:36:55 -08:00
blitter.c drm/gma500: Add first piece of blitter code 2014-03-17 20:11:51 +01:00
blitter.h drm/gma500: Add first piece of blitter code 2014-03-17 20:11:51 +01:00
cdv_device.c drm/gma500: Unify _get_core_freq for cdv and psb 2014-03-17 20:13:24 +01:00
cdv_device.h drm/gma500/cdv: Add and hook up chip op for disabling sr 2013-08-15 00:54:44 +02:00
cdv_intel_crt.c drm: add register and unregister functions for connectors 2014-06-19 08:55:28 +02:00
cdv_intel_display.c drm: Replace crtc fb with primary plane fb (v3) 2014-04-01 20:18:28 -04:00
cdv_intel_dp.c drm/dp-helper: Move the legacy helpers to gma500 2014-10-23 09:24:06 +02:00
cdv_intel_hdmi.c drm: add register and unregister functions for connectors 2014-06-19 08:55:28 +02:00
cdv_intel_lvds.c drm: add register and unregister functions for connectors 2014-06-19 08:55:28 +02:00
framebuffer.c drm/gma500: use container_of to resolve psb_fbdev from drm_fb_helper 2014-09-24 12:09:27 +02:00
framebuffer.h drm/gma500: Rename psb_intel_connector to gma_connector 2013-07-24 01:47:34 +02:00
gem.c drm/gma500: Remove dead code 2014-03-17 20:12:02 +01:00
gem.h drm/gma500: Add backing type and base align to psb_gem_create() 2014-03-17 20:11:59 +01:00
gma_device.c drm/gma500: Unify _get_core_freq for cdv and psb 2014-03-17 20:13:24 +01:00
gma_device.h drm/gma500: Unify _get_core_freq for cdv and psb 2014-03-17 20:13:24 +01:00
gma_display.c drm: Replace crtc fb with primary plane fb (v3) 2014-04-01 20:18:28 -04:00
gma_display.h drm/gma500: Unify encoder mode fixup 2014-03-17 20:14:01 +01:00
gtt.c drm/gem: remove misleading gfp parameter to get_pages() 2014-07-08 00:29:53 +02:00
gtt.h drm: Extract <drm/drm_gem.h> 2014-09-24 11:43:41 +10:00
intel_bios.c drm/gma500: Renaming DP training vswing pre emph defines 2014-09-03 11:05:38 +02:00
intel_bios.h drm/gma500: Clean up various defines 2013-03-17 18:32:56 +01:00
intel_gmbus.c drm/gma500: Add aux device support for gmbus 2013-11-08 16:22:08 +01:00
intel_i2c.c gma500: fixup build versus latest header changes. 2011-11-16 12:14:04 +00:00
Kconfig ACPI / gpu / drm: Stop selecting VIDEO_OUTPUT_CONTROL 2014-03-20 02:37:22 +01:00
Makefile drm/gma500: Unify _get_core_freq for cdv and psb 2014-03-17 20:13:24 +01:00
mdfld_device.c gma500: handle poulsbo cursor restriction 2012-05-22 10:15:34 +01:00
mdfld_dsi_dpi.c drm: Make the .mode_fixup() operations mode argument a const pointer 2012-07-19 21:52:38 -04:00
mdfld_dsi_dpi.h drm: Make the .mode_fixup() operations mode argument a const pointer 2012-07-19 21:52:38 -04:00
mdfld_dsi_output.c drm: add register and unregister functions for connectors 2014-06-19 08:55:28 +02:00
mdfld_dsi_output.h intel_mid: Renamed *mrst* to *intel_mid* 2013-10-17 16:40:36 -07:00
mdfld_dsi_pkg_sender.c drm: Remove spurious ';' 2014-06-10 09:35:42 +10:00
mdfld_dsi_pkg_sender.h gma500: initial medfield merge 2012-03-10 13:05:48 +00:00
mdfld_intel_display.c drm: Replace crtc fb with primary plane fb (v3) 2014-04-01 20:18:28 -04:00
mdfld_output.c gma500: mdfld_dsi_output_init() drop unused parameter 2012-03-10 13:05:51 +00:00
mdfld_output.h gma500: initial medfield merge 2012-03-10 13:05:48 +00:00
mdfld_tmd_vid.c gma500: initial medfield merge 2012-03-10 13:05:48 +00:00
mdfld_tpo_vid.c gma500: initial medfield merge 2012-03-10 13:05:48 +00:00
mid_bios.c gma500: remove duplicate FB_REG09 define 2014-06-19 15:12:41 +02:00
mid_bios.h gma500: Add the glue to the various BIOS and firmware interfaces 2011-11-16 11:25:28 +00:00
mmu.c Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-04-08 09:52:16 -07:00
mmu.h drm/gma500: Give MMU code it's own header file 2014-03-17 20:11:48 +01:00
oaktrail_crtc.c drm: Replace crtc fb with primary plane fb (v3) 2014-04-01 20:18:28 -04:00
oaktrail_device.c Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2013-11-15 14:19:54 +09:00
oaktrail_hdmi_i2c.c tree-wide: use reinit_completion instead of INIT_COMPLETION 2013-11-15 09:32:21 +09:00
oaktrail_hdmi.c PCI: Remove DEFINE_PCI_DEVICE_TABLE macro use 2014-08-12 12:15:14 -06:00
oaktrail_lvds.c drm: add register and unregister functions for connectors 2014-06-19 08:55:28 +02:00
oaktrail.h gma600: Enable HDMI support 2012-11-07 10:59:32 +10:00
opregion.c drm/gma500: Move asle interrupt work into a work task 2014-03-17 20:12:04 +01:00
opregion.h gma500: move the ASLE enable 2012-07-16 09:20:33 -07:00
power.c drm/gma500: Add hooks for hibernation 2013-04-07 17:09:34 +02:00
power.h drm/gma500: Add hooks for hibernation 2013-04-07 17:09:34 +02:00
psb_device.c drm/gma500: Unify _get_core_freq for cdv and psb 2014-03-17 20:13:24 +01:00
psb_device.h drm/gma500/psb: Make use of generic clock code 2013-07-24 01:47:18 +02:00
psb_drv.c drm: add driver->set_busid() callback 2014-09-10 17:43:04 +10:00
psb_drv.h drm/gma500: Code cleanup - inline documentation 2014-03-17 20:14:10 +01:00
psb_intel_display.c drm: Move drm_crtc_init from drm_crtc.h to drm_plane_helper.h 2014-11-05 00:14:55 +01:00
psb_intel_drv.h drm/gma500: Remove unused ioctls 2014-03-17 20:11:57 +01:00
psb_intel_lvds.c drm: add register and unregister functions for connectors 2014-06-19 08:55:28 +02:00
psb_intel_modes.c gma500: Remove psb_intel_output from ddc_probe and ddc_get_modes 2011-12-20 10:23:06 +00:00
psb_intel_reg.h drm/gma500: Clean up various defines 2013-03-17 18:32:56 +01:00
psb_intel_sdvo_regs.h gma500: Replace SDVO code with slightly modified version from i915 2011-12-20 10:23:14 +00:00
psb_intel_sdvo.c drm/gma500: Don't destroy DRM properties in the driver 2014-10-31 18:38:21 +01:00
psb_irq.c drm/gma500: Add support for SGX interrupts 2014-03-17 20:11:38 +01:00
psb_irq.h drm: Kill DRM_IRQ_ARGS 2013-12-18 11:33:46 +10:00
psb_lid.c gma500: Prevent endless loop in panel power up sequence 2012-05-22 10:15:29 +01:00
psb_reg.h gma500: Add the core DRM files and headers 2011-11-16 11:26:35 +00:00
tc35876x-dsi-lvds.c Drivers: gpu: remove __dev* attributes. 2013-01-03 15:57:15 -08:00
tc35876x-dsi-lvds.h gma500: initial medfield merge 2012-03-10 13:05:48 +00:00