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

Marek Olšák maraeo at gmail.com
Fri Aug 1 06:33:37 PDT 2014


On Fri, Aug 1, 2014 at 3:09 PM, Andreas Boll <andreas.boll.dev at gmail.com> wrote:
> The initial firmware for hawaii does not support type3 nop packet.
> Detect the new hawaii firmware with query RADEON_INFO_ACCEL_WORKING2.
> If the returned value is 2, then the new firmware is used.
>
> This patch uses type2 for the old firmware and type3 for the new firmware.
>
> It fixes the cases when the old firmware is used and the user wants to
> manually enable acceleration.
> The two possible scenarios are:
>  - the kernel has no support for the new firmware.
>  - the kernel has support for the new firmware but only the old firmware
>    is available.
>
> Cc: mesa-stable at lists.freedesktop.org
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Cc: Jérôme Glisse <jglisse at redhat.com>
> Signed-off-by: Andreas Boll <andreas.boll.dev at gmail.com>
> ---
>
> Unfortunately I can't test this patch myself since I don't own a hawaii card.
> So I'd need someone to test this patch on kernel >= 3.16-rc7.
> This patch would bring us one step further for hawaii acceleration on kernel 1.16.
>
> Andreas.
>
>  src/gallium/winsys/radeon/drm/radeon_drm_cs.c     | 6 +++++-
>  src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 3 +++
>  src/gallium/winsys/radeon/drm/radeon_winsys.h     | 1 +
>  3 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
> index a06ecb2..ed2744b 100644
> --- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
> @@ -446,8 +446,12 @@ static void radeon_drm_cs_flush(struct radeon_winsys_cs *rcs,
>      case RING_GFX:
>          /* pad DMA ring to 8 DWs to meet CP fetch alignment requirements
>           * r6xx, requires at least 4 dw alignment to avoid a hw bug.
> +         * hawaii with old firmware needs type2 nop packet.
> +         * r600_accel_working2 with value 2 indicates the new firmware.
>           */
> -        if (cs->ws->info.chip_class <= SI) {
> +        if (cs->ws->info.chip_class <= SI
> +                || (cs->ws->info.family == CHIP_HAWAII
> +                && cs->ws->info.r600_accel_working2 < 2)) {

This indentation is really weird, it's not aligned with the first
parenthesis. Also, we always put operators and the end of the line,
not at the beginning of the next line.

Also, struct radeon_info is a public structure consumed by
drivers/r600|radeonsi. Since the new flag isn't used by those drivers,
it shouldn't be there. For private stuff, use struct
radeon_drm_winsys.

Marek

>              while (rcs->cdw & 7)
>                  OUT_CS(&cs->base, 0x80000000); /* type2 nop packet */
>          } else {
> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
> index 910d06b..05ea458 100644
> --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
> @@ -395,6 +395,9 @@ static boolean do_winsys_init(struct radeon_drm_winsys *ws)
>      radeon_get_drm_value(ws->fd, RADEON_INFO_MAX_SH_PER_SE, NULL,
>                           &ws->info.max_sh_per_se);
>
> +    radeon_get_drm_value(ws->fd, RADEON_INFO_ACCEL_WORKING2, NULL,
> +                         &ws->info.r600_accel_working2);
> +
>      if (radeon_get_drm_value(ws->fd, RADEON_INFO_SI_TILE_MODE_ARRAY, NULL,
>                               ws->info.si_tile_mode_array)) {
>          ws->info.si_tile_mode_array_valid = TRUE;
> diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h
> index dbd58f1..e1f4b95 100644
> --- a/src/gallium/winsys/radeon/drm/radeon_winsys.h
> +++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h
> @@ -223,6 +223,7 @@ struct radeon_info {
>      uint32_t                    r600_max_pipes;
>      boolean                     r600_virtual_address;
>      boolean                     r600_has_dma;
> +    uint32_t                    r600_accel_working2;
>
>      uint32_t                    r600_backend_map;
>      boolean                     r600_backend_map_valid;
> --
> 2.0.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list