mirror of
https://github.com/libretro/RetroArch
synced 2025-02-09 00:40:09 +00:00
Merge branch 'master' of https://github.com/libretro/RetroArch
This commit is contained in:
commit
a54d0e6336
@ -348,11 +348,11 @@ static void *v4l_init(const char *device, uint64_t caps,
|
||||
goto error;
|
||||
}
|
||||
|
||||
v4l->scaler.in_width = v4l->scaler.out_width = v4l->width;
|
||||
v4l->scaler.in_height = v4l->scaler.out_height = v4l->height;
|
||||
v4l->scaler.in_fmt = SCALER_FMT_YUYV;
|
||||
v4l->scaler.out_fmt = SCALER_FMT_ARGB8888;
|
||||
v4l->scaler.in_stride = v4l->pitch;
|
||||
v4l->scaler.in_width = v4l->scaler.out_width = v4l->width;
|
||||
v4l->scaler.in_height = v4l->scaler.out_height = v4l->height;
|
||||
v4l->scaler.in_fmt = SCALER_FMT_YUYV;
|
||||
v4l->scaler.out_fmt = SCALER_FMT_ARGB8888;
|
||||
v4l->scaler.in_stride = v4l->pitch;
|
||||
v4l->scaler.out_stride = v4l->width * 4;
|
||||
|
||||
if (!scaler_ctx_gen_filter(&v4l->scaler))
|
||||
|
@ -315,8 +315,10 @@ void scaler_ctx_scale(struct scaler_ctx *ctx,
|
||||
else
|
||||
{
|
||||
/* Take generic filter path. */
|
||||
ctx->scaler_horiz(ctx, input_frame, input_stride);
|
||||
ctx->scaler_vert (ctx, output, output_stride);
|
||||
if (ctx->scaler_horiz)
|
||||
ctx->scaler_horiz(ctx, input_frame, input_stride);
|
||||
if (ctx->scaler_vert)
|
||||
ctx->scaler_vert (ctx, output, output_stride);
|
||||
}
|
||||
|
||||
if (ctx->out_fmt != SCALER_FMT_ARGB8888)
|
||||
@ -324,4 +326,3 @@ void scaler_ctx_scale(struct scaler_ctx *ctx,
|
||||
ctx->out_width, ctx->out_height,
|
||||
ctx->out_stride, ctx->output.stride);
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,65 @@
|
||||
#include "netplay.h"
|
||||
#endif
|
||||
|
||||
static void video_frame_scale(const void *data,
|
||||
unsigned width, unsigned height,
|
||||
size_t pitch)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(video_frame_conv);
|
||||
|
||||
if (!data)
|
||||
return;
|
||||
if (data == RETRO_HW_FRAME_BUFFER_VALID)
|
||||
return;
|
||||
|
||||
RARCH_PERFORMANCE_START(video_frame_conv);
|
||||
|
||||
driver.scaler.in_width = width;
|
||||
driver.scaler.in_height = height;
|
||||
driver.scaler.out_width = width;
|
||||
driver.scaler.out_height = height;
|
||||
driver.scaler.in_stride = pitch;
|
||||
driver.scaler.out_stride = width * sizeof(uint16_t);
|
||||
|
||||
scaler_ctx_scale(&driver.scaler, driver.scaler_out, data);
|
||||
|
||||
data = driver.scaler_out;
|
||||
pitch = driver.scaler.out_stride;
|
||||
|
||||
RARCH_PERFORMANCE_STOP(video_frame_conv);
|
||||
}
|
||||
|
||||
static void video_frame_filter(const void *data,
|
||||
unsigned width, unsigned height,
|
||||
size_t pitch)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(softfilter_process);
|
||||
unsigned owidth = 0, oheight = 0, opitch = 0;
|
||||
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
rarch_softfilter_get_output_size(g_extern.filter.filter,
|
||||
&owidth, &oheight, width, height);
|
||||
|
||||
opitch = owidth * g_extern.filter.out_bpp;
|
||||
|
||||
RARCH_PERFORMANCE_START(softfilter_process);
|
||||
rarch_softfilter_process(g_extern.filter.filter,
|
||||
g_extern.filter.buffer, opitch,
|
||||
data, width, height, pitch);
|
||||
RARCH_PERFORMANCE_STOP(softfilter_process);
|
||||
|
||||
if (driver.recording_data && g_settings.video.post_filter_record)
|
||||
rarch_recording_dump_frame(g_extern.filter.buffer,
|
||||
owidth, oheight, opitch);
|
||||
|
||||
data = g_extern.filter.buffer;
|
||||
width = owidth;
|
||||
height = oheight;
|
||||
pitch = opitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* video_frame:
|
||||
* @data : pointer to data of the video frame.
|
||||
@ -58,23 +117,8 @@ static void video_frame(const void *data, unsigned width,
|
||||
g_extern.frame_cache.height = height;
|
||||
g_extern.frame_cache.pitch = pitch;
|
||||
|
||||
if (g_extern.system.pix_fmt == RETRO_PIXEL_FORMAT_0RGB1555 &&
|
||||
data && data != RETRO_HW_FRAME_BUFFER_VALID)
|
||||
{
|
||||
RARCH_PERFORMANCE_INIT(video_frame_conv);
|
||||
RARCH_PERFORMANCE_START(video_frame_conv);
|
||||
driver.scaler.in_width = width;
|
||||
driver.scaler.in_height = height;
|
||||
driver.scaler.out_width = width;
|
||||
driver.scaler.out_height = height;
|
||||
driver.scaler.in_stride = pitch;
|
||||
driver.scaler.out_stride = width * sizeof(uint16_t);
|
||||
|
||||
scaler_ctx_scale(&driver.scaler, driver.scaler_out, data);
|
||||
data = driver.scaler_out;
|
||||
pitch = driver.scaler.out_stride;
|
||||
RARCH_PERFORMANCE_STOP(video_frame_conv);
|
||||
}
|
||||
if (g_extern.system.pix_fmt == RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
video_frame_scale(data, width, height, pitch);
|
||||
|
||||
/* Slightly messy code,
|
||||
* but we really need to do processing before blocking on VSync
|
||||
@ -86,34 +130,11 @@ static void video_frame(const void *data, unsigned width,
|
||||
)
|
||||
rarch_recording_dump_frame(data, width, height, pitch);
|
||||
|
||||
msg = msg_queue_pull(g_extern.msg_queue);
|
||||
msg = msg_queue_pull(g_extern.msg_queue);
|
||||
driver.current_msg = msg;
|
||||
|
||||
if (g_extern.filter.filter && data)
|
||||
{
|
||||
unsigned owidth = 0, oheight = 0, opitch = 0;
|
||||
|
||||
rarch_softfilter_get_output_size(g_extern.filter.filter,
|
||||
&owidth, &oheight, width, height);
|
||||
|
||||
opitch = owidth * g_extern.filter.out_bpp;
|
||||
|
||||
RARCH_PERFORMANCE_INIT(softfilter_process);
|
||||
RARCH_PERFORMANCE_START(softfilter_process);
|
||||
rarch_softfilter_process(g_extern.filter.filter,
|
||||
g_extern.filter.buffer, opitch,
|
||||
data, width, height, pitch);
|
||||
RARCH_PERFORMANCE_STOP(softfilter_process);
|
||||
|
||||
if (driver.recording_data && g_settings.video.post_filter_record)
|
||||
rarch_recording_dump_frame(g_extern.filter.buffer,
|
||||
owidth, oheight, opitch);
|
||||
|
||||
data = g_extern.filter.buffer;
|
||||
width = owidth;
|
||||
height = oheight;
|
||||
pitch = opitch;
|
||||
}
|
||||
if (g_extern.filter.filter)
|
||||
video_frame_filter(data, width, height, pitch);
|
||||
|
||||
if (!driver.video->frame(driver.video_data, data, width, height, pitch, msg))
|
||||
driver.video_active = false;
|
||||
|
60
runloop.c
60
runloop.c
@ -527,6 +527,41 @@ static int do_pre_state_checks(
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
static int do_netplay_state_checks(
|
||||
retro_input_t input, retro_input_t old_input,
|
||||
retro_input_t trigger_input)
|
||||
{
|
||||
if (BIT64_GET(trigger_input, RARCH_NETPLAY_FLIP))
|
||||
rarch_main_command(RARCH_CMD_NETPLAY_FLIP_PLAYERS);
|
||||
|
||||
if (BIT64_GET(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY))
|
||||
rarch_main_command(RARCH_CMD_FULLSCREEN_TOGGLE);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int do_pause_state_checks(
|
||||
retro_input_t input, retro_input_t old_input,
|
||||
retro_input_t trigger_input)
|
||||
{
|
||||
check_pause_func(trigger_input);
|
||||
|
||||
if (!g_extern.is_paused)
|
||||
return 0;
|
||||
|
||||
if (BIT64_GET(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY))
|
||||
{
|
||||
rarch_main_command(RARCH_CMD_FULLSCREEN_TOGGLE);
|
||||
rarch_render_cached_frame();
|
||||
}
|
||||
|
||||
if (!check_oneshot_func(trigger_input))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* do_state_checks:
|
||||
* @input : input sample for this frame
|
||||
@ -555,28 +590,13 @@ static int do_state_checks(
|
||||
|
||||
#ifdef HAVE_NETPLAY
|
||||
if (driver.netplay_data)
|
||||
{
|
||||
if (BIT64_GET(trigger_input, RARCH_NETPLAY_FLIP))
|
||||
rarch_main_command(RARCH_CMD_NETPLAY_FLIP_PLAYERS);
|
||||
|
||||
if (BIT64_GET(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY))
|
||||
rarch_main_command(RARCH_CMD_FULLSCREEN_TOGGLE);
|
||||
return 0;
|
||||
}
|
||||
return do_netplay_state_checks(input,
|
||||
old_input, trigger_input);
|
||||
#endif
|
||||
check_pause_func(trigger_input);
|
||||
|
||||
if (g_extern.is_paused)
|
||||
{
|
||||
if (BIT64_GET(trigger_input, RARCH_FULLSCREEN_TOGGLE_KEY))
|
||||
{
|
||||
rarch_main_command(RARCH_CMD_FULLSCREEN_TOGGLE);
|
||||
rarch_render_cached_frame();
|
||||
}
|
||||
|
||||
if (!check_oneshot_func(trigger_input))
|
||||
return 1;
|
||||
}
|
||||
if (do_pause_state_checks(input, old_input,
|
||||
trigger_input))
|
||||
return 1;
|
||||
|
||||
check_fast_forward_button_func(input, old_input, trigger_input);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user