summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Vlad <marius.vlad@collabora.com>2025-06-07 21:25:57 +0300
committerMarius Vlad <marius.vlad0@gmail.com>2025-06-10 12:00:07 +0000
commita4494f2ea38c71fa938e2470bc8184d4f3b2cf71 (patch)
tree36353bf27ce576e50ad6d2aacd88f2caf4314528
parentc0dfeaf15665c45122039864074f7d45f6692fa0 (diff)
backend-drm: Use a local variable to store output frame rate dataHEADmain
As otherwise we might trip because the output might be not available. Fixes: cda8de1089 ("backend-drm: Count and display KMS page flips") Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
-rw-r--r--libweston/backend-drm/kms.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c
index 2096774c..5d8cb498 100644
--- a/libweston/backend-drm/kms.c
+++ b/libweston/backend-drm/kms.c
@@ -1901,6 +1901,8 @@ atomic_flip_handler(int fd, unsigned int frame, unsigned int sec,
struct drm_crtc *crtc;
struct drm_output *output;
struct timespec now;
+ float page_flips_per_timer_interval;
+ uint32_t frame_counter_interval;
uint32_t flags = WP_PRESENTATION_FEEDBACK_KIND_VSYNC |
WP_PRESENTATION_FEEDBACK_KIND_HW_COMPLETION |
WP_PRESENTATION_FEEDBACK_KIND_HW_CLOCK;
@@ -1917,6 +1919,12 @@ atomic_flip_handler(int fd, unsigned int frame, unsigned int sec,
return;
output->page_flips_counted++;
+ /* store them temporarily as drm_output_update_complete might destroy
+ * the output */
+ page_flips_per_timer_interval = output->page_flips_per_timer_interval;
+ frame_counter_interval =
+ output->backend->perf_page_flips_stats.frame_counter_interval;
+
drm_output_update_msc(output, frame);
@@ -1939,8 +1947,7 @@ atomic_flip_handler(int fd, unsigned int frame, unsigned int sec,
drm_output_update_complete(output, flags, sec, usec);
drm_debug(b, "[atomic][CRTC:%u] flip processing completed\n", crtc_id);
drm_debug(b, "[atomic][CRTC:%u] %.2f page flips computed in %d seconds\n",
- crtc_id, output->page_flips_per_timer_interval,
- output->backend->perf_page_flips_stats.frame_counter_interval);
+ crtc_id, page_flips_per_timer_interval, frame_counter_interval);
}
int