Module: Mesa
Branch: main
Commit: e7d393b1d7b8fd9b39942d4c2e5b32c46ffffff7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e7d393b1d7b8fd9b39942d4c2e5b32c46ffffff7

Author: Cong Liu <[email protected]>
Date:   Thu Sep 28 18:36:06 2023 +0800

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 <[email protected]>
Reviewerd-by: Feng Jiang <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25453>

---

 src/gallium/drivers/virgl/virgl_video.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/virgl/virgl_video.c 
b/src/gallium/drivers/virgl/virgl_video.c
index 49d29db2520..6a21f602acb 100644
--- a/src/gallium/drivers/virgl/virgl_video.c
+++ b/src/gallium/drivers/virgl/virgl_video.c
@@ -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;

Reply via email to