drm: add drm_set_resolution
Allows to easily switch the output resolution.
This commit is contained in:
parent
d67ce2865e
commit
590d7129aa
2 changed files with 13 additions and 0 deletions
12
src/drm.cpp
12
src/drm.cpp
|
@ -1045,3 +1045,15 @@ bool drm_set_refresh( struct drm_t *drm, int refresh )
|
|||
|
||||
return drm_set_mode(drm, &mode);
|
||||
}
|
||||
|
||||
bool drm_set_resolution( struct drm_t *drm, int width, int height )
|
||||
{
|
||||
drmModeConnector *connector = drm->connector->connector;
|
||||
const drmModeModeInfo *mode = get_matching_mode(connector, width, height, 0);
|
||||
if ( !mode )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return drm_set_mode(drm, mode);
|
||||
}
|
||||
|
|
|
@ -124,3 +124,4 @@ uint32_t drm_fbid_from_dmabuf( struct drm_t *drm, struct wlr_buffer *buf, struct
|
|||
void drm_drop_fbid( struct drm_t *drm, uint32_t fbid );
|
||||
bool drm_set_mode( struct drm_t *drm, const drmModeModeInfo *mode );
|
||||
bool drm_set_refresh( struct drm_t *drm, int refresh );
|
||||
bool drm_set_resolution( struct drm_t *drm, int width, int height );
|
||||
|
|
Loading…
Reference in a new issue