src/video/vivante/SDL_vivantevideo.c
author Sam Lantinga <slouken@libsdl.org>
Wed, 15 Oct 2014 09:18:17 -0700
changeset 9164 494876610c49
child 9169 70e5da67cf9d
permissions -rw-r--r--
Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9164
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     1
/*
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     2
  Simple DirectMedia Layer
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     3
  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     4
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     5
  This software is provided 'as-is', without any express or implied
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     6
  warranty.  In no event will the authors be held liable for any damages
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     7
  arising from the use of this software.
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     8
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
     9
  Permission is granted to anyone to use this software for any purpose,
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    10
  including commercial applications, and to alter it and redistribute it
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    11
  freely, subject to the following restrictions:
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    12
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    13
  1. The origin of this software must not be misrepresented; you must not
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    14
     claim that you wrote the original software. If you use this software
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    15
     in a product, an acknowledgment in the product documentation would be
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    16
     appreciated but is not required.
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    17
  2. Altered source versions must be plainly marked as such, and must not be
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    18
     misrepresented as being the original software.
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    19
  3. This notice may not be removed or altered from any source distribution.
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    20
*/
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    21
#include "../../SDL_internal.h"
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    22
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    23
#if SDL_VIDEO_DRIVER_VIVANTE
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    24
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    25
/* SDL internals */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    26
#include "../SDL_sysvideo.h"
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    27
#include "SDL_version.h"
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    28
#include "SDL_syswm.h"
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    29
#include "SDL_loadso.h"
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    30
#include "SDL_events.h"
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    31
#include "../../events/SDL_events_c.h"
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    32
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    33
#ifdef SDL_INPUT_LINUXEV
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    34
#include "../../core/linux/SDL_evdev.h"
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    35
#endif
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    36
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    37
#include "SDL_vivantevideo.h"
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    38
#include "SDL_vivanteplatform.h"
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    39
#include "SDL_vivanteopengles.h"
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    40
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    41
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    42
static int
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    43
VIVANTE_Available(void)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    44
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    45
    return 1;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    46
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    47
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    48
static void
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    49
VIVANTE_Destroy(SDL_VideoDevice * device)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    50
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    51
    if (device->driverdata != NULL) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    52
        SDL_free(device->driverdata);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    53
        device->driverdata = NULL;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    54
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    55
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    56
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    57
static SDL_VideoDevice *
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    58
VIVANTE_Create()
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    59
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    60
    SDL_VideoDevice *device;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    61
    SDL_VideoData *data;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    62
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    63
    /* Initialize SDL_VideoDevice structure */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    64
    device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    65
    if (device == NULL) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    66
        SDL_OutOfMemory();
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    67
        return NULL;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    68
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    69
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    70
    /* Initialize internal data */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    71
    data = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    72
    if (data == NULL) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    73
        SDL_OutOfMemory();
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    74
        SDL_free(device);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    75
        return NULL;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    76
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    77
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    78
    device->driverdata = data;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    79
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    80
    /* Setup amount of available displays and current display */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    81
    device->num_displays = 0;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    82
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    83
    /* Set device free function */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    84
    device->free = VIVANTE_Destroy;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    85
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    86
    /* Setup all functions which we can handle */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    87
    device->VideoInit = VIVANTE_VideoInit;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    88
    device->VideoQuit = VIVANTE_VideoQuit;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    89
    device->GetDisplayModes = VIVANTE_GetDisplayModes;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    90
    device->SetDisplayMode = VIVANTE_SetDisplayMode;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    91
    device->CreateWindow = VIVANTE_CreateWindow;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    92
    device->SetWindowTitle = VIVANTE_SetWindowTitle;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    93
    device->SetWindowPosition = VIVANTE_SetWindowPosition;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    94
    device->SetWindowSize = VIVANTE_SetWindowSize;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    95
    device->ShowWindow = VIVANTE_ShowWindow;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    96
    device->HideWindow = VIVANTE_HideWindow;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    97
    device->DestroyWindow = VIVANTE_DestroyWindow;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    98
    device->GetWindowWMInfo = VIVANTE_GetWindowWMInfo;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
    99
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   100
    device->GL_LoadLibrary = VIVANTE_GLES_LoadLibrary;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   101
    device->GL_GetProcAddress = VIVANTE_GLES_GetProcAddress;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   102
    device->GL_UnloadLibrary = VIVANTE_GLES_UnloadLibrary;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   103
    device->GL_CreateContext = VIVANTE_GLES_CreateContext;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   104
    device->GL_MakeCurrent = VIVANTE_GLES_MakeCurrent;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   105
    device->GL_SetSwapInterval = VIVANTE_GLES_SetSwapInterval;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   106
    device->GL_GetSwapInterval = VIVANTE_GLES_GetSwapInterval;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   107
    device->GL_SwapWindow = VIVANTE_GLES_SwapWindow;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   108
    device->GL_DeleteContext = VIVANTE_GLES_DeleteContext;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   109
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   110
    device->PumpEvents = VIVANTE_PumpEvents;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   111
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   112
    return device;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   113
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   114
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   115
VideoBootStrap VIVANTE_bootstrap = {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   116
    "vivante",
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   117
    "Vivante EGL Video Driver",
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   118
    VIVANTE_Available,
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   119
    VIVANTE_Create
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   120
};
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   121
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   122
/*****************************************************************************/
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   123
/* SDL Video and Display initialization/handling functions                   */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   124
/*****************************************************************************/
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   125
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   126
static int
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   127
VIVANTE_AddVideoDisplays(_THIS)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   128
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   129
    SDL_VideoData *videodata = _this->driverdata;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   130
    SDL_VideoDisplay display;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   131
    SDL_DisplayMode current_mode;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   132
    SDL_DisplayData *data;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   133
    int pitch = 0, bpp = 0;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   134
    unsigned long pixels = 0;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   135
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   136
    data = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData));
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   137
    if (data == NULL) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   138
        return SDL_OutOfMemory();
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   139
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   140
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   141
    SDL_zero(current_mode);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   142
