mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-13 03:30:31 +00:00
videoctrl: Add VBL callback.
Allows overriding the method used to post interrupts.
This commit is contained in:
parent
cf9237f7d6
commit
5c460c9f3b
@ -84,8 +84,7 @@ void VideoCtrlBase::start_refresh_task() {
|
|||||||
refresh_interval,
|
refresh_interval,
|
||||||
[this]() {
|
[this]() {
|
||||||
// assert VBL interrupt
|
// assert VBL interrupt
|
||||||
if (this->int_ctrl)
|
this->vbl_cb(1);
|
||||||
this->int_ctrl->ack_int(this->irq_id, 1);
|
|
||||||
this->update_screen();
|
this->update_screen();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -97,8 +96,7 @@ void VideoCtrlBase::start_refresh_task() {
|
|||||||
refresh_interval + vbl_duration,
|
refresh_interval + vbl_duration,
|
||||||
[this]() {
|
[this]() {
|
||||||
// deassert VBL interrupt
|
// deassert VBL interrupt
|
||||||
if (this->int_ctrl)
|
this->vbl_cb(0);
|
||||||
this->int_ctrl->ack_int(this->irq_id, 0);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
#ifndef VIDEO_CTRL_H
|
#ifndef VIDEO_CTRL_H
|
||||||
#define VIDEO_CTRL_H
|
#define VIDEO_CTRL_H
|
||||||
|
|
||||||
|
#include <devices/common/hwinterrupt.h>
|
||||||
#include <devices/video/display.h>
|
#include <devices/video/display.h>
|
||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
class InterruptCtrl;
|
|
||||||
class WindowEvent;
|
class WindowEvent;
|
||||||
|
|
||||||
class VideoCtrlBase {
|
class VideoCtrlBase {
|
||||||
@ -96,6 +96,10 @@ protected:
|
|||||||
// interrupt suff
|
// interrupt suff
|
||||||
InterruptCtrl* int_ctrl = nullptr;
|
InterruptCtrl* int_ctrl = nullptr;
|
||||||
uint32_t irq_id = 0;
|
uint32_t irq_id = 0;
|
||||||
|
std::function<void(uint8_t irq_line_state)> 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<void(uint8_t *dst_buf, int dst_pitch)> convert_fb_cb;
|
std::function<void(uint8_t *dst_buf, int dst_pitch)> convert_fb_cb;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user