* [PATCH 1/3] igt/gem_stolen: Verify contents of stolen-backed objects across hibernation
@ 2016-06-03 8:51 ankitprasad.r.sharma
2016-06-03 10:52 ` Tvrtko Ursulin
0 siblings, 1 reply; 3+ messages in thread
From: ankitprasad.r.sharma @ 2016-06-03 8:51 UTC (permalink / raw)
To: intel-gfx; +Cc: akash.goel, Ankitprasad Sharma
From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
This patch verifies if the contents of the stolen backed object were
preserved across hibernation. This is to validate kernel changes related
to moving stolen-backed objects to shmem on hibernation.
v2: Added comment, Use igt_assert_eq() instead of igt_assert(), Made loops
more readable (Tvrtko)
v3: Corrected assertion (Tvrtko)
Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
tests/gem_stolen.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 95 insertions(+)
diff --git a/tests/gem_stolen.c b/tests/gem_stolen.c
index 07fdd39..3a3cf81 100644
--- a/tests/gem_stolen.c
+++ b/tests/gem_stolen.c
@@ -290,6 +290,98 @@ static void stolen_fill_purge_test(int fd)
gem_close(fd, handle[i]);
}
+static void stolen_hibernate(int fd)
+{
+ drm_intel_bo *bo;
+ drm_intel_bo *src, *dest;
+ int obj_count = 0, i = 0;
+ int ret, j;
+ uint32_t handle[MAX_OBJECTS], src_handle;
+ uint32_t *virt;
+
+ gem_require_stolen_support(fd);
+
+ src_handle = gem_create(fd, SIZE);
+ src = gem_handle_to_libdrm_bo(bufmgr, fd,
+ "bo", src_handle);
+ igt_assert(src != NULL);
+
+ ret = drm_intel_gem_bo_map_gtt(src);
+ igt_assert_eq(ret, 0);
+
+ virt = src->virtual;
+ for (j = 0; j < SIZE/DWORD_SIZE; j++) {
+ igt_assert_eq(virt[j], 0);
+ virt[j] = j;
+ }
+
+ drm_intel_bo_unmap(src);
+ /* Exhaust Stolen space */
+ for (i = 0; i < MAX_OBJECTS; i++) {
+ handle[i] = __gem_create_stolen(fd, SIZE);
+ if (!handle[i])
+ break;
+
+ bo = gem_handle_to_libdrm_bo(bufmgr, fd,
+ "verify_bo", handle[i]);
+ igt_assert(bo != NULL);
+ ret = drm_intel_gem_bo_map_gtt(bo);
+ igt_assert_eq(ret, 0);
+
+ virt = bo->virtual;
+ for (j = 0; j < SIZE/DWORD_SIZE; j++)
+ igt_assert_eq(virt[j], 0);
+
+ drm_intel_bo_unmap(bo);
+ drm_intel_bo_unreference(bo);
+
+ obj_count++;
+ }
+
+ /* Assert if atleast one object is allocated from stolen, that
+ * is good enough to verify the content preservation across
+ * hibernation.
+ */
+ igt_assert(obj_count > 0);
+
+ /* Copy data to all stolen backed objects */
+ for (i = 0; i < obj_count; i++) {
+ dest = gem_handle_to_libdrm_bo(bufmgr, fd,
+ "dst_bo", handle[i]);
+ igt_assert(dest != NULL);
+ /* Copy contents to stolen backed objects via blt and
+ * verify post-hibernation, this also helps in identifying
+ * that the operation was completed before going to
+ * hibernation.
+ */
+ intel_copy_bo(batch, dest, src, SIZE);
+ }
+
+ drm_intel_bo_unreference(src);
+
+ igt_system_hibernate_autoresume();
+ /* Check if the object's memory contents are intact
+ * across hibernation.
+ */
+ for (i = 0; i < obj_count; i++) {
+ bo = gem_handle_to_libdrm_bo(bufmgr, fd,
+ "verify_bo", handle[i]);
+ igt_assert(bo != NULL);
+ ret = drm_intel_gem_bo_map_gtt(bo);
+ igt_assert_eq(ret, 0);
+ virt = bo->virtual;
+ for (j = 0; j < SIZE/DWORD_SIZE; j++)
+ igt_assert_eq(virt[j], j);
+
+ drm_intel_bo_unmap(bo);
+ drm_intel_bo_unreference(bo);
+ }
+
+ gem_close(fd, src_handle);
+ for (i = 0; i < obj_count; i++)
+ gem_close(fd, handle[i]);
+}
+
static void
stolen_no_mmap(int fd)
{
@@ -353,6 +445,9 @@ igt_main
igt_subtest("stolen-fill-purge")
stolen_fill_purge_test(fd);
+ igt_subtest("stolen-hibernate")
+ stolen_hibernate(fd);
+
igt_fixture {
intel_batchbuffer_free(batch);
drm_intel_bufmgr_destroy(bufmgr);
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] igt/gem_stolen: Verify contents of stolen-backed objects across hibernation
2016-06-03 8:51 ankitprasad.r.sharma
@ 2016-06-03 10:52 ` Tvrtko Ursulin
0 siblings, 0 replies; 3+ messages in thread
From: Tvrtko Ursulin @ 2016-06-03 10:52 UTC (permalink / raw)
To: ankitprasad.r.sharma, intel-gfx; +Cc: akash.goel
On 03/06/16 09:51, ankitprasad.r.sharma@intel.com wrote:
> From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
>
> This patch verifies if the contents of the stolen backed object were
> preserved across hibernation. This is to validate kernel changes related
> to moving stolen-backed objects to shmem on hibernation.
>
> v2: Added comment, Use igt_assert_eq() instead of igt_assert(), Made loops
> more readable (Tvrtko)
>
> v3: Corrected assertion (Tvrtko)
>
> Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> tests/gem_stolen.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 95 insertions(+)
>
> diff --git a/tests/gem_stolen.c b/tests/gem_stolen.c
> index 07fdd39..3a3cf81 100644
> --- a/tests/gem_stolen.c
> +++ b/tests/gem_stolen.c
> @@ -290,6 +290,98 @@ static void stolen_fill_purge_test(int fd)
> gem_close(fd, handle[i]);
> }
>
> +static void stolen_hibernate(int fd)
> +{
> + drm_intel_bo *bo;
> + drm_intel_bo *src, *dest;
> + int obj_count = 0, i = 0;
> + int ret, j;
> + uint32_t handle[MAX_OBJECTS], src_handle;
> + uint32_t *virt;
> +
> + gem_require_stolen_support(fd);
> +
> + src_handle = gem_create(fd, SIZE);
> + src = gem_handle_to_libdrm_bo(bufmgr, fd,
> + "bo", src_handle);
> + igt_assert(src != NULL);
> +
> + ret = drm_intel_gem_bo_map_gtt(src);
> + igt_assert_eq(ret, 0);
> +
> + virt = src->virtual;
> + for (j = 0; j < SIZE/DWORD_SIZE; j++) {
> + igt_assert_eq(virt[j], 0);
> + virt[j] = j;
> + }
> +
> + drm_intel_bo_unmap(src);
> + /* Exhaust Stolen space */
> + for (i = 0; i < MAX_OBJECTS; i++) {
> + handle[i] = __gem_create_stolen(fd, SIZE);
> + if (!handle[i])
> + break;
> +
> + bo = gem_handle_to_libdrm_bo(bufmgr, fd,
> + "verify_bo", handle[i]);
> + igt_assert(bo != NULL);
> + ret = drm_intel_gem_bo_map_gtt(bo);
> + igt_assert_eq(ret, 0);
> +
> + virt = bo->virtual;
> + for (j = 0; j < SIZE/DWORD_SIZE; j++)
> + igt_assert_eq(virt[j], 0);
> +
> + drm_intel_bo_unmap(bo);
> + drm_intel_bo_unreference(bo);
> +
> + obj_count++;
> + }
> +
> + /* Assert if atleast one object is allocated from stolen, that
> + * is good enough to verify the content preservation across
> + * hibernation.
> + */
> + igt_assert(obj_count > 0);
> +
> + /* Copy data to all stolen backed objects */
> + for (i = 0; i < obj_count; i++) {
> + dest = gem_handle_to_libdrm_bo(bufmgr, fd,
> + "dst_bo", handle[i]);
> + igt_assert(dest != NULL);
> + /* Copy contents to stolen backed objects via blt and
> + * verify post-hibernation, this also helps in identifying
> + * that the operation was completed before going to
> + * hibernation.
> + */
> + intel_copy_bo(batch, dest, src, SIZE);
> + }
> +
> + drm_intel_bo_unreference(src);
> +
> + igt_system_hibernate_autoresume();
> + /* Check if the object's memory contents are intact
> + * across hibernation.
> + */
> + for (i = 0; i < obj_count; i++) {
> + bo = gem_handle_to_libdrm_bo(bufmgr, fd,
> + "verify_bo", handle[i]);
> + igt_assert(bo != NULL);
> + ret = drm_intel_gem_bo_map_gtt(bo);
> + igt_assert_eq(ret, 0);
> + virt = bo->virtual;
> + for (j = 0; j < SIZE/DWORD_SIZE; j++)
> + igt_assert_eq(virt[j], j);
> +
> + drm_intel_bo_unmap(bo);
> + drm_intel_bo_unreference(bo);
> + }
> +
> + gem_close(fd, src_handle);
> + for (i = 0; i < obj_count; i++)
> + gem_close(fd, handle[i]);
> +}
> +
> static void
> stolen_no_mmap(int fd)
> {
> @@ -353,6 +445,9 @@ igt_main
> igt_subtest("stolen-fill-purge")
> stolen_fill_purge_test(fd);
>
> + igt_subtest("stolen-hibernate")
> + stolen_hibernate(fd);
> +
> igt_fixture {
> intel_batchbuffer_free(batch);
> drm_intel_bufmgr_destroy(bufmgr);
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/3] igt/gem_stolen: Verify contents of stolen-backed objects across hibernation
@ 2016-06-06 9:21 ankitprasad.r.sharma
0 siblings, 0 replies; 3+ messages in thread
From: ankitprasad.r.sharma @ 2016-06-06 9:21 UTC (permalink / raw)
To: intel-gfx; +Cc: akash.goel, Ankitprasad Sharma
From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
This patch verifies if the contents of the stolen backed object were
preserved across hibernation. This is to validate kernel changes related
to moving stolen-backed objects to shmem on hibernation.
v2: Added comment, Use igt_assert_eq() instead of igt_assert(), Made loops
more readable (Tvrtko)
v3: Corrected assertion (Tvrtko)
Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
tests/gem_stolen.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 95 insertions(+)
diff --git a/tests/gem_stolen.c b/tests/gem_stolen.c
index 07fdd39..3a3cf81 100644
--- a/tests/gem_stolen.c
+++ b/tests/gem_stolen.c
@@ -290,6 +290,98 @@ static void stolen_fill_purge_test(int fd)
gem_close(fd, handle[i]);
}
+static void stolen_hibernate(int fd)
+{
+ drm_intel_bo *bo;
+ drm_intel_bo *src, *dest;
+ int obj_count = 0, i = 0;
+ int ret, j;
+ uint32_t handle[MAX_OBJECTS], src_handle;
+ uint32_t *virt;
+
+ gem_require_stolen_support(fd);
+
+ src_handle = gem_create(fd, SIZE);
+ src = gem_handle_to_libdrm_bo(bufmgr, fd,
+ "bo", src_handle);
+ igt_assert(src != NULL);
+
+ ret = drm_intel_gem_bo_map_gtt(src);
+ igt_assert_eq(ret, 0);
+
+ virt = src->virtual;
+ for (j = 0; j < SIZE/DWORD_SIZE; j++) {
+ igt_assert_eq(virt[j], 0);
+ virt[j] = j;
+ }
+
+ drm_intel_bo_unmap(src);
+ /* Exhaust Stolen space */
+ for (i = 0; i < MAX_OBJECTS; i++) {
+ handle[i] = __gem_create_stolen(fd, SIZE);
+ if (!handle[i])
+ break;
+
+ bo = gem_handle_to_libdrm_bo(bufmgr, fd,
+ "verify_bo", handle[i]);
+ igt_assert(bo != NULL);
+ ret = drm_intel_gem_bo_map_gtt(bo);
+ igt_assert_eq(ret, 0);
+
+ virt = bo->virtual;
+ for (j = 0; j < SIZE/DWORD_SIZE; j++)
+ igt_assert_eq(virt[j], 0);
+
+ drm_intel_bo_unmap(bo);
+ drm_intel_bo_unreference(bo);
+
+ obj_count++;
+ }
+
+ /* Assert if atleast one object is allocated from stolen, that
+ * is good enough to verify the content preservation across
+ * hibernation.
+ */
+ igt_assert(obj_count > 0);
+
+ /* Copy data to all stolen backed objects */
+ for (i = 0; i < obj_count; i++) {
+ dest = gem_handle_to_libdrm_bo(bufmgr, fd,
+ "dst_bo", handle[i]);
+ igt_assert(dest != NULL);
+ /* Copy contents to stolen backed objects via blt and
+ * verify post-hibernation, this also helps in identifying
+ * that the operation was completed before going to
+ * hibernation.
+ */
+ intel_copy_bo(batch, dest, src, SIZE);
+ }
+
+ drm_intel_bo_unreference(src);
+
+ igt_system_hibernate_autoresume();
+ /* Check if the object's memory contents are intact
+ * across hibernation.
+ */
+ for (i = 0; i < obj_count; i++) {
+ bo = gem_handle_to_libdrm_bo(bufmgr, fd,
+ "verify_bo", handle[i]);
+ igt_assert(bo != NULL);
+ ret = drm_intel_gem_bo_map_gtt(bo);
+ igt_assert_eq(ret, 0);
+ virt = bo->virtual;
+ for (j = 0; j < SIZE/DWORD_SIZE; j++)
+ igt_assert_eq(virt[j], j);
+
+ drm_intel_bo_unmap(bo);
+ drm_intel_bo_unreference(bo);
+ }
+
+ gem_close(fd, src_handle);
+ for (i = 0; i < obj_count; i++)
+ gem_close(fd, handle[i]);
+}
+
static void
stolen_no_mmap(int fd)
{
@@ -353,6 +445,9 @@ igt_main
igt_subtest("stolen-fill-purge")
stolen_fill_purge_test(fd);
+ igt_subtest("stolen-hibernate")
+ stolen_hibernate(fd);
+
igt_fixture {
intel_batchbuffer_free(batch);
drm_intel_bufmgr_destroy(bufmgr);
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-06 9:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-06 9:21 [PATCH 1/3] igt/gem_stolen: Verify contents of stolen-backed objects across hibernation ankitprasad.r.sharma
-- strict thread matches above, loose matches on Subject: below --
2016-06-03 8:51 ankitprasad.r.sharma
2016-06-03 10:52 ` Tvrtko Ursulin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).