From: Hai Lan <hai.lan@intel.com>
To: jbarnes@virtuousgeek.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [PATCH] test/testdisplay:add cursor test
Date: Sat, 22 Oct 2011 22:03:05 -0400 [thread overview]
Message-ID: <1319335385-29991-1-git-send-email-hai.lan@intel.com> (raw)
Signed-off-by: Hai Lan <hai.lan@intel.com>
---
tests/testdisplay.c | 32 +++++++++++++++++++++++++-------
1 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 01f31dc..174d5c7 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -75,7 +75,7 @@ struct udev_monitor *uevent_monitor;
drmModeRes *resources;
int fd, modes;
int dump_info = 0, test_all_modes =0, test_preferred_mode = 0, force_mode = 0,
- test_plane, enable_tiling;
+ test_plane, enable_tiling, test_cursor;
int sleep_between_modes = 5;
uint32_t depth = 24;
@@ -823,7 +823,7 @@ set_mode(struct connector *c)
cairo_surface_t *surface;
cairo_status_t status;
cairo_t *cr;
- uint32_t handle;
+ uint32_t handle,cursor_handle;
if (test_all_modes)
c->mode = c->connector->modes[j];
@@ -872,7 +872,6 @@ set_mode(struct connector *c)
handle, &fb_id);
cairo_surface_destroy(surface);
gem_close(fd, handle);
-
if (ret) {
fprintf(stderr, "failed to add fb (%dx%d): %s\n",
width, height, strerror(errno));
@@ -888,6 +887,21 @@ set_mode(struct connector *c)
continue;
}
+ if (test_cursor) {
+ cursor_handle = gem_create(fd,64*64*4);
+ char * cursor_buff = gem_mmap(fd, cursor_handle, 64*64*4, PROT_READ | PROT_WRITE);
+ for(int i=0;i<64*64*4;i++)
+ *(cursor_buff+i)=0xff;
+
+ drmModeSetCursor(fd,c->crtc,cursor_handle,64,64);
+ for(int i=0;i<10;i++) {
+ drmModeMoveCursor(fd,c->crtc,i*100, 0);
+ sleep(1);
+ }
+ drmModeSetCursor(fd,c->crtc,0,64,64);
+ gem_close(fd, cursor_handle);
+ }
+
if (test_plane)
enable_plane(c);
@@ -931,7 +945,7 @@ static int update_display(void)
dump_planes();
}
- if (test_preferred_mode || test_all_modes || force_mode) {
+ if (test_preferred_mode || test_all_modes || force_mode || test_cursor) {
/* Find any connected displays */
for (c = 0; c < resources->count_connectors; c++) {
connectors[c].id = resources->connectors[c];
@@ -944,11 +958,11 @@ static int update_display(void)
extern char *optarg;
extern int optind, opterr, optopt;
-static char optstr[] = "hiaf:s:d:pmt";
+static char optstr[] = "hiaf:s:d:pmtc";
static void usage(char *name)
{
- fprintf(stderr, "usage: %s [-hiafs]\n", name);
+ fprintf(stderr, "usage: %s [-hiaf:s:d:pmtc]\n", name);
fprintf(stderr, "\t-i\tdump info\n");
fprintf(stderr, "\t-a\ttest all modes\n");
fprintf(stderr, "\t-s\t<duration>\tsleep between each mode test\n");
@@ -959,6 +973,7 @@ static void usage(char *name)
fprintf(stderr, "\t-f\t<clock MHz>,<hdisp>,<hsync-start>,<hsync-end>,<htotal>,\n");
fprintf(stderr, "\t\t<vdisp>,<vsync-start>,<vsync-end>,<vtotal>\n");
fprintf(stderr, "\t\ttest force mode\n");
+ fprintf(stderr, "\t-c\ttest cursor\n");
fprintf(stderr, "\tDefault is to test all modes.\n");
exit(0);
}
@@ -1048,6 +1063,9 @@ int main(int argc, char **argv)
case 't':
enable_tiling = 1;
break;
+ case 'c':
+ test_cursor = 1;
+ break;
default:
fprintf(stderr, "unknown option %c\n", c);
/* fall through */
@@ -1057,7 +1075,7 @@ int main(int argc, char **argv)
}
}
if (!test_all_modes && !force_mode && !dump_info &&
- !test_preferred_mode)
+ !test_preferred_mode && !test_cursor)
test_all_modes = 1;
for (i = 0; i < ARRAY_SIZE(modules); i++) {
--
1.7.0.1
next reply other threads:[~2011-10-22 13:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-23 2:03 Hai Lan [this message]
2011-10-22 13:25 ` [PATCH] test/testdisplay:add cursor test Paul Menzel
2011-10-22 13:34 ` Lan, Hai
2011-10-22 19:40 ` Eugeni Dodonov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1319335385-29991-1-git-send-email-hai.lan@intel.com \
--to=hai.lan@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jbarnes@virtuousgeek.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.