Skip to content

Commit

Permalink
Store float refresh rate and interlaced / doublestrike attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
zoltanvb committed Jun 15, 2024
1 parent 0f5cdaf commit b90041f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gfx/display_servers/dispserv_kms.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ static void *kms_display_server_get_resolution_list(
unsigned curr_width = 0;
unsigned curr_height = 0;
unsigned curr_bpp = 0;
bool curr_interlaced = false;
bool curr_doublestrike = false;
float curr_refreshrate = 0;
unsigned curr_orientation = 0;
struct video_display_config *conf = NULL;
Expand All @@ -134,6 +136,8 @@ static void *kms_display_server_get_resolution_list(
curr_width = g_drm_mode->hdisplay;
curr_height = g_drm_mode->vdisplay;
curr_bpp = 32;
curr_interlaced = (g_drm_mode->flags | DRM_MODE_FLAG_INTERLACE) ? true : false;
curr_doublestrike = (g_drm_mode->flags | DRM_MODE_FLAG_DBLSCAN) ? true : false;
}

*len = g_drm_connector->count_modes;
Expand All @@ -147,13 +151,18 @@ static void *kms_display_server_get_resolution_list(
conf[j].height = g_drm_connector->modes[i].vdisplay;
conf[j].bpp = 32;
conf[j].refreshrate = floor(drm_calc_refresh_rate(&g_drm_connector->modes[i]));
conf[j].refreshrate_float = drm_calc_refresh_rate(&g_drm_connector->modes[i]);
conf[j].interlaced = (g_drm_connector->modes[i].flags | DRM_MODE_FLAG_INTERLACE) ? true : false;
conf[j].doublestrike = (g_drm_connector->modes[i].flags | DRM_MODE_FLAG_DBLSCAN) ? true : false;
conf[j].idx = j;
conf[j].current = false;

if ( (conf[j].width == curr_width)
&& (conf[j].height == curr_height)
&& (conf[j].bpp == curr_bpp)
&& (drm_calc_refresh_rate(&g_drm_connector->modes[i]) == curr_refreshrate)
&& (conf[j].interlaced == curr_interlaced)
&& (conf[j].doublestrike == curr_doublestrike)
)
conf[j].current = true;
j++;
Expand Down
3 changes: 3 additions & 0 deletions gfx/display_servers/dispserv_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,11 @@ static void *win32_display_server_get_resolution_list(
conf[j].height = dm.dmPelsHeight;
conf[j].bpp = dm.dmBitsPerPel;
conf[j].refreshrate = dm.dmDisplayFrequency;
conf[j].refreshrate_float = 0.0f
conf[j].idx = j;
conf[j].current = false;
conf[j].interlaced = (dm.dmDisplayFlags & DM_INTERLACED) ? true : false;
conf[j].doublestrike = false;

if ( (conf[j].width == curr_width)
&& (conf[j].height == curr_height)
Expand Down
3 changes: 3 additions & 0 deletions gfx/video_display_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ typedef struct video_display_config
unsigned refreshrate;
unsigned idx;
bool current;
bool interlaced;
bool doublestrike;
float refreshrate_float;
} video_display_config_t;

typedef struct video_display_server
Expand Down

0 comments on commit b90041f

Please sign in to comment.