aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_sprite.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2017-03-09 10:44:33 -0500
committerVille Syrjälä <ville.syrjala@linux.intel.com>2017-03-13 15:15:06 -0400
commitdd584fc0711a28fb338bf66a623178e468c82272 (patch)
tree9019cadca3737f4ecbaf2281116d8eec5c75445e /drivers/gpu/drm/i915/intel_sprite.c
parent78587de299dd653d64c731e40f17050cb66d0c27 (diff)
drm/i915: Use I915_READ_FW for plane updates
Optimize the plane register accesses a little bit by grabbing the uncore lock manually across the entire pile of accesses and using I915_READ_FW(). This helps keep the pipe update vblank evade critical section below our 100 usec deadline, particularly with lockdep enabled. And in general we want to keep that critical section as short as possible as it's executed with interrupts disabled. Not all plane updates currently happen from within the vblank evade critical section, so we must use the irqsave/irqrestore variants of the spinlock functions in the plane hooks. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170309154434.29303-5-ville.syrjala@linux.intel.com Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_sprite.c')
-rw-r--r--drivers/gpu/drm/i915/intel_sprite.c228
1 files changed, 134 insertions, 94 deletions
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 532db7d62290..b931d0bd7a64 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -230,6 +230,7 @@ skl_update_plane(struct drm_plane *drm_plane,
230 uint32_t y = plane_state->main.y; 230 uint32_t y = plane_state->main.y;
231 uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16; 231 uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16;
232 uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16; 232 uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16;
233 unsigned long irqflags;
233 234
234 plane_ctl = PLANE_CTL_ENABLE; 235 plane_ctl = PLANE_CTL_ENABLE;
235 236
@@ -255,22 +256,24 @@ skl_update_plane(struct drm_plane *drm_plane,
255 crtc_w--; 256 crtc_w--;
256 crtc_h--; 257 crtc_h--;
257 258
259 spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
260
258 if (IS_GEMINILAKE(dev_priv)) { 261 if (IS_GEMINILAKE(dev_priv)) {
259 I915_WRITE(PLANE_COLOR_CTL(pipe, plane_id), 262 I915_WRITE_FW(PLANE_COLOR_CTL(pipe, plane_id),
260 PLANE_COLOR_PIPE_GAMMA_ENABLE | 263 PLANE_COLOR_PIPE_GAMMA_ENABLE |
261 PLANE_COLOR_PIPE_CSC_ENABLE | 264 PLANE_COLOR_PIPE_CSC_ENABLE |
262 PLANE_COLOR_PLANE_GAMMA_DISABLE); 265 PLANE_COLOR_PLANE_GAMMA_DISABLE);
263 } 266 }
264 267
265 if (key->flags) { 268 if (key->flags) {
266 I915_WRITE(PLANE_KEYVAL(pipe, plane_id), key->min_value); 269 I915_WRITE_FW(PLANE_KEYVAL(pipe, plane_id), key->min_value);
267 I915_WRITE(PLANE_KEYMAX(pipe, plane_id), key->max_value); 270 I915_WRITE_FW(PLANE_KEYMAX(pipe, plane_id), key->max_value);
268 I915_WRITE(PLANE_KEYMSK(pipe, plane_id), key->channel_mask); 271 I915_WRITE_FW(PLANE_KEYMSK(pipe, plane_id), key->channel_mask);
269 } 272 }
270 273
271 I915_WRITE(PLANE_OFFSET(pipe, plane_id), (y << 16) | x); 274 I915_WRITE_FW(PLANE_OFFSET(pipe, plane_id), (y << 16) | x);
272 I915_WRITE(PLANE_STRIDE(pipe, plane_id), stride); 275 I915_WRITE_FW(PLANE_STRIDE(pipe, plane_id), stride);
273 I915_WRITE(PLANE_SIZE(pipe, plane_id), (src_h << 16) | src_w); 276 I915_WRITE_FW(PLANE_SIZE(pipe, plane_id), (src_h << 16) | src_w);
274 277
275 /* program plane scaler */ 278 /* program plane scaler */
276 if (plane_state->scaler_id >= 0) { 279 if (plane_state->scaler_id >= 0) {
@@ -279,22 +282,24 @@ skl_update_plane(struct drm_plane *drm_plane,
279 282
280 scaler = &crtc_state->scaler_state.scalers[scaler_id]; 283 scaler = &crtc_state->scaler_state.scalers[scaler_id];
281 284
282 I915_WRITE(SKL_PS_CTRL(pipe, scaler_id), 285 I915_WRITE_FW(SKL_PS_CTRL(pipe, scaler_id),
283 PS_SCALER_EN | PS_PLANE_SEL(plane_id) | scaler->mode); 286 PS_SCALER_EN | PS_PLANE_SEL(plane_id) | scaler->mode);
284 I915_WRITE(SKL_PS_PWR_GATE(pipe, scaler_id), 0); 287 I915_WRITE_FW(SKL_PS_PWR_GATE(pipe, scaler_id), 0);
285 I915_WRITE(SKL_PS_WIN_POS(pipe, scaler_id), (crtc_x << 16) | crtc_y); 288 I915_WRITE_FW(SKL_PS_WIN_POS(pipe, scaler_id), (crtc_x << 16) | crtc_y);
286 I915_WRITE(SKL_PS_WIN_SZ(pipe, scaler_id), 289 I915_WRITE_FW(SKL_PS_WIN_SZ(pipe, scaler_id),
287 ((crtc_w + 1) << 16)|(crtc_h + 1)); 290 ((crtc_w + 1) << 16)|(crtc_h + 1));
288 291
289 I915_WRITE(PLANE_POS(pipe, plane_id), 0); 292 I915_WRITE_FW(PLANE_POS(pipe, plane_id), 0);
290 } else { 293 } else {
291 I915_WRITE(PLANE_POS(pipe, plane_id), (crtc_y << 16) | crtc_x); 294 I915_WRITE_FW(PLANE_POS(pipe, plane_id), (crtc_y << 16) | crtc_x);
292 } 295 }
293 296
294 I915_WRITE(PLANE_CTL(pipe, plane_id), plane_ctl); 297 I915_WRITE_FW(PLANE_CTL(pipe, plane_id), plane_ctl);
295 I915_WRITE(PLANE_SURF(pipe, plane_id), 298 I915_WRITE_FW(PLANE_SURF(pipe, plane_id),
296 intel_plane_ggtt_offset(plane_state) + surf_addr); 299 intel_plane_ggtt_offset(plane_state) + surf_addr);
297 POSTING_READ(PLANE_SURF(pipe, plane_id)); 300 POSTING_READ_FW(PLANE_SURF(pipe, plane_id));
301
302 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
298} 303}
299 304
300static void 305static void
@@ -305,11 +310,16 @@ skl_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc)
305 struct intel_plane *intel_plane = to_intel_plane(dplane); 310 struct intel_plane *intel_plane = to_intel_plane(dplane);
306 enum plane_id plane_id = intel_plane->id; 311 enum plane_id plane_id = intel_plane->id;
307 enum pipe pipe = intel_plane->pipe; 312 enum pipe pipe = intel_plane->pipe;
313 unsigned long irqflags;
314
315 spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
308 316
309 I915_WRITE(PLANE_CTL(pipe, plane_id), 0); 317 I915_WRITE_FW(PLANE_CTL(pipe, plane_id), 0);
310 318
311 I915_WRITE(PLANE_SURF(pipe, plane_id), 0); 319 I915_WRITE_FW(PLANE_SURF(pipe, plane_id), 0);
312 POSTING_READ(PLANE_SURF(pipe, plane_id)); 320 POSTING_READ_FW(PLANE_SURF(pipe, plane_id));
321
322 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
313} 323}
314 324
315static void 325static void
@@ -332,23 +342,23 @@ chv_update_csc(struct intel_plane *intel_plane, uint32_t format)
332 * Cb and Cr apparently come in as signed already, so no 342 * Cb and Cr apparently come in as signed already, so no
333 * need for any offset. For Y we need to remove the offset. 343 * need for any offset. For Y we need to remove the offset.
334 */ 344 */
335 I915_WRITE(SPCSCYGOFF(plane_id), SPCSC_OOFF(0) | SPCSC_IOFF(-64)); 345 I915_WRITE_FW(SPCSCYGOFF(plane_id), SPCSC_OOFF(0) | SPCSC_IOFF(-64));
336 I915_WRITE(SPCSCCBOFF(plane_id), SPCSC_OOFF(0) | SPCSC_IOFF(0)); 346 I915_WRITE_FW(SPCSCCBOFF(plane_id), SPCSC_OOFF(0) | SPCSC_IOFF(0));
337 I915_WRITE(SPCSCCROFF(plane_id), SPCSC_OOFF(0) | SPCSC_IOFF(0)); 347 I915_WRITE_FW(SPCSCCROFF(plane_id), SPCSC_OOFF(0) | SPCSC_IOFF(0));
338 348
339 I915_WRITE(SPCSCC01(plane_id), SPCSC_C1(4769) | SPCSC_C0(6537)); 349 I915_WRITE_FW(SPCSCC01(plane_id), SPCSC_C1(4769) | SPCSC_C0(6537));
340 I915_WRITE(SPCSCC23(plane_id), SPCSC_C1(-3330) | SPCSC_C0(0)); 350 I915_WRITE_FW(SPCSCC23(plane_id), SPCSC_C1(-3330) | SPCSC_C0(0));
341 I915_WRITE(SPCSCC45(plane_id), SPCSC_C1(-1605) | SPCSC_C0(4769)); 351 I915_WRITE_FW(SPCSCC45(plane_id), SPCSC_C1(-1605) | SPCSC_C0(4769));
342 I915_WRITE(SPCSCC67(plane_id), SPCSC_C1(4769) | SPCSC_C0(0)); 352 I915_WRITE_FW(SPCSCC67(plane_id), SPCSC_C1(4769) | SPCSC_C0(0));
343 I915_WRITE(SPCSCC8(plane_id), SPCSC_C0(8263)); 353 I915_WRITE_FW(SPCSCC8(plane_id), SPCSC_C0(8263));
344 354
345 I915_WRITE(SPCSCYGICLAMP(plane_id), SPCSC_IMAX(940) | SPCSC_IMIN(64)); 355 I915_WRITE_FW(SPCSCYGICLAMP(plane_id), SPCSC_IMAX(940) | SPCSC_IMIN(64));
346 I915_WRITE(SPCSCCBICLAMP(plane_id), SPCSC_IMAX(448) | SPCSC_IMIN(-448)); 356 I915_WRITE_FW(SPCSCCBICLAMP(plane_id), SPCSC_IMAX(448) | SPCSC_IMIN(-448));
347 I915_WRITE(SPCSCCRICLAMP(plane_id), SPCSC_IMAX(448) | SPCSC_IMIN(-448)); 357 I915_WRITE_FW(SPCSCCRICLAMP(plane_id), SPCSC_IMAX(448) | SPCSC_IMIN(-448));
348 358
349 I915_WRITE(SPCSCYGOCLAMP(plane_id), SPCSC_OMAX(1023) | SPCSC_OMIN(0)); 359 I915_WRITE_FW(SPCSCYGOCLAMP(plane_id), SPCSC_OMAX(1023) | SPCSC_OMIN(0));
350 I915_WRITE(SPCSCCBOCLAMP(plane_id), SPCSC_OMAX(1023) | SPCSC_OMIN(0)); 360 I915_WRITE_FW(SPCSCCBOCLAMP(plane_id), SPCSC_OMAX(1023) | SPCSC_OMIN(0));
351 I915_WRITE(SPCSCCROCLAMP(plane_id), SPCSC_OMAX(1023) | SPCSC_OMIN(0)); 361 I915_WRITE_FW(SPCSCCROCLAMP(plane_id), SPCSC_OMAX(1023) | SPCSC_OMIN(0));
352} 362}
353 363
354static void 364static void
@@ -374,6 +384,7 @@ vlv_update_plane(struct drm_plane *dplane,
374 uint32_t y = plane_state->base.src.y1 >> 16; 384 uint32_t y = plane_state->base.src.y1 >> 16;
375 uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16; 385 uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16;
376 uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16; 386 uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16;
387 unsigned long irqflags;
377 388
378 sprctl = SP_ENABLE; 389 sprctl = SP_ENABLE;
379 390
@@ -456,29 +467,33 @@ vlv_update_plane(struct drm_plane *dplane,
456 467
457 linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); 468 linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
458 469
470 spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
471
459 if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) 472 if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B)
460 chv_update_csc(intel_plane, fb->format->format); 473 chv_update_csc(intel_plane, fb->format->format);
461 474
462 if (key->flags) { 475 if (key->flags) {
463 I915_WRITE(SPKEYMINVAL(pipe, plane_id), key->min_value); 476 I915_WRITE_FW(SPKEYMINVAL(pipe, plane_id), key->min_value);
464 I915_WRITE(SPKEYMAXVAL(pipe, plane_id), key->max_value); 477 I915_WRITE_FW(SPKEYMAXVAL(pipe, plane_id), key->max_value);
465 I915_WRITE(SPKEYMSK(pipe, plane_id), key->channel_mask); 478 I915_WRITE_FW(SPKEYMSK(pipe, plane_id), key->channel_mask);
466 } 479 }
467 I915_WRITE(SPSTRIDE(pipe, plane_id), fb->pitches[0]); 480 I915_WRITE_FW(SPSTRIDE(pipe, plane_id), fb->pitches[0]);
468 I915_WRITE(SPPOS(pipe, plane_id), (crtc_y << 16) | crtc_x); 481 I915_WRITE_FW(SPPOS(pipe, plane_id), (crtc_y << 16) | crtc_x);
469 482
470 if (fb->modifier == I915_FORMAT_MOD_X_TILED) 483 if (fb->modifier == I915_FORMAT_MOD_X_TILED)
471 I915_WRITE(SPTILEOFF(pipe, plane_id), (y << 16) | x); 484 I915_WRITE_FW(SPTILEOFF(pipe, plane_id), (y << 16) | x);
472 else 485 else
473 I915_WRITE(SPLINOFF(pipe, plane_id), linear_offset); 486 I915_WRITE_FW(SPLINOFF(pipe, plane_id), linear_offset);
474 487
475 I915_WRITE(SPCONSTALPHA(pipe, plane_id), 0); 488 I915_WRITE_FW(SPCONSTALPHA(pipe, plane_id), 0);
476 489
477 I915_WRITE(SPSIZE(pipe, plane_id), (crtc_h << 16) | crtc_w); 490 I915_WRITE_FW(SPSIZE(pipe, plane_id), (crtc_h << 16) | crtc_w);
478 I915_WRITE(SPCNTR(pipe, plane_id), sprctl); 491 I915_WRITE_FW(SPCNTR(pipe, plane_id), sprctl);
479 I915_WRITE(SPSURF(pipe, plane_id), 492 I915_WRITE_FW(SPSURF(pipe, plane_id),
480 intel_plane_ggtt_offset(plane_state) + sprsurf_offset); 493 intel_plane_ggtt_offset(plane_state) + sprsurf_offset);
481 POSTING_READ(SPSURF(pipe, plane_id)); 494 POSTING_READ_FW(SPSURF(pipe, plane_id));
495
496 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
482} 497}
483 498
484static void 499static void
@@ -489,11 +504,16 @@ vlv_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc)
489 struct intel_plane *intel_plane = to_intel_plane(dplane); 504 struct intel_plane *intel_plane = to_intel_plane(dplane);
490 enum pipe pipe = intel_plane->pipe; 505 enum pipe pipe = intel_plane->pipe;
491 enum plane_id plane_id = intel_plane->id; 506 enum plane_id plane_id = intel_plane->id;
507 unsigned long irqflags;
508
509 spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
492 510
493 I915_WRITE(SPCNTR(pipe, plane_id), 0); 511 I915_WRITE_FW(SPCNTR(pipe, plane_id), 0);
494 512
495 I915_WRITE(SPSURF(pipe, plane_id), 0); 513 I915_WRITE_FW(SPSURF(pipe, plane_id), 0);
496 POSTING_READ(SPSURF(pipe, plane_id)); 514 POSTING_READ_FW(SPSURF(pipe, plane_id));
515
516 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
497} 517}
498 518
499static void 519static void
@@ -518,6 +538,7 @@ ivb_update_plane(struct drm_plane *plane,
518 uint32_t y = plane_state->base.src.y1 >> 16; 538 uint32_t y = plane_state->base.src.y1 >> 16;
519 uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16; 539 uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16;
520 uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16; 540 uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16;
541 unsigned long irqflags;
521 542
522 sprctl = SPRITE_ENABLE; 543 sprctl = SPRITE_ENABLE;
523 544
@@ -590,31 +611,35 @@ ivb_update_plane(struct drm_plane *plane,
590 611
591 linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); 612 linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
592 613
614 spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
615
593 if (key->flags) { 616 if (key->flags) {
594 I915_WRITE(SPRKEYVAL(pipe), key->min_value); 617 I915_WRITE_FW(SPRKEYVAL(pipe), key->min_value);
595 I915_WRITE(SPRKEYMAX(pipe), key->max_value); 618 I915_WRITE_FW(SPRKEYMAX(pipe), key->max_value);
596 I915_WRITE(SPRKEYMSK(pipe), key->channel_mask); 619 I915_WRITE_FW(SPRKEYMSK(pipe), key->channel_mask);
597 } 620 }
598 621
599 I915_WRITE(SPRSTRIDE(pipe), fb->pitches[0]); 622 I915_WRITE_FW(SPRSTRIDE(pipe), fb->pitches[0]);
600 I915_WRITE(SPRPOS(pipe), (crtc_y << 16) | crtc_x); 623 I915_WRITE_FW(SPRPOS(pipe), (crtc_y << 16) | crtc_x);
601 624
602 /* HSW consolidates SPRTILEOFF and SPRLINOFF into a single SPROFFSET 625 /* HSW consolidates SPRTILEOFF and SPRLINOFF into a single SPROFFSET
603 * register */ 626 * register */
604 if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) 627 if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv))
605 I915_WRITE(SPROFFSET(pipe), (y << 16) | x); 628 I915_WRITE_FW(SPROFFSET(pipe), (y << 16) | x);
606 else if (fb->modifier == I915_FORMAT_MOD_X_TILED) 629 else if (fb->modifier == I915_FORMAT_MOD_X_TILED)
607 I915_WRITE(SPRTILEOFF(pipe), (y << 16) | x); 630 I915_WRITE_FW(SPRTILEOFF(pipe), (y << 16) | x);
608 else 631 else
609 I915_WRITE(SPRLINOFF(pipe), linear_offset); 632 I915_WRITE_FW(SPRLINOFF(pipe), linear_offset);
610 633
611 I915_WRITE(SPRSIZE(pipe), (crtc_h << 16) | crtc_w); 634 I915_WRITE_FW(SPRSIZE(pipe), (crtc_h << 16) | crtc_w);
612 if (intel_plane->can_scale) 635 if (intel_plane->can_scale)
613 I915_WRITE(SPRSCALE(pipe), sprscale); 636 I915_WRITE_FW(SPRSCALE(pipe), sprscale);
614 I915_WRITE(SPRCTL(pipe), sprctl); 637 I915_WRITE_FW(SPRCTL(pipe), sprctl);
615 I915_WRITE(SPRSURF(pipe), 638 I915_WRITE_FW(SPRSURF(pipe),
616 intel_plane_ggtt_offset(plane_state) + sprsurf_offset); 639 intel_plane_ggtt_offset(plane_state) + sprsurf_offset);
617 POSTING_READ(SPRSURF(pipe)); 640 POSTING_READ_FW(SPRSURF(pipe));
641
642 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
618} 643}
619 644
620static void 645static void
@@ -624,14 +649,19 @@ ivb_disable_plane(struct drm_plane *plane, struct drm_crtc *crtc)
624 struct drm_i915_private *dev_priv = to_i915(dev); 649 struct drm_i915_private *dev_priv = to_i915(dev);
625 struct intel_plane *intel_plane = to_intel_plane(plane); 650 struct intel_plane *intel_plane = to_intel_plane(plane);
626 int pipe = intel_plane->pipe; 651 int pipe = intel_plane->pipe;
652 unsigned long irqflags;
653
654 spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
627 655
628 I915_WRITE(SPRCTL(pipe), 0); 656 I915_WRITE_FW(SPRCTL(pipe), 0);
629 /* Can't leave the scaler enabled... */ 657 /* Can't leave the scaler enabled... */
630 if (intel_plane->can_scale) 658 if (intel_plane->can_scale)
631 I915_WRITE(SPRSCALE(pipe), 0); 659 I915_WRITE_FW(SPRSCALE(pipe), 0);
632 660
633 I915_WRITE(SPRSURF(pipe), 0); 661 I915_WRITE_FW(SPRSURF(pipe), 0);
634 POSTING_READ(SPRSURF(pipe)); 662 POSTING_READ_FW(SPRSURF(pipe));
663
664 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
635} 665}
636 666
637static void 667static void
@@ -656,6 +686,7 @@ ilk_update_plane(struct drm_plane *plane,
656 uint32_t y = plane_state->base.src.y1 >> 16; 686 uint32_t y = plane_state->base.src.y1 >> 16;
657 uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16; 687 uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16;
658 uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16; 688 uint32_t src_h = drm_rect_height(&plane_state->base.src) >> 16;
689 unsigned long irqflags;
659 690
660 dvscntr = DVS_ENABLE; 691 dvscntr = DVS_ENABLE;
661 692
@@ -722,26 +753,30 @@ ilk_update_plane(struct drm_plane *plane,
722 753
723 linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); 754 linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
724 755
756 spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
757
725 if (key->flags) { 758 if (key->flags) {
726 I915_WRITE(DVSKEYVAL(pipe), key->min_value); 759 I915_WRITE_FW(DVSKEYVAL(pipe), key->min_value);
727 I915_WRITE(DVSKEYMAX(pipe), key->max_value); 760 I915_WRITE_FW(DVSKEYMAX(pipe), key->max_value);
728 I915_WRITE(DVSKEYMSK(pipe), key->channel_mask); 761 I915_WRITE_FW(DVSKEYMSK(pipe), key->channel_mask);
729 } 762 }
730 763
731 I915_WRITE(DVSSTRIDE(pipe), fb->pitches[0]); 764 I915_WRITE_FW(DVSSTRIDE(pipe), fb->pitches[0]);
732 I915_WRITE(DVSPOS(pipe), (crtc_y << 16) | crtc_x); 765 I915_WRITE_FW(DVSPOS(pipe), (crtc_y << 16) | crtc_x);
733 766
734 if (fb->modifier == I915_FORMAT_MOD_X_TILED) 767 if (fb->modifier == I915_FORMAT_MOD_X_TILED)
735 I915_WRITE(DVSTILEOFF(pipe), (y << 16) | x); 768 I915_WRITE_FW(DVSTILEOFF(pipe), (y << 16) | x);
736 else 769 else
737 I915_WRITE(DVSLINOFF(pipe), linear_offset); 770 I915_WRITE_FW(DVSLINOFF(pipe), linear_offset);
738 771
739 I915_WRITE(DVSSIZE(pipe), (crtc_h << 16) | crtc_w); 772 I915_WRITE_FW(DVSSIZE(pipe), (crtc_h << 16) | crtc_w);
740 I915_WRITE(DVSSCALE(pipe), dvsscale); 773 I915_WRITE_FW(DVSSCALE(pipe), dvsscale);
741 I915_WRITE(DVSCNTR(pipe), dvscntr); 774 I915_WRITE_FW(DVSCNTR(pipe), dvscntr);
742 I915_WRITE(DVSSURF(pipe), 775 I915_WRITE_FW(DVSSURF(pipe),
743 intel_plane_ggtt_offset(plane_state) + dvssurf_offset); 776 intel_plane_ggtt_offset(plane_state) + dvssurf_offset);
744 POSTING_READ(DVSSURF(pipe)); 777 POSTING_READ_FW(DVSSURF(pipe));
778
779 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
745} 780}
746 781
747static void 782static void
@@ -751,13 +786,18 @@ ilk_disable_plane(struct drm_plane *plane, struct drm_crtc *crtc)
751 struct drm_i915_private *dev_priv = to_i915(dev); 786 struct drm_i915_private *dev_priv = to_i915(dev);
752 struct intel_plane *intel_plane = to_intel_plane(plane); 787 struct intel_plane *intel_plane = to_intel_plane(plane);
753 int pipe = intel_plane->pipe; 788 int pipe = intel_plane->pipe;
789 unsigned long irqflags;
754 790
755 I915_WRITE(DVSCNTR(pipe), 0); 791 spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
792
793 I915_WRITE_FW(DVSCNTR(pipe), 0);
756 /* Disable the scaler */ 794 /* Disable the scaler */
757 I915_WRITE(DVSSCALE(pipe), 0); 795 I915_WRITE_FW(DVSSCALE(pipe), 0);
796
797 I915_WRITE_FW(DVSSURF(pipe), 0);
798 POSTING_READ_FW(DVSSURF(pipe));
758 799
759 I915_WRITE(DVSSURF(pipe), 0); 800 spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
760 POSTING_READ(DVSSURF(pipe));
761} 801}
762 802
763static int 803static int