summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_atomic_helper.c
AgeCommit message (Collapse)Author
2016-05-17drm: Drop connector argument from __drm_atomic_helper_connector_destroy_stateDaniel Vetter
It's unused, and really this helper should only look at the state structure and nothing else. Note that this conflicts with a patch from Dave that adds refcounting to drm_connectors. It's not yet clear whether the check Dave adds for connector != NULL is really needed or the right check. v2: Fix commmit message (Laurent). Cc: Dave Airlie <airlied@gmail.com> Acked-by: Thierry Reding <thierry.reding@gmail.com> Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1462804451-15318-3-git-send-email-daniel.vetter@ffwll.ch
2016-05-17drm: Drop plane argument from __drm_atomic_helper_plane_destroy_stateDaniel Vetter
It's unused, and really this helper should only look at the state structure and nothing else. v2: Fix commit message (Laurent). v3: Rebase onto mtk driver merge. Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Eric Anholt <eric@anholt.net> Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Cc: Inki Dae <inki.dae@samsung.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Mark Yao <mark.yao@rock-chips.com> Acked-by: Thierry Reding <thierry.reding@gmail.com> Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Eric Anholt <eric@anholt.net> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1462804451-15318-2-git-send-email-daniel.vetter@ffwll.ch
2016-05-17drm: Drop crtc argument from __drm_atomic_helper_crtc_destroy_stateDaniel Vetter
It's unused, and really this helper should only look at the state structure and nothing else. v2: Rebase on top of rockchip changes v3: Drop unrelated hunk, spotted by Laurent. v4: Rebase onto mtk driver merge. Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Eric Anholt <eric@anholt.net> Cc: Mark Yao <mark.yao@rock-chips.com> Acked-by: Thierry Reding <thierry.reding@gmail.com> Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Eric Anholt <eric@anholt.net> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1462804451-15318-1-git-send-email-daniel.vetter@ffwll.ch
2016-05-11drm/atomic: Add drm_atomic_helper_best_encoder()Noralf Trønnes
Add (struct drm_connector_helper_funcs *)->best_encoder callback helper for connectors that support exactly 1 encoder, statically determined at driver init time. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1462982962-10530-6-git-send-email-noralf@tronnes.org
2016-05-11drm/atomic: Don't skip drm_bridge_*() calls if !drm_encoder_helper_funcsNoralf Trønnes
Don't skip drm_bridge_*() calls if encoder->helper_private is NULL. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1462982962-10530-5-git-send-email-noralf@tronnes.org
2016-05-10drm: Make drm_encoder_helper_funcs optionalNoralf Trønnes
Make drm_encoder_helper_funcs and it's functions optional to avoid having dummy functions. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1462454674-2246-3-git-send-email-noralf@tronnes.org
2016-05-05drm/atomic: use connector references (v3)Dave Airlie
Take a reference when setting a crtc on a connecter, also take one when duplicating if a crtc is set, and drop one on destroy if a crtc is set. v2: take Daniel Stone's advice and simplify the ref/unref dances, also take care of NULL as connector to state reset. v3: remove need for connector NULL check. Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-05-05Merge tag 'topic/drm-misc-2016-05-04' of ↵Dave Airlie
git://anongit.freedesktop.org/drm-intel into drm-next Ofc I promise just a few leftovers for drm-misc and somehow it's the biggest pull. But really mostly trivial stuff: - MAINTAINERS updates from Emil - rename async to nonblock in atomic_commit to avoid the confusion between nonblocking ioctl and async flip (= not vblank synced), from Maarten. Needs to be regened with newer drivers, but probably only after -rc1 to catch them all. - actually lockless gem_object_free, plus acked driver conversion patches. All the trickier prep stuff already is in drm-next. - Noralf's nice work for generic defio support in our fbdev emulation. Keeps the udl hack, and qxl is tested by Gerd. * tag 'topic/drm-misc-2016-05-04' of git://anongit.freedesktop.org/drm-intel: (47 commits) drm: Fixup locking WARN_ON mistake around gem_object_free_unlocked drm/etnaviv: Use lockless gem BO free callback drm/imx: Use lockless gem BO free callback drm/radeon: Use lockless gem BO free callback drm/amdgpu: Use lockless gem BO free callback drm/gem: support BO freeing without dev->struct_mutex MAINTAINERS: Add myself for the new VC4 (RPi GPU) graphics driver. MAINTAINERS: Add a bunch of legacy (UMS) DRM drivers MAINTAINERS: Add a few DRM drivers by Dave Airlie MAINTAINERS: List the correct git repo for the Renesas DRM drivers MAINTAINERS: Update the files list for the Renesas DRM drivers MAINTAINERS: Update the files list for the Armada DRM driver MAINTAINERS: Update the files list for the Rockchip DRM driver MAINTAINERS: Update the files list for the Exynos DRM driver MAINTAINERS: Add maintainer entry for the VMWGFX DRM driver MAINTAINERS: Add maintainer entry for the MSM DRM driver MAINTAINERS: Add maintainer entry for the Nouveau DRM driver MAINTAINERS: Update the files list for the Etnaviv DRM driver MAINTAINERS: Remove unneded wildcard for the i915 DRM driver drm/atomic: Add WARN_ON when state->acquire_ctx is not set. ...
2016-05-02drm/atomic: Rename drm_atomic_async_commit to nonblocking.Maarten Lankhorst
Another step in renaming async to nonblocking for atomic commit. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1461679905-30177-3-git-send-email-maarten.lankhorst@linux.intel.com
2016-05-02drm/atomic: Rename async parameter to nonblocking.Maarten Lankhorst
This is the first step of renaming async commit to nonblocking commit. The flag passed by userspace is NONBLOCKING, and async has a different meaning for page flips, where it means as soon as possible. Fixing up comments in drm core is done manually, to make sure I didn't miss anything. For drivers, the following cocci script is used to rename bool async to bool nonblock: @@ identifier I =~ "^async"; identifier func; @@ func(..., bool - I + nonblock , ...) { <... - I + nonblock ...> } @@ identifier func; type T; identifier I =~ "^async"; @@ T func(..., bool - I + nonblock , ...); Thanks to Tvrtko Ursulin for the cocci script. Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1461679905-30177-2-git-send-email-maarten.lankhorst@linux.intel.com
2016-04-27drm/atomic-helpers: Don't duplicate code in destroy helpersDaniel Vetter
Random drive-by refactoring I spotted. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-04-18drm/atomic-helper: Print an error if vblank wait times outVille Syrjälä
Vblank waits timing out is no a normal thing to happen, so let's inform people when it happens. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1460978973-24945-2-git-send-email-ville.syrjala@linux.intel.com
2016-04-06Merge tag 'topic/drm-misc-2016-04-01' of ↵Dave Airlie
git://anongit.freedesktop.org/drm-intel into drm-next * tag 'topic/drm-misc-2016-04-01' of git://anongit.freedesktop.org/drm-intel: drm: Add new DCS commands in the enum list drm: Make uapi headers C89 pendantic compliant drm/atomic: export drm_atomic_helper_wait_for_fences() drm: Untangle __KERNEL__ guards drm: Move DRM_MODE_OBJECT_* to uapi headers drm: align #include directives with libdrm in uapi headers drm: Make drm.h uapi header safe for C++ vgacon: dummy implementation for vgacon_text_force drm/sysfs: Nuke TV/DVI property files drm/ttm: Remove TTM_HAS_AGP drm: bridge/dw-hdmi: Remove pre_enable/post_disable dummy funcs Revert "drm: Don't pass negative delta to ktime_sub_ns()" drm/atmel: Fixup drm_connector_/unplug/unregister/_all drm: Rename drm_connector_unplug_all() to drm_connector_unregister_all() drm: bridge: Make (pre/post) enable/disable callbacks optional
2016-03-31drm/atomic: export drm_atomic_helper_wait_for_fences()Rob Clark
Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1458342904-23326-3-git-send-email-robdclark@gmail.com
2016-03-24Merge tag 'topic/drm-misc-2016-03-22' of ↵Dave Airlie
git://anongit.freedesktop.org/drm-intel into drm-next Bunch of small fixupes all over. Plus a dma-buf patch that Sumit asked me to cherry-pick since that's the only one he had in his tree. There's a sparse issue outstanding in the color mgr stuff, but Lionel is still working on something that actually appeases sparse. * tag 'topic/drm-misc-2016-03-22' of git://anongit.freedesktop.org/drm-intel: dma-buf/fence: fix fence_is_later v2 dma-buf: Update docs for SYNC ioctl drm: remove excess description dma-buf, drm, ion: Propagate error code from dma_buf_start_cpu_access() drm/atmel-hlcdc: use helper to get crtc state drm/atomic: use helper to get crtc state
2016-03-16Merge tag 'topic/drm-misc-2016-03-14' of ↵Dave Airlie
git://anongit.freedesktop.org/drm-intel into drm-next * tag 'topic/drm-misc-2016-03-14' of git://anongit.freedesktop.org/drm-intel: (27 commits) drm: atomic helper: do not unreference error pointer drm/edid: Extract SADs properly from multiple audio data blocks drm: fix blob pointer check drm: introduce pipe color correction properties drm/atomic: Clean up update_connector_routing. drm/atomic: Clean up steal_encoder, v2. drm/atomic: Handle encoder assignment conflicts in a separate check, v3. drm/atomic: Handle encoder stealing from set_config better. drm/atomic: Always call steal_encoder, v2. drm/ast: removed optional dummy crtc mode_fixup function. drm/bochs: removed optional dummy crtc mode_fixup function. drm/fsl-dcu: removed optional dummy crtc mode_fixup function. drm/virtio: removed optional dummy crtc mode_fixup function. drm/nouveau/dispnv04: removed optional dummy crtc mode_fixup function. drm/atmel-hlcdc: remove optional dummy crtc mode_fixup function. drm/sti: removed optional dummy crtc mode_fixup function. drm/shmobile: removed optional dummy crtc mode_fixup function. drm/msm/mdp: removed optional dummy crtc mode_fixup function. drm/omapdrm: removed optional dummy crtc mode_fixup function. drm/rcar-du: removed optional dummy crtc mode_fixup function. ...
2016-03-15drm/atomic: use helper to get crtc stateAndrzej Hajda
DRM core provide helper to access crtc state. Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1458045960-25193-1-git-send-email-a.hajda@samsung.com
2016-03-14Merge drm-fixes into drm-next.Dave Airlie
Nouveau wanted this to avoid some worse conflicts when I merge that.
2016-03-13drm: atomic helper: do not unreference error pointerLionel Landwerlin
562c5b4d8986 didn't quite fix the issue of dealing with an error pointer. We can't free/unref an error pointer so reset it to NULL. Many thanks to Dan Carpenter for pointing this out again. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Daniel Stone <daniels@collabora.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Matt Roper <matthew.d.roper@intel.com> Cc: dri-devel@lists.freedesktop.org Fixes: 562c5b4d8986 ("drm: fix blob pointer check") Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1457698646-22231-1-git-send-email-lionel.g.landwerlin@intel.com
2016-03-10drm: fix blob pointer checkLionel Landwerlin
Check properly that the allocated blob's pointer is valid. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: Daniel Stone <daniels@collabora.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Matt Roper <matthew.d.roper@intel.com> Cc: dri-devel@lists.freedesktop.org Reviewed-by: Daniel Stone <daniels@collabora.com> Fixes: 5488dc16fde7 ("drm: introduce pipe color correction properties") Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1457611461-9116-1-git-send-email-lionel.g.landwerlin@intel.com
2016-03-08drm: introduce pipe color correction propertiesLionel Landwerlin
Patch based on a previous series by Shashank Sharma. This introduces optional properties to enable color correction at the pipe level. It relies on 3 transformations applied to every pixels displayed. First a lookup into a degamma table, then a multiplication of the rgb components by a 3x3 matrix and finally another lookup into a gamma table. The following properties can be added to a pipe : - DEGAMMA_LUT : blob containing degamma LUT - DEGAMMA_LUT_SIZE : number of elements in DEGAMMA_LUT - CTM : transformation matrix applied after the degamma LUT - GAMMA_LUT : blob containing gamma LUT - GAMMA_LUT_SIZE : number of elements in GAMMA_LUT DEGAMMA_LUT_SIZE and GAMMA_LUT_SIZE are read only properties, set by the driver to tell userspace applications what sizes should be the lookup tables in DEGAMMA_LUT and GAMMA_LUT. A helper is also provided so legacy gamma correction is redirected through these new properties. v2: Register LUT size properties as range v3: Fix round in drm_color_lut_get_value() helper More docs on how degamma/gamma properties are used v4: Update contributors v5: Rename CTM_MATRIX property to CTM (Doh!) Add legacy gamma_set atomic helper Describe CTM/LUT acronyms in the kernel doc v6: Fix missing blob unref in drm_atomic_helper_crtc_reset Signed-off-by: Shashank Sharma <shashank.sharma@intel.com> Signed-off-by: Kumar, Kiran S <kiran.s.kumar@intel.com> Signed-off-by: Kausal Malladi <kausalmalladi@gmail.com> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Acked-by: Rob Bradford <robert.bradford@intel.com> [danvet: CrOS maintainers are also happy with the userspacde side: https://codereview.chromium.org/1182063002/ ] Reviewed-by: Daniel Stone <daniels@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1456506302-640-4-git-send-email-lionel.g.landwerlin@intel.com
2016-03-08drm/atomic: Clean up update_connector_routing.Maarten Lankhorst
connector_state->crtc can no longer be unset by accident, so that check can be removed. The other code open-codes drm_atomic_get_existing_crtc_state, so use that. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> [danvet: Resolve tiny conflict due to gcc warning fix on previous patch.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-03-08drm/atomic: Clean up steal_encoder, v2.Maarten Lankhorst
Now that only encoders can be stolen that are part of the state steal_encoder no longer needs to inspect all connectors, just those that are part of the atomic state. Changes since v1: - Change return value to void, can no longer fail. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> [danvet: Appease gcc, reported by kbuild.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1456996662-8704-7-git-send-email-maarten.lankhorst@linux.intel.com
2016-03-08drm/atomic: Handle encoder assignment conflicts in a separate check, v3.Maarten Lankhorst
The current check doesn't handle the case where we don't steal an encoder, but keep it on the current connector. If we repurpose disable_conflicting_encoders to do the checking, we just have to reject the ones that conflict. Changes since v1: - Return early with empty encoder_mask, drm_for_each_connector requires connection_mutex held. Changes since v2: - Add comments for the loops. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Testcase: kms_setmode.invalid-clone-single-crtc-stealing Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1456996662-8704-6-git-send-email-maarten.lankhorst@linux.intel.com
2016-03-08drm/atomic: Handle encoder stealing from set_config better.Maarten Lankhorst
Instead of failing with -EINVAL when conflicting encoders are found, the legacy set_config will disable other connectors when encoders conflict. With the previous commit this becomes a lot easier to implement. set_config only adds connectors to the state that are modified, and because of the previous commit that calls add_affected_connectors only on set->crtc it means any connector not part of the modeset can be stolen from. We disable the connector in that case, and possibly the crtc if required. Atomic modeset itself still doesn't allow encoder stealing, the results would be too unpredictable. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1456996662-8704-5-git-send-email-maarten.lankhorst@linux.intel.com
2016-03-08drm/atomic: Always call steal_encoder, v2.Maarten Lankhorst
There's no need to have a separate function to get the crtc which is stolen, this can already be found when actually stealing the encoder. drm_for_each_connector already checks for connection_mutex, so use that macro now. Changes since v1: - Do not check for NULL crtc in connector_state, this may happen when a crtc is disabled and its encoder stolen. - Because of this, use connector->state->crtc instead of conn_state->crtc. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1456996662-8704-4-git-send-email-maarten.lankhorst@linux.intel.com
2016-03-04drm/atomic: Pass connector and state to update_connector_routing.Maarten Lankhorst
Minor cleanup, connector and connector_state are always non-NULL here. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1456303053-28806-3-git-send-email-maarten.lankhorst@linux.intel.com
2016-03-04drm/atomic: Clean up update_output_state.Maarten Lankhorst
With the addition of crtc_state->connector_mask other connectors from different crtc's aren't needed any more to determine if a crtc has connectors, so only call add_affected_connectors on the target crtc. This allows a cleanup to first remove all current connectors, then add all set->connectors to the target crtc. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1456303053-28806-2-git-send-email-maarten.lankhorst@linux.intel.com
2016-02-19drm/atomic: Allow for holes in connector state, v2.Maarten Lankhorst
Because we record connector_mask using 1 << drm_connector_index now the connector_mask should stay the same even when other connectors are removed. This was not the case with MST, in that case when removing a connector all other connectors may change their index. This is fixed by waiting until the first get_connector_state to allocate connector_state, and force reallocation when state is too small. As a side effect connector arrays no longer have to be preallocated, and can be allocated on first use which means a less allocations in the page flip only path. Changes since v1: - Whitespace. (Ville) - Call ida_remove when destroying the connector. (Ville) - u32 alloc -> int. (Ville) Fixes: 14de6c44d149 ("drm/atomic: Remove drm_atomic_connectors_for_crtc.") Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Lyude <cpaul@redhat.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-02-09drm/atomic: Add encoder_mask to crtc_state, v3.Maarten Lankhorst
This allows iteration over encoders without requiring connection_mutex. Changes since v1: - Add a set_best_encoder helper function and update encoder_mask inside it. Changes since v2: - Relax the WARN_ON(!crtc), with explanation. - Call set_best_encoder when connector is moved between crtc's. - Add some paranoia to steal_encoder to prevent accidentally setting best_encoder to NULL. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/56AA200A.6070501@linux.intel.com
2016-02-09drm/atomic: Do not unset crtc when an encoder is stolenMaarten Lankhorst
While we steal the encoder away from the connector the connector may be updated to use a different encoder. Without this change if 2 connectors swap encoders one of them will end up without a crtc. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1452160762-30487-5-git-send-email-maarten.lankhorst@linux.intel.com
2016-02-09Merge tag 'topic/drm-misc-2016-02-08' of ↵Dave Airlie
git://anongit.freedesktop.org/drm-intel into drm-next First drm-misc pull req for 4.6. Big one is the drm_event cleanup, which is also prep work for adding android fence support to kms (Gustavo is planning to do that). Otherwise random small bits all over. * tag 'topic/drm-misc-2016-02-08' of git://anongit.freedesktop.org/drm-intel: (33 commits) gma500: clean up an excessive and confusing helper drm/gma500: remove helper function drm/vmwgfx: Nuke preclose hook drm/vc4: Nuke preclose hook drm/tilcdc: Nuke preclose hook drm/tegra: Stop cancelling page flip events drm/shmob: Nuke preclose hook drm/rcar: Nuke preclose hook drm/omap: Nuke close hooks drm/msm: Nuke preclose hooks drm/imx: Unconfuse preclose logic drm/exynos: Remove event cancelling from postclose drm/atmel: Nuke preclose drm/i915: Nuke intel_modeset_preclose drm: Nuke vblank event file cleanup code drm: Clean up pending events in the core drm/vblank: Use drm_event_reserve_init drm/vmwgfx: fix a NULL dereference drm/crtc-helper: Add caveat to disable_unused_functions doc drm/gma500: Remove empty preclose hook ...
2016-01-20drm/atomic-helper: Export framebuffer_changed()John Keeping
The Rockchip driver cannot use drm_atomic_helper_wait_for_vblanks() because it has hardware counters for neither vblanks nor scanlines. In order to simplify re-implementing the functionality for this driver, export the framebuffer_changed() helper so it can be reused. Signed-off-by: John Keeping <john@metanate.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-01-19drm: initialize default rotation value to DRM_ROTATE_0Marek Szyprowski
When no console framebuffer is enabled, the default plane state is defined by plane reset function. If driver uses generic helper, then rotation property is set to zero. This is not a valid value for that enum. This patch sets default rotation value to DRM_ROTATE_0. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Link: http://patchwork.freedesktop.org/patch/msgid/1453192008-13283-1-git-send-email-m.szyprowski@samsung.com Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-01-18drm/atomic-helper: Remove redundant local var old_crtc_state in disable_outputsLiu Ying
One of the two local variables old_crtc_state is redundantly defined in the function disable_outputs(). It has only a scope partway through the block for_each_connector_in_state. So, let's remove it and use the one which has the scope within the function disable_outputs(). Signed-off-by: Liu Ying <gnuiyl@gmail.com> Link: http://patchwork.freedesktop.org/patch/msgid/1453088195-2564-1-git-send-email-gnuiyl@gmail.com Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-01-06drm/atomic: Remove drm_atomic_connectors_for_crtc.Maarten Lankhorst
Now that connector_mask is reliable there's no need for this function any more. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1451908400-25147-6-git-send-email-maarten.lankhorst@linux.intel.com Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-01-05drm/atomic-helper: Reject legacy flips on a disabled pipeDaniel Vetter
We want this for consistency with existing page_flip semantics. Since this spurred quite a discussion on IRC also document why we reject event generation when the pipe is off: It's not that it's hard to implement, but userspace has a track recording which proves that it's way too easy to accidentally abuse and cause havoc. We want to make sure userspace doesn't get away with that. v2: Somehow thought we do reject events already, but that code only existed in my imagination ... Also suggestions from Thierry. Cc: Daniel Stone <daniels@collabora.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Thierry Reding <thierry.reding@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1449564561-3896-4-git-send-email-daniel.vetter@ffwll.ch
2016-01-05drm/atomic: Add __drm_atomic_helper_connector_reset, v2.Maarten Lankhorst
This is useful for drivers that subclass connector_state, like tegra. Changes since v1: - Docbook updates. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1451908400-25147-2-git-send-email-maarten.lankhorst@linux.intel.com Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-12-15drm/atomic-helper: Drop unneeded argument from check_pending_encoderDaniel Vetter
Just a remnant from an old iteration of this patch that I've forgotten to remove: We only need the encoder to figure out whether it has been reassigned in this update already or not to figure out whether there's a conflict or not. Reported-by: Thierry Reding <thierry.reding@gmail.com> Cc: Thierry Reding <thierry.reding@gmail.com> Link: http://patchwork.freedesktop.org/patch/msgid/1449564561-3896-2-git-send-email-daniel.vetter@ffwll.ch Reviewed-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-12-11drm: Add plane->name and use it in debug printsVille Syrjälä
Show a sensible name for the plane in debug mesages. The driver may supply its own name, otherwise the core genrates the name ("plane-0", "plane-1" etc.). v2: kstrdup() the name passed by the caller (Jani) v3: Generate a default name if the driver doesn't supply one Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1449592922-5545-7-git-send-email-ville.syrjala@linux.intel.com
2015-12-11drm: Add crtc->name and use it in debug messagesVille Syrjälä
Show a sensible name for the crtc in debug mesages. The driver may supply its own name, otherwise the core genrates the name ("crtc-0", "crtc-1" etc.). v2: kstrdup() the name passed by the caller (Jani) v3: Generate a default name if the driver doesn't supply one Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1449592922-5545-6-git-send-email-ville.syrjala@linux.intel.com
2015-12-08drm/atomic-helper: Mention the new system/resume helpers the docsDaniel Vetter
They have pretty kerneldoc already, but better to link to that in one of the overview sections. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1449218769-16577-26-git-send-email-daniel.vetter@ffwll.ch Reviewed-by: Thierry Reding <treding@nvidia.com>
2015-12-08drm: Reorganize helper vtables and their docsDaniel Vetter
Currently we have 4 helper libraries (probe, crtc, plane & atomic) that all use the same helper vtables. And that's by necessity since we don't want to litter the core structs with one ops pointer per helper library. Also often the reuse the same hooks (like atomic does, to facilite conversion from existing drivers using crtc and plane helpers). Given all that it doesn't make sense to put the docs for these next to specific helpers. Instead extract them into a new header file and section in the docbook, and add references to them everywhere. Unfortunately kernel-doc complains when an include directive doesn't find anything (and it does by dumping crap into the output file). We have to remove the now empty includes to avoid that, instead of leaving them in for future proofing. v2: More OCD in ordering functions. v3: Spelling plus collate copyright headers properly. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1449218769-16577-4-git-send-email-daniel.vetter@ffwll.ch Reviewed-by: Thierry Reding <treding@nvidia.com>
2015-12-03drm/atomic-helper: Reject attempts at re-stealing encodersDaniel Vetter
This can happen when we run out of encoders for a multi-crtc modeset, or also when userspace is silly and tries to clone multiple connectors that need the same encoder on the same crtc. Reported-and-Tested-and-Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1449136154-11588-1-git-send-email-daniel.vetter@ffwll.ch
2015-12-02drm/atomic-helper: Implement subsystem-level suspend/resumeThierry Reding
Provide subsystem-level suspend and resume helpers that can be used to implement suspend/resume on atomic mode-setting enabled drivers. v2: simplify locking, enhance kerneldoc comments v3: pass lock acquisition context by parameter, improve kerneldoc v4: - remove redundant code (already provided by atomic helpers) (Maarten Lankhorst) - move backoff dance from drm_modeset_lock_all_ctx() into suspend helper (Daniel Vetter) v5: handle potential EDEADLK from drm_atomic_helper_duplicate_state() and drm_atomic_helper_disable_all() (Daniel Vetter) Signed-off-by: Thierry Reding <treding@nvidia.com> Link: http://patchwork.freedesktop.org/patch/msgid/1449075005-13937-2-git-send-email-thierry.reding@gmail.com Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-11-30drm/atomic_helper: Add drm_atomic_helper_disable_planes_on_crtc()Jyri Sarha
Add drm_atomic_helper_disable_planes_on_crtc() for disabling all planes associated with the given CRTC. This can be used for instance in the CRTC helper disable callback to disable all planes before shutting down the display pipeline. v2: - Address Daniels review comments [1] - Do atomic_begin() and atomic_flush() always if they are defined and atomic knob is set - update kerneldoc - Put drm_atomic_helper_disable_planes_on_crtc() after drm_atomic_helper_commit_planes_on_crtc() in drm_atomic_helper.c to have functions in the same order as in drm_atomic_helper.h Signed-off-by: Jyri Sarha <jsarha@ti.com> Link: http://patchwork.freedesktop.org/patch/msgid/1448633641-6486-1-git-send-email-jsarha@ti.com Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-11-24drm: Keep coordinates in the typical x, y, w, h order instead of x, y, h, wVille Syrjälä
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-11-24GPU-DRM: Delete unnecessary checks before drm_property_unreference_blob()Markus Elfring
The drm_property_unreference_blob() function tests whether its argument is NULL and then returns immediately. Thus the tests around the calls are not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Link: http://patchwork.freedesktop.org/patch/msgid/563C8B3E.405@users.sourceforge.net Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-11-19drm/atomic-helper: Check encoder/crtc constraintsDaniel Vetter
This was totally lost when I originally created the atomic helpers. We probably should also check possible_clones in the helpers, but since the legacy ones didn't do that this is for a separate patch. Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Daniel Stone <daniels@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1447868808-10266-1-git-send-email-daniel.vetter@ffwll.ch
2015-11-17drm: Fix primary plane size for stereo doubled modes for legacy setcrtcVille Syrjälä
Properly double the hdisplay/vdisplay timings that we use as the primary plane size with stereo doubled modes. Otherwise the modeset gets rejected on machines where the primary plane must be fullscreen, and on the rest only the first eye would get a visible plane. Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: stable@vger.kernel.org #v3.19+ Fixes: 042652ed9599 ("drm/atomic-helper: implementatations for legacy interfaces") Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1447686157-29607-1-git-send-email-ville.syrjala@linux.intel.com Testcase: igt/kms_3d Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Jani Nikula <jani.nikula@intel.com>