[igt-dev] [PATCH i-g-t 1/2] lib/intel_bufops: Add fixed mapping for reading ccs data

Dixit, Ashutosh ashutosh.dixit at intel.com
Wed Dec 29 21:39:01 UTC 2021


On Wed, 29 Dec 2021 03:48:05 -0800, Zbigniew Kempczyński wrote:
>
> On discrete gem_mmap_offset__fixed() function must be used to map
> local memory.

WC will also work, though FIXED will be more efficient for smem-only
buffers which will be mapped WB.

> Add this case for copying of ccs data and fix all *ccs* subtests in
> gem_render_copy test.
>
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
> Cc: Ashutosh Dixit <ashutosh.dixit at intel.com>
> Cc: Petri Latvala <petri.latvala at intel.com>
> ---
>  lib/intel_bufops.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
> index f13063fa9..72d729b63 100644
> --- a/lib/intel_bufops.c
> +++ b/lib/intel_bufops.c
> @@ -399,11 +399,17 @@ static void __copy_ccs(struct buf_ops *bops, struct intel_buf *buf,
>	ccs_size = CCS_SIZE(gen, buf);
>	size = offset + ccs_size;
>
> -	map = __gem_mmap_offset__wc(bops->fd, buf->handle, 0, size,
> -				    PROT_READ | PROT_WRITE);
> +	if (gem_has_lmem(bops->fd)) {
> +		map = gem_mmap_offset__fixed(bops->fd, buf->handle, 0, size,
> +					     PROT_READ | PROT_WRITE);
> +	}

Not sure but maybe gem_has_lmem() check can be skipped and we use
__gem_mmap_offset__fixed() (see __gem_mmap__device_coherent())?

>	if (!map)
> -		map = gem_mmap__wc(bops->fd, buf->handle, 0, size,
> -				   PROT_READ | PROT_WRITE);
> +		map = __gem_mmap_offset__wc(bops->fd, buf->handle, 0, size,
> +					    PROT_READ | PROT_WRITE);
> +	if (!map)
> +		map = __gem_mmap__wc(bops->fd, buf->handle, 0, size,

This should be gem_mmap__wc not __gem_mmap__wc (need to assert at the end).

Though I am not sure why CI is failing for this patch.

> +				     PROT_READ | PROT_WRITE);
> +
>
>	switch (dir) {
>	case CCS_LINEAR_TO_BUF:
> --
> 2.32.0
>


More information about the igt-dev mailing list