From: notaz Date: Wed, 18 Jul 2012 20:41:31 +0000 (+0300) Subject: gpulib: clear fb when display is blanked X-Git-Tag: r15~23 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aafcb4ddc257478d613611adcae7cb13fd716577;p=pcsx_rearmed.git gpulib: clear fb when display is blanked --- diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c index 2e954aac..17fa1ec8 100644 --- a/frontend/plugin_lib.c +++ b/frontend/plugin_lib.c @@ -116,6 +116,9 @@ void pl_print_hud(int xborder) { int w = pl_vout_w, h = pl_vout_h; + if (h < 16) + return; + if (g_opts & OPT_SHOWSPU) draw_active_chans(w, h); diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c index 79a5fa46..70847abe 100644 --- a/plugins/gpulib/gpu.c +++ b/plugins/gpulib/gpu.c @@ -601,7 +601,16 @@ void GPUupdateLace(void) flush_cmd_buffer(); renderer_flush_queues(); - if (gpu.status.blanking || !gpu.state.fb_dirty) + if (gpu.status.blanking) { + if (!gpu.state.blanked) { + vout_blank(); + gpu.state.blanked = 1; + gpu.state.fb_dirty = 1; + } + return; + } + + if (!gpu.state.fb_dirty) return; if (gpu.frameskip.set) { @@ -615,6 +624,7 @@ void GPUupdateLace(void) vout_update(); gpu.state.fb_dirty = 0; + gpu.state.blanked = 0; } void GPUvBlank(int is_vblank, int lcf) diff --git a/plugins/gpulib/gpu.h b/plugins/gpulib/gpu.h index 11bfe467..a508cdc8 100644 --- a/plugins/gpulib/gpu.h +++ b/plugins/gpulib/gpu.h @@ -66,6 +66,7 @@ struct psx_gpu { uint32_t fb_dirty:1; uint32_t old_interlace:1; uint32_t allow_interlace:2; + uint32_t blanked:1; uint32_t *frame_count; uint32_t *hcnt; /* hsync count */ struct { @@ -105,6 +106,7 @@ void renderer_set_config(const struct rearmed_cbs *config); int vout_init(void); int vout_finish(void); void vout_update(void); +void vout_blank(void); void vout_set_config(const struct rearmed_cbs *config); /* listing these here for correct linkage if rasterizer uses c++ */ diff --git a/plugins/gpulib/vout_pl.c b/plugins/gpulib/vout_pl.c index 79b6c3e6..0bd1ecf6 100644 --- a/plugins/gpulib/vout_pl.c +++ b/plugins/gpulib/vout_pl.c @@ -9,6 +9,7 @@ * See the COPYING file in the top-level directory. */ +#include #include "gpu.h" #include "cspace.h" #include "../../frontend/plugin_lib.h" @@ -52,8 +53,11 @@ static void blit(void) int fb_offs, doffs; uint8_t *dest; - fb_offs = y * 1024 + x; dest = (uint8_t *)screen_buf; + if (dest == NULL) + return; + + fb_offs = y * 1024 + x; // only do centering, at least for now doffs = (stride - w) / 2 & ~1; @@ -99,6 +103,16 @@ void vout_update(void) blit(); } +void vout_blank(void) +{ + check_mode_change(); + if (cbs->pl_vout_raw_flip == NULL) { + int bytespp = gpu.status.rgb24 ? 3 : 2; + memset(screen_buf, 0, gpu.screen.hres * gpu.screen.h * bytespp); + screen_buf = cbs->pl_vout_flip(); + } +} + long GPUopen(void **unused) { gpu.frameskip.active = 0; diff --git a/plugins/gpulib/vout_sdl.c b/plugins/gpulib/vout_sdl.c index db1ae96e..b8c4eae2 100644 --- a/plugins/gpulib/vout_sdl.c +++ b/plugins/gpulib/vout_sdl.c @@ -77,6 +77,10 @@ void vout_update(void) SDL_UpdateRect(screen, 0, 0, 1024, 512); } +void vout_blank(void) +{ +} + long GPUopen(void **dpy) { *dpy = x11_display;