Skip to content

Commit be7eeab

Browse files
matt-auldlucasdemarchi
authored andcommitted
drm/xe: handle flat ccs during hibernation on igpu
Starting from LNL, CCS has moved over to flat CCS model where there is now dedicated memory reserved for storing compression state. On platforms like LNL this reserved memory lives inside graphics stolen memory, which is not treated like normal RAM and is therefore skipped by the core kernel when creating the hibernation image. Currently if something was compressed and we enter hibernation all the corresponding CCS state is lost on such HW, resulting in corrupted memory. To fix this evict user buffers from TT -> SYSTEM to ensure we take a snapshot of the raw CCS state when entering hibernation, where upon resuming we can restore the raw CCS state back when next validating the buffer. This has been confirmed to fix display corruption on LNL when coming back from hibernation. Fixes: cbdc52c ("drm/xe/xe2: Support flat ccs") Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/3409 Signed-off-by: Matthew Auld <[email protected]> Cc: Matthew Brost <[email protected]> Cc: <[email protected]> # v6.8+ Reviewed-by: Rodrigo Vivi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit c8b3c6d) Signed-off-by: Lucas De Marchi <[email protected]>
1 parent 46f1f4b commit be7eeab

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/gpu/drm/xe/xe_bo_evict.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,21 @@ int xe_bo_evict_all(struct xe_device *xe)
3535
int ret;
3636

3737
/* User memory */
38-
for (mem_type = XE_PL_VRAM0; mem_type <= XE_PL_VRAM1; ++mem_type) {
38+
for (mem_type = XE_PL_TT; mem_type <= XE_PL_VRAM1; ++mem_type) {
3939
struct ttm_resource_manager *man =
4040
ttm_manager_type(bdev, mem_type);
4141

42+
/*
43+
* On igpu platforms with flat CCS we need to ensure we save and restore any CCS
44+
* state since this state lives inside graphics stolen memory which doesn't survive
45+
* hibernation.
46+
*
47+
* This can be further improved by only evicting objects that we know have actually
48+
* used a compression enabled PAT index.
49+
*/
50+
if (mem_type == XE_PL_TT && (IS_DGFX(xe) || !xe_device_has_flat_ccs(xe)))
51+
continue;
52+
4253
if (man) {
4354
ret = ttm_resource_manager_evict_all(bdev, man);
4455
if (ret)

0 commit comments

Comments
 (0)