提交 d75e9826 编写于 作者: 指向BIOS的野指针's avatar 指向BIOS的野指针

add update queue to sync

上级 73ba4457
......@@ -7,11 +7,11 @@
#include <sys/time.h>
#include <signal.h>
#include "update.hh"
#include "../includes/bsv.hh"
#include "../includes/syscfg.hh"
#include "update.hh"
extern volatile bool server_running; //服务器运行标志
extern std::map<bwl::id_t, bwl::__page *> pages; //页列表
......@@ -41,11 +41,38 @@ namespace bwl
else
updating_signal = 0;
//检查背景更新
if(__ud.__bg.sig)
if (__ud.__bg.sig)
{
update_bg();
__ud.__bg.sig = 0;
}
//检查更新鼠标
if (__ud.__mo.sig)
{
update_mo();
__ud.__mo.sig = 0;
}
}
/**
* @brief 更新刷新队列
*
*/
void update_queues()
{
//背景队列
if (!__ud.bg_update_que.empty() && !__ud.__bg.sig)
{
__ud.__bg = __ud.bg_update_que.front();
__ud.bg_update_que.pop();
}
//鼠标队列
if (!__ud.mouse_update_que.empty() && !__ud.__bg.sig)
{
__ud.__mo = __ud.mouse_update_que.front();
__ud.mouse_update_que.pop();
}
}
void updateDrmBuffer()
......@@ -55,8 +82,9 @@ namespace bwl
useconds_t itv = interval(server::getFPS()); //获取帧率并换算为每帧时间间隔
while (server_running)
{
usleep(itv); //睡眠
updater(); //更新屏幕
usleep(itv); //睡眠
update_queues(); //更新队列
updater(); //更新屏幕
}
}
};
......@@ -35,4 +35,9 @@ namespace bwl
}
}
void update_mo()
{
}
};
......@@ -4,6 +4,7 @@
#define __bwl_server
#include <iostream>
#include <queue>
namespace bwl
{
......@@ -15,14 +16,31 @@ namespace bwl
int64_t pos[2]; //更新位置
uint64_t size[2]; //更新大小
} __bg;
std::queue<bg> bg_update_que; //背景更新队列
struct mouse
{
uint8_t sig; //更新标志
int64_t pos[2]; //更新位置
uint64_t size[2]; //更新大小
} __mo;
std::queue<mouse> mouse_update_que; //鼠标更新队列
};
/**
* @brief 更新背景
*
*
*/
void update_bg();
/**
* @brief 更新鼠标
*
*/
void update_mo();
};
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册