#if SDL_VIDEO_DRIVER_VIVANTE_VDK
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   143
    data->native_display = vdkGetDisplay(videodata->vdk_private);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   144
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   145
    vdkGetDisplayInfo(data->native_display, &current_mode.w, &current_mode.h, &pixels, &pitch, &bpp);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   146
#else
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   147
    data->native_display = videodata->fbGetDisplayByIndex(0);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   148
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   149
    videodata->fbGetDisplayInfo(data->native_display, &current_mode.w, &current_mode.h, &pixels, &pitch, &bpp);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   150
#endif /* SDL_VIDEO_DRIVER_VIVANTE_VDK */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   151
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   152
    switch (bpp)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   153
    {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   154
    default: /* Is another format used? */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   155
    case 16:
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   156
        current_mode.format = SDL_PIXELFORMAT_RGB565;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   157
        break;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   158
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   159
    /* FIXME: How do we query refresh rate? */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   160
    current_mode.refresh_rate = 60;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   161
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   162
    SDL_zero(display);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   163
    display.desktop_mode = current_mode;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   164
    display.current_mode = current_mode;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   165
    display.driverdata = data;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   166
    SDL_AddVideoDisplay(&display);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   167
    return 0;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   168
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   169
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   170
int
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   171
VIVANTE_VideoInit(_THIS)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   172
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   173
    SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   174
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   175
#if SDL_VIDEO_DRIVER_VIVANTE_VDK
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   176
    videodata->vdk_private = vdkInitialize();
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   177
    if (!videodata->vdk_private) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   178
        return SDL_SetError("vdkInitialize() failed");
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   179
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   180
#else
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   181
    videodata->egl_handle = SDL_LoadObject("libEGL.so.1");
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   182
    if (!videodata->egl_handle) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   183
        videodata->egl_handle = SDL_LoadObject("libEGL.so");
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   184
        if (!videodata->egl_handle) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   185
            return -1;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   186
        }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   187
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   188
#define LOAD_FUNC(NAME) \
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   189
    videodata->NAME = SDL_LoadFunction(videodata->egl_handle, #NAME); \
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   190
    if (!videodata->NAME) return -1;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   191
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   192
    LOAD_FUNC(fbGetDisplay);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   193
    LOAD_FUNC(fbGetDisplayByIndex);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   194
    LOAD_FUNC(fbGetDisplayGeometry);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   195
    LOAD_FUNC(fbGetDisplayInfo);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   196
    LOAD_FUNC(fbDestroyDisplay);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   197
    LOAD_FUNC(fbCreateWindow);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   198
    LOAD_FUNC(fbGetWindowGeometry);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   199
    LOAD_FUNC(fbGetWindowInfo);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   200
    LOAD_FUNC(fbDestroyWindow);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   201
#endif
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   202
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   203
    if (VIVANTE_SetupPlatform(_this) < 0) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   204
        return -1;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   205
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   206
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   207
    if (VIVANTE_AddVideoDisplays(_this) < 0) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   208
        return -1;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   209
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   210
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   211
#ifdef SDL_INPUT_LINUXEV
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   212
    if (SDL_EVDEV_Init() < 0) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   213
        return -1;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   214
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   215
#endif
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   216
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   217
    return 0;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   218
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   219
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   220
void
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   221
VIVANTE_VideoQuit(_THIS)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   222
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   223
    SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   224
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   225
#ifdef SDL_INPUT_LINUXEV
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   226
    SDL_EVDEV_Quit();
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   227
#endif
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   228
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   229
#if SDL_VIDEO_DRIVER_VIVANTE_VDK
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   230
    if (videodata->vdk_private) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   231
        vdkExit(videodata->vdk_private);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   232
        videodata->vdk_private = NULL;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   233
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   234
#else
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   235
    if (videodata->egl_handle) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   236
        SDL_UnloadObject(videodata->egl_handle);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   237
        videodata->egl_handle = NULL;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   238
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   239
#endif
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   240
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   241
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   242
void
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   243
VIVANTE_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   244
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   245
    /* Only one display mode available, the current one */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   246
    SDL_AddDisplayMode(display, &display->current_mode);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   247
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   248
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   249
int
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   250
VIVANTE_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   251
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   252
    return 0;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   253
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   254
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   255
int
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   256
VIVANTE_CreateWindow(_THIS, SDL_Window * window)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   257
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   258
    SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   259
    SDL_DisplayData *displaydata;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   260
    SDL_WindowData *data;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   261
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   262
    displaydata = SDL_GetDisplayDriverData(0);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   263
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   264
    /* Allocate window internal data */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   265
    data = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   266
    if (data == NULL) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   267
        return SDL_OutOfMemory();
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   268
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   269
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   270
    /* Setup driver data for this window */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   271
    window->driverdata = data;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   272
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   273
#if SDL_VIDEO_DRIVER_VIVANTE_VDK
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   274
    data->native_window = vdkCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   275
#else
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   276
    data->native_window = videodata->fbCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   277
#endif
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   278
    if (!data->native_window) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   279
        return SDL_SetError("VIVANTE: Can't create native window");
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   280
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   281
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   282
    if (window->flags & SDL_WINDOW_OPENGL) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   283
        data->egl_surface = SDL_EGL_CreateSurface(_this, data->native_window);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   284
        if (data->egl_surface == EGL_NO_SURFACE) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   285
            return SDL_SetError("VIVANTE: Can't create EGL surface");
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   286
        }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   287
    } else {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   288
        data->egl_surface = EGL_NO_SURFACE;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   289
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   290
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   291
    /* Window has been successfully created */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   292
    return 0;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   293
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   294
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   295
void
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   296
VIVANTE_DestroyWindow(_THIS, SDL_Window * window)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   297
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   298
    SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   299
    SDL_WindowData *data;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   300
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   301
    data = window->driverdata;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   302
    if (data) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   303
        if (data->egl_surface != EGL_NO_SURFACE) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   304
            SDL_EGL_DestroySurface(_this, data->egl_surface);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   305
        }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   306
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   307
        if (data->native_window) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   308
