drm_get_connector - cleanup
This commit is contained in:
parent
304cd05dc6
commit
250468a1ba
|
@ -64,11 +64,11 @@ bool drm_get_resources(int fd)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool drm_get_connector(int fd, video_frame_info_t *video_info)
|
bool drm_get_connector(int fd, unsigned monitor_index)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned monitor_index = 0;
|
unsigned monitor_index = 0;
|
||||||
unsigned monitor = MAX(video_info->monitor_index, 1);
|
unsigned monitor = MAX(monitor_index, 1);
|
||||||
|
|
||||||
/* Enumerate all connectors. */
|
/* Enumerate all connectors. */
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ void drm_setup(int fd);
|
||||||
|
|
||||||
void drm_free(void);
|
void drm_free(void);
|
||||||
|
|
||||||
bool drm_get_connector(int fd, video_frame_info_t *video_info);
|
bool drm_get_connector(int fd, unsigned monitor_index);
|
||||||
|
|
||||||
float drm_get_refresh_rate(void *data);
|
float drm_get_refresh_rate(void *data);
|
||||||
|
|
||||||
|
|
|
@ -398,8 +398,10 @@ static void *gfx_ctx_drm_init(video_frame_info_t *video_info, void *video_driver
|
||||||
const char *gpu = NULL;
|
const char *gpu = NULL;
|
||||||
struct string_list *gpu_descriptors = NULL;
|
struct string_list *gpu_descriptors = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)
|
gfx_ctx_drm_data_t *drm = (gfx_ctx_drm_data_t*)
|
||||||
calloc(1, sizeof(gfx_ctx_drm_data_t));
|
calloc(1, sizeof(gfx_ctx_drm_data_t));
|
||||||
|
unsigned video_monitor_index = settings->uints.video_monitor_index;
|
||||||
|
|
||||||
if (!drm)
|
if (!drm)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -431,7 +433,7 @@ nextgpu:
|
||||||
if (!drm_get_resources(fd))
|
if (!drm_get_resources(fd))
|
||||||
goto nextgpu;
|
goto nextgpu;
|
||||||
|
|
||||||
if (!drm_get_connector(fd, video_info))
|
if (!drm_get_connector(fd, video_monitor_index))
|
||||||
goto nextgpu;
|
goto nextgpu;
|
||||||
|
|
||||||
if (!drm_get_encoder(fd))
|
if (!drm_get_encoder(fd))
|
||||||
|
@ -442,10 +444,13 @@ nextgpu:
|
||||||
/* Choose the optimal video mode for get_video_size():
|
/* Choose the optimal video mode for get_video_size():
|
||||||
- the current video mode from the CRTC
|
- the current video mode from the CRTC
|
||||||
- otherwise pick first connector mode */
|
- otherwise pick first connector mode */
|
||||||
if (g_orig_crtc->mode_valid) {
|
if (g_orig_crtc->mode_valid)
|
||||||
|
{
|
||||||
drm->fb_width = g_orig_crtc->mode.hdisplay;
|
drm->fb_width = g_orig_crtc->mode.hdisplay;
|
||||||
drm->fb_height = g_orig_crtc->mode.vdisplay;
|
drm->fb_height = g_orig_crtc->mode.vdisplay;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
drm->fb_width = g_drm_connector->modes[0].hdisplay;
|
drm->fb_width = g_drm_connector->modes[0].hdisplay;
|
||||||
drm->fb_height = g_drm_connector->modes[0].vdisplay;
|
drm->fb_height = g_drm_connector->modes[0].vdisplay;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue