mirror of https://github.com/encounter/SDL.git
Fixed bug 4054 - Raspberry Pi refresh rate detection
Viacheslav Slavinsky
SDL_rpivideo driver has 60 frames per second hardcoded in it, this is a problem for games that need to keep pace using VSYNC. I believe that I have found a solution to this. It is based on code in tvservice.c in rpi userland:
a1b89e91f3/host_applications/linux/apps/tvservice/tvservice.c (L433)
This commit is contained in:
parent
11c348b4d7
commit
940933d892
|
@ -63,6 +63,23 @@ RPI_Destroy(SDL_VideoDevice * device)
|
||||||
SDL_free(device);
|
SDL_free(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
RPI_GetRefreshRate()
|
||||||
|
{
|
||||||
|
TV_DISPLAY_STATE_T tvstate;
|
||||||
|
if (vc_tv_get_display_state( &tvstate ) == 0) {
|
||||||
|
//The width/height parameters are in the same position in the union
|
||||||
|
//for HDMI and SDTV
|
||||||
|
HDMI_PROPERTY_PARAM_T property;
|
||||||
|
property.property = HDMI_PROPERTY_PIXEL_CLOCK_TYPE;
|
||||||
|
vc_tv_hdmi_get_property(&property);
|
||||||
|
return property.param1 == HDMI_PIXEL_CLOCK_TYPE_NTSC ?
|
||||||
|
tvstate.display.hdmi.frame_rate * (1000.0f/1001.0f) :
|
||||||
|
tvstate.display.hdmi.frame_rate;
|
||||||
|
}
|
||||||
|
return 60; /* Failed to get display state, default to 60 */
|
||||||
|
}
|
||||||
|
|
||||||
static SDL_VideoDevice *
|
static SDL_VideoDevice *
|
||||||
RPI_Create()
|
RPI_Create()
|
||||||
{
|
{
|
||||||
|
@ -159,8 +176,7 @@ RPI_VideoInit(_THIS)
|
||||||
|
|
||||||
current_mode.w = w;
|
current_mode.w = w;
|
||||||
current_mode.h = h;
|
current_mode.h = h;
|
||||||
/* FIXME: Is there a way to tell the actual refresh rate? */
|
current_mode.refresh_rate = RPI_GetRefreshRate();
|
||||||
current_mode.refresh_rate = 60;
|
|
||||||
/* 32 bpp for default */
|
/* 32 bpp for default */
|
||||||
current_mode.format = SDL_PIXELFORMAT_ABGR8888;
|
current_mode.format = SDL_PIXELFORMAT_ABGR8888;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue