X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=plugins%2Fgpu_neon%2Fvout_sdl.c;fp=plugins%2Fgpu_neon%2Fvout_sdl.c;h=f2f87e95b03c3564d3695f38e5d27b2fe4124544;hp=0000000000000000000000000000000000000000;hb=56f08d8331df07ee6b17dfdba0ca2b5f0b1058c8;hpb=d30279e272e53b5d0c22474f3aa3655af5f8dd88 diff --git a/plugins/gpu_neon/vout_sdl.c b/plugins/gpu_neon/vout_sdl.c new file mode 100644 index 00000000..f2f87e95 --- /dev/null +++ b/plugins/gpu_neon/vout_sdl.c @@ -0,0 +1,101 @@ +/* + * (C) Gražvydas "notaz" Ignotas, 2011 + * + * This work is licensed under the terms of any of these licenses + * (at your option): + * - GNU GPL, version 2 or later. + * - GNU LGPL, version 2.1 or later. + * See the COPYING file in the top-level directory. + */ + +#include +#include +#include +#include "gpu.h" + +static SDL_Surface *screen; +static Display *x11_display; + +int vout_init(void) +{ + SDL_SysWMinfo wminfo; + int ret; + + ret = SDL_Init(SDL_INIT_VIDEO); + if (ret != 0) { + fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError()); + return ret; + } + + screen = SDL_SetVideoMode(1024, 512, 32, 0); + if (screen == NULL) { + fprintf(stderr, "SDL_SetVideoMode failed: %s\n", SDL_GetError()); + SDL_Quit(); + return -1; + } + + SDL_VERSION(&wminfo.version); + ret = SDL_GetWMInfo(&wminfo); + if (ret == 1) + x11_display = wminfo.info.x11.display; + + return 0; +} + +int vout_finish(void) +{ + SDL_Quit(); + return 0; +} + +static void blit(void) +{ + uint32_t *d; + int i; + + SDL_LockSurface(screen); + if (gpu.status.rgb24) + { + uint8_t *s; + int y; + for (y = 0; y < 512; y++) { + s = (uint8_t *)gpu.vram + y * 2*1024; + d = (uint32_t *)screen->pixels + y * 1024; + for (i = 0; i < 1024 * 2 / 3; i++, s += 3) + d[i] = (s[0] << 16) | (s[1] << 8) | s[2]; + } + } + else + { + uint16_t *s = gpu.vram; + d = screen->pixels; + for (i = 0; i < 1024 * 512; i++) + d[i] = (((uint32_t)s[i] << 19) & 0xf80000) | ((s[i] << 6) & 0xf800) | + ((s[i] >> 7) & 0xf8); + } + SDL_UnlockSurface(screen); + SDL_UpdateRect(screen, 0, 0, 1024, 512); +} + +void GPUupdateLace(void) +{ + if (!gpu.status.blanking) + blit(); +} + +long GPUopen(void **dpy) +{ + *dpy = x11_display; + return 0; +} + +long GPUclose(void) +{ + return 0; +} + +void GPUrearmedCallbacks(const void *cbs_) +{ +} + +// vim:shiftwidth=2:expandtab