Re: [Intel-gfx] [PATCH i-g-t 2/2] tests/drm_read: Change tests to not require fbcon

2017-10-16 Thread Maarten Lankhorst
Op 13-10-17 om 16:22 schreef Chris Wilson:
> Quoting Maarten Lankhorst (2017-10-13 15:10:49)
>> The first active pipe might not be pipe A, and we shouldn't rely on
>> fbcon for a working crtc. Use igt_kms to set up something basic, and
>> use the kmstest helper to get an event from the correct pipe.
>>
>> Signed-off-by: Maarten Lankhorst 
> If one is lazy enough, some one will be foolhardy enough to try turning
> off all outputs and fixup the fallout. Not the most catchy of sayings,
> but true in this case.
>
>> ---
>>  tests/drm_read.c | 62 
>> +++-
>>  1 file changed, 34 insertions(+), 28 deletions(-)
>>
>> diff --git a/tests/drm_read.c b/tests/drm_read.c
>> index 7df36e965c59..b6aab731261d 100644
>> --- a/tests/drm_read.c
>> +++ b/tests/drm_read.c
>> @@ -57,18 +57,9 @@ static void assert_empty(int fd)
>> do_or_die(poll(, 1, 0));
>>  }
>>  
>> -static void generate_event(int fd)
>> +static void generate_event(int fd, enum pipe pipe)
>>  {
>> -   union drm_wait_vblank vbl;
>> -
>> -   /* We require that pipe 0 is running */
>> -
>> -   vbl.request.type =
>> -   DRM_VBLANK_RELATIVE |
>> -   DRM_VBLANK_EVENT;
>> -   vbl.request.sequence = 0;
>> -
>> -   do_ioctl(fd, DRM_IOCTL_WAIT_VBLANK, );
>> +   igt_assert(kmstest_get_vblank(fd, pipe, DRM_VBLANK_EVENT));
>>  }
> Now this is pipe-aware, is there any variation between pipes? Any
> advantage in extending the test? Well that should already be kms_vblank.
>
> Reviewed-by: Chris Wilson 
> -Chris

Thanks, pushed. Will resubmit kms_plane_lowres, can't get it right..

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH i-g-t 2/2] tests/drm_read: Change tests to not require fbcon

2017-10-13 Thread Chris Wilson
Quoting Maarten Lankhorst (2017-10-13 15:10:49)
> The first active pipe might not be pipe A, and we shouldn't rely on
> fbcon for a working crtc. Use igt_kms to set up something basic, and
> use the kmstest helper to get an event from the correct pipe.
> 
> Signed-off-by: Maarten Lankhorst 

If one is lazy enough, some one will be foolhardy enough to try turning
off all outputs and fixup the fallout. Not the most catchy of sayings,
but true in this case.

> ---
>  tests/drm_read.c | 62 
> +++-
>  1 file changed, 34 insertions(+), 28 deletions(-)
> 
> diff --git a/tests/drm_read.c b/tests/drm_read.c
> index 7df36e965c59..b6aab731261d 100644
> --- a/tests/drm_read.c
> +++ b/tests/drm_read.c
> @@ -57,18 +57,9 @@ static void assert_empty(int fd)
> do_or_die(poll(, 1, 0));
>  }
>  
> -static void generate_event(int fd)
> +static void generate_event(int fd, enum pipe pipe)
>  {
> -   union drm_wait_vblank vbl;
> -
> -   /* We require that pipe 0 is running */
> -
> -   vbl.request.type =
> -   DRM_VBLANK_RELATIVE |
> -   DRM_VBLANK_EVENT;
> -   vbl.request.sequence = 0;
> -
> -   do_ioctl(fd, DRM_IOCTL_WAIT_VBLANK, );
> +   igt_assert(kmstest_get_vblank(fd, pipe, DRM_VBLANK_EVENT));
>  }

Now this is pipe-aware, is there any variation between pipes? Any
advantage in extending the test? Well that should already be kms_vblank.

Reviewed-by: Chris Wilson 
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 2/2] tests/drm_read: Change tests to not require fbcon

2017-10-13 Thread Maarten Lankhorst
The first active pipe might not be pipe A, and we shouldn't rely on
fbcon for a working crtc. Use igt_kms to set up something basic, and
use the kmstest helper to get an event from the correct pipe.

Signed-off-by: Maarten Lankhorst 
---
 tests/drm_read.c | 62 +++-
 1 file changed, 34 insertions(+), 28 deletions(-)

