Fix software rendering in the mir backend. The window assumed hardware buffer, which caused testdrawchessboard to fail to mmap a buffer.
authorBrandon Schaefer <brandon.schaefer@canonical.com>
Fri, 02 May 2014 12:33:19 -0700
changeset 8749 f34996d809b7
parent 8748 7ba9c0a0cad7
child 8750 5064096ddaf7
Fix software rendering in the mir backend. The window assumed hardware buffer, which caused testdrawchessboard to fail to mmap a buffer.
src/video/mir/SDL_mirframebuffer.c
src/video/mir/SDL_mirvideo.c
src/video/mir/SDL_mirvideo.h
src/video/mir/SDL_mirwindow.c
src/video/mir/SDL_mirwindow.h
--- a/src/video/mir/SDL_mirframebuffer.c	Wed Apr 30 21:12:47 2014 -0400
+++ b/src/video/mir/SDL_mirframebuffer.c	Fri May 02 12:33:19 2014 -0700
@@ -56,6 +56,8 @@
     MIR_Window* mir_window;
     MirSurfaceParameters surfaceparm;
 
+    mir_data->software = SDL_TRUE;
+
     if (MIR_CreateWindow(_this, window) < 0)
         return SDL_SetError("Failed to created a mir window.");
 
--- a/src/video/mir/SDL_mirvideo.c	Wed Apr 30 21:12:47 2014 -0400
+++ b/src/video/mir/SDL_mirvideo.c	Fri May 02 12:33:19 2014 -0700
@@ -273,6 +273,7 @@
     MIR_Data* mir_data = _this->driverdata;
 
     mir_data->connection = MIR_mir_connect_sync(NULL, __PRETTY_FUNCTION__);
+    mir_data->software = SDL_FALSE;
 
     if (!MIR_mir_connection_is_valid(mir_data->connection))
         return SDL_SetError("Failed to connect to the Mir Server");
--- a/src/video/mir/SDL_mirvideo.h	Wed Apr 30 21:12:47 2014 -0400
+++ b/src/video/mir/SDL_mirvideo.h	Fri May 02 12:33:19 2014 -0700
@@ -32,6 +32,8 @@
 typedef struct
 {
     MirConnection* connection;
+    SDL_bool software;
+    
 } MIR_Data;
 
 #endif /* _SDL_mirvideo_h_ */
--- a/src/video/mir/SDL_mirwindow.c	Wed Apr 30 21:12:47 2014 -0400
+++ b/src/video/mir/SDL_mirwindow.c	Fri May 02 12:33:19 2014 -0700
@@ -99,6 +99,9 @@
     mir_data = _this->driverdata;
     window->driverdata = mir_window;
 
+    if (mir_data->software)
+        surfaceparm.buffer_usage = mir_buffer_usage_software;
+
     if (window->x == SDL_WINDOWPOS_UNDEFINED)
         window->x = 0;
 
--- a/src/video/mir/SDL_mirwindow.h	Wed Apr 30 21:12:47 2014 -0400
+++ b/src/video/mir/SDL_mirwindow.h	Fri May 02 12:33:19 2014 -0700
@@ -34,6 +34,7 @@
 typedef struct {
     SDL_Window* sdl_window;
     MIR_Data* mir_data;
+    bool software;
 
     MirSurface* surface;
     EGLSurface egl_surface;