Skip to content

Commit 0a4d0b2

Browse files
committed
Merge tag 'drm-xe-next-2024-10-17' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-next
UAPI Changes: - (Implicit) Fix the exec unnecessary implicit fencing (Matt Brost) Driver Changes: - Fix an inverted if statement (Colin) - Fixes around display d3cold vs non-d3cold runtime pm (Imre) - A couple of scheduling fixes (Matt Brost) - Increase a query timestamp witdh (Lucas) - Move a timestamp read (Lucas) - Tidy some code using multiple put_user() (Lucas) - Fix an ufence signaling error (Nirmoy) - Initialize the ufence.signalled field (Matt Auld) - Display fb alignement work (Juha-Pekka) - Disallow horisontal flip with tile4 + display20 (Juha-Pekka) - Extend a workaround (Shekhar) - Enlarge the global invalidation timeout (Shuicheng) Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thomas Hellstrom <thomas.hellstrom@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/ZxDZaRRQAzrG1uir@fedora
2 parents c391220 + 2eb460a commit 0a4d0b2

File tree

19 files changed

+147
-78
lines changed

19 files changed

+147
-78
lines changed

drivers/gpu/drm/i915/display/intel_fb.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,19 @@ bool intel_fb_needs_64k_phys(u64 modifier)
519519
INTEL_PLANE_CAP_NEED64K_PHYS);
520520
}
521521

522+
/**
523+
* intel_fb_is_tile4_modifier: Check if a modifier is a tile4 modifier type
524+
* @modifier: Modifier to check
525+
*
526+
* Returns:
527+
* Returns %true if @modifier is a tile4 modifier.
528+
*/
529+
bool intel_fb_is_tile4_modifier(u64 modifier)
530+
{
531+
return plane_caps_contain_any(lookup_modifier(modifier)->plane_caps,
532+
INTEL_PLANE_CAP_TILING_4);
533+
}
534+
522535
static bool check_modifier_display_ver_range(const struct intel_modifier_desc *md,
523536
u8 display_ver_from, u8 display_ver_until)
524537
{

drivers/gpu/drm/i915/display/intel_fb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ bool intel_fb_is_ccs_modifier(u64 modifier);
3636
bool intel_fb_is_rc_ccs_cc_modifier(u64 modifier);
3737
bool intel_fb_is_mc_ccs_modifier(u64 modifier);
3838
bool intel_fb_needs_64k_phys(u64 modifier);
39+
bool intel_fb_is_tile4_modifier(u64 modifier);
3940

4041
bool intel_fb_is_ccs_aux_plane(const struct drm_framebuffer *fb, int color_plane);
4142
int intel_fb_rc_ccs_cc_plane(const struct drm_framebuffer *fb);

drivers/gpu/drm/i915/display/skl_universal_plane.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,6 +1618,17 @@ static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state,
16181618
return -EINVAL;
16191619
}
16201620

1621+
/*
1622+
* Display20 onward tile4 hflip is not supported
1623+
*/
1624+
if (rotation & DRM_MODE_REFLECT_X &&
1625+
intel_fb_is_tile4_modifier(fb->modifier) &&
1626+
DISPLAY_VER(dev_priv) >= 20) {
1627+
drm_dbg_kms(&dev_priv->drm,
1628+
"horizontal flip is not supported with tile4 surface formats\n");
1629+
return -EINVAL;
1630+
}
1631+
16211632
if (drm_rotation_90_or_270(rotation)) {
16221633
if (!intel_fb_supports_90_270_rotation(to_intel_framebuffer(fb))) {
16231634
drm_dbg_kms(&dev_priv->drm,

drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_stolen.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static inline int i915_gem_stolen_insert_node_in_range(struct xe_device *xe,
2929

3030
bo = xe_bo_create_locked_range(xe, xe_device_get_root_tile(xe),
3131
NULL, size, start, end,
32-
ttm_bo_type_kernel, flags);
32+
ttm_bo_type_kernel, flags, 0);
3333
if (IS_ERR(bo)) {
3434
err = PTR_ERR(bo);
3535
bo = NULL;

drivers/gpu/drm/xe/display/xe_display.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ static void __xe_display_pm_suspend(struct xe_device *xe, bool runtime)
345345
intel_opregion_suspend(display, s2idle ? PCI_D1 : PCI_D3cold);
346346

347347
intel_dmc_suspend(display);
348+
349+
if (runtime && has_display(xe))
350+
intel_hpd_poll_enable(xe);
348351
}
349352

350353
void xe_display_pm_suspend(struct xe_device *xe)
@@ -387,8 +390,10 @@ void xe_display_pm_runtime_suspend(struct xe_device *xe)
387390
if (!xe->info.probe_display)
388391
return;
389392

390-
if (xe->d3cold.allowed)
393+
if (xe->d3cold.allowed) {
391394
__xe_display_pm_suspend(xe, true);
395+
return;
396+
}
392397

393398
intel_hpd_poll_enable(xe);
394399
}
@@ -453,9 +458,11 @@ static void __xe_display_pm_resume(struct xe_device *xe, bool runtime)
453458
intel_display_driver_resume(xe);
454459
drm_kms_helper_poll_enable(&xe->drm);
455460
intel_display_driver_enable_user_access(xe);
456-
intel_hpd_poll_disable(xe);
457461
}
458462

463+
if (has_display(xe))
464+
intel_hpd_poll_disable(xe);
465+
459466
intel_opregion_resume(display);
460467

461468
if (!runtime)
@@ -474,10 +481,13 @@ void xe_display_pm_runtime_resume(struct xe_device *xe)
474481
if (!xe->info.probe_display)
475482
return;
476483

477-
intel_hpd_poll_disable(xe);
478-
479-
if (xe->d3cold.allowed)
484+
if (xe->d3cold.allowed) {
480485
__xe_display_pm_resume(xe, true);
486+
return;
487+
}
488+
489+
intel_hpd_init(xe);
490+
intel_hpd_poll_disable(xe);
481491
}
482492