#if SDL_VIDEO_DRIVER_VIVANTE_VDK
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   309
            vdkDestroyWindow(data->native_window);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   310
#else
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   311
            videodata->fbDestroyWindow(data->native_window);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   312
#endif
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   313
        }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   314
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   315
        SDL_free(data);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   316
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   317
    window->driverdata = NULL;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   318
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   319
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   320
void
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   321
VIVANTE_SetWindowTitle(_THIS, SDL_Window * window)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   322
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   323
#if SDL_VIDEO_DRIVER_VIVANTE_VDK
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   324
    SDL_WindowData *data = window->driverdata;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   325
    vdkSetWindowTitle(data->native_window, window->title);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   326
#endif
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   327
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   328
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   329
void
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   330
VIVANTE_SetWindowPosition(_THIS, SDL_Window * window)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   331
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   332
    /* FIXME */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   333
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   334
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   335
void
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   336
VIVANTE_SetWindowSize(_THIS, SDL_Window * window)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   337
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   338
    /* FIXME */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   339
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   340
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   341
void
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   342
VIVANTE_ShowWindow(_THIS, SDL_Window * window)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   343
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   344
#if SDL_VIDEO_DRIVER_VIVANTE_VDK
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   345
    SDL_WindowData *data = window->driverdata;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   346
    vdkShowWindow(data->native_window);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   347
