radeon/uvd: clear message buffer when reuse
authorLeo Liu <leo.liu@amd.com>
Thu, 9 Feb 2017 15:30:21 +0000 (10:30 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 30 Mar 2017 12:44:33 +0000 (14:44 +0200)
As required by firmware

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
src/gallium/drivers/radeon/radeon_uvd.c

index ea614c1dd2a051ac70cb514a4975854f388b3a58..1d1e40af9796cdb75372875fedac512dd991abff 100644 (file)
@@ -157,6 +157,8 @@ static void map_msg_fb_it_buf(struct ruvd_decoder *dec)
 
        /* calc buffer offsets */
        dec->msg = (struct ruvd_msg *)ptr;
+       memset(dec->msg, 0, sizeof(*dec->msg));
+
        dec->fb = (uint32_t *)(ptr + FB_BUFFER_OFFSET);
        if (have_it(dec))
                dec->it = (uint8_t *)(ptr + FB_BUFFER_OFFSET + dec->fb_size);
@@ -941,7 +943,6 @@ static void ruvd_destroy(struct pipe_video_codec *decoder)
        assert(decoder);
 
        map_msg_fb_it_buf(dec);
-       memset(dec->msg, 0, sizeof(*dec->msg));
        dec->msg->size = sizeof(*dec->msg);
        dec->msg->msg_type = RUVD_MSG_DESTROY;
        dec->msg->stream_handle = dec->stream_handle;