[PATCH i-g-t v6 2/2] tests/xe_ccs: Update compression check based on flat-ccs enablement

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Fri Apr 19 07:41:42 UTC 2024


On Thu, Apr 18, 2024 at 11:36:37PM -0700, Jahagirdar, Akshata wrote:
> 
> On 4/18/2024 6:59 AM, Zbigniew Kempczyński wrote:
> > On Thu, Apr 18, 2024 at 01:46:43AM -0700, Akshata Jahagirdar wrote:
> > > In Xe2+ platforms,we need to run this test regardless of the status of flat-ccs.
> > > Check if the platform supports compression and has flat ccs enabled, and if it
> > > doesn't, then update the checks accordingly and proceed with the test.
> > > 
> > > Additionally, On Xe2 dGPU, compression is only supported with VRAM. When copying
> > > from VRAM -> sysmem the KMD uses mapping with uncompressed PAT so the copy
> > > in system memory is guaranteed to be uncompressed. When restoring such buffers
> > > from sysmem -> VRAM the KMD can't easily know which pages were originally
> > > compressed, so we always use uncompressed -> uncompressed here. so this means
> > > there's no need for extra CCS storage on such platforms.
> > > Thats why we shouldn't need to run suspend-resume on xe2 dgpu.
> > > 
> > > Signed-off-by: Akshata Jahagirdar <akshata.jahagirdar at intel.com>
> > > Acked-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
> > > ---
> > >   tests/intel/xe_ccs.c | 26 ++++++++++++++++++++++----
> > >   1 file changed, 22 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/tests/intel/xe_ccs.c b/tests/intel/xe_ccs.c
> > > index b3bf97af7..d6148dc44 100644
> > > --- a/tests/intel/xe_ccs.c
> > > +++ b/tests/intel/xe_ccs.c
> > > @@ -162,8 +162,24 @@ static void surf_copy(int xe,
> > >   						      (void *)mid->ptr, mid->size);
> > >   		munmap(ccsmap2, ccssize);
> > > -		igt_assert(!strcmp(orig, newsum));
> > > -		igt_assert(!strcmp(orig2, newsum2));
> > > +		if (blt_platform_has_flat_ccs_enabled(xe)) {
> > > +			if (IS_GEN(xe, 12) && is_intel_dgfx(xe)) {
> > > +				igt_assert(!strcmp(orig, newsum));
> > > +				igt_assert(!strcmp(orig2, newsum2));
> > > +			} else if (AT_LEAST_GEN(xe, 20)) {
> > > +				if (is_intel_dgfx(xe)) {
> > > +					/* buffer object would become
> > > +					 * uncompressed in xe2+ dgfx
> > > +					 */
> > > +					igt_assert(!blt_surface_is_compressed(xe, ctx,
> > > +							NULL, ahnd, mid));
> > > +				} else {
> > > +					/* ccs should be present in xe2+ igfx */
> > > +					igt_assert(blt_surface_is_compressed(xe, ctx,
> > > +							NULL, ahnd, mid));
> > > +				}
> > > +			}
> > > +		}
> > This part is fine for me, but below code doesn't work on Xe2/discrete.
> > I mean I got:
> > 
> > (xe_ccs:6919) CRITICAL: Test assertion failure function surf_copy, file ../tests/intel/xe_ccs.c:232:
> > (xe_ccs:6919) CRITICAL: Failed assertion: result == 0
> > (xe_ccs:6919) CRITICAL: Source and destination surfaces are different after restoring source ccs data
> > 
> > After resume we put corrupted, then previous ccs data. In all cases
> > along with uncompressed surface this leads to disaster. I mean for
> > discrete instead putting original ccs data (this one extracted before
> > suspend) you should fill it with zeros. Original ccs data were fine
> > before suspend migrated surface to system memory, but after resume
> > those ccs data are not valid anymore.
> > 
> > I've verified that for Xe2/discrete:
> > 
> > 	/* retrieve back ccs */
> > 	/* memcpy(ccsmap, ccscopy, ccssize); */
> > 	memset(ccsmap, 0, ccssize);
> > 
> > does last blit work correctly.
> > 
> > --
> > Zbigniew
> I see. But doing memset() would fail for ctrl-surf-copy subtest since the
> mid blt object would be compressed all along.
> So, we need to copy the original ccs data to the mid blt object to copy it
> correctly to dst blt object.
> 
> So, we need to call memset() only in case of suspend-resume.

Right, only on suspend-resume subtest on Xe2/discrete. Other
platforms should have ccs data intact.

--
Zbigniew

> 
> Best,
> Akshata
> 
> > >   		g_free(orig);
> > >   		g_free(orig2);
> > >   		g_free(newsum);
> > > @@ -193,7 +209,8 @@ static void surf_copy(int xe,
> > >   	intel_ctx_xe_sync(ctx, true);
> > >   	WRITE_PNG(xe, run_id, "corrupted", &blt.dst, dst->x2, dst->y2, bpp);
> > >   	result = memcmp(src->ptr, dst->ptr, src->size);
> > > -	igt_assert(result != 0);
> > > +	if (!blt_platform_has_flat_ccs_enabled(xe))
> > > +		igt_assert(result != 0);
> > >   	/* retrieve back ccs */
> > >   	memcpy(ccsmap, ccscopy, ccssize);
> > > @@ -365,7 +382,8 @@ static void block_copy(int xe,
> > >   	 * occurs and ctrl surface will be filled with some not-zeroed values.
> > >   	 */
> > >   	if (mid->compression && FROM_EXP_WH(width, height))
> > > -		igt_assert(blt_surface_is_compressed(xe, ctx, NULL, ahnd, mid));
> > > +		if (!blt_platform_has_flat_ccs_enabled(xe))
> > > +			igt_assert(blt_surface_is_compressed(xe, ctx, NULL, ahnd, mid));
> > >   	WRITE_PNG(xe, run_id, "mid", &blt.dst, width, height, bpp);
> > > -- 
> > > 2.34.1
> > > 


More information about the igt-dev mailing list