diff --git a/devices/video/videoctrl.cpp b/devices/video/videoctrl.cpp
index 780f31b..0a08284 100644
--- a/devices/video/videoctrl.cpp
+++ b/devices/video/videoctrl.cpp
@@ -84,8 +84,7 @@ void VideoCtrlBase::start_refresh_task() {
refresh_interval,
[this]() {
// assert VBL interrupt
- if (this->int_ctrl)
- this->int_ctrl->ack_int(this->irq_id, 1);
+ this->vbl_cb(1);
this->update_screen();
}
);
@@ -97,8 +96,7 @@ void VideoCtrlBase::start_refresh_task() {
refresh_interval + vbl_duration,
[this]() {
// deassert VBL interrupt
- if (this->int_ctrl)
- this->int_ctrl->ack_int(this->irq_id, 0);
+ this->vbl_cb(0);
}
);
}
diff --git a/devices/video/videoctrl.h b/devices/video/videoctrl.h
index b047eed..650c782 100644
--- a/devices/video/videoctrl.h
+++ b/devices/video/videoctrl.h
@@ -24,12 +24,12 @@ along with this program. If not, see .
#ifndef VIDEO_CTRL_H
#define VIDEO_CTRL_H
+#include
#include
#include
#include
-class InterruptCtrl;
class WindowEvent;
class VideoCtrlBase {
@@ -96,6 +96,10 @@ protected:
// interrupt suff
InterruptCtrl* int_ctrl = nullptr;
uint32_t irq_id = 0;
+ std::function vbl_cb = [this](uint8_t irq_line_state) {
+ if (this->int_ctrl)
+ this->int_ctrl->ack_int(this->irq_id, irq_line_state);
+ };
std::function convert_fb_cb;