tests/pm_rpm tests for set_caching and set_tiling ioctl(s)
PATCH 1/1 tests/pm_rpm tests for set_caching and set_tiling ioctl(s)
From: Marius Vlad <[email protected]>
--- tests/pm_rpm.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+)
tests/pm_rpm.c +90 -0
@@ -1729,6 +1729,90 @@ static void planes_subtest(bool universal, bool dpms) } } +static void pm_test_tiling (void ) +{ +uint32_t handle; +uint8_t *gem_buf; +uint32_t i, tiling_modes[3 ] = { +I915_TILING_NONE , +I915_TILING_X , +I915_TILING_Y , + }; +uint32_t ti, sw, j; +uint32_t obj_size = (8 *1024 *1024 ); + + handle =gem_create (drm_fd, obj_size); + +for (i =0 ; i <ARRAY_SIZE (tiling_modes); i++) { +disable_all_screens_and_wait (&ms_data); + +if (tiling_modes[i] ==0 ) { +gem_set_tiling (drm_fd, handle, tiling_modes[i],0 ); + + gem_buf =gem_mmap__cpu (drm_fd, handle,0 , + obj_size,PROT_WRITE ); + +for (j =0 ; j < obj_size; j++) + gem_buf[j] = j &0xff ; + +igt_assert (munmap (gem_buf, obj_size) ==0 ); + +gem_get_tiling (drm_fd, handle, &ti, &sw); +igt_assert (tiling_modes[i] == ti); + }else { +gem_set_tiling (drm_fd, handle, tiling_modes[i],512 ); + gem_buf =gem_mmap__cpu (drm_fd, handle,0 , + obj_size,PROT_WRITE ); + +for (j =0 ; j < obj_size; j++) + gem_buf[j] = j &0xff ; + +igt_assert (munmap (gem_buf, obj_size) ==0 ); + +gem_get_tiling (drm_fd, handle, &ti, &sw); +igt_assert (tiling_modes[i] == ti); + } + +enable_one_screen_and_wait (&ms_data); + } + +gem_close (drm_fd, handle); +} + +static void pm_test_caching (void ) +{ +uint32_t handle, got_caching, obj_size = (8 *1024 *1024 ); +void *src_buf; +uint32_t i, cache_levels[3 ] = { +I915_CACHING_NONE , +I915_CACHING_CACHED , +I915_CACHING_DISPLAY , + }; + + handle =gem_create (drm_fd, obj_size); + src_buf =malloc (obj_size); + +memset (src_buf,0x65 , obj_size); + +for (i =0 ; i <ARRAY_SIZE (cache_levels); i++) { +disable_all_screens_and_wait (&ms_data); + +gem_set_caching (drm_fd, handle, cache_levels[i]); +gem_write (drm_fd, handle,0 , src_buf, obj_size); + + got_caching =gem_get_caching (drm_fd, handle); + +enable_one_screen_and_wait (&ms_data); + +/* skip CACHING_DISPLAY, some platforms do not have it */ +if (i !=2 ) +igt_assert (got_caching == cache_levels[i]); + } + +free (src_buf); +gem_close (drm_fd, handle); +} +static void fences_subtest (bool dpms) {int i;
@@ -1927,6 +2011,12 @@ int main(int argc, char *argv[]) igt_subtest("gem-execbuf-stress-extra-wait")gem_execbuf_stress_subtest (rounds,WAIT_STATUS |WAIT_EXTRA ); +/* power-wake reference tests */ + igt_subtest("pm-tiling") +pm_test_tiling (); + igt_subtest("pm-caching") +pm_test_caching (); +igt_fixture teardown_environment ();
Signature · 6 lines
2.6.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Hi,
thanks for the patch. Looks ok in general, I have a few comments below.
Quoted 23 lines · On Tue, 2015-11-24 at 19:42 +0200, [email protected] wrote:
From: Marius Vlad <[email protected]>
Signed-off-by Marius Vlad <[email protected]>---
tests/pm_rpm.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++1 file changed, 90 insertions(+)tests/pm_rpm.c +0
-0@@ -1729,6 +1729,90 @@ static void planes_subtest(bool universal, bool dpms) } }tests/pm_rpm.c +8
-0+static void pm_test_tiling (void ) +{ +uint32_t handle; +uint8_t *gem_buf; +uint32_t i, tiling_modes[3 ] = { +I915_TILING_NONE , +I915_TILING_X , +I915_TILING_Y ,
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1749
Quoted 10 lines
tests/pm_rpm.c +10
-0+ }; +uint32_t ti, sw, j; +uint32_t obj_size = (8 *1024 *1024 ); + + handle =gem_create (drm_fd, obj_size); + +for (i =0 ; i <ARRAY_SIZE (tiling_modes); i++) { +disable_all_screens_and_wait (&ms_data); + +if (tiling_modes[i] ==0 ) {
Better not to hardcode.
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1750
Quoted 1 line
tests/pm_rpm.c +1
-0+gem_set_tiling (drm_fd, handle, tiling_modes[i],0 );
You can just pass the same stride always, flattening the if-else.
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1753
Quoted 3 lines
tests/pm_rpm.c +3
-0+ + gem_buf =gem_mmap__cpu (drm_fd, handle,0 , + obj_size,PROT_WRITE );
Mapping to the CPU doesn't make a difference in this test case. On old HW we could make sure that there will be an unbind during the IOCTL, for that you need an alignment that isn't valid for the tiling mode. The easiest would be to map a few smaller sized objects to GGTT and do a memset on each, not sure if there is a more precise way. Also this should be done before calling gem_set_tiling()
and disable_all_screens_and_wait().
Quoted 38 lines
tests/pm_rpm.c +38
-0+ +for (j =0 ; j < obj_size; j++) + gem_buf[j] = j &0xff ; + +igt_assert (munmap (gem_buf, obj_size) ==0 ); + +gem_get_tiling (drm_fd, handle, &ti, &sw); +igt_assert (tiling_modes[i] == ti); + }else { +gem_set_tiling (drm_fd, handle, tiling_modes[i],512 ); + gem_buf =gem_mmap__cpu (drm_fd, handle,0 , + obj_size,PROT_WRITE ); + +for (j =0 ; j < obj_size; j++) + gem_buf[j] = j &0xff ; + +igt_assert (munmap (gem_buf, obj_size) ==0 ); + +gem_get_tiling (drm_fd, handle, &ti, &sw); +igt_assert (tiling_modes[i] == ti); + } + +enable_one_screen_and_wait (&ms_data); + } + +gem_close (drm_fd, handle); +} + +static void pm_test_caching (void ) +{ +uint32_t handle, got_caching, obj_size = (8 *1024 *1024 ); +void *src_buf; +uint32_t i, cache_levels[3 ] = { +I915_CACHING_NONE , +I915_CACHING_CACHED , +I915_CACHING_DISPLAY , + }; +
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1801
Quoted 10 lines
tests/pm_rpm.c +10
-0+ handle =gem_create (drm_fd, obj_size); + src_buf =malloc (obj_size); + +memset (src_buf,0x65 , obj_size); + +for (i =0 ; i <ARRAY_SIZE (cache_levels); i++) { +disable_all_screens_and_wait (&ms_data); + +gem_set_caching (drm_fd, handle, cache_levels[i]); +gem_write (drm_fd, handle,0 , src_buf, obj_size);
Similarly as above we need to force an unbind here, by mapping to GGTT and doing a memset on it before calling disable_all_screens_and_wait(). We don't need a specific object alignment here.
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1808
Quoted 7 lines
tests/pm_rpm.c +7
-0+ + got_caching =gem_get_caching (drm_fd, handle); + +enable_one_screen_and_wait (&ms_data); + +/* skip CACHING_DISPLAY, some platforms do not have it */ +if (i !=2 )
Better not to hardcode.
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1809
Quoted 1 line
tests/pm_rpm.c +1
-0+igt_assert (got_caching == cache_levels[i]);
You could make it more precise by requiring either CACHING_DISPLAY or CACHING_NONE in this case.
--Imre
Quoted 19 lines
tests/pm_rpm.c +6
-0+ } + +free (src_buf); +gem_close (drm_fd, handle); +} +static void
fences_subtest(bool dpms)
{
int i;tests/pm_rpm.c +0
-0@@ -1927,6 +2011,12 @@ int main(int argc, char *argv[]) igt_subtest("gem-execbuf-stress-extra-wait") gem_execbuf_stress_subtest(rounds, WAIT_STATUS | WAIT_EXTRA);tests/pm_rpm.c +6
-0+/* power-wake reference tests */ + igt_subtest("pm-tiling") +pm_test_tiling (); + igt_subtest("pm-caching") +pm_test_caching (); +
Quoted 3 lines
igt_fixture
teardown_environment();
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 tests/pm_rpm tests for set_caching and set_tiling ioctl(s)
Second attempt using Imres' hints.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 tests/pm_rpm tests for set_caching and set_tiling ioctl(s)
From: Marius Vlad <[email protected]>
--- tests/pm_rpm.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+)
tests/pm_rpm.c +120 -0
@@ -1729,6 +1729,120 @@ static void planes_subtest(bool universal, bool dpms) } } +static void pm_test_tiling (void ) +{ +uint32_t *handles; +uint8_t **gem_bufs; + +int max_gem_objs =0 ; +uint8_t off_bit =20 ; +uint32_t gtt_obj_max_size = (16 *1024 *1024 ); + +uint32_t i, j, tiling_modes[3 ] = { +I915_TILING_NONE , +I915_TILING_X , +I915_TILING_Y , + }; +uint32_t ti, sw; + +/* default value */ +uint32_t stride =1024 ; + +/* calculate how many objects we can map */ +for (j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , max_gem_objs++) + ; + + gem_bufs =calloc (max_gem_objs,sizeof (uint8_t *)); + handles =malloc (sizeof (uint32_t ) * max_gem_objs); + +/* map to gtt and store some random data */ +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { + handles[i] =gem_create (drm_fd, j); + gem_bufs[i] =gem_mmap__gtt (drm_fd, handles[i], j,PROT_WRITE ); +memset (gem_bufs[i],0x65 , j); + } + +/* try to set different tiling for each handle */ +for (i =0 ; i <ARRAY_SIZE (tiling_modes); i++) { +disable_all_screens_and_wait (&ms_data); + +for (j =0 ; j < max_gem_objs; j++) { +gem_set_tiling (drm_fd, handles[j], tiling_modes[i], stride); + +gem_get_tiling (drm_fd, handles[j], &ti, &sw); +igt_assert (tiling_modes[i] == ti); + } + +enable_one_screen_and_wait (&ms_data); + } + +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { +igt_assert (munmap (gem_bufs[i], j) ==0 ); +gem_close (drm_fd, handles[i]); + } + +free (gem_bufs); +free (handles); +} + +static void pm_test_caching (void ) +{ +uint32_t *handles; +uint8_t **gem_bufs; +int8_t has_caching_display =-1 ; + +uint32_t i, j, got_caching; +uint32_t gtt_obj_max_size = (16 *1024 *1024 ); +uint32_t cache_levels[3 ] = { +I915_CACHING_NONE , +I915_CACHING_CACHED ,/* LLC caching */ +I915_CACHING_DISPLAY ,/* eDRAM caching */ + }; + +int max_gem_objs =0 ; +uint8_t off_bit =20 ; + +for (j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , max_gem_objs++) + ; + + gem_bufs =calloc (max_gem_objs,sizeof (uint8_t *)); + handles =malloc (sizeof (uint32_t ) * max_gem_objs); + +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { + handles[i] =gem_create (drm_fd, j); + gem_bufs[i] =gem_mmap__gtt (drm_fd, handles[i], j,PROT_WRITE ); +memset (gem_bufs[i],0x65 , j); + } + +/* figure out if we have cache display available on the platform */ +gem_set_caching (drm_fd, handles[0 ],I915_CACHING_DISPLAY ); +if (gem_get_caching (drm_fd, handles[0 ])) + has_caching_display++; + +for (i =0 ; i <ARRAY_SIZE (cache_levels) + has_caching_display; i++) { +disable_all_screens_and_wait (&ms_data); + +for (j =0 ; j < max_gem_objs; j++) { +gem_set_caching (drm_fd, handles[j], cache_levels[i]); + +igt_debug ("Verying cache for handle %u, level %u\n" , j, i); + got_caching =gem_get_caching (drm_fd, handles[j]); + +igt_assert (got_caching == cache_levels[i]); + } + +enable_one_screen_and_wait (&ms_data); + } + +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { +igt_assert (munmap (gem_bufs[i], j) ==0 ); +gem_close (drm_fd, handles[i]); + } + +free (handles); +free (gem_bufs); +} +static void fences_subtest (bool dpms) {int i;
@@ -1927,6 +2041,12 @@ int main(int argc, char *argv[]) igt_subtest("gem-execbuf-stress-extra-wait")gem_execbuf_stress_subtest (rounds,WAIT_STATUS |WAIT_EXTRA ); +/* power-wake reference tests */ + igt_subtest("pm-tiling") +pm_test_tiling (); + igt_subtest("pm-caching") +pm_test_caching (); +igt_fixture teardown_environment ();
Signature · 6 lines
2.6.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 27 lines · On ke, 2015-11-25 at 19:16 +0200, [email protected] wrote:
From: Marius Vlad <[email protected]>
Signed-off-by Marius Vlad <[email protected]>---
tests/pm_rpm.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++1 file changed, 120 insertions(+)tests/pm_rpm.c +0
-0@@ -1729,6 +1729,120 @@ static void planes_subtest(bool universal, bool dpms) } }tests/pm_rpm.c +12
-0+static void pm_test_tiling (void ) +{ +uint32_t *handles; +uint8_t **gem_bufs; + +int max_gem_objs =0 ; +uint8_t off_bit =20 ; +uint32_t gtt_obj_max_size = (16 *1024 *1024 ); + +uint32_t i, j, tiling_modes[3 ] = { +I915_TILING_NONE , +I915_TILING_X ,
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1753
Quoted 10 lines
tests/pm_rpm.c +10
-0+ I915_TILING_Y, + }; +uint32_t ti, sw; + +/* default value */ +uint32_t stride =1024 ; + +/* calculate how many objects we can map */ +for (j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , max_gem_objs++) + ;
With these sizes we may end up with all objects properly aligned, that's why I suggested smaller objects. Based on I830_FENCE_START_MASK we could allocate for example starting from 16kB to 256kB.
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1756
Quoted 3 lines
tests/pm_rpm.c +3
-0+ + gem_bufs =calloc (max_gem_objs,sizeof (uint8_t *)); + handles =malloc (sizeof (uint32_t ) * max_gem_objs);
Nitpick: sizeof(*ptr) is safer and you could've used calloc in both cases.
Quoted 10 lines
tests/pm_rpm.c +10
-0+ +/* map to gtt and store some random data */ +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { + handles[i] =gem_create (drm_fd, j); + gem_bufs[i] =gem_mmap__gtt (drm_fd, handles[i], j,PROT_WRITE ); +memset (gem_bufs[i],0x65 , j); + } + +/* try to set different tiling for each handle */ +for (i =0 ; i <ARRAY_SIZE (tiling_modes); i++) {
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1776
Quoted 10 lines
tests/pm_rpm.c +10
-0+disable_all_screens_and_wait (&ms_data); + +for (j =0 ; j < max_gem_objs; j++) { +gem_set_tiling (drm_fd, handles[j], tiling_modes[i], stride); + +gem_get_tiling (drm_fd, handles[j], &ti, &sw); +igt_assert (tiling_modes[i] == ti); + } + +enable_one_screen_and_wait (&ms_data);
Ok, but after the second iteration all objects could be properly aligned, so it's better to close/realloc/memset the objects in each iteration.
Quoted 20 lines
tests/pm_rpm.c +20
-0+ } + +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { +igt_assert (munmap (gem_bufs[i], j) ==0 ); +gem_close (drm_fd, handles[i]); + } + +free (gem_bufs); +free (handles); +} + +static void pm_test_caching (void ) +{ +uint32_t *handles; +uint8_t **gem_bufs; +int8_t has_caching_display =-1 ; + +uint32_t i, j, got_caching; +uint32_t gtt_obj_max_size = (16 *1024 *1024 ); +uint32_t cache_levels[3 ] = {
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1806
Quoted 10 lines
tests/pm_rpm.c +10
-0+I915_CACHING_NONE , +I915_CACHING_CACHED ,/* LLC caching */ + I915_CACHING_DISPLAY, /* eDRAM caching */ + }; + +int max_gem_objs =0 ; +uint8_t off_bit =20 ; + +for (j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , max_gem_objs++) + ;
No need to bother about alignment here, so we can just use a single 16kB object for example.
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1819
Quoted 13 lines
tests/pm_rpm.c +13
-0+ + gem_bufs =calloc (max_gem_objs,sizeof (uint8_t *)); + handles =malloc (sizeof (uint32_t ) * max_gem_objs); + +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { + handles[i] =gem_create (drm_fd, j); + gem_bufs[i] =gem_mmap__gtt (drm_fd, handles[i], j,PROT_WRITE ); +memset (gem_bufs[i],0x65 , j); + } + +/* figure out if we have cache display available on the platform */ +gem_set_caching (drm_fd, handles[0 ],I915_CACHING_DISPLAY ); +if (gem_get_caching (drm_fd, handles[0 ]))
No need to hardcode I915_CACHING_NONE here. Also I liked the original version to check this everywhere better, by accepting both CACHING_DISPLAY and CACHING_NONE as a result.
Quoted 5 lines
tests/pm_rpm.c +5
-0+ has_caching_display++; + +for (i =0 ; i <ARRAY_SIZE (cache_levels) + has_caching_display; i++) { +disable_all_screens_and_wait (&ms_data); +
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1834
Quoted 10 lines
tests/pm_rpm.c +10
-0+for (j =0 ; j < max_gem_objs; j++) { +gem_set_caching (drm_fd, handles[j], cache_levels[i]); + +igt_debug ("Verying cache for handle %u, level %u\n" , j, i); + got_caching =gem_get_caching (drm_fd, handles[j]); + +igt_assert (got_caching == cache_levels[i]); + } + +enable_one_screen_and_wait (&ms_data);
The object can be unbound after the IOCTL so you need to do a memset at the begin of each iteration.
Quoted 24 lines
tests/pm_rpm.c +11
-0+ } + +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { +igt_assert (munmap (gem_bufs[i], j) ==0 ); +gem_close (drm_fd, handles[i]); + } + +free (handles); +free (gem_bufs); +} +static void
fences_subtest(bool dpms)
{
int i;tests/pm_rpm.c +0
-0@@ -1927,6 +2041,12 @@ int main(int argc, char *argv[]) igt_subtest("gem-execbuf-stress-extra-wait") gem_execbuf_stress_subtest(rounds, WAIT_STATUS | WAIT_EXTRA);tests/pm_rpm.c +6
-0+/* power-wake reference tests */ + igt_subtest("pm-tiling") +pm_test_tiling (); + igt_subtest("pm-caching") +pm_test_caching (); +
Quoted 3 lines
igt_fixture
teardown_environment();
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 34 lines · Imre Deak
Quoted 33 lines · On ke, 2015-11-25 at 19:16 +0200, [email protected] wrote:
From: Marius Vlad <[email protected]>
Signed-off-by Marius Vlad <[email protected]>---
tests/pm_rpm.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++1 file changed, 120 insertions(+)tests/pm_rpm.c +0
-0@@ -1729,6 +1729,120 @@ static void planes_subtest(bool universal, bool dpms) } }tests/pm_rpm.c +18
-0+static void pm_test_tiling (void ) +{ +uint32_t *handles; +uint8_t **gem_bufs; + +int max_gem_objs =0 ; +uint8_t off_bit =20 ; +uint32_t gtt_obj_max_size = (16 *1024 *1024 ); + +uint32_t i, j, tiling_modes[3 ] = { +I915_TILING_NONE , +I915_TILING_X , +I915_TILING_Y , + }; +uint32_t ti, sw; + +/* default value */ +uint32_t stride =1024 ;
Quoted 9 lines
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1753
Quoted 4 lines
tests/pm_rpm.c +4
-0+ +/* calculate how many objects we can map */ +for (j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , max_gem_objs++) + ;With these sizes we may end up with all objects properly aligned, that's why I suggested smaller objects. Based on
I830_FENCE_START_MASKwe could allocate for example starting from 16kB to 256kB.
Initially, I've tried with smaller sizes, but the assertion(s) failed. I'll try as you suggested.
Quoted 6 lines
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1756
Quoted 3 lines
tests/pm_rpm.c +3
-0+ + gem_bufs =calloc (max_gem_objs,sizeof (uint8_t *)); + handles =malloc (sizeof (uint32_t ) * max_gem_objs);Nitpick:
sizeof(*ptr)is safer and you could've used calloc in both cases.
Indeed.
Quoted 17 lines
Quoted 17 lines
tests/pm_rpm.c +16
-0+ +/* map to gtt and store some random data */ +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { + handles[i] =gem_create (drm_fd, j); + gem_bufs[i] =gem_mmap__gtt (drm_fd, handles[i], j,PROT_WRITE ); +memset (gem_bufs[i],0x65 , j); + } + +/* try to set different tiling for each handle */ +for (i =0 ; i <ARRAY_SIZE (tiling_modes); i++) { +disable_all_screens_and_wait (&ms_data); + +for (j =0 ; j < max_gem_objs; j++) { +gem_set_tiling (drm_fd, handles[j], tiling_modes[i], stride); + +gem_get_tiling (drm_fd, handles[j], &ti, &sw);
Quoted 8 lines
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1776
Quoted 4 lines
tests/pm_rpm.c +4
-0+igt_assert (tiling_modes[i] == ti); + } + +enable_one_screen_and_wait (&ms_data);Ok, but after the second iteration all objects could be properly aligned, so it's better to close/realloc/memset the objects in each iteration.
Alright. I'll do that.
Quoted 26 lines
Quoted 26 lines
tests/pm_rpm.c +25
-0+ } + +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { +igt_assert (munmap (gem_bufs[i], j) ==0 ); +gem_close (drm_fd, handles[i]); + } + +free (gem_bufs); +free (handles); +} + +static void pm_test_caching (void ) +{ +uint32_t *handles; +uint8_t **gem_bufs; +int8_t has_caching_display =-1 ; + +uint32_t i, j, got_caching; +uint32_t gtt_obj_max_size = (16 *1024 *1024 ); +uint32_t cache_levels[3 ] = { +I915_CACHING_NONE , +I915_CACHING_CACHED ,/* LLC caching */ +I915_CACHING_DISPLAY ,/* eDRAM caching */ + }; +
Quoted 8 lines
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1753
Quoted 5 lines
tests/pm_rpm.c +5
-0+int max_gem_objs =0 ; +uint8_t off_bit =20 ; + +for (j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , max_gem_objs++) + ;No need to bother about alignment here, so we can just use a single 16kB object for example.
Alright.
Quoted 10 lines
Quoted 10 lines
tests/pm_rpm.c +9
-0+ + gem_bufs =calloc (max_gem_objs,sizeof (uint8_t *)); + handles =malloc (sizeof (uint32_t ) * max_gem_objs); + +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { + handles[i] =gem_create (drm_fd, j); + gem_bufs[i] =gem_mmap__gtt (drm_fd, handles[i], j,PROT_WRITE ); +memset (gem_bufs[i],0x65 , j); + }
Quoted 8 lines
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1819
Quoted 4 lines
tests/pm_rpm.c +4
-0+ +/* figure out if we have cache display available on the platform */ +gem_set_caching (drm_fd, handles[0 ],I915_CACHING_DISPLAY ); +if (gem_get_caching (drm_fd, handles[0 ]))No need to hardcode
I915_CACHING_NONEhere. Also I liked the original version to check this everywhere better, by accepting bothCACHING_DISPLAYandCACHING_NONEas a result.
I don't think I get it.
As far as I understand CACHING_DISPLAY will fall-back to CACHING_NONE if the platform doesn't have support for it. Is there a proper way to check for this?
igt_require()/igt_skip_on()/igt_require_f() can indeed be used to bypass certain test(s), but there has to be a way to determine apriori if (indeed) the platform supports CACHING_DISPLAY, before asserting the status.
Most likely this kind of issue has come up in other circumstances...
Quoted 11 lines
Quoted 11 lines
tests/pm_rpm.c +10
-0+ has_caching_display++; + +for (i =0 ; i <ARRAY_SIZE (cache_levels) + has_caching_display; i++) { +disable_all_screens_and_wait (&ms_data); + +for (j =0 ; j < max_gem_objs; j++) { +gem_set_caching (drm_fd, handles[j], cache_levels[i]); + +igt_debug ("Verying cache for handle %u, level %u\n" , j, i); + got_caching =gem_get_caching (drm_fd, handles[j]);
Quoted 8 lines
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1834
Quoted 5 lines
tests/pm_rpm.c +5
-0+ +igt_assert (got_caching == cache_levels[i]); + } + +enable_one_screen_and_wait (&ms_data);The object can be unbound after the IOCTL so you need to do a memset at the begin of each iteration.
Okay. Will redo and send another try. Thanks for taking to time to review!.
Quoted 20 lines
Quoted 20 lines
tests/pm_rpm.c +11
-0+ } + +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { +igt_assert (munmap (gem_bufs[i], j) ==0 ); +gem_close (drm_fd, handles[i]); + } + +free (handles); +free (gem_bufs); +} +static void
fences_subtest(bool dpms)
{
int i;tests/pm_rpm.c +0
-0@@ -1927,6 +2041,12 @@ int main(int argc, char *argv[]) igt_subtest("gem-execbuf-stress-extra-wait") gem_execbuf_stress_subtest(rounds, WAIT_STATUS | WAIT_EXTRA);tests/pm_rpm.c +1
-0+/* power-wake reference tests */
Quoted 8 lines
Quoted 8 lines
tests/pm_rpm.c +5
-0+ igt_subtest("pm-tiling") +pm_test_tiling (); + igt_subtest("pm-caching") +pm_test_caching (); +
igt_fixture
teardown_environment();
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 48 lines · Marius Vlad
Quoted 37 lines · Imre Deak
Quoted 36 lines · On ke, 2015-11-25 at 19:16 +0200, [email protected] wrote:
From: Marius Vlad <[email protected]>
Signed-off-by Marius Vlad <[email protected]>---
tests/pm_rpm.c | 120
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++1 file changed, 120 insertions(+)tests/pm_rpm.c +0
-0@@ -1729,6 +1729,120 @@ static void planes_subtest(bool universal, bool dpms) } }tests/pm_rpm.c +19
-0+static void pm_test_tiling (void ) +{ +uint32_t *handles; +uint8_t **gem_bufs; + +int max_gem_objs =0 ; +uint8_t off_bit =20 ; +uint32_t gtt_obj_max_size = (16 *1024 *1024 ); + +uint32_t i, j, tiling_modes[3 ] = { +I915_TILING_NONE , +I915_TILING_X , +I915_TILING_Y , + }; +uint32_t ti, sw; + +/* default value */ +uint32_t stride =1024 ; +Quoted 9 lines
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1753
Quoted 3 lines
tests/pm_rpm.c +3
-0+/* calculate how many objects we can map */ +for (j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , max_gem_objs++) + ;With these sizes we may end up with all objects properly aligned, that's why I suggested smaller objects. Based on
I830_FENCE_START_MASK
we could allocate for example starting from 16kB to 256kB.
Quoted 3 lines
Initially, I've tried with smaller sizes, but the assertion(s) failed.
I'll try as you suggested.
Hm, there shouldn't be any asserts. The only practical restriction is on the stride size which on new platforms should be a multiple of 128 or 512 bytes based on the tiling mode and power-of-two on GEN < 4.
Quoted 104 lines
Quoted 6 lines
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1756
Quoted 3 lines
tests/pm_rpm.c +3
-0+ + gem_bufs =calloc (max_gem_objs,sizeof (uint8_t *)); + handles =malloc (sizeof (uint32_t ) * max_gem_objs);Nitpick:
sizeof(*ptr)is safer and you could've used calloc in both cases.Indeed.
Quoted 17 lines
Quoted 17 lines
tests/pm_rpm.c +16
-0+ +/* map to gtt and store some random data */ +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { + handles[i] =gem_create (drm_fd, j); + gem_bufs[i] =gem_mmap__gtt (drm_fd, handles[i], j,PROT_WRITE ); +memset (gem_bufs[i],0x65 , j); + } + +/* try to set different tiling for each handle */ +for (i =0 ; i <ARRAY_SIZE (tiling_modes); i++) { +disable_all_screens_and_wait (&ms_data); + +for (j =0 ; j < max_gem_objs; j++) { +gem_set_tiling (drm_fd, handles[j], tiling_modes[i], stride); + +gem_get_tiling (drm_fd, handles[j], &ti, &sw);Quoted 8 lines
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1776
Quoted 4 lines
tests/pm_rpm.c +4
-0+igt_assert (tiling_modes[i] == ti); + } + +enable_one_screen_and_wait (&ms_data);Ok, but after the second iteration all objects could be properly aligned, so it's better to close/realloc/memset the objects in each iteration.
Alright. I'll do that.
Quoted 30 lines
Quoted 30 lines
tests/pm_rpm.c +3
-0+ } + + for (i = 0, j = 1 << off_bit; j <= gtt_obj_max_size; j<<= 1, i++) {
tests/pm_rpm.c +19
-0+igt_assert (munmap (gem_bufs[i], j) ==0 ); +gem_close (drm_fd, handles[i]); + } + +free (gem_bufs); +free (handles); +} + +static void pm_test_caching (void ) +{ +uint32_t *handles; +uint8_t **gem_bufs; +int8_t has_caching_display =-1 ; + +uint32_t i, j, got_caching; +uint32_t gtt_obj_max_size = (16 *1024 *1024 ); +uint32_t cache_levels[3 ] = { +I915_CACHING_NONE , +I915_CACHING_CACHED ,/* LLC caching */
tests/pm_rpm.c +1
-0+ I915_CACHING_DISPLAY, /* eDRAMcaching */
tests/pm_rpm.c +3
-0+ }; + +int max_gem_objs =0 ;Quoted 8 lines
tests/pm_rpm.c
Quoted 5 lines
tests/pm_rpm.c +3
-0+uint8_t off_bit =20 ; + + for (j = 1 << off_bit; j <= gtt_obj_max_size; j <<= 1,max_gem_objs++)
tests/pm_rpm.c +1
-0+ ;No need to bother about alignment here, so we can just use a single 16kB object for example.
Alright.
Quoted 15 lines
Quoted 15 lines
tests/pm_rpm.c +5
-0+ + gem_bufs =calloc (max_gem_objs,sizeof (uint8_t *)); + handles =malloc (sizeof (uint32_t ) * max_gem_objs); + + for (i = 0, j = 1 << off_bit; j <= gtt_obj_max_size; j<<= 1, i++) {
tests/pm_rpm.c +2
-0+ handles[i] =gem_create (drm_fd, j); + gem_bufs[i] = gem_mmap__gtt(drm_fd, handles[i],j,
PROT_WRITE);tests/pm_rpm.c +4
-0+memset (gem_bufs[i],0x65 , j); + } + +/* figure out if we have cache display available on the platform */
Quoted 8 lines
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1819
Quoted 3 lines
tests/pm_rpm.c +1
-0+ gem_set_caching(drm_fd, handles[0],
I915_CACHING_DISPLAY);tests/pm_rpm.c +1
-0+if (gem_get_caching (drm_fd, handles[0 ]))No need to hardcode
I915_CACHING_NONEhere. Also I liked the original
version to check this everywhere better, by accepting bothCACHING_DISPLAYandCACHING_NONEas a result.I don't think I get it.
Quoted 10 lines
As far as I understand
CACHING_DISPLAYwill fall-back toCACHING_NONEif
the platform doesn't have support for it. Is there a proper way to check
for this?
igt_require()/igt_skip_on()/igt_require_f() can indeed be used to bypass
certain test(s), but there has to be a way to determine apriori if (indeed)
the platform supportsCACHING_DISPLAY, before asserting the status.
We don't need to skip the test, it's valid on any platform to call the IOCTL with CACHING_DISPLAY, it may just fall back to CACHING_NONE as you said. So instead of skipping the test just call the IOCTL everywhere but allow for both CACHING_DISPLAY and CACHING_NONE as the result of gem_get_caching().
--Imre
Quoted 48 lines
Most likely this kind of issue has come up in other circumstances...
Quoted 12 lines
Quoted 12 lines
tests/pm_rpm.c +11
-0+ has_caching_display++; + +for (i =0 ; i <ARRAY_SIZE (cache_levels) + has_caching_display; i++) { +disable_all_screens_and_wait (&ms_data); + +for (j =0 ; j < max_gem_objs; j++) { +gem_set_caching (drm_fd, handles[j], cache_levels[i]); + +igt_debug ("Verying cache for handle %u, level %u\n" , j, i); + got_caching =gem_get_caching (drm_fd, handles[j]); +Quoted 8 lines
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1834
Quoted 4 lines
tests/pm_rpm.c +4
-0+igt_assert (got_caching == cache_levels[i]); + } + +enable_one_screen_and_wait (&ms_data);The object can be unbound after the IOCTL so you need to do a memset at
the begin of each iteration.Okay. Will redo and send another try. Thanks for taking to time to review!.
Quoted 22 lines
Quoted 22 lines
tests/pm_rpm.c +3
-0+ } + + for (i = 0, j = 1 << off_bit; j <= gtt_obj_max_size; j<<= 1, i++) {
tests/pm_rpm.c +8
-0+igt_assert (munmap (gem_bufs[i], j) ==0 ); +gem_close (drm_fd, handles[i]); + } + +free (handles); +free (gem_bufs); +} +static void
fences_subtest(bool dpms)
{
int i;tests/pm_rpm.c +0
-0@@ -1927,6 +2041,12 @@ int main(int argc, char *argv[]) igt_subtest("gem-execbuf-stress-extra-wait")
gem_execbuf_stress_subtest(rounds, WAIT_STATUS | WAIT_EXTRA);tests/pm_rpm.c +1
-0+/* power-wake reference tests */
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
tests/pm_rpm.c +5
-0+ igt_subtest("pm-tiling") +pm_test_tiling (); + igt_subtest("pm-caching") +pm_test_caching (); +
igt_fixture
teardown_environment();
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 tests/pm_rpm tests for set_caching and set_tiling ioctl(s)
In reply to [email protected]--- tests/pm_rpm.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+)
tests/pm_rpm.c +120 -0
@@ -1729,6 +1729,120 @@ static void planes_subtest(bool universal, bool dpms) } } +static void pm_test_tiling (void ) +{ +uint32_t *handles; +uint8_t **gem_bufs; + +int max_gem_objs =0 ; +uint8_t off_bit =14 ; +uint32_t gtt_obj_max_size = (256 *1024 ); + +uint32_t i, j, p, tiling_modes[3 ] = { +I915_TILING_NONE , +I915_TILING_X , +I915_TILING_Y , + }; +uint32_t ti, sw; + +/* default stride value */ +uint32_t stride =512 ; + +/* calculate how many objects we can map */ +for (j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , max_gem_objs++) + ; + + gem_bufs =calloc (max_gem_objs,sizeof (*gem_bufs)); + handles =calloc (max_gem_objs,sizeof (*handles)); + +/* map to gtt */ +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { + handles[i] =gem_create (drm_fd, j); + gem_bufs[i] =gem_mmap__gtt (drm_fd, handles[i], j,PROT_WRITE ); + } + +/* try to set different tiling for each handle */ +for (i =0 ; i <ARRAY_SIZE (tiling_modes); i++) { +disable_all_screens_and_wait (&ms_data); + +for (j =0 , p =1 << off_bit; j < max_gem_objs; j++, p <<=1 ) { + +/* modify the contents each time */ +memset (gem_bufs[j],16 << j, p); + +igt_debug ("Testing tiling mode %u, gem %u, " +"size=%ukB (d=0x%x)\n" , i, j, + (p / (1 <<10 )), (16 << j)); + +gem_set_tiling (drm_fd, handles[j], + tiling_modes[i], stride); + +gem_get_tiling (drm_fd, handles[j], &ti, &sw); +igt_assert (tiling_modes[i] == ti); + + } + +enable_one_screen_and_wait (&ms_data); + } + +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { +igt_assert (munmap (gem_bufs[i], j) ==0 ); +gem_close (drm_fd, handles[i]); + } + +free (gem_bufs); +free (handles); +} + +static void pm_test_caching (void ) +{ +uint32_t handle; +uint8_t *gem_buf; + +uint32_t i, got_caching; +uint32_t gtt_obj_max_size = (16 *1024 ); +uint32_t cache_levels[3 ] = { +I915_CACHING_NONE , +I915_CACHING_CACHED ,/* LLC caching */ +I915_CACHING_DISPLAY ,/* eDRAM caching */ + }; + + + handle =gem_create (drm_fd, gtt_obj_max_size); + gem_buf =gem_mmap__gtt (drm_fd, handle, gtt_obj_max_size,PROT_WRITE ); + +for (i =0 ; i <ARRAY_SIZE (cache_levels); i++) { +memset (gem_buf,16 << i, gtt_obj_max_size); + +disable_all_screens_and_wait (&ms_data); + +igt_debug ("Setting cache level %u\n" , cache_levels[i]); + +gem_set_caching (drm_fd, handle, cache_levels[i]); + + got_caching =gem_get_caching (drm_fd, handle); + +igt_debug ("Got back %u\n" , got_caching); + +/* +* Allow fall-back to CACHING_NONE in case the platform does +* not support it. +*/ +if (cache_levels[i] ==I915_CACHING_DISPLAY ) +igt_assert (got_caching ==I915_CACHING_NONE || + got_caching ==I915_CACHING_DISPLAY ); +else +igt_assert (got_caching == cache_levels[i]); + +enable_one_screen_and_wait (&ms_data); + } + +igt_assert (munmap (gem_buf, gtt_obj_max_size) ==0 ); +gem_close (drm_fd, handle); +} + + +static void fences_subtest (bool dpms) {int i;
@@ -1927,6 +2041,12 @@ int main(int argc, char *argv[]) igt_subtest("gem-execbuf-stress-extra-wait")gem_execbuf_stress_subtest (rounds,WAIT_STATUS |WAIT_EXTRA ); +/* power-wake reference tests */ + igt_subtest("pm-tiling") +pm_test_tiling (); + igt_subtest("pm-caching") +pm_test_caching (); +igt_fixture teardown_environment ();
Signature · 6 lines
2.6.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 37 lines · Marius Vlad
Signed-off-by Marius Vlad <[email protected]>---
tests/pm_rpm.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++1 file changed, 120 insertions(+)tests/pm_rpm.c +0
-0@@ -1729,6 +1729,120 @@ static void planes_subtest(bool universal, bool dpms) } }tests/pm_rpm.c +24
-0+static void pm_test_tiling (void ) +{ +uint32_t *handles; +uint8_t **gem_bufs; + +int max_gem_objs =0 ; +uint8_t off_bit =14 ; +uint32_t gtt_obj_max_size = (256 *1024 ); + +uint32_t i, j, p, tiling_modes[3 ] = { +I915_TILING_NONE , +I915_TILING_X , +I915_TILING_Y , + }; +uint32_t ti, sw; + +/* default stride value */ +uint32_t stride =512 ; + +/* calculate how many objects we can map */ +for (j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , max_gem_objs++) + ; + + gem_bufs =calloc (max_gem_objs,sizeof (*gem_bufs));
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1765
Quoted 10 lines
tests/pm_rpm.c +10
-0+ handles =calloc (max_gem_objs,sizeof (*handles)); + +/* map to gtt */ +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { + handles[i] =gem_create (drm_fd, j); + gem_bufs[i] =gem_mmap__gtt (drm_fd, handles[i], j,PROT_WRITE ); + } + +/* try to set different tiling for each handle */ +for (i =0 ; i <ARRAY_SIZE (tiling_modes); i++) {
This still has the problem that we don't rebind the objects in each iteration before disable_all_screens_and_wait(). So please move the above "map to gtt" loop allocating and mmaping the objects and the memset(gem_bufs[]) below here, and ..
Quoted 10 lines
tests/pm_rpm.c +10
-0+disable_all_screens_and_wait (&ms_data); + +for (j =0 , p =1 << off_bit; j < max_gem_objs; j++, p <<=1 ) { + +/* modify the contents each time */ +memset (gem_bufs[j],16 << j, p); + +igt_debug ("Testing tiling mode %u, gem %u, " + "size=%ukB (d=0x%x)\n", i, j, + (p / (1 << 10)), (16 << j));
tests/pm_rpm.c static void planes_subtest(bool universal, bool dpms) · line 1785
Quoted 10 lines
tests/pm_rpm.c +10
-0+ +gem_set_tiling (drm_fd, handles[j], + tiling_modes[i], stride); + +gem_get_tiling (drm_fd, handles[j], &ti, &sw); +igt_assert (tiling_modes[i] == ti); + + } + +enable_one_screen_and_wait (&ms_data);
move the loop below doing the munmap() and gem_close() on the objects here. With that fixed this looks ok to me:
Quoted 73 lines
tests/pm_rpm.c +60
-0+ } + +for (i =0 , j =1 << off_bit; j <= gtt_obj_max_size; j <<=1 , i++) { +igt_assert (munmap (gem_bufs[i], j) ==0 ); +gem_close (drm_fd, handles[i]); + } + +free (gem_bufs); +free (handles); +} + +static void pm_test_caching (void ) +{ +uint32_t handle; +uint8_t *gem_buf; + +uint32_t i, got_caching; +uint32_t gtt_obj_max_size = (16 *1024 ); +uint32_t cache_levels[3 ] = { +I915_CACHING_NONE , + I915_CACHING_CACHED, /* LLC caching */ + I915_CACHING_DISPLAY, /* eDRAM caching */ + }; + + + handle =gem_create (drm_fd, gtt_obj_max_size); + gem_buf =gem_mmap__gtt (drm_fd, handle, gtt_obj_max_size,PROT_WRITE ); + +for (i =0 ; i <ARRAY_SIZE (cache_levels); i++) { +memset (gem_buf,16 << i, gtt_obj_max_size); + +disable_all_screens_and_wait (&ms_data); + +igt_debug ("Setting cache level %u\n" , cache_levels[i]); + +gem_set_caching (drm_fd, handle, cache_levels[i]); + + got_caching =gem_get_caching (drm_fd, handle); + +igt_debug ("Got back %u\n" , got_caching); + +/* +* Allow fall-back to CACHING_NONE in case the platform does +* not support it. +*/ +if (cache_levels[i] ==I915_CACHING_DISPLAY ) +igt_assert (got_caching ==I915_CACHING_NONE || + got_caching == I915_CACHING_DISPLAY); +else +igt_assert (got_caching == cache_levels[i]); + +enable_one_screen_and_wait (&ms_data); + } + +igt_assert (munmap (gem_buf, gtt_obj_max_size) ==0 ); +gem_close (drm_fd, handle); +} + + +static void
fences_subtest(bool dpms)
{
int i;tests/pm_rpm.c +0
-0@@ -1927,6 +2041,12 @@ int main(int argc, char *argv[]) igt_subtest("gem-execbuf-stress-extra-wait") gem_execbuf_stress_subtest(rounds, WAIT_STATUS | WAIT_EXTRA);tests/pm_rpm.c +6
-0+/* power-wake reference tests */ + igt_subtest("pm-tiling") +pm_test_tiling (); + igt_subtest("pm-caching") +pm_test_caching (); +
Quoted 3 lines
igt_fixture
teardown_environment();
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 1/1 tests/pm_rpm tests for set_caching and set_tiling
In reply to [email protected]v4: re-bind the gem objects each time before calling disable_all_screens_and_wait().
v3: Use smaller sizes when allocating gem objects for caching tests.
v2: use mmap to gtt instead off cpu and various style-changes.
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 tests/pm_rpm tests for set_caching and set_tiling ioctl(s)
--- tests/pm_rpm.c | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+)
tests/pm_rpm.c +114 -0
@@ -1729,6 +1729,114 @@ static void planes_subtest(bool universal, bool dpms) } } +static void pm_test_tiling (void ) +{ +uint32_t *handles; +uint8_t **gem_bufs; + +int max_gem_objs =0 ; +uint8_t off_bit =14 ; +uint32_t gtt_obj_max_size = (256 *1024 ); + +uint32_t i, j, k, tiling_modes[3 ] = { +I915_TILING_NONE , +I915_TILING_X , +I915_TILING_Y , + }; +uint32_t ti, sw; + +/* default stride value */ +uint32_t stride =512 ; + +/* calculate how many objects we can map */ +for (i =1 << off_bit; i <= gtt_obj_max_size; i <<=1 , max_gem_objs++) + ; + + gem_bufs =calloc (max_gem_objs,sizeof (*gem_bufs)); + handles =calloc (max_gem_objs,sizeof (*handles)); + +/* try to set different tiling for each handle */ +for (i =0 ; i <ARRAY_SIZE (tiling_modes); i++) { + +for (j =0 , k =1 << off_bit; + k <= gtt_obj_max_size; k <<=1 , j++) { + handles[j] =gem_create (drm_fd, k); + gem_bufs[j] =gem_mmap__gtt (drm_fd, handles[j], + k,PROT_WRITE ); +memset (gem_bufs[j],0x0 , k); + } + +disable_all_screens_and_wait (&ms_data); + +for (j =0 ; j < max_gem_objs; j++) { +gem_set_tiling (drm_fd, handles[j], + tiling_modes[i], stride); +gem_get_tiling (drm_fd, handles[j], &ti, &sw); +igt_assert (tiling_modes[i] == ti); + } + +enable_one_screen_and_wait (&ms_data); + +for (j =0 , k =1 << off_bit; + k <= gtt_obj_max_size; k <<=1 , j++) { +igt_assert (munmap (gem_bufs[j], k) ==0 ); +gem_close (drm_fd, handles[j]); + } + } + +free (gem_bufs); +free (handles); +} + +static void pm_test_caching (void ) +{ +uint32_t handle; +uint8_t *gem_buf; + +uint32_t i, got_caching; +uint32_t gtt_obj_max_size = (16 *1024 ); +uint32_t cache_levels[3 ] = { +I915_CACHING_NONE , +I915_CACHING_CACHED ,/* LLC caching */ +I915_CACHING_DISPLAY ,/* eDRAM caching */ + }; + + + handle =gem_create (drm_fd, gtt_obj_max_size); + gem_buf =gem_mmap__gtt (drm_fd, handle, gtt_obj_max_size,PROT_WRITE ); + +for (i =0 ; i <ARRAY_SIZE (cache_levels); i++) { +memset (gem_buf,16 << i, gtt_obj_max_size); + +disable_all_screens_and_wait (&ms_data); + +igt_debug ("Setting cache level %u\n" , cache_levels[i]); + +gem_set_caching (drm_fd, handle, cache_levels[i]); + + got_caching =gem_get_caching (drm_fd, handle); + +igt_debug ("Got back %u\n" , got_caching); + +/* +* Allow fall-back to CACHING_NONE in case the platform does +* not support it. +*/ +if (cache_levels[i] ==I915_CACHING_DISPLAY ) +igt_assert (got_caching ==I915_CACHING_NONE || + got_caching ==I915_CACHING_DISPLAY ); +else +igt_assert (got_caching == cache_levels[i]); + +enable_one_screen_and_wait (&ms_data); + } + +igt_assert (munmap (gem_buf, gtt_obj_max_size) ==0 ); +gem_close (drm_fd, handle); +} + + +static void fences_subtest (bool dpms) {int i;
@@ -1927,6 +2035,12 @@ int main(int argc, char *argv[]) igt_subtest("gem-execbuf-stress-extra-wait")gem_execbuf_stress_subtest (rounds,WAIT_STATUS |WAIT_EXTRA ); +/* power-wake reference tests */ + igt_subtest("pm-tiling") +pm_test_tiling (); + igt_subtest("pm-caching") +pm_test_caching (); +igt_fixture teardown_environment ();
Signature · 6 lines
2.6.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 1 line · Marius Vlad
Signed-off-by Marius Vlad <[email protected]>
For the future: please send the patch revision log and commit tags together with the patch itself, not as a separate email. The patch looks ok I pushed it to igt with the amended commit log.
Quoted 144 lines
---
tests/pm_rpm.c | 114
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++1 file changed, 114 insertions(+)tests/pm_rpm.c +0
-0@@ -1729,6 +1729,114 @@ static void planes_subtest(bool universal, bool dpms) } }tests/pm_rpm.c +21
-0+static void pm_test_tiling (void ) +{ +uint32_t *handles; +uint8_t **gem_bufs; + +int max_gem_objs =0 ; +uint8_t off_bit =14 ; +uint32_t gtt_obj_max_size = (256 *1024 ); + +uint32_t i, j, k, tiling_modes[3 ] = { +I915_TILING_NONE , +I915_TILING_X , +I915_TILING_Y , + }; +uint32_t ti, sw; + +/* default stride value */ +uint32_t stride =512 ; + +/* calculate how many objects we can map */ + for (i = 1 << off_bit; i <= gtt_obj_max_size; i <<= 1,max_gem_objs++)
tests/pm_rpm.c +12
-0+ ; + + gem_bufs =calloc (max_gem_objs,sizeof (*gem_bufs)); + handles =calloc (max_gem_objs,sizeof (*handles)); + +/* try to set different tiling for each handle */ +for (i =0 ; i <ARRAY_SIZE (tiling_modes); i++) { + +for (j =0 , k =1 << off_bit; + k <= gtt_obj_max_size; k <<= 1, j++) { + handles[j] =gem_create (drm_fd, k); + gem_bufs[j] = gem_mmap__gtt(drm_fd,handles[j],
tests/pm_rpm.c +10
-0+ k, PROT_WRITE); +memset (gem_bufs[j],0x0 , k); + } + +disable_all_screens_and_wait (&ms_data); + +for (j =0 ; j < max_gem_objs; j++) { +gem_set_tiling (drm_fd, handles[j], + tiling_modes[i], stride); + gem_get_tiling(drm_fd, handles[j], &ti,&sw);
tests/pm_rpm.c +32
-0+igt_assert (tiling_modes[i] == ti); + } + +enable_one_screen_and_wait (&ms_data); + +for (j =0 , k =1 << off_bit; + k <= gtt_obj_max_size; k <<= 1, j++) { +igt_assert (munmap (gem_bufs[j], k) ==0 ); +gem_close (drm_fd, handles[j]); + } + } + +free (gem_bufs); +free (handles); +} + +static void pm_test_caching (void ) +{ +uint32_t handle; +uint8_t *gem_buf; + +uint32_t i, got_caching; +uint32_t gtt_obj_max_size = (16 *1024 ); +uint32_t cache_levels[3 ] = { +I915_CACHING_NONE , + I915_CACHING_CACHED, /* LLC caching */ + I915_CACHING_DISPLAY, /* eDRAM caching */ + }; + + + handle =gem_create (drm_fd, gtt_obj_max_size); + gem_buf = gem_mmap__gtt(drm_fd, handle, gtt_obj_max_size,
PROT_WRITE);tests/pm_rpm.c +7
-0+ +for (i =0 ; i <ARRAY_SIZE (cache_levels); i++) { +memset (gem_buf,16 << i, gtt_obj_max_size); + +disable_all_screens_and_wait (&ms_data); + + igt_debug("Setting cache level %u\n",cache_levels[i]);
tests/pm_rpm.c +9
-0+ +gem_set_caching (drm_fd, handle, cache_levels[i]); + + got_caching =gem_get_caching (drm_fd, handle); + +igt_debug ("Got back %u\n" , got_caching); + +/* +* Allow fall-back to CACHING_NONE in case the platform does
tests/pm_rpm.c +4
-0+* not support it. +*/ +if (cache_levels[i] ==I915_CACHING_DISPLAY ) + igt_assert(got_caching == I915_CACHING_NONE||
tests/pm_rpm.c +1
-0+ got_caching ==
I915_CACHING_DISPLAY);tests/pm_rpm.c +12
-0+else +igt_assert (got_caching == cache_levels[i]); + +enable_one_screen_and_wait (&ms_data); + } + +igt_assert (munmap (gem_buf, gtt_obj_max_size) ==0 ); +gem_close (drm_fd, handle); +} + + +static void
fences_subtest(bool dpms)
{
int i;tests/pm_rpm.c +0
-0@@ -1927,6 +2035,12 @@ int main(int argc, char *argv[]) igt_subtest("gem-execbuf-stress-extra-wait")
gem_execbuf_stress_subtest(rounds, WAIT_STATUS | WAIT_EXTRA);tests/pm_rpm.c +6
-0+/* power-wake reference tests */ + igt_subtest("pm-tiling") +pm_test_tiling (); + igt_subtest("pm-caching") +pm_test_caching (); +
Quoted 3 lines
igt_fixture
teardown_environment();
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx