From 5d3a0eb078b00fc8df9b02aa719fe2c214e31cdc Mon Sep 17 00:00:00 2001 From: "Pierre-Loup A. Griffais" Date: Thu, 2 Sep 2021 14:52:16 -0700 Subject: [PATCH] Repaint on possible connector hotplug --- src/drm.cpp | 6 ++++-- src/drm.hpp | 2 +- src/steamcompmgr.cpp | 5 ++++- src/wlserver.cpp | 2 ++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/drm.cpp b/src/drm.cpp index a6645ab..e9f423a 100644 --- a/src/drm.cpp +++ b/src/drm.cpp @@ -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 ) diff --git a/src/drm.hpp b/src/drm.hpp index 4d4698b..5274e17 100644 --- a/src/drm.hpp +++ b/src/drm.hpp @@ -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 ); diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index 904e32e..2222dd8 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -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 diff --git a/src/wlserver.cpp b/src/wlserver.cpp index e32fc9c..16facb1 100644 --- a/src/wlserver.cpp +++ b/src/wlserver.cpp @@ -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 ) {