#endif
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   348
    SDL_SetMouseFocus(window);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   349
    SDL_SetKeyboardFocus(window);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   350
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   351
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   352
void
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   353
VIVANTE_HideWindow(_THIS, SDL_Window * window)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   354
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   355
#if SDL_VIDEO_DRIVER_VIVANTE_VDK
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   356
    SDL_WindowData *data = window->driverdata;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   357
    vdkHideWindow(data->native_window);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   358
#endif
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   359
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   360
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   361
/*****************************************************************************/
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   362
/* SDL Window Manager function                                               */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   363
/*****************************************************************************/
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   364
SDL_bool
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   365
VIVANTE_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   366
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   367
/*
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   368
    SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   369
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   370
    if (info->version.major == SDL_MAJOR_VERSION &&
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   371
        info->version.minor == SDL_MINOR_VERSION) {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   372
        info->subsystem = SDL_SYSWM_VIVANTE;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   373
        info->info.vivante.window = data->native_window;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   374
        return SDL_TRUE;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   375
    } else {
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   376
        SDL_SetError("Application not compiled with SDL %d.%d\n",
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   377
                     SDL_MAJOR_VERSION, SDL_MINOR_VERSION);
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   378
        return SDL_FALSE;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   379
    }
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   380
*/
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   381
    SDL_Unsupported();
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   382
    return SDL_FALSE;
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   383
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   384
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   385
/*****************************************************************************/
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   386
/* SDL event functions                                                       */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   387
/*****************************************************************************/
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   388
void VIVANTE_PumpEvents(_THIS)
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   389
{
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   390
#ifdef SDL_INPUT_LINUXEV
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   391
    SDL_EVDEV_Poll();
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   392
#endif
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   393
}
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   394
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   395
#endif /* SDL_VIDEO_DRIVER_VIVANTE */
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   396
494876610c49 Expanded the iMX6 video driver into a general Vivante video driver that works across multiple SoCs
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
   397
/* vi: set ts=4 sw=4 expandtab: */