notaz.gp2x.de
/
pcsx_rearmed.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
468072a
)
attempt to make gles plugin work under RPi
author
notaz
<notasas@gmail.com>
Wed, 6 Feb 2013 01:54:04 +0000
(
03:54
+0200)
committer
notaz
<notasas@gmail.com>
Wed, 6 Feb 2013 01:54:04 +0000
(
03:54
+0200)
frontend/libpicofe
patch
|
blob
|
blame
|
history
frontend/plat_sdl.c
patch
|
blob
|
blame
|
history
frontend/plugin_lib.h
patch
|
blob
|
blame
|
history
plugins/gpu-gles/gpuDraw.c
patch
|
blob
|
blame
|
history
plugins/gpu-gles/gpuDraw.h
patch
|
blob
|
blame
|
history
plugins/gpu-gles/gpuExternals.h
patch
|
blob
|
blame
|
history
plugins/gpu-gles/gpuPlugin.c
patch
|
blob
|
blame
|
history
plugins/gpu-gles/gpuPrim.c
patch
|
blob
|
blame
|
history
plugins/gpu-gles/gpuStdafx.h
patch
|
blob
|
blame
|
history
plugins/gpu-gles/gpulib_if.c
patch
|
blob
|
blame
|
history
diff --git
a/frontend/libpicofe
b/frontend/libpicofe
index
63f173a
..
6fd0935
160000
(submodule)
--- a/
frontend/libpicofe
+++ b/
frontend/libpicofe
@@
-1
+1
@@
-Subproject commit 6
3f173a2509a27f9ae156ad6ee798d76dec0ad6b
+Subproject commit 6
fd09356f0d8c3d823f33c27b5e40041468b94b8
diff --git
a/frontend/plat_sdl.c
b/frontend/plat_sdl.c
index
e3d70f6
..
2aa199f
100644
(file)
--- a/
frontend/plat_sdl.c
+++ b/
frontend/plat_sdl.c
@@
-1,5
+1,5
@@
/*
/*
- * (C) Gražvydas "notaz" Ignotas, 2011
,2012
+ * (C) Gražvydas "notaz" Ignotas, 2011
-2013
*
* This work is licensed under the terms of any of these licenses
* (at your option):
*
* This work is licensed under the terms of any of these licenses
* (at your option):
@@
-19,6
+19,7
@@
#include "libpicofe/gl.h"
#include "../plugins/gpulib/cspace.h"
#include "plugin_lib.h"
#include "libpicofe/gl.h"
#include "../plugins/gpulib/cspace.h"
#include "plugin_lib.h"
+#include "plugin.h"
#include "main.h"
#include "plat.h"
#include "revision.h"
#include "main.h"
#include "plat.h"
#include "revision.h"
@@
-56,7
+57,7
@@
static int psx_w, psx_h;
static void *shadow_fb, *menubg_img;
static int in_menu;
static void *shadow_fb, *menubg_img;
static int in_menu;
-static int change_video_mode(
void
)
+static int change_video_mode(
int force
)
{
int w, h;
{
int w, h;
@@
-69,7
+70,17
@@
static int change_video_mode(void)
h = psx_h;
}
h = psx_h;
}
- return plat_sdl_change_video_mode(w, h, 0);
+ return plat_sdl_change_video_mode(w, h, force);
+}
+
+static void resize_cb(int w, int h)
+{
+ // used by some plugins..
+ pl_rearmed_cbs.screen_w = w;
+ pl_rearmed_cbs.screen_h = h;
+ pl_rearmed_cbs.gles_display = gl_es_display;
+ pl_rearmed_cbs.gles_surface = gl_es_surface;
+ plugin_call_rearmed_cbs();
}
static void quit_cb(void)
}
static void quit_cb(void)
@@
-77,10
+88,21
@@
static void quit_cb(void)
emu_core_ask_exit();
}
emu_core_ask_exit();
}
+static void get_layer_pos(int *x, int *y, int *w, int *h)
+{
+ // always fill entire SDL window
+ *x = *y = 0;
+ *w = pl_rearmed_cbs.screen_w;
+ *h = pl_rearmed_cbs.screen_h;
+}
+
void plat_init(void)
{
int ret;
void plat_init(void)
{
int ret;
+ plat_sdl_quit_cb = quit_cb;
+ plat_sdl_resize_cb = resize_cb;
+
ret = plat_sdl_init();
if (ret != 0)
exit(1);
ret = plat_sdl_init();
if (ret != 0)
exit(1);
@@
-98,9
+120,9
@@
void plat_init(void)
in_sdl_init(in_sdl_defbinds, plat_sdl_event_handler);
in_probe();
pl_rearmed_cbs.only_16bpp = 1;
in_sdl_init(in_sdl_defbinds, plat_sdl_event_handler);
in_probe();
pl_rearmed_cbs.only_16bpp = 1;
+ pl_rearmed_cbs.pl_get_layer_pos = get_layer_pos;
bgr_to_uyvy_init();
bgr_to_uyvy_init();
- plat_sdl_quit_cb = quit_cb;
}
void plat_finish(void)
}
void plat_finish(void)
@@
-168,7
+190,7
@@
void *plat_gvideo_set_mode(int *w, int *h, int *bpp)
{
psx_w = *w;
psx_h = *h;
{
psx_w = *w;
psx_h = *h;
- change_video_mode();
+ change_video_mode(
0
);
if (plat_sdl_overlay != NULL) {
pl_plat_clear = plat_sdl_overlay_clear;
pl_plat_blit = overlay_blit;
if (plat_sdl_overlay != NULL) {
pl_plat_clear = plat_sdl_overlay_clear;
pl_plat_blit = overlay_blit;
@@
-210,6
+232,8
@@
void plat_gvideo_close(void)
void plat_video_menu_enter(int is_rom_loaded)
{
void plat_video_menu_enter(int is_rom_loaded)
{
+ int force_mode_change = 0;
+
in_menu = 1;
/* surface will be lost, must adjust pl_vout_buf for menu bg */
in_menu = 1;
/* surface will be lost, must adjust pl_vout_buf for menu bg */
@@
-221,7
+245,11
@@
void plat_video_menu_enter(int is_rom_loaded)
memcpy(menubg_img, plat_sdl_screen->pixels, psx_w * psx_h * 2);
pl_vout_buf = menubg_img;
memcpy(menubg_img, plat_sdl_screen->pixels, psx_w * psx_h * 2);
pl_vout_buf = menubg_img;
- change_video_mode();
+ /* gles plugin messes stuff up.. */
+ if (pl_rearmed_cbs.gpu_caps & GPU_CAP_OWNS_DISPLAY)
+ force_mode_change = 1;
+
+ change_video_mode(force_mode_change);
}
void plat_video_menu_begin(void)
}
void plat_video_menu_begin(void)
diff --git
a/frontend/plugin_lib.h
b/frontend/plugin_lib.h
index
a83d954
..
4a11002
100644
(file)
--- a/
frontend/plugin_lib.h
+++ b/
frontend/plugin_lib.h
@@
-51,13
+51,15
@@
struct rearmed_cbs {
// some stats, for display by some plugins
int flips_per_sec, cpu_usage;
float vsps_cur; // currect vsync/s
// some stats, for display by some plugins
int flips_per_sec, cpu_usage;
float vsps_cur; // currect vsync/s
+ // these are for gles plugin
+ unsigned int screen_w, screen_h;
+ void *gles_display, *gles_surface;
// gpu options
int frameskip;
int fskip_advice;
unsigned int *gpu_frame_count;
unsigned int *gpu_hcnt;
unsigned int flip_cnt; // increment manually if not using pl_vout_flip
// gpu options
int frameskip;
int fskip_advice;
unsigned int *gpu_frame_count;
unsigned int *gpu_hcnt;
unsigned int flip_cnt; // increment manually if not using pl_vout_flip
- unsigned int screen_w, screen_h; // gles plugin wants this
unsigned int only_16bpp; // platform is 16bpp-only
struct {
int allow_interlace; // 0 off, 1 on, 2 guess
unsigned int only_16bpp; // platform is 16bpp-only
struct {
int allow_interlace; // 0 off, 1 on, 2 guess
diff --git
a/plugins/gpu-gles/gpuDraw.c
b/plugins/gpu-gles/gpuDraw.c
index
b619104
..
34d1c3b
100644
(file)
--- a/
plugins/gpu-gles/gpuDraw.c
+++ b/
plugins/gpu-gles/gpuDraw.c
@@
-248,9
+248,9
@@
void CreateScanLines(void)
int use_fsaa = 0;
\r
\r
EGLDisplay display;
\r
int use_fsaa = 0;
\r
\r
EGLDisplay display;
\r
-EGLConfig config;
\r
-EGLContext context;
\r
EGLSurface surface;
\r
EGLSurface surface;
\r
+static EGLConfig config;
\r
+static EGLContext context;
\r
\r
#if defined(USE_X11)
\r
#include "X11/Xlib.h"
\r
\r
#if defined(USE_X11)
\r
#include "X11/Xlib.h"
\r
@@
-435,10
+435,19
@@
static int initEGL(void)
return 0;
\r
}
\r
\r
return 0;
\r
}
\r
\r
-int GLinitialize()
\r
+static int created_gles_context;
\r
+
\r
+int GLinitialize(void *ext_gles_display, void *ext_gles_surface)
\r
{
\r
{
\r
- if(initEGL()!=0)
\r
- return -1;
\r
+ if(ext_gles_display != NULL && ext_gles_surface != NULL) {
\r
+ display = (EGLDisplay)ext_gles_display;
\r
+ surface = (EGLSurface)ext_gles_surface;
\r
+ }
\r
+ else {
\r
+ if(initEGL()!=0)
\r
+ return -1;
\r
+ created_gles_context=1;
\r
+ }
\r
\r
//----------------------------------------------------//
\r
\r
\r
//----------------------------------------------------//
\r
\r
@@
-448,7
+457,7
@@
int GLinitialize()
iResY-(rRatioRect.top+rRatioRect.bottom),
\r
rRatioRect.right,
\r
rRatioRect.bottom); glError();
\r
iResY-(rRatioRect.top+rRatioRect.bottom),
\r
rRatioRect.right,
\r
rRatioRect.bottom); glError();
\r
-
\r
+
\r
glScissor(0, 0, iResX, iResY); glError(); // init clipping (fullscreen)
\r
glEnable(GL_SCISSOR_TEST); glError();
\r
\r
glScissor(0, 0, iResX, iResY); glError(); // init clipping (fullscreen)
\r
glEnable(GL_SCISSOR_TEST); glError();
\r
\r
@@
-532,16
+541,19
@@
void GLcleanup()
{
\r
CleanupTextureStore(); // bye textures
\r
\r
{
\r
CleanupTextureStore(); // bye textures
\r
\r
- eglMakeCurrent( display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
\r
- eglDestroySurface( display, surface );
\r
- eglDestroyContext( display, context );
\r
- eglTerminate( display );
\r
+ if(created_gles_context) {
\r
+ eglMakeCurrent( display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
\r
+ eglDestroySurface( display, surface );
\r
+ eglDestroyContext( display, context );
\r
+ eglTerminate( display );
\r
\r
#if defined(USE_X11)
\r
if (x11Window) XDestroyWindow(x11Display, x11Window);
\r
if (x11Colormap) XFreeColormap( x11Display, x11Colormap );
\r
if (x11Display) XCloseDisplay(x11Display);
\r
#endif
\r
\r
#if defined(USE_X11)
\r
if (x11Window) XDestroyWindow(x11Display, x11Window);
\r
if (x11Colormap) XFreeColormap( x11Display, x11Colormap );
\r
if (x11Display) XCloseDisplay(x11Display);
\r
#endif
\r
+ created_gles_context=0;
\r
+ }
\r
}
\r
\r
////////////////////////////////////////////////////////////////////////
\r
}
\r
\r
////////////////////////////////////////////////////////////////////////
\r
diff --git
a/plugins/gpu-gles/gpuDraw.h
b/plugins/gpu-gles/gpuDraw.h
index
c59927d
..
a45bf46
100644
(file)
--- a/
plugins/gpu-gles/gpuDraw.h
+++ b/
plugins/gpu-gles/gpuDraw.h
@@
-49,7
+49,7
@@
extern "C" {
BOOL bSetupPixelFormat(HDC hDC);
\r
#endif
\r
\r
BOOL bSetupPixelFormat(HDC hDC);
\r
#endif
\r
\r
-int GLinitialize();
\r
+int GLinitialize(
void *ext_gles_display, void *ext_gles_surface
);
\r
void GLcleanup();
\r
#ifdef _WINDOWS
\r
BOOL offset2(void);
\r
void GLcleanup();
\r
#ifdef _WINDOWS
\r
BOOL offset2(void);
\r
diff --git
a/plugins/gpu-gles/gpuExternals.h
b/plugins/gpu-gles/gpuExternals.h
index
897b446
..
1260167
100644
(file)
--- a/
plugins/gpu-gles/gpuExternals.h
+++ b/
plugins/gpu-gles/gpuExternals.h
@@
-41,6
+41,10
@@
extern "C" {
#include <GLES/glext.h>
\r
#endif
\r
\r
#include <GLES/glext.h>
\r
#endif
\r
\r
+#ifndef GL_BGRA_EXT
\r
+#define GL_BGRA_EXT GL_RGBA // ??
\r
+#endif
\r
+
\r
#ifdef __NANOGL__
\r
#define glTexParameteri(x,y,z) glTexParameterf(x,y,z)
\r
#define glAlphaFuncx(x,y) glAlphaFunc(x,y)
\r
#ifdef __NANOGL__
\r
#define glTexParameteri(x,y,z) glTexParameterf(x,y,z)
\r
#define glAlphaFuncx(x,y) glAlphaFunc(x,y)
\r
diff --git
a/plugins/gpu-gles/gpuPlugin.c
b/plugins/gpu-gles/gpuPlugin.c
index
9d749a5
..
60570ac
100644
(file)
--- a/
plugins/gpu-gles/gpuPlugin.c
+++ b/
plugins/gpu-gles/gpuPlugin.c
@@
-511,7
+511,7
@@
long CALLBACK GPUopen(int hwndGPU)
// lGPUstatusRet = 0x74000000;
\r
\r
// with some emus, we could do the OGL init right here... oh my
\r
// lGPUstatusRet = 0x74000000;
\r
\r
// with some emus, we could do the OGL init right here... oh my
\r
- if(bIsFirstFrame) GLinitialize();
\r
+ if(bIsFirstFrame) GLinitialize(
NULL, NULL
);
\r
\r
return 0;
\r
}
\r
\r
return 0;
\r
}
\r
@@
-1170,7
+1170,7
@@
void CALLBACK GPUwriteStatus(unsigned long gdata)
{
\r
unsigned long lCommand=(gdata>>24)&0xff;
\r
\r
{
\r
unsigned long lCommand=(gdata>>24)&0xff;
\r
\r
-if(bIsFirstFrame) GLinitialize(
);
// real ogl startup (needed by some emus)
\r
+if(bIsFirstFrame) GLinitialize(
NULL, NULL);
// real ogl startup (needed by some emus)
\r
\r
ulStatusControl[lCommand]=gdata;
\r
\r
\r
ulStatusControl[lCommand]=gdata;
\r
\r
@@
-2183,7
+2183,7
@@
unsigned long dmaMem;
unsigned char * baseAddrB;
\r
short count;unsigned int DMACommandCounter = 0;
\r
\r
unsigned char * baseAddrB;
\r
short count;unsigned int DMACommandCounter = 0;
\r
\r
-if(bIsFirstFrame) GLinitialize();
\r
+if(bIsFirstFrame) GLinitialize(
NULL, NULL
);
\r
\r
GPUIsBusy;
\r
\r
\r
GPUIsBusy;
\r
\r
diff --git
a/plugins/gpu-gles/gpuPrim.c
b/plugins/gpu-gles/gpuPrim.c
index
2f200eb
..
218ff66
100644
(file)
--- a/
plugins/gpu-gles/gpuPrim.c
+++ b/
plugins/gpu-gles/gpuPrim.c
@@
-44,9
+44,6
@@
// globals
\r
////////////////////////////////////////////////////////////////////////
\r
\r
// globals
\r
////////////////////////////////////////////////////////////////////////
\r
\r
-EGLSurface surface;
\r
-EGLDisplay display;
\r
-
\r
\r
BOOL bDrawTextured; // current active drawing states
\r
BOOL bDrawSmoothShaded;
\r
\r
BOOL bDrawTextured; // current active drawing states
\r
BOOL bDrawSmoothShaded;
\r
diff --git
a/plugins/gpu-gles/gpuStdafx.h
b/plugins/gpu-gles/gpuStdafx.h
index
69050b3
..
41051dc
100644
(file)
--- a/
plugins/gpu-gles/gpuStdafx.h
+++ b/
plugins/gpu-gles/gpuStdafx.h
@@
-82,12
+82,6
@@
extern "C" {
#define SHADETEXBIT(x) ((x>>24) & 0x1)
\r
#define SEMITRANSBIT(x) ((x>>25) & 0x1)
\r
\r
#define SHADETEXBIT(x) ((x>>24) & 0x1)
\r
#define SEMITRANSBIT(x) ((x>>25) & 0x1)
\r
\r
-#ifndef _WINDOWS
\r
-#ifndef GL_BGRA_EXT
\r
-#define GL_BGRA_EXT GL_RGBA
\r
-#endif
\r
-#endif
\r
-
\r
#if 0
\r
#define glError() { \
\r
GLenum err = glGetError(); \
\r
#if 0
\r
#define glError() { \
\r
GLenum err = glGetError(); \
\r
diff --git
a/plugins/gpu-gles/gpulib_if.c
b/plugins/gpu-gles/gpulib_if.c
index
2090553
..
1f4a23d
100644
(file)
--- a/
plugins/gpu-gles/gpulib_if.c
+++ b/
plugins/gpu-gles/gpulib_if.c
@@
-690,7
+690,7
@@
long GPUopen(void **dpy)
InitializeTextureStore(); // init texture mem
InitializeTextureStore(); // init texture mem
- ret = GLinitialize();
+ ret = GLinitialize(
cbs->gles_display, cbs->gles_surface
);
MakeDisplayLists();
is_opened = 1;
MakeDisplayLists();
is_opened = 1;
@@
-726,9
+726,16
@@
void renderer_set_config(const struct rearmed_cbs *cbs_)
bUseFastMdec = cbs->gpu_peopsgl.bUseFastMdec;
iTexGarbageCollection = cbs->gpu_peopsgl.iTexGarbageCollection;
iVRamSize = cbs->gpu_peopsgl.iVRamSize;
bUseFastMdec = cbs->gpu_peopsgl.bUseFastMdec;
iTexGarbageCollection = cbs->gpu_peopsgl.iTexGarbageCollection;
iVRamSize = cbs->gpu_peopsgl.iVRamSize;
+
if (cbs->pl_set_gpu_caps)
cbs->pl_set_gpu_caps(GPU_CAP_OWNS_DISPLAY);
if (cbs->pl_set_gpu_caps)
cbs->pl_set_gpu_caps(GPU_CAP_OWNS_DISPLAY);
+ if (is_opened && cbs->gles_display != NULL && cbs->gles_surface != NULL) {
+ // HACK..
+ GPUclose();
+ GPUopen(NULL);
+ }
+
set_vram(gpu.vram);
}
set_vram(gpu.vram);
}