virgl:Fix ITEM_CPY macro pointer copy bug

The ITEM_CPY macro uses the memcpy function to copy the item variable.
When item is a pointer, the memcpy function will copy the value of the
pointer, not the address that the pointer points to.

Signed-off-by: Cong Liu <liucong2@kylinos.cn>
Reviewerd-by: Feng Jiang <jiangfeng@kylinos.cn>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25453>
This commit is contained in:
Cong Liu 2023-09-28 18:36:06 +08:00 committed by Marge Bot
parent 6de10c3585
commit e7d393b1d7

View file

@ -549,8 +549,10 @@ static int fill_mpeg4_picture_desc(const struct pipe_picture_desc *desc,
ITEM_SET(vmpeg4, mpeg4, rounding_control);
ITEM_SET(vmpeg4, mpeg4, alternate_vertical_scan_flag);
ITEM_SET(vmpeg4, mpeg4, top_field_first);
ITEM_CPY(vmpeg4, mpeg4, intra_matrix);
ITEM_CPY(vmpeg4, mpeg4, non_intra_matrix);
memcpy(vmpeg4->intra_matrix, mpeg4->intra_matrix, 64);
memcpy(vmpeg4->non_intra_matrix, mpeg4->non_intra_matrix, 64);
for (i = 0; i < ARRAY_SIZE(mpeg4->ref); i++) {
vbuf = virgl_video_buffer(mpeg4->ref[i]);
vmpeg4->ref[i] = vbuf ? vbuf->handle : 0;