mirror of
git://git.proxmox.com/git/spiceterm.git
synced 2025-01-11 05:17:57 +03:00
remove wakup timer
This commit is contained in:
parent
f6cb554cab
commit
8a22eb4f37
@ -125,7 +125,7 @@ SimpleSpiceUpdate *test_spice_create_update_from_bitmap(uint32_t surface_id,
|
|||||||
return update;
|
return update;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SimpleSpiceUpdate *test_spice_create_update_draw(Test *test, uint32_t surface_id)
|
static SimpleSpiceUpdate *test_draw_char(Test *test, int x, int y, int c)
|
||||||
{
|
{
|
||||||
int top, left;
|
int top, left;
|
||||||
uint8_t *dst;
|
uint8_t *dst;
|
||||||
@ -134,18 +134,18 @@ static SimpleSpiceUpdate *test_spice_create_update_draw(Test *test, uint32_t sur
|
|||||||
int i, j;
|
int i, j;
|
||||||
QXLRect bbox;
|
QXLRect bbox;
|
||||||
|
|
||||||
left = 100;
|
left = x*8;
|
||||||
top = 100;
|
top = y*16;
|
||||||
|
|
||||||
|
printf("DRAW %d %d %d\n", left, top, c);
|
||||||
|
|
||||||
unique++;
|
unique++;
|
||||||
|
|
||||||
bw = 8;
|
bw = 8;
|
||||||
bh = 16;
|
bh = 16;
|
||||||
|
|
||||||
bitmap = dst = malloc(bw * bh * 4);
|
bitmap = dst = malloc(bw * bh * 4);
|
||||||
//printf("allocated %p\n", dst);
|
|
||||||
|
|
||||||
int c = 65;
|
|
||||||
unsigned char *data = vt_font_data + c*16;
|
unsigned char *data = vt_font_data + c*16;
|
||||||
unsigned char d = *data;
|
unsigned char d = *data;
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ static SimpleSpiceUpdate *test_spice_create_update_draw(Test *test, uint32_t sur
|
|||||||
bbox.left = left; bbox.top = top;
|
bbox.left = left; bbox.top = top;
|
||||||
bbox.right = left + bw; bbox.bottom = top + bh;
|
bbox.right = left + bw; bbox.bottom = top + bh;
|
||||||
|
|
||||||
return test_spice_create_update_from_bitmap(surface_id, bbox, bitmap);
|
return test_spice_create_update_from_bitmap(0, bbox, bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -291,56 +291,14 @@ static int get_command(QXLInstance *qin, struct QXLCommandExt *ext)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void produce_command(Test *test)
|
|
||||||
{
|
|
||||||
Command *command;
|
|
||||||
QXLWorker *qxl_worker = test->qxl_worker;
|
|
||||||
|
|
||||||
g_assert(qxl_worker);
|
|
||||||
|
|
||||||
if (!test->num_commands) {
|
|
||||||
usleep(1000);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
command = &test->commands[test->cmd_index];
|
|
||||||
if (command->cb) {
|
|
||||||
command->cb(test, command);
|
|
||||||
}
|
|
||||||
switch (command->command) {
|
|
||||||
/* Drawing commands, they all push a command to the command ring */
|
|
||||||
case SIMPLE_DRAW: {
|
|
||||||
SimpleSpiceUpdate *update;
|
|
||||||
update = test_spice_create_update_draw(test, 0);
|
|
||||||
push_command(&update->ext);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
test->cmd_index = (test->cmd_index + 1) % test->num_commands;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int req_cmd_notification(QXLInstance *qin)
|
static int req_cmd_notification(QXLInstance *qin)
|
||||||
{
|
{
|
||||||
Test *test = SPICE_CONTAINEROF(qin, Test, qxl_instance);
|
Test *test = SPICE_CONTAINEROF(qin, Test, qxl_instance);
|
||||||
|
|
||||||
test->core->timer_start(test->wakeup_timer, test->wakeup_ms);
|
//test->core->timer_start(test->wakeup_timer, test->wakeup_ms);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_wakeup(void *opaque)
|
|
||||||
{
|
|
||||||
Test *test = opaque;
|
|
||||||
int notify;
|
|
||||||
|
|
||||||
test->cursor_notify = NOTIFY_CURSOR_BATCH;
|
|
||||||
for (notify = NOTIFY_DISPLAY_BATCH; notify > 0;--notify) {
|
|
||||||
produce_command(test);
|
|
||||||
}
|
|
||||||
|
|
||||||
test->core->timer_start(test->wakeup_timer, test->wakeup_ms);
|
|
||||||
test->qxl_worker->wakeup(test->qxl_worker);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void release_resource(QXLInstance *qin, struct QXLReleaseInfoExt release_info)
|
static void release_resource(QXLInstance *qin, struct QXLReleaseInfoExt release_info)
|
||||||
{
|
{
|
||||||
QXLCommandExt *ext = (QXLCommandExt*)(unsigned long)release_info.info->id;
|
QXLCommandExt *ext = (QXLCommandExt*)(unsigned long)release_info.info->id;
|
||||||
@ -578,9 +536,21 @@ void test_add_agent_interface(SpiceServer *server)
|
|||||||
spice_server_add_interface(server, &vdagent_sin.base);
|
spice_server_add_interface(server, &vdagent_sin.base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int my_charcode = 65;
|
||||||
|
static int my_posx = 0;
|
||||||
static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag)
|
static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag)
|
||||||
{
|
{
|
||||||
printf("KEYCODE %u\n", frag);
|
Test *test = SPICE_CONTAINEROF(sin, Test, keyboard_sin);
|
||||||
|
|
||||||
|
printf("KEYCODE %u %p\n", frag, test);
|
||||||
|
|
||||||
|
SimpleSpiceUpdate *update;
|
||||||
|
update = test_draw_char(test, my_posx, 10, my_charcode);
|
||||||
|
my_posx++;
|
||||||
|
my_charcode++;
|
||||||
|
push_command(&update->ext);
|
||||||
|
|
||||||
|
test->qxl_worker->wakeup(test->qxl_worker);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t kbd_get_leds(SpiceKbdInstance *sin)
|
static uint8_t kbd_get_leds(SpiceKbdInstance *sin)
|
||||||
@ -597,15 +567,9 @@ static SpiceKbdInterface keyboard_sif = {
|
|||||||
.get_leds = kbd_get_leds,
|
.get_leds = kbd_get_leds,
|
||||||
};
|
};
|
||||||
|
|
||||||
SpiceKbdInstance keyboard_sin = {
|
void test_add_keyboard_interface(Test* test)
|
||||||
.base = {
|
|
||||||
.sif = &keyboard_sif.base,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
void test_add_keyboard_interface(SpiceServer *server)
|
|
||||||
{
|
{
|
||||||
spice_server_add_interface(server, &keyboard_sin.base);
|
spice_server_add_interface(test->server, &test->keyboard_sin.base);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_set_simple_command_list(Test *test, int *simple_commands, int num_commands)
|
void test_set_simple_command_list(Test *test, int *simple_commands, int num_commands)
|
||||||
@ -640,9 +604,11 @@ Test *test_new(SpiceCoreInterface *core)
|
|||||||
test->qxl_instance.base.sif = &display_sif.base;
|
test->qxl_instance.base.sif = &display_sif.base;
|
||||||
test->qxl_instance.id = 0;
|
test->qxl_instance.id = 0;
|
||||||
|
|
||||||
|
test->keyboard_sin.base.sif = &keyboard_sif.base;
|
||||||
|
|
||||||
test->core = core;
|
test->core = core;
|
||||||
test->server = server;
|
test->server = server;
|
||||||
test->wakeup_ms = 50;
|
|
||||||
test->cursor_notify = NOTIFY_CURSOR_BATCH;
|
test->cursor_notify = NOTIFY_CURSOR_BATCH;
|
||||||
// some common initialization for all display tests
|
// some common initialization for all display tests
|
||||||
printf("TESTER: listening on port %d (unsecure)\n", port);
|
printf("TESTER: listening on port %d (unsecure)\n", port);
|
||||||
@ -655,7 +621,6 @@ Test *test_new(SpiceCoreInterface *core)
|
|||||||
|
|
||||||
cursor_init();
|
cursor_init();
|
||||||
test->has_secondary = 0;
|
test->has_secondary = 0;
|
||||||
test->wakeup_timer = core->timer_add(do_wakeup, test);
|
|
||||||
|
|
||||||
int timeout = 10; // max time to wait for client connection
|
int timeout = 10; // max time to wait for client connection
|
||||||
test->conn_timeout_timer = core->timer_add(do_conn_timeout, test);
|
test->conn_timeout_timer = core->timer_add(do_conn_timeout, test);
|
||||||
|
@ -89,13 +89,12 @@ struct Test {
|
|||||||
QXLInstance qxl_instance;
|
QXLInstance qxl_instance;
|
||||||
QXLWorker *qxl_worker;
|
QXLWorker *qxl_worker;
|
||||||
|
|
||||||
|
SpiceKbdInstance keyboard_sin;
|
||||||
|
|
||||||
uint8_t primary_surface[MAX_HEIGHT * MAX_WIDTH * 4];
|
uint8_t primary_surface[MAX_HEIGHT * MAX_WIDTH * 4];
|
||||||
int primary_height;
|
int primary_height;
|
||||||
int primary_width;
|
int primary_width;
|
||||||
|
|
||||||
SpiceTimer *wakeup_timer;
|
|
||||||
int wakeup_ms;
|
|
||||||
|
|
||||||
SpiceTimer *conn_timeout_timer;
|
SpiceTimer *conn_timeout_timer;
|
||||||
|
|
||||||
int cursor_notify;
|
int cursor_notify;
|
||||||
@ -123,7 +122,7 @@ void test_set_simple_command_list(Test *test, int *command, int num_commands);
|
|||||||
void test_set_command_list(Test *test, Command *command, int num_commands);
|
void test_set_command_list(Test *test, Command *command, int num_commands);
|
||||||
void test_add_display_interface(Test *test);
|
void test_add_display_interface(Test *test);
|
||||||
void test_add_agent_interface(SpiceServer *server); // TODO - Test *test
|
void test_add_agent_interface(SpiceServer *server); // TODO - Test *test
|
||||||
void test_add_keyboard_interface(SpiceServer *server);
|
void test_add_keyboard_interface(Test *test);
|
||||||
Test* test_new(SpiceCoreInterface* core);
|
Test* test_new(SpiceCoreInterface* core);
|
||||||
|
|
||||||
uint32_t test_get_width(void);
|
uint32_t test_get_width(void);
|
||||||
|
@ -37,7 +37,7 @@ int main(void)
|
|||||||
|
|
||||||
test_add_agent_interface(test->server);
|
test_add_agent_interface(test->server);
|
||||||
|
|
||||||
test_add_keyboard_interface(test->server);
|
test_add_keyboard_interface(test);
|
||||||
|
|
||||||
test_set_simple_command_list(test, simple_commands, COUNT(simple_commands));
|
test_set_simple_command_list(test, simple_commands, COUNT(simple_commands));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user