drm/i915: Disable all planes for load detection
Subsystems (2)
PATCH 1/1 drm/i915: Disable all planes for load detection
From: Ville Syrjälä <[email protected]>
We don't need any active planes during load detection, so just disable them all. This saves us from having to come up with a suitable framebuffer. And we also avoid leaving sprite/cursor planes on and potentially presenting them at a peculiar location during the load detection.
--- drivers/gpu/drm/i915/intel_display.c | 144 ++++------------------------------- 1 file changed, 14 insertions(+), 130 deletions(-)
drivers/gpu/drm/i915/intel_display.c +14 -130
@@ -9616,111 +9616,23 @@ intel_framebuffer_create(struct drm_i915_gem_object *obj,return ERR_PTR (ret); } -static u32 -intel_framebuffer_pitch_for_width (int width,int bpp) -{ -u32 pitch =DIV_ROUND_UP (width * bpp,8 ); -return ALIGN (pitch,64 ); -} - -static u32 -intel_framebuffer_size_for_mode (struct drm_display_mode *mode,int bpp) -{ -u32 pitch =intel_framebuffer_pitch_for_width (mode->hdisplay, bpp); -return PAGE_ALIGN (pitch * mode->vdisplay); -} - -static struct drm_framebuffer * -intel_framebuffer_create_for_mode (struct drm_device *dev, -struct drm_display_mode *mode, -int depth,int bpp) -{ -struct drm_framebuffer *fb; -struct drm_i915_gem_object *obj; -struct drm_mode_fb_cmd2 mode_cmd = {0 }; - - obj =i915_gem_object_create (to_i915 (dev), -intel_framebuffer_size_for_mode (mode, bpp)); -if (IS_ERR (obj)) -return ERR_CAST (obj); - - mode_cmd.width = mode->hdisplay; - mode_cmd.height = mode->vdisplay; - mode_cmd.pitches[0 ] =intel_framebuffer_pitch_for_width (mode_cmd.width, - bpp); - mode_cmd.pixel_format =drm_mode_legacy_fb_format (bpp, depth); - - fb =intel_framebuffer_create (obj, &mode_cmd); -if (IS_ERR (fb)) -i915_gem_object_put (obj); - -return fb; -} - -static struct drm_framebuffer * -mode_fits_in_fbdev (struct drm_device *dev, -struct drm_display_mode *mode) -{ -#ifdef CONFIG_DRM_FBDEV_EMULATION -struct drm_i915_private *dev_priv =to_i915 (dev); -struct drm_i915_gem_object *obj; -struct drm_framebuffer *fb; - -if (!dev_priv->fbdev) -return NULL ; - -if (!dev_priv->fbdev->fb) -return NULL ; - - obj = dev_priv->fbdev->fb->obj; -BUG_ON (!obj); - - fb = &dev_priv->fbdev->fb->base; -if (fb->pitches[0 ] <intel_framebuffer_pitch_for_width (mode->hdisplay, - fb->format->cpp[0 ] *8 )) -return NULL ; - -if (obj->base.size < mode->vdisplay * fb->pitches[0 ]) -return NULL ; - -drm_framebuffer_reference (fb); -return fb; -#else -return NULL ; -#endif -} - -static int intel_modeset_setup_plane_state (struct drm_atomic_state *state, -struct drm_crtc *crtc, -struct drm_display_mode *mode, -struct drm_framebuffer *fb, -int x,int y) +static int intel_modeset_disable_planes (struct drm_atomic_state *state, +struct drm_crtc *crtc) { +struct drm_plane *plane;struct drm_plane_state *plane_state; -int hdisplay, vdisplay; -int ret; +int ret, i; - plane_state =drm_atomic_get_plane_state (state, crtc->primary); -if (IS_ERR (plane_state)) -return PTR_ERR (plane_state); +for_each_new_plane_in_state (state, plane, plane_state, i) { +if (plane_state->crtc != crtc) +continue ; -if (mode) -drm_mode_get_hv_timing (mode, &hdisplay, &vdisplay); -else - hdisplay = vdisplay =0 ; + ret =drm_atomic_set_crtc_for_plane (plane_state,NULL ); +if (ret) +return ret; - ret =drm_atomic_set_crtc_for_plane (plane_state, fb ? crtc :NULL ); -if (ret) -return ret; -drm_atomic_set_fb_for_plane (plane_state, fb); - plane_state->crtc_x =0 ; - plane_state->crtc_y =0 ; - plane_state->crtc_w = hdisplay; - plane_state->crtc_h = vdisplay; - plane_state->src_x = x <<16 ; - plane_state->src_y = y <<16 ; - plane_state->src_w = hdisplay <<16 ; - plane_state->src_h = vdisplay <<16 ; +drm_atomic_set_fb_for_plane (plane_state,NULL ); + }return 0 ; }
@@ -9738,7 +9650,6 @@ int intel_get_load_detect_pipe(struct drm_connector *connector,struct drm_crtc *crtc =NULL ;struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv =to_i915 (dev); -struct drm_framebuffer *fb;struct drm_mode_config *config = &dev->mode_config;struct drm_atomic_state *state =NULL , *restore_state =NULL ;struct drm_connector_state *connector_state;
@@ -9806,10 +9717,6 @@ int intel_get_load_detect_pipe(struct drm_connector *connector, found: intel_crtc =to_intel_crtc (crtc); - ret =drm_modeset_lock (&crtc->primary->mutex, ctx); -if (ret) - goto fail; - state =drm_atomic_state_alloc (dev); restore_state =drm_atomic_state_alloc (dev);if (!state || !restore_state) {
@@ -9841,40 +9748,17 @@ int intel_get_load_detect_pipe(struct drm_connector *connector,if (!mode) mode = &load_detect_mode; -/* We need a framebuffer large enough to accommodate all accesses -* that the plane may generate whilst we perform load detection. -* We can not rely on the fbcon either being present (we get called -* during its initialisation to detect all boot displays, or it may -* not even exist) or that it is large enough to satisfy the -* requested mode. -*/ - fb =mode_fits_in_fbdev (dev, mode); -if (fb ==NULL ) { -DRM_DEBUG_KMS ("creating tmp fb for load-detection\n" ); - fb =intel_framebuffer_create_for_mode (dev, mode,24 ,32 ); - }else -DRM_DEBUG_KMS ("reusing fbdev for load-detection framebuffer\n" ); -if (IS_ERR (fb)) { -DRM_DEBUG_KMS ("failed to allocate framebuffer for load-detection\n" ); - ret =PTR_ERR (fb); - goto fail; - } - - ret =intel_modeset_setup_plane_state (state, crtc, mode, fb,0 ,0 ); + ret =drm_atomic_set_mode_for_crtc (&crtc_state->base, mode);if (ret) goto fail; -drm_framebuffer_unreference (fb); - - ret =drm_atomic_set_mode_for_crtc (&crtc_state->base, mode); + ret =intel_modeset_disable_planes (state, crtc);if (ret) goto fail; ret =PTR_ERR_OR_ZERO (drm_atomic_get_connector_state (restore_state, connector));if (!ret) ret =PTR_ERR_OR_ZERO (drm_atomic_get_crtc_state (restore_state, crtc)); -if (!ret) - ret =PTR_ERR_OR_ZERO (drm_atomic_get_plane_state (restore_state, crtc->primary));if (ret) {DRM_DEBUG_KMS ("Failed to create a copy of old state to restore: %i\n" , ret); goto fail;
Signature · 6 lines
2.13.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: warning for drm/i915: Disable all planes for load detection
== Series Details ==
== Series Details ==
Series: drm/i915: Disable all planes for load detection
URL : https://patchwork.freedesktop.org/series/26900/
State : warning
== Summary ==
Series 26900v1 drm/i915: Disable all planes for load detection
https://patchwork.freedesktop.org/api/1.0/series/26900/revisions/1/mbox/
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
pass -> FAIL (fi-snb-2600) fdo#100215
Test kms_frontbuffer_tracking:
Subgroup basic:
incomplete -> PASS (fi-bsw-n3050)
Test drv_module_reload:
Subgroup basic-reload-inject:
pass -> DMESG-WARN (fi-skl-6770hq)fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fi-bdw-5557u total:279 pass:268 dwarn:0 dfail:0 fail:0 skip:11 time:441s fi-bdw-gvtdvm total:279 pass:265 dwarn:0 dfail:0 fail:0 skip:14 time:435s fi-blb-e6850 total:279 pass:224 dwarn:1 dfail:0 fail:0 skip:54 time:360s fi-bsw-n3050 total:279 pass:243 dwarn:0 dfail:0 fail:0 skip:36 time:538s fi-bxt-j4205 total:279 pass:260 dwarn:0 dfail:0 fail:0 skip:19 time:507s fi-byt-j1900 total:279 pass:255 dwarn:0 dfail:0 fail:0 skip:24 time:480s fi-byt-n2820 total:279 pass:250 dwarn:1 dfail:0 fail:0 skip:28 time:479s fi-glk-2a total:279 pass:260 dwarn:0 dfail:0 fail:0 skip:19 time:595s fi-hsw-4770 total:279 pass:263 dwarn:0 dfail:0 fail:0 skip:16 time:434s fi-hsw-4770r total:279 pass:263 dwarn:0 dfail:0 fail:0 skip:16 time:418s fi-ilk-650 total:279 pass:229 dwarn:0 dfail:0 fail:0 skip:50 time:421s fi-ivb-3520m total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:490s fi-ivb-3770 total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:484s fi-kbl-7500u total:279 pass:261 dwarn:0 dfail:0 fail:0 skip:18 time:462s fi-kbl-7560u total:279 pass:269 dwarn:0 dfail:0 fail:0 skip:10 time:581s fi-kbl-r total:279 pass:260 dwarn:1 dfail:0 fail:0 skip:18 time:582s fi-skl-6260u total:279 pass:269 dwarn:0 dfail:0 fail:0 skip:10 time:455s fi-skl-6700hq total:279 pass:262 dwarn:0 dfail:0 fail:0 skip:17 time:589s fi-skl-6700k total:279 pass:257 dwarn:4 dfail:0 fail:0 skip:18 time:470s fi-skl-6770hq total:279 pass:268 dwarn:1 dfail:0 fail:0 skip:10 time:478s fi-skl-gvtdvm total:279 pass:266 dwarn:0 dfail:0 fail:0 skip:13 time:438s fi-snb-2520m total:279 pass:251 dwarn:0 dfail:0 fail:0 skip:28 time:535s fi-snb-2600 total:279 pass:249 dwarn:0 dfail:0 fail:1 skip:29 time:407s
e1f396dbaf2a6a1d44ac246b1b9591fa92c92cdc drm-tip: 2017y-07m-06d-09h-31m-35s UTC integration manifest 4d0026a drm/i915: Disable all planes for load detection
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_5123/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx