From 6d1a1ac2f1100c69dd3e1084aede6646d6c48f1e Mon Sep 17 00:00:00 2001 From: notaz Date: Tue, 28 Dec 2010 18:33:34 +0200 Subject: [PATCH] move layer control to plugin/plugin_lib --- frontend/menu.c | 15 ++++++++++++--- frontend/plugin_lib.c | 16 +++++++++------- frontend/plugin_lib.h | 4 ++-- plugins/dfxvideo/draw_fb.c | 4 ++-- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/frontend/menu.c b/frontend/menu.c index 04a22faf..e46b50f9 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -1032,13 +1032,16 @@ void menu_notify_mode_change(int w, int h, int bpp) if (scaling == SCALE_1_1) { g_layer_x = 800/2 - w/2; g_layer_y = 480/2 - h/2; g_layer_w = w; g_layer_h = h; - omap_enable_layer(1); } } static void menu_leave_emu(void) { - omap_enable_layer(0); + if (GPU_close != NULL) { + int ret = GPU_close(); + if (ret) + fprintf(stderr, "Warning: GPU_close returned %d\n", ret); + } memcpy(g_menubg_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h * 2); if (ready_to_go && last_psx_bpp == 16) { @@ -1077,7 +1080,6 @@ void menu_prepare_emu(void) case SCALE_CUSTOM: break; } - omap_enable_layer(1); apply_filter(filter); apply_cpu_clock(); stop = 0; @@ -1086,6 +1088,13 @@ void menu_prepare_emu(void) // so handle them manually here if (Config.Cdda) CDR_stop(); + + if (GPU_open != NULL) { + extern unsigned long gpuDisp; + int ret = GPU_open(&gpuDisp, "PCSX", NULL); + if (ret) + fprintf(stderr, "Warning: GPU_open returned %d\n", ret); + } } void me_update_msg(const char *msg) diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c index 800a1ae4..0ca45ce6 100644 --- a/frontend/plugin_lib.c +++ b/frontend/plugin_lib.c @@ -62,12 +62,6 @@ static void print_cpu_usage(void) pl_text_out16(pl_fbdev_w - 28, pl_fbdev_h - 10, "%3d", tick_per_sec); } -int pl_fbdev_init(void) -{ - pl_fbdev_buf = vout_fbdev_flip(layer_fb); - return 0; -} - int pl_fbdev_set_mode(int w, int h, int bpp) { void *ret; @@ -103,8 +97,16 @@ void pl_fbdev_flip(void) pl_fbdev_buf = vout_fbdev_flip(layer_fb); } -void pl_fbdev_finish(void) +int pl_fbdev_open(void) +{ + pl_fbdev_buf = vout_fbdev_flip(layer_fb); + omap_enable_layer(1); + return 0; +} + +void pl_fbdev_close(void) { + omap_enable_layer(0); } static void update_input(void) diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h index a1400e93..81999a33 100644 --- a/frontend/plugin_lib.h +++ b/frontend/plugin_lib.h @@ -21,10 +21,10 @@ enum { extern void *pl_fbdev_buf; -int pl_fbdev_init(void); +int pl_fbdev_open(void); int pl_fbdev_set_mode(int w, int h, int bpp); void pl_fbdev_flip(void); -void pl_fbdev_finish(void); +void pl_fbdev_close(void); void pl_text_out16(int x, int y, const char *texto, ...); diff --git a/plugins/dfxvideo/draw_fb.c b/plugins/dfxvideo/draw_fb.c index 3e241d7a..64657bb2 100644 --- a/plugins/dfxvideo/draw_fb.c +++ b/plugins/dfxvideo/draw_fb.c @@ -137,7 +137,7 @@ unsigned long ulInitDisplay(void) iShowFPS=1; initialize(); - if (pl_fbdev_init() != 0) + if (pl_fbdev_open() != 0) return 0; return 1; /* ok */ @@ -146,7 +146,7 @@ unsigned long ulInitDisplay(void) void CloseDisplay(void) { CloseMenu(); - pl_fbdev_finish(); + pl_fbdev_close(); //WriteConfig(); } -- 2.39.2