Add some fbdev refresh rate polls. Also Xv.

This commit is contained in:
Brandon Wright 2018-04-16 16:23:59 -05:00
parent 95f8205fd1
commit c4f818599c
5 changed files with 63 additions and 9 deletions

View File

@ -1129,13 +1129,23 @@ static void omap_gfx_set_texture_enable(void *data, bool state, bool full_screen
(void) full_screen;
}
static float omap_get_refresh_rate(void *data)
{
omap_video_t *vid = (omap_video_t*)data;
struct fb_var_screeninfo *s = &vid->omap->current_state->si;
return 1000000.0f / s->pixclock /
(s->xres + s->left_margin + s->right_margin + s->hsync_len) * 1000000.0f /
(s->yres + s->upper_margin + s->lower_margin + s->vsync_len);
}
static const video_poke_interface_t omap_gfx_poke_interface = {
NULL, /* set_coords */
NULL, /* set_mvp */
NULL,
NULL,
NULL,
NULL, /* get_refresh_rate */
omap_get_refresh_rate,
NULL, /* set_filtering */
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */

View File

@ -109,6 +109,7 @@ typedef struct
uint32_t framebuffer_size; /* total size of the framebuffer */
int framebuffer_height;/* virtual vertical resolution */
uint32_t gfx_layer_size; /* the size of the primary layer */
float refresh_rate;
/* Layers support */
int gfx_layer_id;
@ -416,6 +417,9 @@ static sunxi_disp_t *sunxi_disp_init(const char *device)
ctx->framebuffer_height = ctx->framebuffer_size /
(ctx->xres * ctx->bits_per_pixel / 8);
ctx->gfx_layer_size = ctx->xres * ctx->yres * fb_var.bits_per_pixel / 8;
ctx->refresh_rate = 1000000.0f / fb_var.pixclock * 1000000.0f /
(fb_var.yres + fb_var.upper_margin + fb_var.lower_margin + fb_var.vsync_len)
(fb_var.xres + fb_var.left_margin + fb_var.right_margin + fb_var.hsync_len);
if (ctx->framebuffer_size < ctx->gfx_layer_size)
{
@ -931,6 +935,13 @@ static void sunxi_set_aspect_ratio (void *data, unsigned aspect_ratio_idx)
}
}
static float sunxi_get_refresh_rate (void *data)
{
struct sunxi_video *_dispvars = (struct sunxi_video*)data;
return _dispvars->sunxi_disp->refresh_rate;
}
static const video_poke_interface_t sunxi_poke_interface = {
NULL, /* set_coords */
NULL, /* set_mvp */

View File

@ -203,18 +203,13 @@ static void xshm_grab_mouse_toggle(void *data)
}
static float xshm_poke_get_refresh_rate(void *data)
{
return x11_get_refresh_rate(data);
}
static video_poke_interface_t xshm_video_poke_interface = {
NULL, /* set_coords */
NULL, /* set_mvp */
NULL,
NULL,
NULL,
xshm_poke_get_refresh_rate,
x11_get_refresh_rate,
xshm_poke_set_filtering,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */

View File

@ -933,11 +933,36 @@ static bool xv_read_viewport(void *data, uint8_t *buffer, bool is_idle)
return true;
}
static video_poke_interface_t xv_video_poke_interface = {
NULL,
NULL,
NULL,
NULL,
NULL,
x11_get_refresh_rate,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
};
static void xv_get_poke_interface(void *data,
const video_poke_interface_t **iface)
{
(void)data;
(void)iface;
*iface = &xv_video_poke_interface;
}
static bool xv_set_shader(void *data,

View File

@ -50,6 +50,7 @@ typedef struct
} native_window;
bool resize;
unsigned width, height;
float refresh_rate;
} mali_ctx_data_t;
static enum gfx_ctx_api mali_api = GFX_CTX_NONE;
@ -178,6 +179,11 @@ static bool gfx_ctx_mali_fbdev_set_video_mode(void *data,
mali->native_window.width = vinfo.xres;
mali->native_window.height = vinfo.yres;
mali->refresh_rate =
ctx->refresh_rate = 1000000.0f / vinfo.pixclock * 1000000.0f /
(vinfo.yres + vinfo.upper_margin + vinfo.lower_margin + vinfo.vsync_len)
(vinfo.xres + vinfo.left_margin + vinfo.right_margin + vinfo.hsync_len);
#ifdef HAVE_EGL
if (!egl_create_context(&mali->egl, attribs))
{
@ -286,6 +292,13 @@ static void gfx_ctx_mali_fbdev_set_flags(void *data, uint32_t flags)
(void)data;
}
static float gfx_ctx_mali_fbdev_get_refresh_rate(void *data)
{
mali_ctx_data_t *mali = (mali_ctx_data_t*)data;
return mali->refresh_rate;
}
const gfx_ctx_driver_t gfx_ctx_mali_fbdev = {
gfx_ctx_mali_fbdev_init,
gfx_ctx_mali_fbdev_destroy,
@ -294,7 +307,7 @@ const gfx_ctx_driver_t gfx_ctx_mali_fbdev = {
gfx_ctx_mali_fbdev_set_swap_interval,
gfx_ctx_mali_fbdev_set_video_mode,
gfx_ctx_mali_fbdev_get_video_size,
NULL, /* get_refresh_rate */
gfx_ctx_mali_fbdev_get_refresh_rate,
NULL, /* get_video_output_size */
NULL, /* get_video_output_prev */
NULL, /* get_video_output_next */