public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 2/2] drmtest: assert operations inside gem_mmap__cpu
Date: Fri,  8 Nov 2013 18:50:23 -0200	[thread overview]
Message-ID: <1383943823-5061-2-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1383943823-5061-1-git-send-email-przanoni@gmail.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

All the callers seem to rely on the correct behavior of gem_mmap__cpu,
so add some assertions to catch the unexpected cases. This way we
won't need to worry about adding assertions to all the callers.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 lib/drmtest.c            | 4 ++--
 tests/gem_fence_thrash.c | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 636ba26..6ac9354 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -564,8 +564,8 @@ void *gem_mmap__cpu(int fd, uint32_t handle, int size)
 	mmap_arg.handle = handle;
 	mmap_arg.offset = 0;
 	mmap_arg.size = size;
-	if (drmIoctl(fd, DRM_IOCTL_I915_GEM_MMAP, &mmap_arg))
-		return NULL;
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &mmap_arg);
+	igt_assert(mmap_arg.addr_ptr);
 
 	return (void *)(uintptr_t)mmap_arg.addr_ptr;
 }
diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c
index 8e16f21..ced9b13 100644
--- a/tests/gem_fence_thrash.c
+++ b/tests/gem_fence_thrash.c
@@ -69,7 +69,6 @@ bo_create (int fd, int tiling)
 
 	/* dirty cpu caches a bit ... */
 	ptr = gem_mmap__cpu(fd, handle, OBJECT_SIZE);
-	igt_assert(ptr);
 	memset(ptr, 0, OBJECT_SIZE);
 	munmap(ptr, OBJECT_SIZE);
 
-- 
1.8.3.1

      reply	other threads:[~2013-11-08 20:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-08 20:50 [PATCH 1/2] drmtest: remove unused argument from gem_mmap__cpu Paulo Zanoni
2013-11-08 20:50 ` Paulo Zanoni [this message]

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=1383943823-5061-2-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox