mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
Add DRM interface for refresh rate.
This commit is contained in:
parent
64b2830889
commit
95f8205fd1
@ -168,6 +168,18 @@ void drm_setup(int fd)
|
||||
RARCH_WARN("[DRM]: Cannot find original CRTC.\n");
|
||||
}
|
||||
|
||||
float drm_get_refresh_rate(void *data)
|
||||
{
|
||||
float refresh_rate = 0.0f;
|
||||
|
||||
if (g_drm_mode)
|
||||
{
|
||||
refresh_rate = g_drm_mode->clock * 1000.0f / g_drm_mode->htotal / g_drm_mode->vtotal;
|
||||
}
|
||||
|
||||
return refresh_rate;
|
||||
}
|
||||
|
||||
void drm_free(void)
|
||||
{
|
||||
if (g_drm_encoder)
|
||||
|
@ -55,6 +55,8 @@ void drm_free(void);
|
||||
|
||||
bool drm_get_connector(int fd, video_frame_info_t *video_info);
|
||||
|
||||
float drm_get_refresh_rate(void *data);
|
||||
|
||||
static INLINE bool drm_wait_flip(int timeout)
|
||||
{
|
||||
g_drm_fds.revents = 0;
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "../font_driver.h"
|
||||
#include "../../retroarch.h"
|
||||
#include "../../verbosity.h"
|
||||
#include "../common/drm_common.h"
|
||||
|
||||
#include "drm_pixformats.h"
|
||||
|
||||
@ -683,6 +684,7 @@ static bool init_drm(void)
|
||||
* on exit in case we change it. */
|
||||
drm.orig_crtc = drmModeGetCrtc(drm.fd, drm.encoder->crtc_id);
|
||||
drm.current_mode = &(drm.orig_crtc->mode);
|
||||
g_drm_mode = drm.current_mode;
|
||||
|
||||
/* Set mode physical video mode. Not really needed, but clears TTY console. */
|
||||
struct modeset_buf buf;
|
||||
@ -969,7 +971,7 @@ static const video_poke_interface_t drm_poke_interface = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL, /* set_video_mode */
|
||||
NULL, /* get_refresh_rate */
|
||||
drm_get_refresh_rate,
|
||||
NULL, /* set_filtering */
|
||||
NULL, /* get_video_output_size */
|
||||
NULL, /* get_video_output_prev */
|
||||
@ -1012,6 +1014,8 @@ static void drm_gfx_free(void *data)
|
||||
slock_free(_drmvars->vsync_cond_mutex);
|
||||
scond_free(_drmvars->vsync_condition);
|
||||
|
||||
g_drm_mode = NULL;
|
||||
|
||||
free(_drmvars);
|
||||
}
|
||||
|
||||
|
@ -663,6 +663,7 @@ static void exynos_deinit(struct exynos_data *pdata)
|
||||
{
|
||||
drm_restore_crtc();
|
||||
|
||||
g_drm_mode = NULL;
|
||||
pdata->width = 0;
|
||||
pdata->height = 0;
|
||||
pdata->num_pages = 0;
|
||||
@ -1494,7 +1495,7 @@ static const video_poke_interface_t exynos_poke_interface = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL, /* set_video_mode */
|
||||
NULL, /* get_refresh_rate */
|
||||
drm_get_refresh_rate,
|
||||
NULL, /* set_filtering */
|
||||
NULL, /* get_video_output_size */
|
||||
NULL, /* get_video_output_prev */
|
||||
|
@ -908,7 +908,7 @@ const gfx_ctx_driver_t gfx_ctx_drm = {
|
||||
gfx_ctx_drm_swap_interval,
|
||||
gfx_ctx_drm_set_video_mode,
|
||||
gfx_ctx_drm_get_video_size,
|
||||
NULL, /* get_refresh_rate */
|
||||
drm_get_refresh_rate,
|
||||
NULL, /* get_video_output_size */
|
||||
NULL, /* get_video_output_prev */
|
||||
NULL, /* get_video_output_next */
|
||||
|
Loading…
x
Reference in New Issue
Block a user