mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 15:40:44 +00:00
DISPMANX: implement pitch alignment for better videocore blitting performance
This commit is contained in:
parent
8640522073
commit
869a050a18
@ -239,8 +239,9 @@ static void dispmanx_surface_setup(void *data, int src_width, int src_height,
|
||||
/* Setup surface parameters */
|
||||
surface->numpages = numpages;
|
||||
/* We receive the pitch for what we consider "useful info",
|
||||
* excluding things that are between scanlines. */
|
||||
surface->pitch = visible_pitch;
|
||||
* excluding things that are between scanlines.
|
||||
* Then we align it to 16 pixels (not bytes) for performance reasons. */
|
||||
surface->pitch = ALIGN_UP(visible_pitch, (pixformat == VC_IMAGE_XRGB8888 ? 64 : 32));
|
||||
|
||||
/* Transparency disabled */
|
||||
surface->alpha.flags = DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS;
|
||||
@ -262,7 +263,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);
|
||||
|
||||
|
||||
dst_width = _dispvars->dispmanx_height * aspect;
|
||||
dst_height = _dispvars->dispmanx_height;
|
||||
|
||||
@ -335,17 +336,6 @@ static void dispmanx_surface_update(void *data, const void *frame,
|
||||
slock_lock(_dispvars->pending_mutex);
|
||||
_dispvars->pageflip_pending++;
|
||||
slock_unlock(_dispvars->pending_mutex);
|
||||
|
||||
if (settings->video.max_swapchain_images <= 2)
|
||||
{
|
||||
/* Wait for page flip before continuing, i.e. do not allow core to run
|
||||
* ahead. This reduces input lag, but is less forgiving performance-
|
||||
* wise. */
|
||||
slock_lock(_dispvars->pending_mutex);
|
||||
if (_dispvars->pageflip_pending > 0)
|
||||
scond_wait(_dispvars->vsync_condition, _dispvars->pending_mutex);
|
||||
slock_unlock(_dispvars->pending_mutex);
|
||||
}
|
||||
}
|
||||
|
||||
/* Enable/disable bilinear filtering. */
|
||||
@ -359,17 +349,16 @@ static void dispmanx_set_scaling (bool bilinear_filter)
|
||||
|
||||
static void dispmanx_blank_console (void *data)
|
||||
{
|
||||
/* Note that a 2-pixels array is needed to accomplish console blanking because with 1-pixel
|
||||
* only the write data function doesn't work well, so when we do the only resource
|
||||
* change in the surface update function, we will be seeing a distorted console. */
|
||||
/* Since pitch will be aligned to 16 pixels (not bytes) we use a
|
||||
* 16 pixels image to save the alignment */
|
||||
struct dispmanx_video *_dispvars = data;
|
||||
uint16_t image[2] = {0x0000, 0x0000};
|
||||
uint16_t image[16] = {0x0000};
|
||||
float aspect = (float)_dispvars->dispmanx_width / (float)_dispvars->dispmanx_height;
|
||||
|
||||
dispmanx_surface_setup(_dispvars,
|
||||
2,
|
||||
2,
|
||||
4,
|
||||
16,
|
||||
1,
|
||||
32,
|
||||
16,
|
||||
VC_IMAGE_RGB565,
|
||||
255,
|
||||
|
Loading…
x
Reference in New Issue
Block a user