From: Dave Airlie Date: Mon, 3 Apr 2017 06:30:24 +0000 (+1000) Subject: Merge tag 'drm-misc-next-2017-03-31' of git://anongit.freedesktop.org/git/drm-misc... X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=320d8c3d38739fa8e31a076b86cbdafcf8897d5e;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git Merge tag 'drm-misc-next-2017-03-31' of git://anongit.freedesktop.org/git/drm-misc into drm-next drm-misc for 4.12: Core: - Removed some fb subsampling dimension checks from core (Ville) - Some MST slot cleanup (Dhinakaran) - Extracted drm_debugfs.h & drm_ioctl.h from drmP.h (Daniel) - Added drm_atomic_helper_shutdown() to compliment suspend/resume counterparts (Daniel) - Pipe context through legacy modeset to remove legacy_backoff nasties (Daniel) - Cleanups around vblank as well as allowing lockless counter reads (Chris W.) - VGA Switcheroo added to MAINTAINERS with Lukas Wunner as reviewer (Lukas) Drivers: - Enhancements to rockchip driver probe (Jeffy) and dsi (Chris Z.) - Thunderbolt external GPU awareness added (Lukas) * tag 'drm-misc-next-2017-03-31' of git://anongit.freedesktop.org/git/drm-misc: (63 commits) apple-gmux: Don't switch external DP port on 2011+ MacBook Pros drm/nouveau: Don't register Thunderbolt eGPU with vga_switcheroo drm/amdgpu: Don't register Thunderbolt eGPU with vga_switcheroo drm/radeon: Don't register Thunderbolt eGPU with vga_switcheroo PCI: Recognize Thunderbolt devices MAINTAINERS: Add Lukas Wunner as reviewer for vga_switcheroo drm: Fix locking gotcha in page_flip ioctl drm: Clarify the role of plane_state argument to drm_simple update(). drm: Clear e after kfree in drm_mode_page_flip_ioctl drm: Convert cmpxchg(bool) back to a two step operation drm/bridge: ti-tfp410: support hpd via gpio drm: use .hword to represent 16-bit numbers Revert unrelated part of "drm: simplify the locking in the GETCRTC ioctl" drm: Fixup failure paths in drm_atomic_helper_set_config drm: Peek at the current counter/timestamp for vblank queries drm: Refactor vblank sequence number comparison drm: vblank cannot be enabled if dev->irq_enabled is false drm: Mark up accesses of vblank->enabled outside of its spinlock drm: Make the decision to keep vblank irq enabled earlier drm/atomic-helper: Remove the backoff hack from set_config ... --- 320d8c3d38739fa8e31a076b86cbdafcf8897d5e diff --cc drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index c18c81f63ac3,d492d57d5309..6078654d033b --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@@ -2934,23 -2223,3 +2934,24 @@@ vmw_kms_create_implicit_placement_prope "implicit_placement", 0, 1); } + + +/** + * vmw_kms_set_config - Wrapper around drm_atomic_helper_set_config + * + * @set: The configuration to set. + * + * The vmwgfx Xorg driver doesn't assign the mode::type member, which + * when drm_mode_set_crtcinfo is called as part of the configuration setting + * causes it to return incorrect crtc dimensions causing severe problems in + * the vmwgfx modesetting. So explicitly clear that member before calling + * into drm_atomic_helper_set_config. + */ - int vmw_kms_set_config(struct drm_mode_set *set) ++int vmw_kms_set_config(struct drm_mode_set *set, ++ struct drm_modeset_acquire_ctx *ctx) +{ + if (set && set->mode) + set->mode->type = 0; + - return drm_atomic_helper_set_config(set); ++ return drm_atomic_helper_set_config(set, ctx); +} diff --cc drivers/gpu/drm/vmwgfx/vmwgfx_kms.h index 9c161d29aaeb,cb36e1d70133..0c226b2adea5 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h @@@ -453,6 -339,5 +453,7 @@@ int vmw_kms_stdu_dma(struct vmw_privat bool to_surface, bool interruptible); - int vmw_kms_set_config(struct drm_mode_set *set); ++int vmw_kms_set_config(struct drm_mode_set *set, ++ struct drm_modeset_acquire_ctx *ctx); #endif diff --cc drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c index 2664e4c16750,e9d3c4b92df7..8d7dc9def7c2 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c @@@ -308,9 -382,22 +308,10 @@@ static void vmw_sou_crtc_helper_disable } static int vmw_sou_crtc_page_flip(struct drm_crtc *crtc, - struct drm_framebuffer *fb, + struct drm_framebuffer *new_fb, struct drm_pending_vblank_event *event, - uint32_t flags) + uint32_t flags, + struct drm_modeset_acquire_ctx *ctx) { struct vmw_private *dev_priv = vmw_priv(crtc->dev); struct drm_framebuffer *old_fb = crtc->primary->fb; @@@ -322,12 -409,7 +323,12 @@@ if (!vmw_kms_crtc_flippable(dev_priv, crtc)) return -EINVAL; - crtc->primary->fb = fb; + flags &= ~DRM_MODE_PAGE_FLIP_ASYNC; - ret = drm_atomic_helper_page_flip(crtc, new_fb, NULL, flags); ++ ret = drm_atomic_helper_page_flip(crtc, new_fb, NULL, flags, ctx); + if (ret) { + DRM_ERROR("Page flip error %d.\n", ret); + return ret; + } /* do a full screen dirty update */ vclips.x = crtc->x; diff --cc drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c index e872ffe5f0db,b2c9d6ce7ce4..bad31bdf09b6 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c @@@ -496,19 -666,9 +497,19 @@@ static int vmw_stdu_crtc_page_flip(stru if (!stdu->defined || !vmw_kms_crtc_flippable(dev_priv, crtc)) return -EINVAL; - ret = vmw_stdu_bind_fb(dev_priv, crtc, &crtc->mode, new_fb); - if (ret) + /* + * We're always async, but the helper doesn't know how to set async + * so lie to the helper. Also, the helper expects someone + * to pick the event up from the crtc state, and if nobody does, + * it will free it. Since we handle the event in this function, + * don't hand it to the helper. + */ + flags &= ~DRM_MODE_PAGE_FLIP_ASYNC; - ret = drm_atomic_helper_page_flip(crtc, new_fb, NULL, flags); ++ ret = drm_atomic_helper_page_flip(crtc, new_fb, NULL, flags, ctx); + if (ret) { + DRM_ERROR("Page flip error %d.\n", ret); return ret; + } if (stdu->base.is_implicit) vmw_kms_update_implicit_fb(dev_priv, crtc);