All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Forbes <ian.forbes@broadcom.com>
To: dri-devel@lists.freedesktop.org
Cc: bcm-kernel-feedback-list@broadcom.com, zack.rusin@broadcom.com,
	martin.krastev@broadcom.com, maaz.mombasawala@broadcom.com,
	Ian Forbes <ian.forbes@broadcom.com>
Subject: [PATCH] drm/vmwgfx: Don't memcmp equivalent pointers
Date: Thu, 28 Mar 2024 14:07:16 -0500	[thread overview]
Message-ID: <20240328190716.27367-1-ian.forbes@broadcom.com> (raw)

These pointers are frequently the same and memcmp does not compare the pointers
before comparing their contents so this was wasting cycles comparing 16 KiB of
memory which will always be equal.

Fixes: bb6780aa5a1d9 ("drm/vmwgfx: Diff cursors when using cmds")
Signed-off-by: Ian Forbes <ian.forbes@broadcom.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index cd4925346ed4..fbcce84e2f4c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -216,7 +216,7 @@ static bool vmw_du_cursor_plane_has_changed(struct vmw_plane_state *old_vps,
 	new_image = vmw_du_cursor_plane_acquire_image(new_vps);
 
 	changed = false;
-	if (old_image && new_image)
+	if (old_image && new_image && (old_image != new_image))
 		changed = memcmp(old_image, new_image, size) != 0;
 
 	return changed;
-- 
2.34.1


             reply	other threads:[~2024-03-28 19:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 19:07 Ian Forbes [this message]
2024-03-29  1:22 ` [PATCH] drm/vmwgfx: Don't memcmp equivalent pointers Zack Rusin
2024-04-05 15:02 ` [PATCH v2] " Ian Forbes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240328190716.27367-1-ian.forbes@broadcom.com \
    --to=ian.forbes@broadcom.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=maaz.mombasawala@broadcom.com \
    --cc=martin.krastev@broadcom.com \
    --cc=zack.rusin@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.