[Mesa-dev] [PATCH] radeon/uvd: add session context buffer for polaris 10/11

Leo Liu leo.liu at amd.com
Wed Jul 13 16:50:58 UTC 2016


Patch is Reviewed-by: Leo Liu <leo.liu at amd.com>

Regards,
Leo


On 07/13/2016 10:00 AM, Christian König wrote:
> From: Christian König <christian.koenig at amd.com>
>
> This way we have unlimited UVD sessions.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>   src/gallium/drivers/radeon/radeon_uvd.c | 20 ++++++++++++++++++++
>   src/gallium/drivers/radeon/radeon_uvd.h |  1 +
>   2 files changed, 21 insertions(+)
>
> diff --git a/src/gallium/drivers/radeon/radeon_uvd.c b/src/gallium/drivers/radeon/radeon_uvd.c
> index c693b79..37a063c 100644
> --- a/src/gallium/drivers/radeon/radeon_uvd.c
> +++ b/src/gallium/drivers/radeon/radeon_uvd.c
> @@ -59,6 +59,7 @@
>   #define FB_BUFFER_SIZE 2048
>   #define FB_BUFFER_SIZE_TONGA (2048 * 64)
>   #define IT_SCALING_TABLE_SIZE 992
> +#define UVD_SESSION_CONTEXT_SIZE (128 * 1024)
>   
>   /* UVD decoder representation */
>   struct ruvd_decoder {
> @@ -89,6 +90,7 @@ struct ruvd_decoder {
>   	struct rvid_buffer		dpb;
>   	bool				use_legacy;
>   	struct rvid_buffer		ctx;
> +	struct rvid_buffer		sessionctx;
>   };
>   
>   /* flush IB to the hardware */
> @@ -170,6 +172,12 @@ static void send_msg_buf(struct ruvd_decoder *dec)
>   	dec->fb = NULL;
>   	dec->it = NULL;
>   
> +
> +	if (dec->sessionctx.res)
> +		send_cmd(dec, RUVD_CMD_SESSION_CONTEXT_BUFFER,
> +			 dec->sessionctx.res->buf, 0, RADEON_USAGE_READWRITE,
> +			 RADEON_DOMAIN_VRAM);
> +
>   	/* and send it to the hardware */
>   	send_cmd(dec, RUVD_CMD_MSG_BUFFER, buf->res->buf, 0,
>   		 RADEON_USAGE_READ, RADEON_DOMAIN_GTT);
> @@ -938,6 +946,7 @@ static void ruvd_destroy(struct pipe_video_codec *decoder)
>   
>   	rvid_destroy_buffer(&dec->dpb);
>   	rvid_destroy_buffer(&dec->ctx);
> +	rvid_destroy_buffer(&dec->sessionctx);
>   
>   	FREE(dec);
>   }
> @@ -1259,6 +1268,16 @@ struct pipe_video_codec *ruvd_create_decoder(struct pipe_context *context,
>   		rvid_clear_buffer(context, &dec->ctx);
>   	}
>   
> +	if (info.family >= CHIP_POLARIS10) {
> +		if (!rvid_create_buffer(dec->screen, &dec->sessionctx,
> +					UVD_SESSION_CONTEXT_SIZE,
> +					PIPE_USAGE_DEFAULT)) {
> +			RVID_ERR("Can't allocated session ctx.\n");
> +			goto error;
> +		}
> +		rvid_clear_buffer(context, &dec->sessionctx);
> +	}
> +
>   	map_msg_fb_it_buf(dec);
>   	dec->msg->size = sizeof(*dec->msg);
>   	dec->msg->msg_type = RUVD_MSG_CREATE;
> @@ -1283,6 +1302,7 @@ error:
>   
>   	rvid_destroy_buffer(&dec->dpb);
>   	rvid_destroy_buffer(&dec->ctx);
> +	rvid_destroy_buffer(&dec->sessionctx);
>   
>   	FREE(dec);
>   
> diff --git a/src/gallium/drivers/radeon/radeon_uvd.h b/src/gallium/drivers/radeon/radeon_uvd.h
> index bb1782a..e3f8504 100644
> --- a/src/gallium/drivers/radeon/radeon_uvd.h
> +++ b/src/gallium/drivers/radeon/radeon_uvd.h
> @@ -61,6 +61,7 @@
>   #define RUVD_CMD_DPB_BUFFER		0x00000001
>   #define RUVD_CMD_DECODING_TARGET_BUFFER	0x00000002
>   #define RUVD_CMD_FEEDBACK_BUFFER	0x00000003
> +#define RUVD_CMD_SESSION_CONTEXT_BUFFER	0x00000005
>   #define RUVD_CMD_BITSTREAM_BUFFER	0x00000100
>   #define RUVD_CMD_ITSCALING_TABLE_BUFFER	0x00000204
>   #define RUVD_CMD_CONTEXT_BUFFER		0x00000206



More information about the mesa-dev mailing list