483493

drivers/gpu/drm/xe/display/xe_fb_pin.c

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ write_dpt_remapped(struct xe_bo *bo, struct iosys_map *map, u32 *dpt_ofs,
7979

8080
static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
8181
const struct i915_gtt_view *view,
82-
struct i915_vma *vma)
82+
struct i915_vma *vma,
83+
u64 physical_alignment)
8384
{
8485
struct xe_device *xe = to_xe_device(fb->base.dev);
8586
struct xe_tile *tile0 = xe_device_get_root_tile(xe);
@@ -99,23 +100,29 @@ static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
99100
XE_PAGE_SIZE);
100101

101102
if (IS_DGFX(xe))
102-
dpt = xe_bo_create_pin_map(xe, tile0, NULL, dpt_size,
103-
ttm_bo_type_kernel,
104-
XE_BO_FLAG_VRAM0 |
105-
XE_BO_FLAG_GGTT |
106-
XE_BO_FLAG_PAGETABLE);
103+
dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
104+
dpt_size, ~0ull,
105+
ttm_bo_type_kernel,
106+
XE_BO_FLAG_VRAM0 |
107+
XE_BO_FLAG_GGTT |
108+
XE_BO_FLAG_PAGETABLE,
109+
physical_alignment);
107110
else
108-
dpt = xe_bo_create_pin_map(xe, tile0, NULL, dpt_size,
109-
ttm_bo_type_kernel,
110-
XE_BO_FLAG_STOLEN |
111-
XE_BO_FLAG_GGTT |
112-
XE_BO_FLAG_PAGETABLE);
111+
dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
112+
dpt_size, ~0ull,
113+
ttm_bo_type_kernel,
114+
XE_BO_FLAG_STOLEN |
115+
XE_BO_FLAG_GGTT |
116+
XE_BO_FLAG_PAGETABLE,
117+
physical_alignment);
113118
if (IS_ERR(dpt))
114-
dpt = xe_bo_create_pin_map(xe, tile0, NULL, dpt_size,
115-
ttm_bo_type_kernel,
116-
XE_BO_FLAG_SYSTEM |
117-
XE_BO_FLAG_GGTT |
118-
XE_BO_FLAG_PAGETABLE);
119+
dpt = xe_bo_create_pin_map_at_aligned(xe, tile0, NULL,
120+
dpt_size, ~0ull,
121+
ttm_bo_type_kernel,
122+
XE_BO_FLAG_SYSTEM |
123+
XE_BO_FLAG_GGTT |
124+
XE_BO_FLAG_PAGETABLE,
125+
physical_alignment);
119126
if (IS_ERR(dpt))
120127
return PTR_ERR(dpt);
121128

@@ -184,7 +191,8 @@ write_ggtt_rotated(struct xe_bo *bo, struct xe_ggtt *ggtt, u32 *ggtt_ofs, u32 bo
184191

185192
static int __xe_pin_fb_vma_ggtt(const struct intel_framebuffer *fb,
186193
const struct i915_gtt_view *view,
187-
struct i915_vma *vma)
194+
struct i915_vma *vma,
195+
u64 physical_alignment)
188196
{
189197
struct drm_gem_object *obj = intel_fb_bo(&fb->base);
190198
struct xe_bo *bo = gem_to_xe_bo(obj);
@@ -266,7 +274,8 @@ static int __xe_pin_fb_vma_ggtt(const struct intel_framebuffer *fb,
266274
}
267275

268276
static struct i915_vma *__xe_pin_fb_vma(const struct intel_framebuffer *fb,
269-
const struct i915_gtt_view *view)
277+
const struct i915_gtt_view *view,
278+
u64 physical_alignment)
270279
{
271280
struct drm_device *dev = fb->base.dev;
272281
struct xe_device *xe = to_xe_device(dev);
@@ -315,9 +324,9 @@ static struct i915_vma *__xe_pin_fb_vma(const struct intel_framebuffer *fb,
315324

316325
vma->bo = bo;
317326
if (intel_fb_uses_dpt(&fb->base))
318-
ret = __xe_pin_fb_vma_dpt(fb, view, vma);
327+
ret = __xe_pin_fb_vma_dpt(fb, view, vma, physical_alignment);
319328
else
320-
ret = __xe_pin_fb_vma_ggtt(fb, view, vma);
329+
ret = __xe_pin_fb_vma_ggtt(fb, view, vma, physical_alignment);
321330
if (ret)
322331
goto err_unpin;
323332

@@ -358,7 +367,7 @@ intel_fb_pin_to_ggtt(const struct drm_framebuffer *fb,
358367
{
359368
*out_flags = 0;
360369

361-
return __xe_pin_fb_vma(to_intel_framebuffer(fb), view);
370+
return __xe_pin_fb_vma(to_intel_framebuffer(fb), view, phys_alignment);
362371
}
363372

364373
void intel_fb_unpin_vma(struct i915_vma *vma, unsigned long flags)
@@ -372,11 +381,15 @@ int intel_plane_pin_fb(struct intel_plane_state *plane_state)
372381
struct drm_gem_object *obj = intel_fb_bo(fb);
373382
struct xe_bo *bo = gem_to_xe_bo(obj);
374383
struct i915_vma *vma;
384+
struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
385+
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
386+
u64 phys_alignment = plane->min_alignment(plane, fb, 0);
375387

376388
/* We reject creating !SCANOUT fb's, so this is weird.. */
377389
drm_WARN_ON(bo->ttm.base.dev, !(bo->flags & XE_BO_FLAG_SCANOUT));
378390

379-
vma = __xe_pin_fb_vma(to_intel_framebuffer(fb), &plane_state->view.gtt);
391+
vma = __xe_pin_fb_vma(intel_fb, &plane_state->view.gtt, phys_alignment);
392+
380393
if (IS_ERR(vma))
381394
return PTR_ERR(vma);
382395

drivers/gpu/drm/xe/xe_bo.c

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,8 @@ static struct xe_bo *
14541454
__xe_bo_create_locked(struct xe_device *xe,
14551455
struct xe_tile *tile, struct xe_vm *vm,
14561456
size_t size, u64 start, u64 end,
1457-
u16 cpu_caching, enum ttm_bo_type type, u32 flags)
1457+
u16 cpu_caching, enum ttm_bo_type type, u32 flags,
1458+
u64 alignment)
14581459
{
14591460
struct xe_bo *bo = NULL;
14601461
int err;
@@ -1483,6 +1484,8 @@ __xe_bo_create_locked(struct xe_device *xe,
14831484
if (IS_ERR(bo))
14841485
return bo;
14851486

1487+
bo->min_align = alignment;
1488+
14861489
/*
14871490
* Note that instead of taking a reference no the drm_gpuvm_resv_bo(),
14881491
* to ensure the shared resv doesn't disappear under the bo, the bo
@@ -1523,16 +1526,18 @@ struct xe_bo *
15231526
xe_bo_create_locked_range(struct xe_device *xe,
15241527
struct xe_tile *tile, struct xe_vm *vm,
15251528
size_t size, u64 start, u64 end,
1526-
enum ttm_bo_type type, u32 flags)
1529+
enum ttm_bo_type type, u32 flags, u64 alignment)
15271530
{
1528-
return __xe_bo_create_locked(xe, tile, vm, size, start, end, 0, type, flags);
1531+
return __xe_bo_create_locked(xe, tile, vm, size, start, end, 0, type,
1532+
flags, alignment);
15291533
}
15301534

15311535
struct xe_bo *xe_bo_create_locked(struct xe_device *xe, struct xe_tile *tile,
15321536
struct xe_vm *vm, size_t size,
15331537
enum ttm_bo_type type, u32 flags)
15341538
{
1535-
return __xe_bo_create_locked(xe, tile, vm, size, 0, ~0ULL, 0, type, flags);
1539+
return __xe_bo_create_locked(xe, tile, vm, size, 0, ~0ULL, 0, type,
1540+
flags, 0);
15361541
}
15371542

15381543
struct xe_bo *xe_bo_create_user(struct xe_device *xe, struct xe_tile *tile,
@@ -1542,7 +1547,7 @@ struct xe_bo *xe_bo_create_user(struct xe_device *xe, struct xe_tile *tile,
15421547
{
15431548
struct xe_bo *bo = __xe_bo_create_locked(xe, tile, vm, size, 0, ~0ULL,
15441549
cpu_caching, ttm_bo_type_device,
1545-
flags | XE_BO_FLAG_USER);
1550+
flags | XE_BO_FLAG_USER, 0);
15461551
if (!IS_ERR(bo))
15471552
xe_bo_unlock_vm_held(bo);
15481553

@@ -1565,6 +1570,17 @@ struct xe_bo *xe_bo_create_pin_map_at(struct xe_device *xe, struct xe_tile *tile
15651570
struct xe_vm *vm,
15661571
size_t size, u64 offset,
15671572
enum ttm_bo_type type, u32 flags)
1573+
{
1574+
return xe_bo_create_pin_map_at_aligned(xe, tile, vm, size, offset,
1575+
type, flags, 0);
1576+
}
1577+
1578+
struct xe_bo *xe_bo_create_pin_map_at_aligned(struct xe_device *xe,
1579+
struct xe_tile *tile,
1580+
struct xe_vm *vm,
1581+
size_t size, u64 offset,
1582+
enum ttm_bo_type type, u32 flags,
1583+
u64 alignment)
15681584
{
15691585
struct xe_bo *bo;
15701586
int err;
@@ -1576,7 +1592,8 @@ struct xe_bo *xe_bo_create_pin_map_at(struct xe_device *xe, struct xe_tile *tile
15761592
flags |= XE_BO_FLAG_GGTT;
15771593

15781594
bo = xe_bo_create_locked_range(xe, tile, vm, size, start, end, type,
1579-
flags | XE_BO_FLAG_NEEDS_CPU_ACCESS);
1595+
flags | XE_BO_FLAG_NEEDS_CPU_ACCESS,
1596+
alignment);
15801597
if (IS_ERR(bo))
15811598
return bo;
15821599

drivers/gpu/drm/xe/xe_bo.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct xe_bo *
7777
xe_bo_create_locked_range(struct xe_device *xe,
7878
struct xe_tile *tile, struct xe_vm *vm,
7979
size_t size, u64 start, u64 end,
80-
enum ttm_bo_type type, u32 flags);
80+
enum ttm_bo_type type, u32 flags, u64 alignment);
8181
struct xe_bo *xe_bo_create_locked(struct xe_device *xe, struct xe_tile *tile,
8282
struct xe_vm *vm, size_t size,
8383
enum ttm_bo_type type, u32 flags);
@@ -94,6 +94,12 @@ struct xe_bo *xe_bo_create_pin_map(struct xe_device *xe, struct xe_tile *tile,
9494
struct xe_bo *xe_bo_create_pin_map_at(struct xe_device *xe, struct xe_tile *tile,
9595
struct xe_vm *vm, size_t size, u64 offset,
9696
enum ttm_bo_type type, u32 flags);
97+
struct xe_bo *xe_bo_create_pin_map_at_aligned(struct xe_device *xe,
98+
struct xe_tile *tile,
99+
struct xe_vm *vm,
100+
size_t size, u64 offset,
101+
enum ttm_bo_type type, u32 flags,
102+
u64 alignment);
97103
struct xe_bo *xe_bo_create_from_data(struct xe_device *xe, struct xe_tile *tile,
98104
const void *data, size_t size,
99105
enum ttm_bo_type type, u32 flags);

drivers/gpu/drm/xe/xe_bo_types.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ struct xe_bo {
7676

7777
/** @vram_userfault_link: Link into @mem_access.vram_userfault.list */
7878
struct list_head vram_userfault_link;
79+
80+
/** @min_align: minimum alignment needed for this BO if different
81+
* from default
82+
*/
83+
u64 min_align;
7984
};
8085

8186
#endif

drivers/gpu/drm/xe/xe_device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ void xe_device_l2_flush(struct xe_device *xe)
925925
spin_lock(&gt->global_invl_lock);
926926
xe_mmio_write32(&gt->mmio, XE2_GLOBAL_INVAL, 0x1);
927927

928-
if (xe_mmio_wait32(&gt->mmio, XE2_GLOBAL_INVAL, 0x1, 0x0, 150, NULL, true))
928+
if (xe_mmio_wait32(&gt->mmio, XE2_GLOBAL_INVAL, 0x1, 0x0, 500, NULL, true))
929929
xe_gt_err_once(gt, "Global invalidation timeout\n");
930930
spin_unlock(&gt->global_invl_lock);
931931

0 commit comments

Comments
 (0)