diff mbox

[2/2] kvm tools: Use double buffering with SDL

Message ID 1307652497-4629-2-git-send-email-levinsasha928@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sasha Levin June 9, 2011, 8:48 p.m. UTC
Page flip every time we copy the buffer over instead of invalidating
rects.
This should improve performance by letting hardware do the page
flipping.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 tools/kvm/ui/sdl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/tools/kvm/ui/sdl.c b/tools/kvm/ui/sdl.c
index 30fd511..59a6aa6 100644
--- a/tools/kvm/ui/sdl.c
+++ b/tools/kvm/ui/sdl.c
@@ -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) {