mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-12 10:26:12 +00:00
flip_test: count the number of flips and check we don't drop any
In the basic case of just flipping between two buffers with no additional work, we should neve drop a frame.
This commit is contained in:
parent
93ea0182c4
commit
f509d40fa9
@ -41,7 +41,7 @@
|
|||||||
#include "intel_batchbuffer.h"
|
#include "intel_batchbuffer.h"
|
||||||
#include "intel_gpu_tools.h"
|
#include "intel_gpu_tools.h"
|
||||||
|
|
||||||
#define TEST_DPMS (1 << 0)
|
#define TEST_DPMS (1 << 0)
|
||||||
#define TEST_WITH_DUMMY_LOAD (1 << 1)
|
#define TEST_WITH_DUMMY_LOAD (1 << 1)
|
||||||
|
|
||||||
drmModeRes *resources;
|
drmModeRes *resources;
|
||||||
@ -66,6 +66,7 @@ struct test_output {
|
|||||||
drmModeConnector *connector;
|
drmModeConnector *connector;
|
||||||
int crtc;
|
int crtc;
|
||||||
int flags;
|
int flags;
|
||||||
|
int count;
|
||||||
unsigned int current_fb_id;
|
unsigned int current_fb_id;
|
||||||
unsigned int fb_ids[2];
|
unsigned int fb_ids[2];
|
||||||
struct kmstest_fb fb_info[2];
|
struct kmstest_fb fb_info[2];
|
||||||
@ -151,6 +152,8 @@ static void page_flip_handler(int fd, unsigned int frame, unsigned int sec,
|
|||||||
struct test_output *o = data;
|
struct test_output *o = data;
|
||||||
unsigned int new_fb_id;
|
unsigned int new_fb_id;
|
||||||
|
|
||||||
|
o->count++;
|
||||||
|
|
||||||
o->current_fb_id = !o->current_fb_id;
|
o->current_fb_id = !o->current_fb_id;
|
||||||
new_fb_id = o->fb_ids[o->current_fb_id];
|
new_fb_id = o->fb_ids[o->current_fb_id];
|
||||||
|
|
||||||
@ -333,6 +336,7 @@ static void flip_mode(struct test_output *o, int crtc, int duration)
|
|||||||
exit(4);
|
exit(4);
|
||||||
}
|
}
|
||||||
o->current_fb_id = 1;
|
o->current_fb_id = 1;
|
||||||
|
o->count = 1; /* for the uncounted tail */
|
||||||
|
|
||||||
memset(&evctx, 0, sizeof evctx);
|
memset(&evctx, 0, sizeof evctx);
|
||||||
evctx.version = DRM_EVENT_CONTEXT_VERSION;
|
evctx.version = DRM_EVENT_CONTEXT_VERSION;
|
||||||
@ -373,6 +377,26 @@ static void flip_mode(struct test_output *o, int crtc, int duration)
|
|||||||
evctx.page_flip_handler = NULL;
|
evctx.page_flip_handler = NULL;
|
||||||
drmHandleEvent(drm_fd, &evctx);
|
drmHandleEvent(drm_fd, &evctx);
|
||||||
|
|
||||||
|
/* Verify we drop no frames */
|
||||||
|
if (o->flags == 0) {
|
||||||
|
struct timeval now;
|
||||||
|
long us;
|
||||||
|
int expected;
|
||||||
|
|
||||||
|
gettimeofday(&now, NULL);
|
||||||
|
|
||||||
|
us = duration * 1000 * 1000;
|
||||||
|
us += (now.tv_sec - end.tv_sec) * 1000 * 1000;
|
||||||
|
us += now.tv_usec - end.tv_usec;
|
||||||
|
|
||||||
|
expected = us * o->mode.vrefresh / (1000 * 1000);
|
||||||
|
if (o->count < expected) {
|
||||||
|
fprintf(stderr, "dropped frames, expected %d, counted %d\n",
|
||||||
|
expected, o->count);
|
||||||
|
exit(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(stdout, "\npage flipping on crtc %d, connector %d: PASSED\n",
|
fprintf(stdout, "\npage flipping on crtc %d, connector %d: PASSED\n",
|
||||||
crtc, o->id);
|
crtc, o->id);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user