gpu accelerated
This commit is contained in:
73
src/protocol.h
Normal file
73
src/protocol.h
Normal file
@@ -0,0 +1,73 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define OWB_CONFIG_MAGIC 0x4f574243u /* OWBC */
|
||||
#define OWB_COMMAND_MAGIC 0x4f574245u /* OWBE */
|
||||
#define OWB_PROTOCOL_VERSION 2u
|
||||
#define OWB_MAX_STRING (16u * 1024u * 1024u)
|
||||
#define OWB_SHARED_MAGIC 0x4f574246u /* OWBF */
|
||||
#define OWB_SHARED_FRAME_FD 198
|
||||
#define OWB_SHARED_FRAME_SLOTS 2u
|
||||
|
||||
struct owb_config_header {
|
||||
uint32_t magic;
|
||||
uint32_t version;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t fps;
|
||||
uint32_t transparent;
|
||||
uint32_t hardware_acceleration;
|
||||
uint32_t url_length;
|
||||
uint32_t css_length;
|
||||
};
|
||||
|
||||
struct owb_shared_frames {
|
||||
uint32_t magic;
|
||||
uint32_t version;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t stride;
|
||||
uint32_t slots;
|
||||
uint64_t sequence[OWB_SHARED_FRAME_SLOTS];
|
||||
uint8_t pixels[];
|
||||
};
|
||||
|
||||
static inline size_t owb_frame_size(uint32_t width, uint32_t height)
|
||||
{
|
||||
return (size_t)width * (size_t)height * 4u;
|
||||
}
|
||||
|
||||
static inline size_t owb_shared_size(uint32_t width, uint32_t height)
|
||||
{
|
||||
return sizeof(struct owb_shared_frames) +
|
||||
owb_frame_size(width, height) * OWB_SHARED_FRAME_SLOTS;
|
||||
}
|
||||
|
||||
static inline uint8_t *owb_shared_slot(struct owb_shared_frames *shared, uint32_t slot)
|
||||
{
|
||||
return shared->pixels + owb_frame_size(shared->width, shared->height) * slot;
|
||||
}
|
||||
|
||||
enum owb_command_type {
|
||||
OWB_MOUSE_MOVE = 1,
|
||||
OWB_MOUSE_CLICK = 2,
|
||||
OWB_MOUSE_WHEEL = 3,
|
||||
OWB_FOCUS = 4,
|
||||
OWB_KEY = 5,
|
||||
OWB_RELOAD = 6,
|
||||
};
|
||||
|
||||
/* Fixed-size control messages keep the renderer's nonblocking parser simple. */
|
||||
struct owb_command {
|
||||
uint32_t magic;
|
||||
uint32_t type;
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int32_t value1;
|
||||
int32_t value2;
|
||||
uint32_t modifiers;
|
||||
uint32_t text_length;
|
||||
char text[64];
|
||||
};
|
||||
Reference in New Issue
Block a user