Repaint on possible connector hotplug

This commit is contained in:
Pierre-Loup A. Griffais 2021-09-02 14:52:16 -07:00 committed by Pierre-Loup A. Griffais
parent 8782dc2cd1
commit 5d3a0eb078
4 changed files with 11 additions and 4 deletions

View file

@ -1063,15 +1063,17 @@ int drm_prepare( struct drm_t *drm, const struct Composite_t *pComposite, const
return ret;
}
void drm_poll_state( struct drm_t *drm )
bool drm_poll_state( struct drm_t *drm )
{
bool out_of_date = drm->out_of_date.exchange(false);
if ( !out_of_date )
return;
return false;
refresh_state( drm );
setup_best_connector(drm);
return true;
}
static bool drm_set_crtc( struct drm_t *drm, struct crtc *crtc )

View file

@ -127,7 +127,7 @@ extern const char *g_sOutputName;
int init_drm(struct drm_t *drm, const char *device);
int drm_commit(struct drm_t *drm, struct Composite_t *pComposite, struct VulkanPipeline_t *pPipeline );
int drm_prepare( struct drm_t *drm, const struct Composite_t *pComposite, const struct VulkanPipeline_t *pPipeline );
void drm_poll_state(struct drm_t *drm);
bool drm_poll_state(struct drm_t *drm);
uint32_t drm_fbid_from_dmabuf( struct drm_t *drm, struct wlr_buffer *buf, struct wlr_dmabuf_attributes *dma_buf );
void drm_drop_fbid( struct drm_t *drm, uint32_t fbid );
bool drm_set_connector( struct drm_t *drm, struct connector *conn );

View file

@ -3756,7 +3756,10 @@ steamcompmgr_main (int argc, char **argv)
// If our DRM state is out-of-date, refresh it. This might update
// the output size.
if ( BIsNested() == false )
drm_poll_state( &g_DRM );
{
if ( drm_poll_state( &g_DRM ) )
hasRepaint = true;
}
// Pick our width/height for this potential frame, regardless of how it might change later
// At some point we might even add proper locking so we get real updates atomically instead

View file

@ -561,6 +561,8 @@ static void kms_device_handle_change( struct wl_listener *listener, void *data )
{
g_DRM.out_of_date = true;
wl_log.infof( "Got change event for KMS device" );
nudge_steamcompmgr();
}
int wlsession_open_kms( const char *device_name ) {