aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotaz2012-01-21 23:22:30 +0200
committernotaz2012-01-21 23:22:30 +0200
commitbb88ec28db0535102b70a7c18ef095cb904e3c6c (patch)
tree29b8be7a70d4133266e2dba2917b8b8b3bdc30cc
parentedee4a7fc46dd881c2a45d14ce569fbfd8336516 (diff)
downloadpcsx_rearmed-bb88ec28db0535102b70a7c18ef095cb904e3c6c.tar.gz
pcsx_rearmed-bb88ec28db0535102b70a7c18ef095cb904e3c6c.tar.bz2
pcsx_rearmed-bb88ec28db0535102b70a7c18ef095cb904e3c6c.zip
gpu-gles: refactor for caanoo/wiz support
too bad it's unusable there.
-rw-r--r--Makefile.caanoo2
-rw-r--r--frontend/plat_omap.c2
-rw-r--r--frontend/plat_pollux.c3
-rw-r--r--frontend/plugin_lib.h1
-rw-r--r--plugins/gpu-gles/Makefile8
-rw-r--r--plugins/gpu-gles/gpuDraw.c43
-rw-r--r--plugins/gpu-gles/gpulib_if.c7
7 files changed, 46 insertions, 20 deletions
diff --git a/Makefile.caanoo b/Makefile.caanoo
index 5db03f3..a937f19 100644
--- a/Makefile.caanoo
+++ b/Makefile.caanoo
@@ -1,7 +1,7 @@
export ARM926=1
export ARM_CORTEXA8=0
# caanoo also covers Wiz
-PLATFORM=caanoo
+export PLATFORM=caanoo
PLAT_CLEAN = caanoo_clean
diff --git a/frontend/plat_omap.c b/frontend/plat_omap.c
index 62f198b..998e1df 100644
--- a/frontend/plat_omap.c
+++ b/frontend/plat_omap.c
@@ -177,6 +177,8 @@ void plat_init(void)
g_menuscreen_w = w;
g_menuscreen_h = h;
g_menuscreen_ptr = vout_fbdev_flip(main_fb);
+ pl_rearmed_cbs.screen_w = w;
+ pl_rearmed_cbs.screen_h = h;
w = 640;
h = 512;
diff --git a/frontend/plat_pollux.c b/frontend/plat_pollux.c
index 6247dc1..af12f1e 100644
--- a/frontend/plat_pollux.c
+++ b/frontend/plat_pollux.c
@@ -610,6 +610,9 @@ void plat_init(void)
psx_width = 320;
psx_height = 240;
psx_bpp = 16;
+
+ pl_rearmed_cbs.screen_w = 320;
+ pl_rearmed_cbs.screen_h = 240;
}
void plat_finish(void)
diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h
index e6d1f7d..e2f1d55 100644
--- a/frontend/plugin_lib.h
+++ b/frontend/plugin_lib.h
@@ -53,6 +53,7 @@ struct rearmed_cbs {
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
struct {
int allow_interlace; // 0 off, 1 on, 2 guess
} gpu_neon;
diff --git a/plugins/gpu-gles/Makefile b/plugins/gpu-gles/Makefile
index 241fad0..06552ed 100644
--- a/plugins/gpu-gles/Makefile
+++ b/plugins/gpu-gles/Makefile
@@ -8,7 +8,13 @@ SRC_STANDALONE += gpuDraw.c gpuFps.c gpuPlugin.c gpuPrim.c gpuTexture.c
SRC_GPULIB += gpulib_if.c
CFLAGS += -I$(PREFIX)include
-LDLIBS += -L$(PREFIX)lib -lGLES_CM
+LDLIBS += -L$(PREFIX)lib
+ifeq "$(PLATFORM)" "caanoo"
+CFLAGS += -DFAKE_WINDOW
+LDLIBS += -lopengles_lite -lstdc++
+else
+LDLIBS += -lGLES_CM
+endif
BIN_STANDLALONE = gpuGLES.so
BIN_GPULIB = gpu_gles.so
diff --git a/plugins/gpu-gles/gpuDraw.c b/plugins/gpu-gles/gpuDraw.c
index d7d6761..ebb3bf0 100644
--- a/plugins/gpu-gles/gpuDraw.c
+++ b/plugins/gpu-gles/gpuDraw.c
@@ -291,15 +291,17 @@ bool TestEGLError(const char* pszLocation)
EGLint iErr = eglGetError();
if (iErr != EGL_SUCCESS)
{
- printf("%s failed (%d).\n", pszLocation, iErr);
+ printf("%s failed (0x%x).\n", pszLocation, iErr);
return FALSE;
}
return TRUE;
}
-static void initEGL(void)
+static int initEGL(void)
{
+ NativeWindowType window = 0;
+
printf ("GL init\n");
EGLint numConfigs;
@@ -336,9 +338,10 @@ static void initEGL(void)
if (!x11Display)
{
printf("GLES Error: Unable to open X display\n");
+ return -1;
}
x11Screen = XDefaultScreen( x11Display );
-
+
// Gets the display parameters so we can pass the same parameters to the window to be created.
sRootWindow = RootWindow(x11Display, x11Screen);
i32Depth = DefaultDepth(x11Display, x11Screen);
@@ -347,7 +350,8 @@ static void initEGL(void)
if (!px11Visual)
{
printf("GLES Error: Unable to acquire visual\n");
- }
+ return -1;
+ }
// Colormap of the specified visual type for the display.
x11Colormap = XCreateColormap( x11Display, sRootWindow, px11Visual->visual, AllocNone );
sWA.colormap = x11Colormap;
@@ -357,7 +361,7 @@ static void initEGL(void)
// Display capabilities list.
ui32Mask = CWBackPixel | CWBorderPixel | CWEventMask | CWColormap;
-
+
// Creates the X11 window
x11Window = XCreateWindow( x11Display, RootWindow(x11Display, x11Screen), 0, 0, iResX, iResY,
0, CopyFromParent, InputOutput, CopyFromParent, ui32Mask, &sWA);
@@ -385,6 +389,7 @@ static void initEGL(void)
XSendEvent(x11Display, DefaultRootWindow(x11Display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
display = eglGetDisplay( (EGLNativeDisplayType)x11Display );
+ window = x11Window;
#else
display = eglGetDisplay( (EGLNativeDisplayType)0 );
#endif
@@ -392,40 +397,48 @@ static void initEGL(void)
if( display == EGL_NO_DISPLAY )
{
printf( "GLES EGL Error: GL No Display\n" );
+ return -1;
}
if( !eglInitialize( display, &majorVersion, &minorVersion ) )
{
printf( "GLES EGL Error: eglInitialize failed\n" );
+ return -1;
}
if( !eglChooseConfig( display, attribList, &config, 1, &numConfigs ) )
{
printf( "GLES EGL Error: eglChooseConfig failed\n" );
+ return -1;
}
context = eglCreateContext( display, config, NULL, NULL );
if( context==0 )
{
printf( "GLES EGL Error: eglCreateContext failed\n" );
+ return -1;
}
-#if defined(USE_X11)
- surface = eglCreateWindowSurface( display, config, (EGLNativeDisplayType)x11Window, NULL );
-#else
- surface = eglCreateWindowSurface( display, config, (EGLNativeDisplayType)0, NULL );
+#ifdef FAKE_WINDOW
+ // broken Caanoo libs won't accept NULL window
+ window = (NativeWindowType)1;
#endif
+ surface = eglCreateWindowSurface( display, config, window, NULL );
+ if (!TestEGLError("eglCreateWindowSurface"))
+ return -1;
+
+ eglMakeCurrent( display, surface, surface, context );
+ if (!TestEGLError("eglMakeCurrent"))
+ return -1;
- eglMakeCurrent( display, surface, surface, context );
- if (!TestEGLError("eglMakeCurrent"))
- printf("error eglMakeCurrent");
- else
- printf("GLES Window Opened\n");
+ printf("GLES init ok\n");
+ return 0;
}
int GLinitialize()
{
- initEGL();
+ if(initEGL()!=0)
+ return -1;
//----------------------------------------------------//
diff --git a/plugins/gpu-gles/gpulib_if.c b/plugins/gpu-gles/gpulib_if.c
index 569fff4..ce32aad 100644
--- a/plugins/gpu-gles/gpulib_if.c
+++ b/plugins/gpu-gles/gpulib_if.c
@@ -626,11 +626,14 @@ void vout_update(void)
}
}
+static struct rearmed_cbs *cbs;
+
long GPUopen(void **dpy)
{
int ret;
- iResX = 800; iResY = 480;
+ iResX = cbs->screen_w;
+ iResY = cbs->screen_h;
rRatioRect.left = rRatioRect.top=0;
rRatioRect.right = iResX;
rRatioRect.bottom = iResY;
@@ -657,8 +660,6 @@ long GPUclose(void)
return 0;
}
-static struct rearmed_cbs *cbs;
-
/* acting as both renderer and vout handler here .. */
void renderer_set_config(const struct rearmed_cbs *cbs_)
{