Skip to content

Commit 952d191

Browse files
matt-auldrodrigovivi
authored andcommitted
drm/i915/migrate: fix corner case in CCS aux copying
In the case of lmem -> lmem transfers, which is currently only possible with small-bar systems, we need to ensure we copy the CCS aux state as-is, rather than nuke it. This should fix some nasty display corruption sometimes seen on DG2 small-bar systems, when also using DG2_RC_CCS_CC for the surface. Fixes: e3afc69 ("drm/i915/display: consider DG2_RC_CCS_CC when migrating buffers") Signed-off-by: Matthew Auld <[email protected]> Cc: Ville Syrjälä <[email protected]> Cc: Nirmoy Das <[email protected]> Cc: Andrzej Hajda <[email protected]> Cc: Shuicheng Lin <[email protected]> Reviewed-by: Nirmoy Das <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit b29d26f) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 31a2e6c commit 952d191

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

drivers/gpu/drm/i915/gt/intel_migrate.c

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -837,14 +837,35 @@ intel_context_migrate_copy(struct intel_context *ce,
837837
if (err)
838838
goto out_rq;
839839

840-
/*
841-
* While we can't always restore/manage the CCS state,
842-
* we still need to ensure we don't leak the CCS state
843-
* from the previous user, so make sure we overwrite it
844-
* with something.
845-
*/
846-
err = emit_copy_ccs(rq, dst_offset, INDIRECT_ACCESS,
847-
dst_offset, DIRECT_ACCESS, len);
840+
if (src_is_lmem) {
841+
/*
842+
* If the src is already in lmem, then we must
843+
* be doing an lmem -> lmem transfer, and so
844+
* should be safe to directly copy the CCS
845+
* state. In this case we have either
846+
* initialised the CCS aux state when first
847+
* clearing the pages (since it is already
848+
* allocated in lmem), or the user has
849+
* potentially populated it, in which case we
850+
* need to copy the CCS state as-is.
851+
*/
852+
err = emit_copy_ccs(rq,
853+
dst_offset, INDIRECT_ACCESS,
854+
src_offset, INDIRECT_ACCESS,
855+
len);
856+
} else {
857+
/*
858+
* While we can't always restore/manage the CCS
859+
* state, we still need to ensure we don't leak
860+
* the CCS state from the previous user, so make
861+
* sure we overwrite it with something.
862+
*/
863+
err = emit_copy_ccs(rq,
864+
dst_offset, INDIRECT_ACCESS,
865+
dst_offset, DIRECT_ACCESS,
866+
len);
867+
}
868+
848869
if (err)
849870
goto out_rq;
850871

0 commit comments

Comments
 (0)