Go to the documentation of this file.
26 #include "../../SDL_internal.h"
28 #if SDL_VIDEO_DRIVER_MIR
44 #define MIR_DRIVER_NAME "mir"
46 static const Uint32 mir_pixel_format_to_sdl_format[] = {
62 return mir_pixel_format_to_sdl_format[
format];
109 if (!MIR_mir_connection_is_valid(connection)) {
111 MIR_mir_connection_get_error_message(connection));
116 MIR_mir_connection_release(connection);
133 MIR_PumpEvents(
_THIS)
138 MIR_CreateDevice(
int device_index)
162 device->driverdata = mir_data;
165 device->VideoInit = MIR_VideoInit;
166 device->VideoQuit = MIR_VideoQuit;
167 device->GetDisplayBounds = MIR_GetDisplayBounds;
168 device->GetDisplayModes = MIR_GetDisplayModes;
169 device->SetDisplayMode = MIR_SetDisplayMode;
170 device->free = MIR_DeleteDevice;
214 device->shape_driver.CreateShaper = MIR_CreateShaper;
215 device->shape_driver.SetWindowShape = MIR_SetWindowShape;
216 device->shape_driver.ResizeWindowShape = MIR_ResizeWindowShape;
218 device->PumpEvents = MIR_PumpEvents;
238 device->Vulkan_LoadLibrary = MIR_Vulkan_LoadLibrary;
239 device->Vulkan_UnloadLibrary = MIR_Vulkan_UnloadLibrary;
240 device->Vulkan_GetInstanceExtensions = MIR_Vulkan_GetInstanceExtensions;
241 device->Vulkan_CreateSurface = MIR_Vulkan_CreateSurface;
248 MIR_DRIVER_NAME,
"SDL Mir video driver",
249 MIR_Available, MIR_CreateDevice
253 MIR_ConvertModeToSDLMode(MirOutputMode
const*
mode, MirPixelFormat
format)
257 .w = MIR_mir_output_mode_get_width(
mode),
258 .h = MIR_mir_output_mode_get_height(
mode),
259 .refresh_rate = MIR_mir_output_mode_get_refresh_rate(
mode),
274 MIR_InitDisplayFromOutput(
_THIS, MirOutput*
output)
279 MirPixelFormat
format = MIR_mir_output_get_current_pixel_format(
output);
280 int num_modes = MIR_mir_output_get_num_modes(
output);
286 display.
name = (
char*)MIR_mir_output_type_name(MIR_mir_output_get_type(
output));
288 for (
m = 0;
m < num_modes;
m++) {
289 MirOutputMode
const*
mode = MIR_mir_output_get_mode(
output,
m);
301 MIR_InitDisplays(
_THIS)
304 int num_outputs = MIR_mir_display_config_get_num_outputs(mir_data->
display_config);
307 for (
d = 0;
d < num_outputs;
d++) {
310 MirOutputConnectionState
state = MIR_mir_output_get_connection_state(
output);
312 if (
enabled &&
state == mir_output_connection_state_connected) {
328 if (!MIR_mir_connection_is_valid(mir_data->
connection)) {
329 return SDL_SetError(
"Failed to connect to the mir server: %s",
330 MIR_mir_connection_get_error_message(mir_data->
connection));
335 MIR_InitDisplays(
_this);
342 MIR_CleanUpDisplayConfig(
_THIS)
360 MIR_CleanUpDisplayConfig(
_this);
367 MIR_mir_connection_release(mir_data->
connection);
396 int num_modes = MIR_mir_output_get_num_modes(
output);
398 MIR_mir_output_get_current_pixel_format(
output));
400 for (
m = 0;
m < num_modes;
m++) {
401 MirOutputMode
const* mir_mode = MIR_mir_output_get_mode(
output,
m);
402 int width = MIR_mir_output_mode_get_width(mir_mode);
403 int height = MIR_mir_output_mode_get_height(mir_mode);
404 double refresh_rate = MIR_mir_output_mode_get_refresh_rate(mir_mode);
406 if (
mode->format == sdl_format &&
409 mode->refresh_rate == refresh_rate) {
412 MIR_mir_output_set_current_mode(
output, mir_mode);
int MIR_GL_SwapWindow(_THIS, SDL_Window *window)
@ SDL_PIXELFORMAT_ARGB8888
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
void MIR_SetWindowTitle(_THIS, SDL_Window *window)
MirPixelFormat pixel_format
A collection of pixels used in software blitting.
int MIR_GL_LoadLibrary(_THIS, const char *path)
MirDisplayConfig * display_config
void MIR_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
GLint GLint GLsizei width
@ SDL_PIXELFORMAT_RGBA5551
Uint32 MIR_GetSDLPixelFormat(MirPixelFormat format)
void MIR_DestroyWindowFramebuffer(_THIS, SDL_Window *sdl_window)
int MIR_UpdateWindowFramebuffer(_THIS, SDL_Window *sdl_window, const SDL_Rect *rects, int numrects)
SDL_DisplayMode desktop_mode
void MIR_DestroyWindow(_THIS, SDL_Window *window)
void MIR_MinimizeWindow(_THIS, SDL_Window *window)
#define MIR_GL_UnloadLibrary
VideoBootStrap MIR_bootstrap
int MIR_CreateWindowFramebuffer(_THIS, SDL_Window *sdl_window, Uint32 *format, void **pixels, int *pitch)
The type used to identify a window.
The structure that defines a display mode.
SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
int SDL_MIR_LoadSymbols(void)
A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents.
void MIR_SetWindowMinimumSize(_THIS, SDL_Window *window)
#define MIR_GL_GetSwapInterval
SDL_GLContext MIR_GL_CreateContext(_THIS, SDL_Window *window)
int MIR_SetWindowGammaRamp(_THIS, SDL_Window *window, Uint16 const *ramp)
static SDL_VideoDevice * _this
int MIR_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
EGLSurface EGLNativeWindowType * window
GLint GLint GLsizei GLsizei height
SDL_VideoDisplay * displays
MirConnection * connection
@ SDL_PIXELFORMAT_UNKNOWN
void MIR_SetWindowMaximumSize(_THIS, SDL_Window *window)
int SDL_AddVideoDisplay(const SDL_VideoDisplay *display)
#define SDL_OutOfMemory()
#define MIR_GL_GetProcAddress
#define MIR_GL_DeleteContext
MIR_Window * current_window
void MIR_MaximizeWindow(_THIS, SDL_Window *window)
#define MIR_GL_SetSwapInterval
void MIR_SetWindowGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
void MIR_RestoreWindow(_THIS, SDL_Window *window)
A rectangle, with the origin at the upper left.
void MIR_HideWindow(_THIS, SDL_Window *window)
void MIR_SetWindowSize(_THIS, SDL_Window *window)
GLenum GLenum GLsizei const GLuint GLboolean enabled
#define SDL_Unsupported()
@ SDL_PIXELFORMAT_ABGR8888
SDL_DisplayMode current_mode
@ SDL_PIXELFORMAT_RGBA4444
static SDL_AudioDeviceID device
int MIR_GetWindowGammaRamp(_THIS, SDL_Window *window, Uint16 *ramp)
void SDL_MIR_UnloadSymbols(void)
int MIR_CreateWindow(_THIS, SDL_Window *window)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
SDL_bool MIR_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)