diff options
author | notaz | 2012-10-29 01:08:35 +0200 |
---|---|---|
committer | notaz | 2012-11-02 03:03:39 +0200 |
commit | fa56d36096cd4ab2b227ce2aa61c8404b8874689 (patch) | |
tree | 21fafd8723022995c1ec9e00914cd1478a3d0476 /frontend | |
parent | b7569147823a8fc5a9de98e5d491da906e119296 (diff) | |
download | pcsx_rearmed-fa56d36096cd4ab2b227ce2aa61c8404b8874689.tar.gz pcsx_rearmed-fa56d36096cd4ab2b227ce2aa61c8404b8874689.tar.bz2 pcsx_rearmed-fa56d36096cd4ab2b227ce2aa61c8404b8874689.zip |
move blit to core, allow filtering while blitting
also adds libpicofe to pull filters from, and filter related UI stuff
Diffstat (limited to 'frontend')
m--------- | frontend/libpicofe | 0 | ||||
-rw-r--r-- | frontend/libretro.c | 43 | ||||
-rw-r--r-- | frontend/main.c | 9 | ||||
-rw-r--r-- | frontend/main.h | 2 | ||||
-rw-r--r-- | frontend/menu.c | 27 | ||||
-rw-r--r-- | frontend/menu.h | 8 | ||||
-rw-r--r-- | frontend/plat_pandora.c | 2 | ||||
-rw-r--r-- | frontend/plat_pollux.c | 33 | ||||
-rw-r--r-- | frontend/plugin_lib.c | 219 | ||||
-rw-r--r-- | frontend/plugin_lib.h | 19 |
10 files changed, 291 insertions, 71 deletions
diff --git a/frontend/libpicofe b/frontend/libpicofe new file mode 160000 +Subproject 6ce097ba2f3cd1c269bacd032b775b6d296433f diff --git a/frontend/libretro.c b/frontend/libretro.c index 9bbea5b..d1cb400 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -13,6 +13,7 @@ #include "../libpcsxcore/psxcounters.h" #include "../libpcsxcore/new_dynarec/new_dynarec.h" #include "../plugins/dfsound/out.h" +#include "../plugins/gpulib/cspace.h" #include "main.h" #include "plugin.h" #include "plugin_lib.h" @@ -26,7 +27,6 @@ static retro_environment_t environ_cb; static retro_audio_sample_batch_t audio_batch_cb; static void *vout_buf; -static int vout_width, vout_height; static int samples_sent, samples_to_send; static int plugins_opened; @@ -41,11 +41,8 @@ static int vout_open(void) return 0; } -static void *vout_set_mode(int w, int h, int bpp) +static void vout_set_mode(int w, int h, int bpp) { - vout_width = w; - vout_height = h; - return vout_buf; } /* FIXME: either teach PCSX to blit to RGB1555 or RetroArch to support RGB565 */ @@ -59,13 +56,39 @@ static void convert(void *buf, size_t bytes) } } -static void *vout_flip(void) +static void vout_flip(const void *vram, int stride, int bgr24, int w, int h) { - pl_rearmed_cbs.flip_cnt++; - convert(vout_buf, vout_width * vout_height * 2); - video_cb(vout_buf, vout_width, vout_height, vout_width * 2); + unsigned short *dest = vout_buf; + const unsigned short *src = vram; + int dstride = w, h1 = h; + + if (vram == NULL) { + // blanking + memset(pl_vout_buf, 0, dstride * h * 2); + goto out; + } + + if (bgr24) + { + // XXX: could we switch to RETRO_PIXEL_FORMAT_XRGB8888 here? + for (; h1-- > 0; dest += dstride, src += stride) + { + bgr888_to_rgb565(dest, src, w * 3); + } + } + else + { + for (; h1-- > 0; dest += dstride, src += stride) + { + bgr555_to_rgb565(dest, src, w * 2); + } + } + - return vout_buf; +out: + convert(vout_buf, w * h * 2); + video_cb(vout_buf, w, h, w * 2); + pl_rearmed_cbs.flip_cnt++; } static void vout_close(void) diff --git a/frontend/main.c b/frontend/main.c index 7c15cb0..56b5cb7 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -232,10 +232,13 @@ do_state_slot: pl_rearmed_cbs.frameskip == 0 ? "OFF" : "1" ); plugin_call_rearmed_cbs(); break; - case SACTION_TOGGLE_RENDERER: - pl_rearmed_cbs.gpu_neon.enhancement_enable = - !pl_rearmed_cbs.gpu_neon.enhancement_enable; + case SACTION_SWITCH_DISPMODE: + pl_switch_dispmode(); plugin_call_rearmed_cbs(); + if (GPU_open != NULL && GPU_close != NULL) { + GPU_close(); + GPU_open(&gpuDisp, "PCSX", NULL); + } break; case SACTION_SCREENSHOT: { diff --git a/frontend/main.h b/frontend/main.h index 56e1e73..a03db8b 100644 --- a/frontend/main.h +++ b/frontend/main.h @@ -65,7 +65,7 @@ enum sched_action { SACTION_NEXT_SSLOT, SACTION_PREV_SSLOT, SACTION_TOGGLE_FSKIP, - SACTION_TOGGLE_RENDERER, + SACTION_SWITCH_DISPMODE, SACTION_SCREENSHOT, SACTION_VOLUME_UP, SACTION_VOLUME_DOWN, diff --git a/frontend/menu.c b/frontend/menu.c index f0fd17c..d3ce06c 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -75,6 +75,7 @@ typedef enum MA_OPT_SCALER, MA_OPT_SCALER2, MA_OPT_FILTERING, + MA_OPT_FILTERING2, MA_OPT_SCALER_C, } menu_id; @@ -87,7 +88,7 @@ static int psx_clock; static int memcard1_sel, memcard2_sel; int g_opts, g_scaler; int soft_scaling, analog_deadzone; // for Caanoo -int filter; +int filter, soft_filter; #ifdef __ARM_ARCH_7A__ #define DEFAULT_PSX_CLOCK 57 @@ -213,6 +214,7 @@ static void menu_set_defconfig(void) frameskip = 0; analog_deadzone = 50; soft_scaling = 1; + soft_filter = 0; psx_clock = DEFAULT_PSX_CLOCK; region = 0; @@ -274,6 +276,7 @@ static const struct { CE_INTVAL(g_layer_w), CE_INTVAL(g_layer_h), CE_INTVAL(filter), + CE_INTVAL(soft_filter), CE_INTVAL(state_slot), CE_INTVAL(cpu_clock), CE_INTVAL(g_opts), @@ -663,7 +666,7 @@ me_bind_action emuctrl_actions[] = { "Next Save Slot ", 1 << SACTION_NEXT_SSLOT }, { "Toggle Frameskip ", 1 << SACTION_TOGGLE_FSKIP }, { "Take Screenshot ", 1 << SACTION_SCREENSHOT }, - { "Toggle Renderer ", 1 << SACTION_TOGGLE_RENDERER }, + { "Switch Renderer ", 1 << SACTION_SWITCH_DISPMODE }, { "Enter Menu ", 1 << SACTION_ENTER_MENU }, #ifdef __ARM_ARCH_7A__ /* XXX */ { "Minimize ", 1 << SACTION_MINIMIZE }, @@ -1032,9 +1035,15 @@ static int menu_loop_keyconfig(int id, int keys) // ------------ gfx options menu ------------ static const char *men_scaler[] = { "1x1", "scaled 4:3", "integer scaled 4:3", "fullscreen", "custom", NULL }; +static const char *men_soft_filter[] = { "None", +#ifdef __ARM_NEON__ + "scale2x", "eagle2x", +#endif + NULL }; +static const char *men_dummy[] = { NULL }; static const char h_cscaler[] = "Displays the scaler layer, you can resize it\n" "using d-pad or move it using R+d-pad"; -static const char *men_dummy[] = { NULL }; +static const char h_soft_filter[] = "Works only if game uses low resolution modes"; static int menu_loop_cscaler(int id, int keys) { @@ -1093,6 +1102,7 @@ static menu_entry e_menu_gfx_options[] = mee_enum ("Scaler", MA_OPT_SCALER, g_scaler, men_scaler), mee_onoff ("Software Scaling", MA_OPT_SCALER2, soft_scaling, 1), mee_enum ("Filter", MA_OPT_FILTERING, filter, men_dummy), + mee_enum_h ("Software Filter", MA_OPT_FILTERING2, soft_filter, men_soft_filter, h_soft_filter), // mee_onoff ("Vsync", 0, vsync, 1), mee_cust_h ("Setup custom scaler", MA_OPT_SCALER_C, menu_loop_cscaler, NULL, h_cscaler), mee_end, @@ -1121,9 +1131,13 @@ void menu_set_filter_list(void *filters) #ifdef __ARM_NEON__ -static const char h_gpu_neon[] = "Configure built-in NEON GPU plugin"; -static const char h_gpu_neon_enhanced[] = "Renders in double resolution at the cost of lower performance"; -static const char h_gpu_neon_enhanced_hack[] = "Speed hack for above option (glitches some games)"; +static const char h_gpu_neon[] = + "Configure built-in NEON GPU plugin"; +static const char h_gpu_neon_enhanced[] = + "Renders in double resolution at the cost of lower performance\n" + "(not available for high resolution games)"; +static const char h_gpu_neon_enhanced_hack[] = + "Speed hack for above option (glitches some games)"; static const char *men_gpu_interlace[] = { "Off", "On", "Auto", NULL }; static menu_entry e_menu_plugin_gpu_neon[] = @@ -2254,6 +2268,7 @@ void menu_init(void) #ifndef __ARM_ARCH_7A__ /* XXX */ me_enable(e_menu_gfx_options, MA_OPT_SCALER, 0); me_enable(e_menu_gfx_options, MA_OPT_FILTERING, 0); + me_enable(e_menu_gfx_options, MA_OPT_FILTERING2, 0); me_enable(e_menu_gfx_options, MA_OPT_SCALER_C, 0); me_enable(e_menu_keyconfig, MA_CTRL_NUBS_BTNS, 0); #else diff --git a/frontend/menu.h b/frontend/menu.h index 2062acd..221be15 100644 --- a/frontend/menu.h +++ b/frontend/menu.h @@ -22,9 +22,15 @@ enum g_scaler_opts { SCALE_CUSTOM, }; +enum g_soft_filter_opts { + SOFT_FILTER_NONE, + SOFT_FILTER_SCALE2X, + SOFT_FILTER_EAGLE2X, +}; + extern int g_opts, g_scaler; extern int soft_scaling, analog_deadzone; -extern int filter; +extern int filter, soft_filter; extern int g_menuscreen_w; extern int g_menuscreen_h; diff --git a/frontend/plat_pandora.c b/frontend/plat_pandora.c index b6447cf..b82450c 100644 --- a/frontend/plat_pandora.c +++ b/frontend/plat_pandora.c @@ -65,7 +65,7 @@ static const struct in_default_bind in_evdev_defbinds[] = { { KEY_4, IN_BINDTYPE_EMU, SACTION_NEXT_SSLOT }, { KEY_5, IN_BINDTYPE_EMU, SACTION_TOGGLE_FSKIP }, { KEY_6, IN_BINDTYPE_EMU, SACTION_SCREENSHOT }, - { KEY_7, IN_BINDTYPE_EMU, SACTION_TOGGLE_RENDERER }, + { KEY_7, IN_BINDTYPE_EMU, SACTION_SWITCH_DISPMODE }, { 0, 0, 0 } }; diff --git a/frontend/plat_pollux.c b/frontend/plat_pollux.c index 1dafb7c..52a09b1 100644 --- a/frontend/plat_pollux.c +++ b/frontend/plat_pollux.c @@ -305,12 +305,13 @@ static void spend_cycles(int loops) #define DMA_REG(x) memregl[(DMA_BASE6 + x) >> 2] /* this takes ~1.5ms, while ldm/stm ~1.95ms */ -static void raw_flip_dma(int x, int y) +static void raw_flip_dma(const void *vram, int stride, int bgr24, int w, int h) { + unsigned int pixel_offset = psx_vram - (unsigned short *)vram; unsigned int dst = fb_paddrs[fb_work_buf] + (fb_offset_y * 320 + fb_offset_x) * psx_bpp / 8; - int spsx_line = y + psx_offset_y; - int spsx_offset = (x + psx_offset_x) & 0x3f8; + int spsx_line = pixel_offset / 1024 + psx_offset_y; + int spsx_offset = (pixel_offset + psx_offset_x) & 0x3f8; int dst_stride = 320 * psx_bpp / 8; int len = psx_src_width * psx_bpp / 8; int i; @@ -344,7 +345,7 @@ static void raw_flip_dma(int x, int y) if (psx_bpp == 16) { pl_vout_buf = g_menuscreen_ptr; - pl_print_hud(fb_offset_x); + pl_print_hud(w, h, fb_offset_x); } g_menuscreen_ptr = fb_flip(); @@ -354,26 +355,24 @@ static void raw_flip_dma(int x, int y) } #define make_flip_func(name, blitfunc) \ -static void name(int x, int y) \ +static void name(const void *vram_, int stride, int bgr24, int w, int h) \ { \ - unsigned short *vram = psx_vram; \ + const unsigned short *vram = vram_; \ unsigned char *dst = (unsigned char *)g_menuscreen_ptr + \ (fb_offset_y * 320 + fb_offset_x) * psx_bpp / 8; \ - unsigned int src = (y + psx_offset_y) * 1024 + x + psx_offset_x; \ int dst_stride = 320 * psx_bpp / 8; \ int len = psx_src_width * psx_bpp / 8; \ int i; \ \ pcnt_start(PCNT_BLIT); \ \ - for (i = psx_src_height; i > 0; i--, src += psx_step * 1024, dst += dst_stride) { \ - src &= 1024*512-1; \ - blitfunc(dst, vram + src, len); \ - } \ + vram += psx_offset_y * 1024 + psx_offset_x; \ + for (i = psx_src_height; i > 0; i--, vram += psx_step * 1024, dst += dst_stride)\ + blitfunc(dst, vram, len); \ \ if (psx_bpp == 16) { \ pl_vout_buf = g_menuscreen_ptr; \ - pl_print_hud(fb_offset_x); \ + pl_print_hud(w, h, fb_offset_x); \ } \ \ g_menuscreen_ptr = fb_flip(); \ @@ -402,20 +401,20 @@ void *plat_gvideo_set_mode(int *w_, int *h_, int *bpp_) switch (w + (bpp != 16) + !soft_scaling) { case 640: - pl_rearmed_cbs.pl_vout_raw_flip = raw_flip_soft_640; + pl_rearmed_cbs.pl_vout_flip = raw_flip_soft_640; w_max = 640; break; case 512: - pl_rearmed_cbs.pl_vout_raw_flip = raw_flip_soft_512; + pl_rearmed_cbs.pl_vout_flip = raw_flip_soft_512; w_max = 512; break; case 384: case 368: - pl_rearmed_cbs.pl_vout_raw_flip = raw_flip_soft_368; + pl_rearmed_cbs.pl_vout_flip = raw_flip_soft_368; w_max = 368; break; default: - pl_rearmed_cbs.pl_vout_raw_flip = have_warm ? raw_flip_dma : raw_flip_soft; + pl_rearmed_cbs.pl_vout_flip = have_warm ? raw_flip_dma : raw_flip_soft; w_max = 320; break; } @@ -621,7 +620,7 @@ void plat_init(void) if (mixerdev == -1) perror("open(/dev/mixer)"); - pl_rearmed_cbs.pl_vout_raw_flip = have_warm ? raw_flip_dma : raw_flip_soft; + pl_rearmed_cbs.pl_vout_flip = have_warm ? raw_flip_dma : raw_flip_soft; pl_rearmed_cbs.pl_vout_set_raw_vram = pl_vout_set_raw_vram; psx_src_width = 320; diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c index 484d67b..bf213dd 100644 --- a/frontend/plugin_lib.c +++ b/frontend/plugin_lib.c @@ -27,8 +27,11 @@ #include "plat.h" #include "pcnt.h" #include "pl_gun_ts.h" +#include "libpicofe/arm/neon_scale2x.h" +#include "libpicofe/arm/neon_eagle2x.h" #include "../libpcsxcore/new_dynarec/new_dynarec.h" #include "../libpcsxcore/psemu_plugin_defs.h" +#include "../plugins/gpulib/cspace.h" int in_type1, in_type2; int in_a1[2] = { 127, 127 }, in_a2[2] = { 127, 127 }; @@ -39,6 +42,7 @@ void *tsdev; void *pl_vout_buf; int g_layer_x, g_layer_y, g_layer_w, g_layer_h; static int pl_vout_w, pl_vout_h, pl_vout_bpp; /* output display/layer */ +static int pl_vout_scale; static int psx_w, psx_h, psx_bpp; static int vsync_cnt; static int is_pal, frame_interval, frame_interval1024; @@ -114,10 +118,8 @@ static __attribute__((noinline)) void draw_active_chans(int vout_w, int vout_h) } } -void pl_print_hud(int xborder) +void pl_print_hud(int w, int h, int xborder) { - int w = pl_vout_w, h = pl_vout_h; - if (h < 16) return; @@ -185,55 +187,142 @@ static void update_layer_size(int w, int h) if (g_layer_h > g_menuscreen_h) g_layer_h = g_menuscreen_h; } -static void *pl_vout_set_mode(int w, int h, int bpp) +// XXX: this is platform specific really +static int resolution_ok(int w, int h) { + return w <= 1024 && h <= 512; +} + +static void pl_vout_set_mode(int w, int h, int bpp) +{ + int vout_w, vout_h, vout_bpp; + // special h handling, Wipeout likes to change it by 1-6 static int vsync_cnt_ms_prev; if ((unsigned int)(vsync_cnt - vsync_cnt_ms_prev) < 5*60) h = (h + 7) & ~7; vsync_cnt_ms_prev = vsync_cnt; - if (w == psx_w && h == psx_h && bpp == psx_bpp) - return pl_vout_buf; + vout_w = psx_w = w; + vout_h = psx_h = h; + vout_bpp = psx_bpp = bpp; + + pl_vout_scale = 1; +#ifdef __ARM_NEON__ + if (soft_filter) { + if (resolution_ok(w * 2, h * 2) && bpp == 16) { + vout_w *= 2; + vout_h *= 2; + pl_vout_scale = 2; + } + else { + // filter unavailable + hud_msg[0] = 0; + } + } +#endif - pl_vout_w = psx_w = w; - pl_vout_h = psx_h = h; - pl_vout_bpp = psx_bpp = bpp; + if (pl_vout_buf != NULL && vout_w == pl_vout_w && vout_h == pl_vout_h + && vout_bpp == pl_vout_bpp) + return; - update_layer_size(pl_vout_w, pl_vout_h); + update_layer_size(vout_w, vout_h); - pl_vout_buf = plat_gvideo_set_mode(&pl_vout_w, &pl_vout_h, &pl_vout_bpp); - if (pl_vout_buf == NULL && pl_rearmed_cbs.pl_vout_raw_flip == NULL) + pl_vout_buf = plat_gvideo_set_mode(&vout_w, &vout_h, &vout_bpp); + if (pl_vout_buf == NULL) fprintf(stderr, "failed to set mode %dx%d@%d\n", psx_w, psx_h, psx_bpp); + else { + pl_vout_w = vout_w; + pl_vout_h = vout_h; + pl_vout_bpp = vout_bpp; + } menu_notify_mode_change(pl_vout_w, pl_vout_h, pl_vout_bpp); - - return pl_vout_buf; } -// only used if raw flip is not defined -static void *pl_vout_flip(void) +static void pl_vout_flip(const void *vram, int stride, int bgr24, int w, int h) { - pl_rearmed_cbs.flip_cnt++; + static int doffs_old, clear_counter; + unsigned char *dest = pl_vout_buf; + const unsigned short *src = vram; + int dstride = pl_vout_w, h1 = h; + int doffs; + + if (dest == NULL) + goto out; + + if (vram == NULL) { + // blanking + memset(pl_vout_buf, 0, dstride * pl_vout_h * pl_vout_bpp / 8); + goto out; + } + + // borders + doffs = (dstride - w * pl_vout_scale) / 2 & ~1; + dest += doffs * 2; + + if (doffs > doffs_old) + clear_counter = 2; + doffs_old = doffs; + + if (clear_counter > 0) { + memset(pl_vout_buf, 0, dstride * pl_vout_h * pl_vout_bpp / 8); + clear_counter--; + } + + if (bgr24) + { + if (pl_rearmed_cbs.only_16bpp) { + for (; h1-- > 0; dest += dstride * 2, src += stride) + { + bgr888_to_rgb565(dest, src, w * 3); + } + } + else { + dest -= doffs * 2; + dest += (doffs / 8) * 24; + + for (; h1-- > 0; dest += dstride * 3, src += stride) + { + bgr888_to_rgb888(dest, src, w * 3); + } + } + } +#ifdef __ARM_NEON__ + else if (soft_filter == SOFT_FILTER_SCALE2X && pl_vout_scale == 2) + { + neon_scale2x_16_16(src, (void *)dest, w, + stride * 2, dstride * 2, h1); + } + else if (soft_filter == SOFT_FILTER_EAGLE2X && pl_vout_scale == 2) + { + neon_eagle2x_16_16(src, (void *)dest, w, + stride * 2, dstride * 2, h1); + } +#endif + else + { + for (; h1-- > 0; dest += dstride * 2, src += stride) + { + bgr555_to_rgb565(dest, src, w * 2); + } + } - if (pl_vout_buf != NULL) - pl_print_hud(0); + pl_print_hud(w * pl_vout_scale, h * pl_vout_scale, 0); +out: // let's flip now pl_vout_buf = plat_gvideo_flip(); - return pl_vout_buf; + pl_rearmed_cbs.flip_cnt++; } static int pl_vout_open(void) { struct timeval now; - int h; - // force mode update - h = psx_h; - psx_h--; - pl_vout_buf = pl_vout_set_mode(psx_w, h, psx_bpp); + // force mode update on pl_vout_set_mode() call from gpulib/vout_pl + pl_vout_buf = NULL; plat_gvideo_open(is_pal); @@ -250,6 +339,11 @@ static void pl_vout_close(void) plat_gvideo_close(); } +static void pl_set_gpu_caps(int caps) +{ + pl_rearmed_cbs.gpu_caps = caps; +} + void *pl_prepare_screenshot(int *w, int *h, int *bpp) { void *ret = plat_prepare_screenshot(w, h, bpp); @@ -263,6 +357,75 @@ void *pl_prepare_screenshot(int *w, int *h, int *bpp) return pl_vout_buf; } +/* display/redering mode switcher */ +static int dispmode_default(void) +{ + pl_rearmed_cbs.gpu_neon.enhancement_enable = 0; + soft_filter = SOFT_FILTER_NONE; + snprintf(hud_msg, sizeof(hud_msg), "default mode"); + return 1; +} + +int dispmode_doubleres(void) +{ + if (!(pl_rearmed_cbs.gpu_caps & GPU_CAP_SUPPORTS_2X) + || !resolution_ok(psx_w * 2, psx_h * 2) || psx_bpp != 16) + return 0; + + dispmode_default(); + pl_rearmed_cbs.gpu_neon.enhancement_enable = 1; + snprintf(hud_msg, sizeof(hud_msg), "double resolution"); + return 1; +} + +int dispmode_scale2x(void) +{ + if (psx_bpp != 16) + return 0; + + dispmode_default(); + soft_filter = SOFT_FILTER_SCALE2X; + snprintf(hud_msg, sizeof(hud_msg), "scale2x"); + return 1; +} + +int dispmode_eagle2x(void) +{ + if (psx_bpp != 16) + return 0; + + dispmode_default(); + soft_filter = SOFT_FILTER_EAGLE2X; + snprintf(hud_msg, sizeof(hud_msg), "eagle2x"); + return 1; +} + +static int (*dispmode_switchers[])(void) = { + dispmode_default, +#ifdef __ARM_NEON__ + dispmode_doubleres, + dispmode_scale2x, + dispmode_eagle2x, +#endif +}; + +static int dispmode_current; + +void pl_switch_dispmode(void) +{ + if (pl_rearmed_cbs.gpu_caps & GPU_CAP_OWNS_DISPLAY) + return; + + while (1) { + dispmode_current++; + if (dispmode_current >= + sizeof(dispmode_switchers) / sizeof(dispmode_switchers[0])) + dispmode_current = 0; + if (dispmode_switchers[dispmode_current]()) + break; + } +} + #ifndef MAEMO static void update_analogs(void) { @@ -501,8 +664,10 @@ struct rearmed_cbs pl_rearmed_cbs = { pl_vout_set_mode, pl_vout_flip, pl_vout_close, - pl_mmap, - pl_munmap, + + .mmap = pl_mmap, + .munmap = pl_munmap, + .pl_set_gpu_caps = pl_set_gpu_caps, }; /* watchdog */ diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h index 1701d06..332fbc2 100644 --- a/frontend/plugin_lib.h +++ b/frontend/plugin_lib.h @@ -31,7 +31,8 @@ void pl_text_out16(int x, int y, const char *texto, ...); void pl_start_watchdog(void); void *pl_prepare_screenshot(int *w, int *h, int *bpp); void pl_init(void); -void pl_print_hud(int xborder); +void pl_print_hud(int width, int height, int xborder); +void pl_switch_dispmode(void); void pl_timing_prepare(int is_pal); void pl_frame_limit(void); @@ -41,14 +42,15 @@ void pl_update_gun(int *xn, int *xres, int *y, int *in); struct rearmed_cbs { void (*pl_get_layer_pos)(int *x, int *y, int *w, int *h); int (*pl_vout_open)(void); - void *(*pl_vout_set_mode)(int w, int h, int bpp); - void *(*pl_vout_flip)(void); + void (*pl_vout_set_mode)(int w, int h, int bpp); + void (*pl_vout_flip)(const void *vram, int stride, int bgr24, + int w, int h); void (*pl_vout_close)(void); void *(*mmap)(unsigned int size); void (*munmap)(void *ptr, unsigned int size); - // these are only used by some frontends - void (*pl_vout_raw_flip)(int x, int y); + // only used by some frontends void (*pl_vout_set_raw_vram)(void *vram); + void (*pl_set_gpu_caps)(int caps); // some stats, for display by some plugins int flips_per_sec, cpu_usage; float vsps_cur; // currect vsync/s @@ -82,10 +84,17 @@ struct rearmed_cbs { int iUseMask, bOpaquePass, bAdvancedBlend, bUseFastMdec; int iVRamSize, iTexGarbageCollection; } gpu_peopsgl; + // misc + int gpu_caps; }; extern struct rearmed_cbs pl_rearmed_cbs; +enum gpu_plugin_caps { + GPU_CAP_OWNS_DISPLAY = (1 << 0), + GPU_CAP_SUPPORTS_2X = (1 << 1), +}; + #ifndef ARRAY_SIZE #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) #endif |