working dos vga writes!
This commit is contained in:
1 parent
5789cafd4e
commit
55ac075e4d
25 files changed
+454
-149
No files matched your search
+22
-16
@@ -126,9 +126,11 @@ static bool plr_x11_handshake(com_std_fd xfd,
|
||||
if (!com_std_write(xfd, AUTH_ENTRY_MAGIC_COOKIE,
|
||||
sizeof AUTH_ENTRY_MAGIC_COOKIE - 1))
|
||||
return false;
|
||||
/* Use 2 bytes back for padding. */
|
||||
if (!com_std_write(xfd, &auth_entry.auth_data->data[-2],
|
||||
auth_entry.auth_data->len + 2))
|
||||
/* 2 bytes padding after magic cookie. */
|
||||
if (!com_std_write(xfd, &request, 2))
|
||||
return false;
|
||||
if (!com_std_write(xfd, auth_entry.auth_data->data,
|
||||
auth_entry.auth_data->len))
|
||||
return false;
|
||||
|
||||
struct {
|
||||
@@ -293,8 +295,8 @@ static uint32_t plr_x11_create_graphical_context(com_std_fd xfd) {
|
||||
|
||||
static uint32_t plr_x11_create_window(com_std_fd xfd) {
|
||||
/* TODO: Use the ones provided in headers ? */
|
||||
#define FLAG_WIN_BG_PIXEL 2
|
||||
#define FLAG_WIN_EVENT 0x800
|
||||
#define FLAG_WIN_BG_PIXEL 0x0002
|
||||
#define FLAG_WIN_EVENT 0x0800
|
||||
#define EVENT_FLAG_EXPOSURE 0x8000
|
||||
#define EVENT_FLAG_KEY_PRESS 0x1
|
||||
#define EVENT_FLAG_KEY_RELEASE 0x2
|
||||
@@ -331,7 +333,7 @@ static uint32_t plr_x11_create_window(com_std_fd xfd) {
|
||||
.class = 1,
|
||||
.root_visual_id = plr_x11_root_screen.root_visual_id,
|
||||
.bitmask = FLAG_WIN_BG_PIXEL | FLAG_WIN_EVENT,
|
||||
.value1 = 0x00000000,
|
||||
.value1 = 0xff000000,
|
||||
.value2 = EVENT_FLAG_EXPOSURE | EVENT_FLAG_BUTTON_RELEASE |
|
||||
EVENT_FLAG_BUTTON_PRESS | EVENT_FLAG_KEY_PRESS |
|
||||
EVENT_FLAG_KEY_RELEASE,
|
||||
@@ -419,6 +421,10 @@ static uint8_t plr_x11_query_extension(com_std_fd xfd, com_str const *ext) {
|
||||
static bool plr_x11_enable_big_requests(com_std_fd xfd) {
|
||||
static com_str bigreqext = com_str_lit("BIG-REQUESTS");
|
||||
uint8_t const opcode = plr_x11_query_extension(xfd, &bigreqext);
|
||||
if (!opcode) {
|
||||
com_std_print('c', "Big request can't accommodate for framebuffer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Request the thing. */
|
||||
struct {
|
||||
@@ -439,8 +445,8 @@ static bool plr_x11_enable_big_requests(com_std_fd xfd) {
|
||||
plr_x11_poll_reply(xfd, seq, &response);
|
||||
|
||||
uint32_t const limit = *(uint32_t *)response.reply.pad;
|
||||
com_std_print('c', "Request limit: ", 'u', limit);
|
||||
if (limit < COM_CFG_FBSIZE) {
|
||||
com_std_print('c', "X11 request limit: ", 'u', limit);
|
||||
if (limit < COM_CFG_FBSIZE / 4) {
|
||||
com_std_print('c', "Big request can't accommodate for framebuffer.");
|
||||
return false;
|
||||
}
|
||||
@@ -449,7 +455,7 @@ static bool plr_x11_enable_big_requests(com_std_fd xfd) {
|
||||
}
|
||||
|
||||
static bool plr_x11_put_framebuffer(com_std_fd xfd, uint32_t gc_id,
|
||||
uint32_t pixmap_id,
|
||||
uint32_t drawable_id,
|
||||
uint8_t pixels[COM_CFG_FBSIZE]) {
|
||||
uint32_t const padded = com_bits_nalign(COM_CFG_FBSIZE, 4);
|
||||
uint32_t const seq = plr_x11_next_seqid();
|
||||
@@ -472,7 +478,7 @@ static bool plr_x11_put_framebuffer(com_std_fd xfd, uint32_t gc_id,
|
||||
.opcode = 72,
|
||||
.format = 2, // ZPixmap
|
||||
.request_length = sizeof request / 4 + padded / 4,
|
||||
.drawable_id = pixmap_id,
|
||||
.drawable_id = drawable_id,
|
||||
.gc_id = gc_id,
|
||||
.width = COM_CFG_WIDTH,
|
||||
.height = COM_CFG_HEIGHT,
|
||||
@@ -600,11 +606,11 @@ extern int plr_display_x11_main(int argc, char const *const *argv) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t const fb = plr_x11_create_pixmap(xfd, win);
|
||||
if (!fb) {
|
||||
com_std_print('c', "Failure to initialize X11");
|
||||
return -1;
|
||||
}
|
||||
// uint32_t const fb = plr_x11_create_pixmap(xfd, win);
|
||||
// if (!fb) {
|
||||
// com_std_print('c', "Failure to initialize X11");
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
// Display *display = XOpenDisplay(NULL);
|
||||
// if (NULL == display) {
|
||||
@@ -704,7 +710,7 @@ extern int plr_display_x11_main(int argc, char const *const *argv) {
|
||||
uint8_t *fbm = plr_draw_get_pixel_buffer();
|
||||
plr_draw_screen(fbm);
|
||||
|
||||
if (!plr_x11_put_framebuffer(xfd, gc, fb, fbm)) {
|
||||
if (!plr_x11_put_framebuffer(xfd, gc, win, fbm)) {
|
||||
com_std_print('c', "Failure to drive X11");
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user