diff --git a/tests/drm_read.c b/tests/drm_read.c
index 7df36e965c59..b6aab731261d 100644
--- a/tests/drm_read.c
+++ b/tests/drm_read.c
@@ -57,18 +57,9 @@ static void assert_empty(int fd)
do_or_die(poll(, 1, 0));
 }
 
-static void generate_event(int fd)
+static void generate_event(int fd, enum pipe pipe)
 {
-   union drm_wait_vblank vbl;
-
-   /* We require that pipe 0 is running */
-
-   vbl.request.type =
-   DRM_VBLANK_RELATIVE |
-   DRM_VBLANK_EVENT;
-   vbl.request.sequence = 0;
-
-   do_ioctl(fd, DRM_IOCTL_WAIT_VBLANK, );
+   igt_assert(kmstest_get_vblank(fd, pipe, DRM_VBLANK_EVENT));
 }
 
 static void wait_for_event(int fd)
@@ -120,7 +111,7 @@ static void test_invalid_buffer(int in)
teardown(fd);
 }
 
-static void test_fault_buffer(int in)
+static void test_fault_buffer(int in, enum pipe pipe)
 {
int fd = setup(in, 0);
struct drm_mode_map_dumb arg;
@@ -134,7 +125,7 @@ static void test_fault_buffer(int in)
buf = mmap(0, 4096, PROT_WRITE, MAP_SHARED, fd, arg.offset);
igt_assert(buf != MAP_FAILED);
 
-   generate_event(fd);
+   generate_event(fd, pipe);
 
alarm(1);
 
@@ -156,13 +147,13 @@ static void test_empty(int in, int nonblock, int expected)
teardown(fd);
 }
 
-static void test_short_buffer(int in, int nonblock)
+static void test_short_buffer(int in, int nonblock, enum pipe pipe)
 {
char buffer[1024]; /* events are typically 32 bytes */
int fd = setup(in, nonblock);
 
-   generate_event(fd);
-   generate_event(fd);
+   generate_event(fd, pipe);
+   generate_event(fd, pipe);
 
wait_for_event(fd);
 
@@ -175,31 +166,46 @@ static void test_short_buffer(int in, int nonblock)
teardown(fd);
 }
 
-static bool crtc0_active(int fd)
-{
-   union drm_wait_vblank vbl = {};
-
-   vbl.request.type = DRM_VBLANK_RELATIVE;
-   return drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, ) == 0;
-}
-
 igt_main
 {
int fd;
+   igt_display_t display;
+   struct igt_fb fb;
+   enum pipe pipe;
 
signal(SIGALRM, sighandler);
siginterrupt(SIGALRM, 1);
 
igt_fixture {
+   igt_output_t *output;
+
fd = drm_open_driver_master(DRIVER_ANY);
-   igt_require(crtc0_active(fd));
+   kmstest_set_vt_graphics_mode();
+
+   igt_display_init(, fd);
+   igt_display_require_output();
+
+   for_each_pipe_with_valid_output(, pipe, output) {
+   drmModeModeInfo *mode = igt_output_get_mode(output);
+
+   igt_create_pattern_fb(fd, mode->hdisplay, 
mode->vdisplay,
+ DRM_FORMAT_XRGB,
+ LOCAL_DRM_FORMAT_MOD_NONE, );
+
+   igt_output_set_pipe(output, pipe);
+   igt_plane_set_fb(igt_output_get_plane_type(output, 
DRM_PLANE_TYPE_PRIMARY), );
+   break;
+   }
+
+   igt_display_commit2(, display.is_atomic ? COMMIT_ATOMIC 
: COMMIT_LEGACY);
+   igt_require(kmstest_get_vblank(fd, pipe, 0));
}
 
igt_subtest("invalid-buffer")
test_invalid_buffer(fd);
 
igt_subtest("fault-buffer")
-   test_fault_buffer(fd);
+   test_fault_buffer(fd, pipe);
 
igt_subtest("empty-block")
test_empty(fd, 0, EINTR);
@@ -208,8 +214,8 @@ igt_main
test_empty(fd, 1, EAGAIN);
 
igt_subtest("short-buffer-block")
-   test_short_buffer(fd, 0);
+   test_short_buffer(fd, 0, pipe);
 
igt_subtest("short-buffer-nonblock")
-   test_short_buffer(fd, 1);
+   test_short_buffer(fd, 1, pipe);
 }
-- 
2.14.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx