Skip to contentSkip to conversation

kvm tools: Fix some SDL keyboard translations

PATCH New Sasha Levin 1 participant 2 messages Jun 8, 2011 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 kvm tools: Fix some SDL keyboard translations

This patch adds unmapped '<', '>', '|', '-', '+' and '=' which are quite useful in linux.

---
 tools/kvm/ui/sdl.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
tools/kvm/ui/sdl.c +7 -3
index 2e7c395..30fd511 100644
@@ -20,7 +20,8 @@ static u8 keymap[255] = {
 	[17]		= 0x3e,		/* 8 */
 	[18]		= 0x46,		/* 9 */
 	[19]		= 0x45,		/* 9 */
-
+	[20]		= 0x4e,		/* - */
+	[21]		= 0x55,		/* + */
 	[22]		= 0x66,		/* <backspace> */
 
 	[24]		= 0x15,		/* q */
@@ -47,6 +48,8 @@ static u8 keymap[255] = {
 	[46]		= 0x4b,		/* l */
 
 	[50]		= 0x12,		/* <left shift> */
+	[51]		= 0x5d,		/* | */
+
 
 	[52]		= 0x1a,		/* z */
 	[53]		= 0x22,		/* x */
@@ -55,8 +58,9 @@ static u8 keymap[255] = {
 	[56]		= 0x32,		/* b */
 	[57]		= 0x31,		/* n */
 	[58]		= 0x3a,		/* m */
-
-	[61]		= 0x4e,		/* - */
+	[59]		= 0x41,		/* < */
+	[60]		= 0x49,		/* > */
+	[61]		= 0x4a,		/* / */
 	[62]		= 0x59,		/* <right shift> */
 	[65]		= 0x29,		/* <space> */
 };
Signature · 1 line
1.7.5.3
#1 lore raw

PATCH 2/2 kvm tools: Use double buffering with SDL

Page flip every time we copy the buffer over instead of invalidating rects.
This should improve performance by letting hardware do the page flipping.

---
 tools/kvm/ui/sdl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/kvm/ui/sdl.c +2 -2
index 30fd511..59a6aa6 100644
@@ -91,7 +91,7 @@ static void *sdl__thread(void *p)
 	if (!guest_screen)
 		die("Unable to create SDL RBG surface");
 
-	flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL;
+	flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_DOUBLEBUF;
 
 	screen = SDL_SetVideoMode(fb->width, fb->height, fb->depth, flags);
 	if (!screen)
@@ -99,7 +99,7 @@ static void *sdl__thread(void *p)
 
 	for (;;) {
 		SDL_BlitSurface(guest_screen, NULL, screen, NULL);
-		SDL_UpdateRect(screen, 0, 0, 0, 0);
+		SDL_Flip(screen);
 
 		while (SDL_PollEvent(&ev)) {
 			switch (ev.type) {
Signature · 1 line
1.7.5.3