[PATCH] Revert "drm/amd/display: Remove unused temp variable"

Alex Deucher alexander.deucher at amd.com
Wed Feb 23 02:28:39 UTC 2022


This reverts commit b1f0ab445ec609f9b58e0969c5d052b52d9a54e7.

This patch is not valid.  The driver needs to actually read the
entries in the ring buffer.  Add a comment to make this clear.

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1916
Cc: Maíra Canal <maira.canal at usp.br>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
index d3088836d4e4..cb92ab4c8b98 100644
--- a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
+++ b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
@@ -2918,8 +2918,15 @@ static inline void dmub_rb_flush_pending(const struct dmub_rb *rb)
 	while (rptr != wptr) {
 		uint64_t volatile *data = (uint64_t volatile *)((uint8_t *)(rb->base_address) + rptr);
 		//uint64_t volatile *p = (uint64_t volatile *)data;
+		uint64_t temp;
+		uint8_t i;
 
-		*data += DMUB_RB_CMD_SIZE / sizeof(uint64_t);
+		/* Don't remove this.
+		 * The contents need to actually be read from the ring buffer
+		 * for this function to be effective.
+		 */
+		for (i = 0; i < DMUB_RB_CMD_SIZE / sizeof(uint64_t); i++)
+			temp = *data++;
 
 		rptr += DMUB_RB_CMD_SIZE;
 		if (rptr >= rb->capacity)
-- 
2.35.1



More information about the amd-gfx mailing list