From 891de78611aef955b9da69018cd0cc51da9632aa Mon Sep 17 00:00:00 2001 From: aliaspider Date: Thu, 12 Nov 2015 14:53:46 +0100 Subject: [PATCH 1/5] enable selecting a video filter when HAVE_FILTERS_BUILTIN is defined. this still requires *.filt files to work. Todo: generate the filter list from the internal soft_plugs_builtin struct. --- menu/menu_setting.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index a2f0449212..a4db56e43d 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -4515,7 +4515,6 @@ static bool setting_append_list_video_options( EVENT_CMD_VIDEO_APPLY_STATE_CHANGES); #endif -#ifndef HAVE_FILTERS_BUILTIN CONFIG_PATH( settings->video.softfilter_plugin, menu_hash_to_str(MENU_LABEL_VIDEO_FILTER), @@ -4529,7 +4528,6 @@ static bool setting_append_list_video_options( menu_settings_list_current_add_values(list, list_info, "filt"); menu_settings_list_current_add_cmd(list, list_info, EVENT_CMD_REINIT); settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_EMPTY); -#endif #ifdef _XBOX1 CONFIG_UINT( From 8cb98acbd2ace9f4db3da833393b561002290fd7 Mon Sep 17 00:00:00 2001 From: aliaspider Date: Thu, 12 Nov 2015 14:54:56 +0100 Subject: [PATCH 2/5] fix video filters when built without HAVE_THREADS. --- gfx/video_filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfx/video_filter.c b/gfx/video_filter.c index c8e2526f61..dca43bd448 100644 --- a/gfx/video_filter.c +++ b/gfx/video_filter.c @@ -216,6 +216,7 @@ static bool create_softfilter_graph(rarch_softfilter_t *filt, return false; } + filt->threads = threads; RARCH_LOG("Using %u threads for softfilter.\n", threads); filt->packets = (struct softfilter_work_packet*) @@ -231,7 +232,6 @@ static bool create_softfilter_graph(rarch_softfilter_t *filt, calloc(threads, sizeof(*filt->thread_data)); if (!filt->thread_data) return false; - filt->threads = threads; for (i = 0; i < threads; i++) { From 75b57f1567a7c758694ef0bec33902e4752ca0e6 Mon Sep 17 00:00:00 2001 From: aliaspider Date: Thu, 12 Nov 2015 14:57:26 +0100 Subject: [PATCH 3/5] (3ds) improve performance when using video filters by allocating the output buffer in linear memory. --- gfx/video_driver.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 00a96f0e45..1bdc9435f1 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -285,7 +285,11 @@ bool video_driver_set_shader(enum rarch_shader_type type, static void deinit_video_filter(void) { rarch_softfilter_free(video_state.filter.filter); +#ifdef _3DS + linearFree(video_state.filter.buffer); +#else free(video_state.filter.buffer); +#endif memset(&video_state.filter, 0, sizeof(video_state.filter)); } @@ -344,7 +348,11 @@ static void init_video_filter(enum retro_pixel_format colfmt) sizeof(uint32_t) : sizeof(uint16_t); /* TODO: Aligned output. */ +#ifdef _3DS + video_state.filter.buffer = linearMemAlign(width * height * video_state.filter.out_bpp, 0x80); +#else video_state.filter.buffer = malloc(width * height * video_state.filter.out_bpp); +#endif if (!video_state.filter.buffer) goto error; From 13699280b4409a682e9d74b21c6a482f0225211c Mon Sep 17 00:00:00 2001 From: aliaspider Date: Thu, 12 Nov 2015 15:00:53 +0100 Subject: [PATCH 4/5] (3ds) video driver: - fix frame dupes - bypass DMA for small frames. --- gfx/drivers/ctr_gfx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gfx/drivers/ctr_gfx.c b/gfx/drivers/ctr_gfx.c index 342025926d..8a2f49cedf 100644 --- a/gfx/drivers/ctr_gfx.c +++ b/gfx/drivers/ctr_gfx.c @@ -536,7 +536,8 @@ static bool ctr_frame(void* data, const void* frame, { if(((((u32)(frame)) >= 0x14000000 && ((u32)(frame)) < 0x40000000)) /* frame in linear memory */ && !((u32)frame & 0x7F) /* 128-byte aligned */ - && !((pitch) & 0xF)) /* 16-byte aligned */ + && !(pitch & 0xF) /* 16-byte aligned */ + && (pitch > 0x40)) { /* can copy the buffer directly with the GPU */ ctrGuCopyImage(false, frame, pitch / (ctr->rgb32? 4: 2), height, ctr->rgb32 ? CTRGU_RGBA8: CTRGU_RGB565, false, @@ -562,6 +563,12 @@ static bool ctr_frame(void* data, const void* frame, } + ctr->frame_coords->u = width; + ctr->frame_coords->v = height; + GSPGPU_FlushDataCache(ctr->frame_coords, sizeof(ctr_vertex_t)); + + ctrGuSetAttributeBuffersAddress(VIRT_TO_PHYS(ctr->frame_coords)); + ctrGuSetVertexShaderFloatUniform(0, (float*)&ctr->scale_vector, 1); } ctrGuSetTexture(GPU_TEXUNIT0, VIRT_TO_PHYS(ctr->texture_swizzled), ctr->texture_width, ctr->texture_height, @@ -570,13 +577,6 @@ static bool ctr_frame(void* data, const void* frame, GPU_TEXTURE_WRAP_S(GPU_CLAMP_TO_EDGE) | GPU_TEXTURE_WRAP_T(GPU_CLAMP_TO_EDGE), ctr->rgb32 ? GPU_RGBA8: GPU_RGB565); - ctr->frame_coords->u = width; - ctr->frame_coords->v = height; - GSPGPU_FlushDataCache(ctr->frame_coords, sizeof(ctr_vertex_t)); - - ctrGuSetAttributeBuffersAddress(VIRT_TO_PHYS(ctr->frame_coords)); - ctrGuSetVertexShaderFloatUniform(0, (float*)&ctr->scale_vector, 1); - /* ARGB --> RGBA */ if (ctr->rgb32) { From dfe5c33f347a9de1ac1265cafaaf1f3e949ffcbb Mon Sep 17 00:00:00 2001 From: aliaspider Date: Thu, 12 Nov 2015 15:15:40 +0100 Subject: [PATCH 5/5] (3ds) set a default video filter dir. --- frontend/drivers/platform_ctr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/drivers/platform_ctr.c b/frontend/drivers/platform_ctr.c index 6311ae5976..ba11f400cf 100644 --- a/frontend/drivers/platform_ctr.c +++ b/frontend/drivers/platform_ctr.c @@ -75,6 +75,8 @@ static void frontend_ctr_get_environment_settings(int *argc, char *argv[], "playlists", sizeof(g_defaults.dir.playlist)); fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.port, "remaps", sizeof(g_defaults.dir.remap)); + fill_pathname_join(g_defaults.dir.video_filter, g_defaults.dir.port, + "filters", sizeof(g_defaults.dir.remap)); fill_pathname_join(g_defaults.path.config, g_defaults.dir.port, "retroarch.cfg", sizeof(g_defaults.path.config));