Fix software rendering in the mir backend. The window assumed hardware buffer, which caused testdrawchessboard to fail to mmap a buffer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
diff --git a/src/video/mir/SDL_mirframebuffer.c b/src/video/mir/SDL_mirframebuffer.c
index f8b4664..212c4a7 100644
--- a/src/video/mir/SDL_mirframebuffer.c
+++ b/src/video/mir/SDL_mirframebuffer.c
@@ -56,6 +56,8 @@ MIR_CreateWindowFramebuffer(_THIS, SDL_Window* window, Uint32* format,
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.");
diff --git a/src/video/mir/SDL_mirvideo.c b/src/video/mir/SDL_mirvideo.c
index 8ffd172..490e057 100644
--- a/src/video/mir/SDL_mirvideo.c
+++ b/src/video/mir/SDL_mirvideo.c
@@ -273,6 +273,7 @@ MIR_VideoInit(_THIS)
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");
diff --git a/src/video/mir/SDL_mirvideo.h b/src/video/mir/SDL_mirvideo.h
index edeca01..5a46d09 100644
--- a/src/video/mir/SDL_mirvideo.h
+++ b/src/video/mir/SDL_mirvideo.h
@@ -32,6 +32,8 @@
typedef struct
{
MirConnection* connection;
+ SDL_bool software;
+
} MIR_Data;
#endif /* _SDL_mirvideo_h_ */
diff --git a/src/video/mir/SDL_mirwindow.c b/src/video/mir/SDL_mirwindow.c
index d233db4..2359c51 100644
--- a/src/video/mir/SDL_mirwindow.c
+++ b/src/video/mir/SDL_mirwindow.c
@@ -99,6 +99,9 @@ MIR_CreateWindow(_THIS, SDL_Window* window)
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;
diff --git a/src/video/mir/SDL_mirwindow.h b/src/video/mir/SDL_mirwindow.h
index 411c148..39d5e74 100644
--- a/src/video/mir/SDL_mirwindow.h
+++ b/src/video/mir/SDL_mirwindow.h
@@ -34,6 +34,7 @@
typedef struct {
SDL_Window* sdl_window;
MIR_Data* mir_data;
+ bool software;
MirSurface* surface;
EGLSurface egl_surface;