public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Chia-I Wu <olvaffe@gmail.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH libdrm] intel: silence valgrind warnings for unsynchronized maps
Date: Wed, 10 Jul 2013 10:49:59 +0800	[thread overview]
Message-ID: <1373424599-8583-1-git-send-email-olvaffe@gmail.com> (raw)

Mark the address ranges as accessible with VALGRIND_MAKE_MEM_DEFINED.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
---
 intel/intel_bufmgr_gem.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index a51e3f3..f98f7a7 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -1322,6 +1322,7 @@ int drm_intel_gem_bo_map_gtt(drm_intel_bo *bo)
 int drm_intel_gem_bo_map_unsynchronized(drm_intel_bo *bo)
 {
 	drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
+	drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
 	int ret;
 
 	/* If the CPU cache isn't coherent with the GTT, then use a
@@ -1335,7 +1336,13 @@ int drm_intel_gem_bo_map_unsynchronized(drm_intel_bo *bo)
 		return drm_intel_gem_bo_map_gtt(bo);
 
 	pthread_mutex_lock(&bufmgr_gem->lock);
+
 	ret = map_gtt(bo);
+	if (ret == 0) {
+		drm_intel_gem_bo_mark_mmaps_incoherent(bo);
+		VG(VALGRIND_MAKE_MEM_DEFINED(bo_gem->gtt_virtual, bo->size));
+	}
+
 	pthread_mutex_unlock(&bufmgr_gem->lock);
 
 	return ret;
-- 
1.8.3.1

             reply	other threads:[~2013-07-10  2:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10  2:49 Chia-I Wu [this message]
2013-07-16 13:24 ` [PATCH libdrm] intel: silence valgrind warnings for unsynchronized maps Daniel Vetter

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=1373424599-8583-1-git-send-email-olvaffe@gmail.com \
    --to=olvaffe@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox