Skip to content

Instantly share code, notes, and snippets.

@tiagovignatti
Created August 4, 2015 21:11
Show Gist options
  • Save tiagovignatti/64c2ff9c15c741729d56 to your computer and use it in GitHub Desktop.
Save tiagovignatti/64c2ff9c15c741729d56 to your computer and use it in GitHub Desktop.
diff --git a/tests/prime_crc.c b/tests/prime_crc.c
index dccfa3f..5357fe8 100644
--- a/tests/prime_crc.c
+++ b/tests/prime_crc.c
@@ -93,6 +93,21 @@ static void mess_with_coherency(char *ptr)
// close(dma_buf_fd);
}
+static char *drm_mmap_framebuffer(struct igt_fb *fb)
+{
+ char *ptr = NULL;
+ struct drm_mode_map_dumb mmap_arg;
+
+ memset(&mmap_arg, 0, sizeof(mmap_arg));
+ mmap_arg.handle = fb->gem_handle;
+ igt_assert(drmIoctl(drm_fd, DRM_IOCTL_MODE_MAP_DUMB, &mmap_arg) == 0);
+
+ ptr = mmap(NULL, BO_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, drm_fd, mmap_arg.offset);
+ igt_assert(ptr != MAP_FAILED);
+
+ return ptr;
+}
+
static char *dmabuf_mmap_framebuffer(struct igt_fb *fb)
{
int dma_buf_fd;
@@ -117,7 +132,8 @@ static void get_method_crc(uint64_t tiling, igt_crc_t *crc, bool mess)
DRM_FORMAT_XRGB8888, tiling, &fb);
if (mess)
- ptr = dmabuf_mmap_framebuffer(&fb);
+ ptr = drm_mmap_framebuffer(&fb);
+ //ptr = dmabuf_mmap_framebuffer(&fb);
rc = drmModeSetCrtc(drm_fd, ms.crtc_id, fb.fb_id, 0, 0,
&ms.connector_id, 1, ms.mode);
@@ -146,7 +162,7 @@ static void draw_method_subtest(uint64_t tiling)
// XXX: IIUC if we mess up with the scanout device, through a dma-buf mmap'ed
// pointer, then both the reference crc and the messed up one should be equal
// because the latter wasn't flushed. That's the theory, but it's not what's
- // happening.
+ // happening and the following is not passing.
igt_assert_crc_equal(&reference_crc, &crc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment