@@ -79,7 +79,8 @@ write_dpt_remapped(struct xe_bo *bo, struct iosys_map *map, u32 *dpt_ofs,
79
79
80
80
static int __xe_pin_fb_vma_dpt (const struct intel_framebuffer * fb ,
81
81
const struct i915_gtt_view * view ,
82
- struct i915_vma * vma )
82
+ struct i915_vma * vma ,
83
+ u64 physical_alignment )
83
84
{
84
85
struct xe_device * xe = to_xe_device (fb -> base .dev );
85
86
struct xe_tile * tile0 = xe_device_get_root_tile (xe );
@@ -98,23 +99,29 @@ static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
98
99
XE_PAGE_SIZE );
99
100
100
101
if (IS_DGFX (xe ))
101
- dpt = xe_bo_create_pin_map (xe , tile0 , NULL , dpt_size ,
102
- ttm_bo_type_kernel ,
103
- XE_BO_FLAG_VRAM0 |
104
- XE_BO_FLAG_GGTT |
105
- XE_BO_FLAG_PAGETABLE );
102
+ dpt = xe_bo_create_pin_map_at_aligned (xe , tile0 , NULL ,
103
+ dpt_size , ~0ull ,
104
+ ttm_bo_type_kernel ,
105
+ XE_BO_FLAG_VRAM0 |
106
+ XE_BO_FLAG_GGTT |
107
+ XE_BO_FLAG_PAGETABLE ,
108
+ physical_alignment );
106
109
else
107
- dpt = xe_bo_create_pin_map (xe , tile0 , NULL , dpt_size ,
108
- ttm_bo_type_kernel ,
109
- XE_BO_FLAG_STOLEN |
110
- XE_BO_FLAG_GGTT |
111
- XE_BO_FLAG_PAGETABLE );
110
+ dpt = xe_bo_create_pin_map_at_aligned (xe , tile0 , NULL ,
111
+ dpt_size , ~0ull ,
112
+ ttm_bo_type_kernel ,
113
+ XE_BO_FLAG_STOLEN |
114
+ XE_BO_FLAG_GGTT |
115
+ XE_BO_FLAG_PAGETABLE ,
116
+ physical_alignment );
112
117
if (IS_ERR (dpt ))
113
- dpt = xe_bo_create_pin_map (xe , tile0 , NULL , dpt_size ,
114
- ttm_bo_type_kernel ,
115
- XE_BO_FLAG_SYSTEM |
116
- XE_BO_FLAG_GGTT |
117
- XE_BO_FLAG_PAGETABLE );
118
+ dpt = xe_bo_create_pin_map_at_aligned (xe , tile0 , NULL ,
119
+ dpt_size , ~0ull ,
120
+ ttm_bo_type_kernel ,
121
+ XE_BO_FLAG_SYSTEM |
122
+ XE_BO_FLAG_GGTT |
123
+ XE_BO_FLAG_PAGETABLE ,
124
+ physical_alignment );
118
125
if (IS_ERR (dpt ))
119
126
return PTR_ERR (dpt );
120
127
@@ -183,7 +190,8 @@ write_ggtt_rotated(struct xe_bo *bo, struct xe_ggtt *ggtt, u32 *ggtt_ofs, u32 bo
183
190
184
191
static int __xe_pin_fb_vma_ggtt (const struct intel_framebuffer * fb ,
185
192
const struct i915_gtt_view * view ,
186
- struct i915_vma * vma )
193
+ struct i915_vma * vma ,
194
+ u64 physical_alignment )
187
195
{
188
196
struct xe_bo * bo = intel_fb_obj (& fb -> base );
189
197
struct xe_device * xe = to_xe_device (fb -> base .dev );
@@ -264,7 +272,8 @@ static int __xe_pin_fb_vma_ggtt(const struct intel_framebuffer *fb,
264
272
}
265
273
266
274
static struct i915_vma * __xe_pin_fb_vma (const struct intel_framebuffer * fb ,
267
- const struct i915_gtt_view * view )
275
+ const struct i915_gtt_view * view ,
276
+ u64 physical_alignment )
268
277
{
269
278
struct drm_device * dev = fb -> base .dev ;
270
279
struct xe_device * xe = to_xe_device (dev );
@@ -312,9 +321,9 @@ static struct i915_vma *__xe_pin_fb_vma(const struct intel_framebuffer *fb,
312
321
313
322
vma -> bo = bo ;
314
323
if (intel_fb_uses_dpt (& fb -> base ))
315
- ret = __xe_pin_fb_vma_dpt (fb , view , vma );
324
+ ret = __xe_pin_fb_vma_dpt (fb , view , vma , physical_alignment );
316
325
else
317
- ret = __xe_pin_fb_vma_ggtt (fb , view , vma );
326
+ ret = __xe_pin_fb_vma_ggtt (fb , view , vma , physical_alignment );
318
327
if (ret )
319
328
goto err_unpin ;
320
329
@@ -355,7 +364,7 @@ intel_fb_pin_to_ggtt(const struct drm_framebuffer *fb,
355
364
{
356
365
* out_flags = 0 ;
357
366
358
- return __xe_pin_fb_vma (to_intel_framebuffer (fb ), view );
367
+ return __xe_pin_fb_vma (to_intel_framebuffer (fb ), view , phys_alignment );
359
368
}
360
369
361
370
void intel_fb_unpin_vma (struct i915_vma * vma , unsigned long flags )
@@ -368,11 +377,15 @@ int intel_plane_pin_fb(struct intel_plane_state *plane_state)
368
377
struct drm_framebuffer * fb = plane_state -> hw .fb ;
369
378
struct xe_bo * bo = intel_fb_obj (fb );
370
379
struct i915_vma * vma ;
380
+ struct intel_framebuffer * intel_fb = to_intel_framebuffer (fb );
381
+ struct intel_plane * plane = to_intel_plane (plane_state -> uapi .plane );
382
+ u64 phys_alignment = plane -> min_alignment (plane , fb , 0 );
371
383
372
384
/* We reject creating !SCANOUT fb's, so this is weird.. */
373
385
drm_WARN_ON (bo -> ttm .base .dev , !(bo -> flags & XE_BO_FLAG_SCANOUT ));
374
386
375
- vma = __xe_pin_fb_vma (to_intel_framebuffer (fb ), & plane_state -> view .gtt );
387
+ vma = __xe_pin_fb_vma (intel_fb , & plane_state -> view .gtt , phys_alignment );
388
+
376
389
if (IS_ERR (vma ))
377
390
return PTR_ERR (vma );
378
391
0 commit comments