Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: Precompute plane SURF address

Currently we pre-compute the plane surface/base address
partially (only for cursor_needs_physical cases) in
intel_plane_pin_fb() and finish the calculation in the
plane->update_arm(). Let's just precompute the whole thing
instead.

One benefit is that we get rid of all the vma offset stuff
from the low level plane code. Another use I have in mind
is including the surface address in the plane tracepoints,
which should make it easier to analyze display faults.

v2: Deal with xe reuse_vma() hacks
v3: use intel_plane_ggtt_offset() still in reuse_vma()

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250717203216.31258-1-ville.syrjala@linux.intel.com

+104 -94
+27 -26
drivers/gpu/drm/i915/display/i9xx_plane.c
··· 360 360 return 0; 361 361 } 362 362 363 + static u32 i8xx_plane_surf_offset(const struct intel_plane_state *plane_state) 364 + { 365 + int x = plane_state->view.color_plane[0].x; 366 + int y = plane_state->view.color_plane[0].y; 367 + 368 + return intel_fb_xy_to_linear(x, y, plane_state, 0); 369 + } 370 + 371 + u32 i965_plane_surf_offset(const struct intel_plane_state *plane_state) 372 + { 373 + return plane_state->view.color_plane[0].offset; 374 + } 375 + 363 376 static u32 i9xx_plane_ctl_crtc(const struct intel_crtc_state *crtc_state) 364 377 { 365 378 struct intel_display *display = to_intel_display(crtc_state); ··· 476 463 enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; 477 464 int x = plane_state->view.color_plane[0].x; 478 465 int y = plane_state->view.color_plane[0].y; 479 - u32 dspcntr, dspaddr_offset, linear_offset; 466 + u32 dspcntr; 480 467 481 468 dspcntr = plane_state->ctl | i9xx_plane_ctl_crtc(crtc_state); 482 469 ··· 484 471 if (plane->need_async_flip_toggle_wa && 485 472 crtc_state->async_flip_planes & BIT(plane->id)) 486 473 dspcntr |= DISP_ASYNC_FLIP; 487 - 488 - linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); 489 - 490 - if (DISPLAY_VER(display) >= 4) 491 - dspaddr_offset = plane_state->view.color_plane[0].offset; 492 - else 493 - dspaddr_offset = linear_offset; 494 474 495 475 if (display->platform.cherryview && i9xx_plane == PLANE_B) { 496 476 int crtc_x = plane_state->uapi.dst.x1; ··· 504 498 DISP_OFFSET_Y(y) | DISP_OFFSET_X(x)); 505 499 } else if (DISPLAY_VER(display) >= 4) { 506 500 intel_de_write_fw(display, DSPLINOFF(display, i9xx_plane), 507 - linear_offset); 501 + intel_fb_xy_to_linear(x, y, plane_state, 0)); 508 502 intel_de_write_fw(display, DSPTILEOFF(display, i9xx_plane), 509 503 DISP_OFFSET_Y(y) | DISP_OFFSET_X(x)); 510 504 } ··· 517 511 intel_de_write_fw(display, DSPCNTR(display, i9xx_plane), dspcntr); 518 512 519 513 if (DISPLAY_VER(display) >= 4) 520 - intel_de_write_fw(display, DSPSURF(display, i9xx_plane), 521 - intel_plane_ggtt_offset(plane_state) + dspaddr_offset); 514 + intel_de_write_fw(display, DSPSURF(display, i9xx_plane), plane_state->surf); 522 515 else 523 - intel_de_write_fw(display, DSPADDR(display, i9xx_plane), 524 - intel_plane_ggtt_offset(plane_state) + dspaddr_offset); 516 + intel_de_write_fw(display, DSPADDR(display, i9xx_plane), plane_state->surf); 525 517 } 526 518 527 519 static void i830_plane_update_arm(struct intel_dsb *dsb, ··· 608 604 { 609 605 struct intel_display *display = to_intel_display(plane); 610 606 u32 dspcntr = plane_state->ctl | i9xx_plane_ctl_crtc(crtc_state); 611 - u32 dspaddr_offset = plane_state->view.color_plane[0].offset; 612 607 enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; 613 608 614 609 if (async_flip) 615 610 dspcntr |= DISP_ASYNC_FLIP; 616 611 617 612 intel_de_write_fw(display, DSPCNTR(display, i9xx_plane), dspcntr); 618 - 619 - intel_de_write_fw(display, DSPSURF(display, i9xx_plane), 620 - intel_plane_ggtt_offset(plane_state) + dspaddr_offset); 613 + intel_de_write_fw(display, DSPSURF(display, i9xx_plane), plane_state->surf); 621 614 } 622 615 623 616 static void ··· 625 624 bool async_flip) 626 625 { 627 626 struct intel_display *display = to_intel_display(plane); 628 - u32 dspaddr_offset = plane_state->view.color_plane[0].offset; 629 627 enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; 630 628 631 - intel_de_write_fw(display, DSPADDR_VLV(display, i9xx_plane), 632 - intel_plane_ggtt_offset(plane_state) + dspaddr_offset); 629 + intel_de_write_fw(display, DSPADDR_VLV(display, i9xx_plane), plane_state->surf); 633 630 } 634 631 635 632 static void ··· 1036 1037 plane->get_hw_state = i9xx_plane_get_hw_state; 1037 1038 plane->check_plane = i9xx_plane_check; 1038 1039 1040 + if (DISPLAY_VER(display) >= 4) 1041 + plane->surf_offset = i965_plane_surf_offset; 1042 + else 1043 + plane->surf_offset = i8xx_plane_surf_offset; 1044 + 1039 1045 if (DISPLAY_VER(display) >= 5 || display->platform.g4x) 1040 1046 plane->capture_error = g4x_primary_capture_error; 1041 1047 else if (DISPLAY_VER(display) >= 4) ··· 1258 1254 const struct intel_plane_state *plane_state = 1259 1255 to_intel_plane_state(plane->base.state); 1260 1256 enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; 1261 - u32 base; 1262 1257 1263 1258 if (!plane_state->uapi.visible) 1264 1259 return false; 1265 - 1266 - base = intel_plane_ggtt_offset(plane_state); 1267 1260 1268 1261 /* 1269 1262 * We may have moved the surface to a different 1270 1263 * part of ggtt, make the plane aware of that. 1271 1264 */ 1272 - if (plane_config->base == base) 1265 + if (plane_config->base == plane_state->surf) 1273 1266 return false; 1274 1267 1275 1268 if (DISPLAY_VER(display) >= 4) 1276 - intel_de_write(display, DSPSURF(display, i9xx_plane), base); 1269 + intel_de_write(display, DSPSURF(display, i9xx_plane), plane_state->surf); 1277 1270 else 1278 - intel_de_write(display, DSPADDR(display, i9xx_plane), base); 1271 + intel_de_write(display, DSPADDR(display, i9xx_plane), plane_state->surf); 1279 1272 1280 1273 return true; 1281 1274 }
+1
drivers/gpu/drm/i915/display/i9xx_plane.h
··· 24 24 const struct drm_framebuffer *fb, 25 25 int colot_plane); 26 26 int i9xx_check_plane_surface(struct intel_plane_state *plane_state); 27 + u32 i965_plane_surf_offset(const struct intel_plane_state *plane_state); 27 28 28 29 struct intel_plane * 29 30 intel_primary_plane_create(struct intel_display *display, enum pipe pipe);
+6 -12
drivers/gpu/drm/i915/display/intel_cursor.c
··· 33 33 DRM_FORMAT_ARGB8888, 34 34 }; 35 35 36 - static u32 intel_cursor_base(const struct intel_plane_state *plane_state) 36 + static u32 intel_cursor_surf_offset(const struct intel_plane_state *plane_state) 37 37 { 38 - struct intel_display *display = to_intel_display(plane_state); 39 - u32 base; 40 - 41 - if (DISPLAY_INFO(display)->cursor_needs_physical) 42 - base = plane_state->phys_dma_addr; 43 - else 44 - base = intel_plane_ggtt_offset(plane_state); 45 - 46 - return base + plane_state->view.color_plane[0].offset; 38 + return plane_state->view.color_plane[0].offset; 47 39 } 48 40 49 41 static u32 intel_cursor_position(const struct intel_crtc_state *crtc_state, ··· 289 297 290 298 size = CURSOR_HEIGHT(height) | CURSOR_WIDTH(width); 291 299 292 - base = intel_cursor_base(plane_state); 300 + base = plane_state->surf; 293 301 pos = intel_cursor_position(crtc_state, plane_state, false); 294 302 } 295 303 ··· 667 675 if (width != height) 668 676 fbc_ctl = CUR_FBC_EN | CUR_FBC_HEIGHT(height - 1); 669 677 670 - base = intel_cursor_base(plane_state); 678 + base = plane_state->surf; 671 679 pos = intel_cursor_position(crtc_state, plane_state, false); 672 680 } 673 681 ··· 1042 1050 cursor->get_hw_state = i9xx_cursor_get_hw_state; 1043 1051 cursor->check_plane = i9xx_check_cursor; 1044 1052 } 1053 + 1054 + cursor->surf_offset = intel_cursor_surf_offset; 1045 1055 1046 1056 if (DISPLAY_VER(display) >= 5 || display->platform.g4x) 1047 1057 cursor->capture_error = g4x_cursor_capture_error;
+4 -1
drivers/gpu/drm/i915/display/intel_display_types.h
··· 642 642 #define PLANE_HAS_FENCE BIT(0) 643 643 644 644 struct intel_fb_view view; 645 - u32 phys_dma_addr; /* for cursor_needs_physical */ 646 645 647 646 /* for legacy cursor fb unpin */ 648 647 struct drm_vblank_work unpin_work; ··· 663 664 664 665 /* chroma upsampler control register */ 665 666 u32 cus_ctl; 667 + 668 + /* surface address register */ 669 + u32 surf; 666 670 667 671 /* 668 672 * scaler_id ··· 1536 1534 bool (*get_hw_state)(struct intel_plane *plane, enum pipe *pipe); 1537 1535 int (*check_plane)(struct intel_crtc_state *crtc_state, 1538 1536 struct intel_plane_state *plane_state); 1537 + u32 (*surf_offset)(const struct intel_plane_state *plane_state); 1539 1538 int (*min_cdclk)(const struct intel_crtc_state *crtc_state, 1540 1539 const struct intel_plane_state *plane_state); 1541 1540 void (*async_flip)(struct intel_dsb *dsb,
+16 -11
drivers/gpu/drm/i915/display/intel_fb_pin.c
··· 277 277 278 278 plane_state->ggtt_vma = vma; 279 279 280 - /* 281 - * Pre-populate the dma address before we enter the vblank 282 - * evade critical section as i915_gem_object_get_dma_address() 283 - * will trigger might_sleep() even if it won't actually sleep, 284 - * which is the case when the fb has already been pinned. 285 - */ 286 - if (intel_plane_needs_physical(plane)) { 287 - struct drm_i915_gem_object *obj = to_intel_bo(intel_fb_bo(&fb->base)); 288 - 289 - plane_state->phys_dma_addr = i915_gem_object_get_dma_address(obj, 0); 290 - } 291 280 } else { 292 281 unsigned int alignment = intel_plane_fb_min_alignment(plane_state); 293 282 ··· 298 309 plane_state->dpt_vma = vma; 299 310 300 311 WARN_ON(plane_state->ggtt_vma == plane_state->dpt_vma); 312 + } 313 + 314 + /* 315 + * Pre-populate the dma address before we enter the vblank 316 + * evade critical section as i915_gem_object_get_dma_address() 317 + * will trigger might_sleep() even if it won't actually sleep, 318 + * which is the case when the fb has already been pinned. 319 + */ 320 + if (intel_plane_needs_physical(plane)) { 321 + struct drm_i915_gem_object *obj = to_intel_bo(intel_fb_bo(&fb->base)); 322 + 323 + plane_state->surf = i915_gem_object_get_dma_address(obj, 0) + 324 + plane->surf_offset(plane_state); 325 + } else { 326 + plane_state->surf = intel_plane_ggtt_offset(plane_state) + 327 + plane->surf_offset(plane_state); 301 328 } 302 329 303 330 return 0;
+2
drivers/gpu/drm/i915/display/intel_plane_initial.c
··· 359 359 i915_vma_pin_fence(vma) == 0 && vma->fence) 360 360 plane_state->flags |= PLANE_HAS_FENCE; 361 361 362 + plane_state->surf = intel_plane_ggtt_offset(plane_state); 363 + 362 364 plane_state->uapi.src_x = 0; 363 365 plane_state->uapi.src_y = 0; 364 366 plane_state->uapi.src_w = fb->width << 16;
+15 -21
drivers/gpu/drm/i915/display/intel_sprite.c
··· 395 395 enum pipe pipe = plane->pipe; 396 396 enum plane_id plane_id = plane->id; 397 397 const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; 398 - u32 sprsurf_offset = plane_state->view.color_plane[0].offset; 399 398 u32 x = plane_state->view.color_plane[0].x; 400 399 u32 y = plane_state->view.color_plane[0].y; 401 - u32 sprctl, linear_offset; 400 + u32 sprctl; 402 401 403 402 sprctl = plane_state->ctl | vlv_sprite_ctl_crtc(crtc_state); 404 - 405 - linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); 406 403 407 404 if (display->platform.cherryview && pipe == PIPE_B) 408 405 chv_sprite_update_csc(plane_state); ··· 415 418 416 419 intel_de_write_fw(display, SPCONSTALPHA(pipe, plane_id), 0); 417 420 418 - intel_de_write_fw(display, SPLINOFF(pipe, plane_id), linear_offset); 421 + intel_de_write_fw(display, SPLINOFF(pipe, plane_id), 422 + intel_fb_xy_to_linear(x, y, plane_state, 0)); 419 423 intel_de_write_fw(display, SPTILEOFF(pipe, plane_id), 420 424 SP_OFFSET_Y(y) | SP_OFFSET_X(x)); 421 425 ··· 426 428 * the control register just before the surface register. 427 429 */ 428 430 intel_de_write_fw(display, SPCNTR(pipe, plane_id), sprctl); 429 - intel_de_write_fw(display, SPSURF(pipe, plane_id), 430 - intel_plane_ggtt_offset(plane_state) + sprsurf_offset); 431 + intel_de_write_fw(display, SPSURF(pipe, plane_id), plane_state->surf); 431 432 432 433 vlv_sprite_update_clrc(plane_state); 433 434 vlv_sprite_update_gamma(plane_state); ··· 827 830 struct intel_display *display = to_intel_display(plane); 828 831 enum pipe pipe = plane->pipe; 829 832 const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; 830 - u32 sprsurf_offset = plane_state->view.color_plane[0].offset; 831 833 u32 x = plane_state->view.color_plane[0].x; 832 834 u32 y = plane_state->view.color_plane[0].y; 833 - u32 sprctl, linear_offset; 835 + u32 sprctl; 834 836 835 837 sprctl = plane_state->ctl | ivb_sprite_ctl_crtc(crtc_state); 836 - 837 - linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); 838 838 839 839 if (key->flags) { 840 840 intel_de_write_fw(display, SPRKEYVAL(pipe), key->min_value); ··· 846 852 intel_de_write_fw(display, SPROFFSET(pipe), 847 853 SPRITE_OFFSET_Y(y) | SPRITE_OFFSET_X(x)); 848 854 } else { 849 - intel_de_write_fw(display, SPRLINOFF(pipe), linear_offset); 855 + intel_de_write_fw(display, SPRLINOFF(pipe), 856 + intel_fb_xy_to_linear(x, y, plane_state, 0)); 850 857 intel_de_write_fw(display, SPRTILEOFF(pipe), 851 858 SPRITE_OFFSET_Y(y) | SPRITE_OFFSET_X(x)); 852 859 } ··· 858 863 * the control register just before the surface register. 859 864 */ 860 865 intel_de_write_fw(display, SPRCTL(pipe), sprctl); 861 - intel_de_write_fw(display, SPRSURF(pipe), 862 - intel_plane_ggtt_offset(plane_state) + sprsurf_offset); 866 + intel_de_write_fw(display, SPRSURF(pipe), plane_state->surf); 863 867 864 868 ivb_sprite_update_gamma(plane_state); 865 869 } ··· 1175 1181 struct intel_display *display = to_intel_display(plane); 1176 1182 enum pipe pipe = plane->pipe; 1177 1183 const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; 1178 - u32 dvssurf_offset = plane_state->view.color_plane[0].offset; 1179 1184 u32 x = plane_state->view.color_plane[0].x; 1180 1185 u32 y = plane_state->view.color_plane[0].y; 1181 - u32 dvscntr, linear_offset; 1186 + u32 dvscntr; 1182 1187 1183 1188 dvscntr = plane_state->ctl | g4x_sprite_ctl_crtc(crtc_state); 1184 - 1185 - linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); 1186 1189 1187 1190 if (key->flags) { 1188 1191 intel_de_write_fw(display, DVSKEYVAL(pipe), key->min_value); ··· 1188 1197 intel_de_write_fw(display, DVSKEYMAX(pipe), key->max_value); 1189 1198 } 1190 1199 1191 - intel_de_write_fw(display, DVSLINOFF(pipe), linear_offset); 1200 + intel_de_write_fw(display, DVSLINOFF(pipe), 1201 + intel_fb_xy_to_linear(x, y, plane_state, 0)); 1192 1202 intel_de_write_fw(display, DVSTILEOFF(pipe), 1193 1203 DVS_OFFSET_Y(y) | DVS_OFFSET_X(x)); 1194 1204 ··· 1199 1207 * the control register just before the surface register. 1200 1208 */ 1201 1209 intel_de_write_fw(display, DVSCNTR(pipe), dvscntr); 1202 - intel_de_write_fw(display, DVSSURF(pipe), 1203 - intel_plane_ggtt_offset(plane_state) + dvssurf_offset); 1210 + intel_de_write_fw(display, DVSSURF(pipe), plane_state->surf); 1204 1211 1205 1212 if (display->platform.g4x) 1206 1213 g4x_sprite_update_gamma(plane_state); ··· 1615 1624 plane->capture_error = vlv_sprite_capture_error; 1616 1625 plane->get_hw_state = vlv_sprite_get_hw_state; 1617 1626 plane->check_plane = vlv_sprite_check; 1627 + plane->surf_offset = i965_plane_surf_offset; 1618 1628 plane->max_stride = i965_plane_max_stride; 1619 1629 plane->min_alignment = vlv_plane_min_alignment; 1620 1630 plane->min_cdclk = vlv_plane_min_cdclk; ··· 1640 1648 plane->capture_error = ivb_sprite_capture_error; 1641 1649 plane->get_hw_state = ivb_sprite_get_hw_state; 1642 1650 plane->check_plane = g4x_sprite_check; 1651 + plane->surf_offset = i965_plane_surf_offset; 1643 1652 1644 1653 if (display->platform.broadwell || display->platform.haswell) { 1645 1654 plane->max_stride = hsw_sprite_max_stride; ··· 1666 1673 plane->capture_error = g4x_sprite_capture_error; 1667 1674 plane->get_hw_state = g4x_sprite_get_hw_state; 1668 1675 plane->check_plane = g4x_sprite_check; 1676 + plane->surf_offset = i965_plane_surf_offset; 1669 1677 plane->max_stride = g4x_sprite_max_stride; 1670 1678 plane->min_alignment = g4x_sprite_min_alignment; 1671 1679 plane->min_cdclk = g4x_sprite_min_cdclk;
+20 -23
drivers/gpu/drm/i915/display/skl_universal_plane.c
··· 1285 1285 } 1286 1286 } 1287 1287 1288 - static u32 skl_plane_surf(const struct intel_plane_state *plane_state, 1289 - int color_plane) 1288 + static int icl_plane_color_plane(const struct intel_plane_state *plane_state) 1290 1289 { 1290 + if (plane_state->planar_linked_plane && !plane_state->is_y_plane) 1291 + return 1; 1292 + else 1293 + return 0; 1294 + } 1295 + 1296 + static u32 skl_plane_surf_offset(const struct intel_plane_state *plane_state) 1297 + { 1298 + int color_plane = icl_plane_color_plane(plane_state); 1291 1299 u32 plane_surf; 1292 1300 1293 - plane_surf = intel_plane_ggtt_offset(plane_state) + 1294 - skl_surf_address(plane_state, color_plane); 1301 + plane_surf = skl_surf_address(plane_state, color_plane); 1295 1302 1296 1303 if (plane_state->decrypt) 1297 1304 plane_surf |= PLANE_SURF_DECRYPT; ··· 1378 1371 intel_de_write_dsb(display, dsb, PLANE_CSC_POSTOFF(pipe, plane_id, 0), 0); 1379 1372 intel_de_write_dsb(display, dsb, PLANE_CSC_POSTOFF(pipe, plane_id, 1), 0); 1380 1373 intel_de_write_dsb(display, dsb, PLANE_CSC_POSTOFF(pipe, plane_id, 2), 0); 1381 - } 1382 - 1383 - static int icl_plane_color_plane(const struct intel_plane_state *plane_state) 1384 - { 1385 - if (plane_state->planar_linked_plane && !plane_state->is_y_plane) 1386 - return 1; 1387 - else 1388 - return 0; 1389 1374 } 1390 1375 1391 1376 static void ··· 1475 1476 intel_de_write_dsb(display, dsb, PLANE_CTL(pipe, plane_id), 1476 1477 plane_ctl); 1477 1478 intel_de_write_dsb(display, dsb, PLANE_SURF(pipe, plane_id), 1478 - skl_plane_surf(plane_state, 0)); 1479 + plane_state->surf); 1479 1480 } 1480 1481 1481 1482 static void icl_plane_update_sel_fetch_noarm(struct intel_dsb *dsb, ··· 1631 1632 struct intel_display *display = to_intel_display(plane); 1632 1633 enum plane_id plane_id = plane->id; 1633 1634 enum pipe pipe = plane->pipe; 1634 - int color_plane = icl_plane_color_plane(plane_state); 1635 1635 u32 plane_ctl; 1636 1636 1637 1637 plane_ctl = plane_state->ctl | ··· 1656 1658 intel_de_write_dsb(display, dsb, PLANE_CTL(pipe, plane_id), 1657 1659 plane_ctl); 1658 1660 intel_de_write_dsb(display, dsb, PLANE_SURF(pipe, plane_id), 1659 - skl_plane_surf(plane_state, color_plane)); 1661 + plane_state->surf); 1660 1662 } 1661 1663 1662 1664 static void skl_plane_capture_error(struct intel_crtc *crtc, ··· 1680 1682 struct intel_display *display = to_intel_display(plane); 1681 1683 enum plane_id plane_id = plane->id; 1682 1684 enum pipe pipe = plane->pipe; 1683 - u32 plane_ctl = plane_state->ctl, plane_surf; 1685 + u32 plane_ctl = plane_state->ctl; 1686 + u32 plane_surf = plane_state->surf; 1684 1687 1685 1688 plane_ctl |= skl_plane_ctl_crtc(crtc_state); 1686 - plane_surf = skl_plane_surf(plane_state, 0); 1687 1689 1688 1690 if (async_flip) { 1689 1691 if (DISPLAY_VER(display) >= 30) ··· 2812 2814 intel_de_write_fw(display, PLANE_CTL(plane->pipe, plane->id), plane_ctl); 2813 2815 2814 2816 intel_de_write_fw(display, PLANE_SURF(plane->pipe, plane->id), 2815 - skl_plane_surf(state, 0)); 2817 + state->surf); 2816 2818 } 2817 2819 2818 2820 struct intel_plane * ··· 2862 2864 plane->min_cdclk = skl_plane_min_cdclk; 2863 2865 } 2864 2866 plane->disable_tiling = skl_disable_tiling; 2867 + 2868 + plane->surf_offset = skl_plane_surf_offset; 2865 2869 2866 2870 if (DISPLAY_VER(display) >= 13) 2867 2871 plane->max_stride = adl_plane_max_stride; ··· 3191 3191 to_intel_plane_state(plane->base.state); 3192 3192 enum plane_id plane_id = plane->id; 3193 3193 enum pipe pipe = crtc->pipe; 3194 - u32 base; 3195 3194 3196 3195 if (!plane_state->uapi.visible) 3197 3196 return false; 3198 - 3199 - base = intel_plane_ggtt_offset(plane_state); 3200 3197 3201 3198 /* 3202 3199 * We may have moved the surface to a different 3203 3200 * part of ggtt, make the plane aware of that. 3204 3201 */ 3205 - if (plane_config->base == base) 3202 + if (plane_config->base == plane_state->surf) 3206 3203 return false; 3207 3204 3208 - intel_de_write(display, PLANE_SURF(pipe, plane_id), base); 3205 + intel_de_write(display, PLANE_SURF(pipe, plane_id), plane_state->surf); 3209 3206 3210 3207 return true; 3211 3208 }
+10
drivers/gpu/drm/xe/display/xe_fb_pin.c
··· 12 12 #include "intel_fb.h" 13 13 #include "intel_fb_pin.h" 14 14 #include "intel_fbdev.h" 15 + #include "intel_plane.h" 15 16 #include "xe_bo.h" 16 17 #include "xe_device.h" 17 18 #include "xe_ggtt.h" ··· 382 381 const struct intel_plane_state *old_plane_state) 383 382 { 384 383 struct intel_framebuffer *fb = to_intel_framebuffer(new_plane_state->hw.fb); 384 + struct intel_plane *plane = to_intel_plane(new_plane_state->uapi.plane); 385 385 struct xe_device *xe = to_xe_device(fb->base.dev); 386 386 struct intel_display *display = xe->display; 387 387 struct i915_vma *vma; ··· 406 404 found: 407 405 refcount_inc(&vma->ref); 408 406 new_plane_state->ggtt_vma = vma; 407 + 408 + new_plane_state->surf = intel_plane_ggtt_offset(new_plane_state) + 409 + plane->surf_offset(new_plane_state); 410 + 409 411 return true; 410 412 } 411 413 ··· 436 430 return PTR_ERR(vma); 437 431 438 432 new_plane_state->ggtt_vma = vma; 433 + 434 + new_plane_state->surf = intel_plane_ggtt_offset(new_plane_state) + 435 + plane->surf_offset(new_plane_state); 436 + 439 437 return 0; 440 438 } 441 439
+3
drivers/gpu/drm/xe/display/xe_plane_initial.c
··· 234 234 goto nofb; 235 235 236 236 plane_state->ggtt_vma = vma; 237 + 238 + plane_state->surf = intel_plane_ggtt_offset(plane_state); 239 + 237 240 plane_state->uapi.src_x = 0; 238 241 plane_state->uapi.src_y = 0; 239 242 plane_state->uapi.src_w = fb->width << 16;