mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 04:20:28 +00:00
Minor race fix and small cleanup to dispmanx_gfx
It's unlikely it was causing issues, but another race existed in the dispmanx driver, it incremented the pending page count after sending the update request. If a context switch happened between sending the update and incrementing the page count, the vsync callback would decrement it from 0 and cause the uint to overflow. Throw in a minor C89 fix and some whitespace fixups too.
This commit is contained in:
parent
a2542590ef
commit
a1d094e64e
@ -235,7 +235,7 @@ static void dispmanx_surface_setup(void *data, int src_width, int src_height,
|
||||
struct dispmanx_surface **sp)
|
||||
{
|
||||
struct dispmanx_video *_dispvars = data;
|
||||
int i, dst_width, dst_height, dst_xpos, dst_ypos;
|
||||
int i, dst_width, dst_height, dst_xpos, dst_ypos, visible_width;
|
||||
struct dispmanx_surface *surface = NULL;
|
||||
|
||||
*sp = calloc (1, sizeof(struct dispmanx_surface));
|
||||
@ -273,7 +273,7 @@ static void dispmanx_surface_setup(void *data, int src_width, int src_height,
|
||||
|
||||
/* The "visible" width obtained from the core pitch. We blit based on
|
||||
* the "visible" width, for cores with things between scanlines. */
|
||||
int visible_width = visible_pitch / (bpp / 8);
|
||||
visible_width = visible_pitch / (bpp / 8);
|
||||
|
||||
dst_width = _dispvars->dispmanx_height * aspect;
|
||||
dst_height = _dispvars->dispmanx_height;
|
||||
@ -349,13 +349,13 @@ static void dispmanx_surface_update(void *data, const void *frame,
|
||||
vc_dispmanx_element_change_source(_dispvars->update, surface->element,
|
||||
surface->next_page->resource);
|
||||
|
||||
vc_dispmanx_update_submit(_dispvars->update,
|
||||
dispmanx_vsync_callback, (void*)(surface->next_page));
|
||||
|
||||
slock_lock(_dispvars->pending_mutex);
|
||||
_dispvars->pageflip_pending++;
|
||||
slock_unlock(_dispvars->pending_mutex);
|
||||
|
||||
vc_dispmanx_update_submit(_dispvars->update,
|
||||
dispmanx_vsync_callback, (void*)(surface->next_page));
|
||||
|
||||
/* Get the next page ready for our next surface_update re-entry.
|
||||
* It's OK to wait now that we've issued the flip to the last produced frame! */
|
||||
surface->next_page = dispmanx_get_free_page(_dispvars, surface);
|
||||
@ -364,10 +364,10 @@ static void dispmanx_surface_update(void *data, const void *frame,
|
||||
/* Enable/disable bilinear filtering. */
|
||||
static void dispmanx_set_scaling (bool bilinear_filter)
|
||||
{
|
||||
if (bilinear_filter)
|
||||
vc_gencmd_send( "%s", "scaling_kernel 0 -2 -6 -8 -10 -8 -3 2 18 50 82 119 155 187 213 227 227 213 187 155 119 82 50 18 2 -3 -8 -10 -8 -6 -2 0 0");
|
||||
else
|
||||
vc_gencmd_send( "%s", "scaling_kernel 0 0 0 0 0 0 0 0 1 1 1 1 255 255 255 255 255 255 255 255 1 1 1 1 0 0 0 0 0 0 0 0 1");
|
||||
if (bilinear_filter)
|
||||
vc_gencmd_send("%s", "scaling_kernel 0 -2 -6 -8 -10 -8 -3 2 18 50 82 119 155 187 213 227 227 213 187 155 119 82 50 18 2 -3 -8 -10 -8 -6 -2 0 0");
|
||||
else
|
||||
vc_gencmd_send("%s", "scaling_kernel 0 0 0 0 0 0 0 0 1 1 1 1 255 255 255 255 255 255 255 255 1 1 1 1 0 0 0 0 0 0 0 0 1");
|
||||
}
|
||||
|
||||
static void dispmanx_blank_console (void *data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user