Mesa (staging/19.2): rbug: fix transmitted texture sizes

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 18 17:02:55 UTC 2019


Module: Mesa
Branch: staging/19.2
Commit: 306e82acb6c2c4a7f01aa3426e4572feec366b4e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=306e82acb6c2c4a7f01aa3426e4572feec366b4e

Author: Lucas Stach <l.stach at pengutronix.de>
Date:   Mon Sep 16 14:48:27 2019 +0200

rbug: fix transmitted texture sizes

The rbug wire format defines the texture size parameters to be uint32_t sized
and uses memcpy to move the function parameters to the message structure.
This caused totally wrong transmitted texture sizes since the height and depth
paramterds have been changed to uint16_t in the gallium API. Fix this by doing
an explicit conversion to the correct representation before packing into the
wire message.

Fixes: e6428092f5e1 (gallium: decrease the size of pipe_resource - 64 -> 48 bytes)
Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
(cherry picked from commit 6174cba748988d2187ea3ae682e7fc0c4a4b7d3e)

---

 src/gallium/auxiliary/rbug/rbug_texture.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/rbug/rbug_texture.c b/src/gallium/auxiliary/rbug/rbug_texture.c
index 3ee5e142b76..768e9505cca 100644
--- a/src/gallium/auxiliary/rbug/rbug_texture.c
+++ b/src/gallium/auxiliary/rbug/rbug_texture.c
@@ -283,9 +283,9 @@ int rbug_send_texture_info_reply(struct rbug_connection *__con,
                                  uint32_t format,
                                  uint32_t *width,
                                  uint32_t width_len,
-                                 uint16_t *height,
+                                 uint16_t *h16,
                                  uint32_t height_len,
-                                 uint16_t *depth,
+                                 uint16_t *d16,
                                  uint32_t depth_len,
                                  uint32_t blockw,
                                  uint32_t blockh,
@@ -299,6 +299,8 @@ int rbug_send_texture_info_reply(struct rbug_connection *__con,
 	uint32_t __pos = 0;
 	uint8_t *__data = NULL;
 	int __ret = 0;
+	uint32_t *height = alloca(sizeof(uint32_t) * height_len);
+	uint32_t *depth = alloca(sizeof(uint32_t) * height_len);
 
 	LEN(8); /* header */
 	LEN(4); /* serial */
@@ -321,6 +323,11 @@ int rbug_send_texture_info_reply(struct rbug_connection *__con,
 	if (!__data)
 		return -ENOMEM;
 
+	for (int i = 0; i < height_len; i++)
+		height[i] = h16[i];
+	for (int i = 0; i < depth_len; i++)
+		depth[i] = d16[i];
+
 	WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_INFO_REPLY));
 	WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
 	WRITE(4, uint32_t, serial); /* serial */




More information about the mesa-commit mailing list