[Mesa-dev] [PATCH] winsys/radeon: fix nop packet padding.

Jerome Glisse j.glisse at gmail.com
Thu Jul 24 15:19:41 PDT 2014


On Thu, Jul 24, 2014 at 05:42:21PM -0400, j.glisse at gmail.com wrote:
> From: Jerome Glisse <jglisse at redhat.com>
> 
> The gpu packet prefetcher hates the ugly big nop packet those leads
> to prefetching some invalid memory in some case. Apparently hawaii
> is particularly sensible to this.
> 
> Note this only partialy fix hawaii issues and some zbuffer tiling
> issues are still present.

Just to clarify this patch is almost good to go, there is the cs[MAX_DW-1]
case that need fixing and i am pondering on how to do that. Also i have not
tested on bonaire but i do expect that it should only fix thing and not
break things.

Cheers,
Jérôme

> 
> Signed-off-by: Jérôme Glisse <jglisse at redhat.com>
> ---
>  src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
> index a06ecb2..502a550 100644
> --- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
> @@ -451,8 +451,22 @@ static void radeon_drm_cs_flush(struct radeon_winsys_cs *rcs,
>              while (rcs->cdw & 7)
>                  OUT_CS(&cs->base, 0x80000000); /* type2 nop packet */
>          } else {
> -            while (rcs->cdw & 7)
> -                OUT_CS(&cs->base, 0xffff1000); /* type3 nop packet */
> +            switch (rcs->cdw & 7) {
> +            case 0:
> +                break;
> +            case 7:
> +                /* FIXME can this be bad if we are at cs[LAST_DW-1] ? Need to
> +                 * think of something.
> +                 */
> +                OUT_CS(&cs->base, 0xc0001000);
> +                OUT_CS(&cs->base, 0xcafedead);
> +                /* Note we fallthrough as this will add another 7 dwords */
> +            default:
> +                OUT_CS(&cs->base, 0xc0001000 | (((8 - (rcs->cdw & 7)) - 1) << 16));
> +                while (rcs->cdw & 7) {
> +                    OUT_CS(&cs->base, 0xcafedead);
> +                }
> +            }
>          }
>          break;
>      case RING_UVD:
> -- 
> 1.8.3.1
> 


More information about the mesa-dev mailing list