fix bugs
This commit is contained in:
parent
a7de7db3d4
commit
b592832c0a
4 changed files with 16 additions and 11 deletions
8
input.c
8
input.c
|
@ -130,7 +130,7 @@ void rfb_key_hook(rfbBool down, rfbKeySym keysym, rfbClientPtr cl)
|
|||
};
|
||||
for (int i = 0; i < KMSVNC_ARRAY_ELEMENTS(ies); i++)
|
||||
{
|
||||
write(kmsvnc->input->uinput_fd, &ies[i], sizeof(ies[0]));
|
||||
KMSVNC_WRITE_MAY(kmsvnc->input->uinput_fd, &ies[i], sizeof(ies[0]));
|
||||
}
|
||||
|
||||
kmsvnc->input->keystate[search.keycode] = down;
|
||||
|
@ -175,7 +175,7 @@ void rfb_ptr_hook(int mask, int screen_x, int screen_y, rfbClientPtr cl)
|
|||
};
|
||||
for (int i = 0; i < KMSVNC_ARRAY_ELEMENTS(ies1); i++)
|
||||
{
|
||||
write(kmsvnc->input->uinput_fd, &ies1[i], sizeof(ies1[0]));
|
||||
KMSVNC_WRITE_MAY(kmsvnc->input->uinput_fd, &ies1[i], sizeof(ies1[0]));
|
||||
}
|
||||
if (mask & 0b11000)
|
||||
{
|
||||
|
@ -193,7 +193,7 @@ void rfb_ptr_hook(int mask, int screen_x, int screen_y, rfbClientPtr cl)
|
|||
};
|
||||
for (int i = 0; i < KMSVNC_ARRAY_ELEMENTS(ies2); i++)
|
||||
{
|
||||
write(kmsvnc->input->uinput_fd, &ies2[i], sizeof(ies2[0]));
|
||||
KMSVNC_WRITE_MAY(kmsvnc->input->uinput_fd, &ies2[i], sizeof(ies2[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -224,6 +224,6 @@ static void wake_system_up()
|
|||
};
|
||||
for (int i = 0; i < KMSVNC_ARRAY_ELEMENTS(ies1); i++)
|
||||
{
|
||||
write(kmsvnc->input->uinput_fd, &ies1[i], sizeof(ies1[0]));
|
||||
KMSVNC_WRITE_MAY(kmsvnc->input->uinput_fd, &ies1[i], sizeof(ies1[0]));
|
||||
}
|
||||
}
|
||||
|
|
3
kmsvnc.c
3
kmsvnc.c
|
@ -212,6 +212,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
|||
else {
|
||||
kmsvnc->va_derive_enabled = 0;
|
||||
}
|
||||
break;
|
||||
case 'w':
|
||||
kmsvnc->input_wakeup = 1;
|
||||
break;
|
||||
|
@ -289,7 +290,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
if (wfd > 0) {
|
||||
if (kmsvnc->va) va_hwframe_to_vaapi(kmsvnc->drm->mapped);
|
||||
write(wfd, kmsvnc->drm->mapped, max_size);
|
||||
KMSVNC_WRITE_MAY(wfd, kmsvnc->drm->mapped, (ssize_t)max_size);
|
||||
fsync(wfd);
|
||||
printf("wrote raw frame buffer to %s\n", kmsvnc->debug_capture_fb);
|
||||
}
|
||||
|
|
1
kmsvnc.h
1
kmsvnc.h
|
@ -111,3 +111,4 @@ struct kmsvnc_va_data
|
|||
#define KMSVNC_FATAL(...) do{ fprintf(stderr, __VA_ARGS__); return 1; } while(0)
|
||||
#define KMSVNC_ARRAY_ELEMENTS(x) (sizeof(x) / sizeof(x[0]))
|
||||
#define KMSVNC_FOURCC_TO_INT(a,b,c,d) (((a) << 0) + ((b) << 8) + ((c) << 16) + ((d) << 24))
|
||||
#define KMSVNC_WRITE_MAY(fd,buf,count) do { ssize_t e = write((fd), (buf), (count)); if (e != (count)) fprintf(stderr, "should write %ld bytes, actually wrote %ld, on line %d\n", (count), e, __LINE__); } while (0)
|
||||
|
|
15
va.c
15
va.c
|
@ -54,7 +54,7 @@ static char* fourcc_to_str(int fourcc) {
|
|||
}
|
||||
|
||||
static void print_va_image_fmt(VAImageFormat *fmt) {
|
||||
printf("image fmt: fourcc %d, %s, byte_order %s, bpp %d, depth %d, blue_mask %#x, green_mask %#x, red_mask %#x, reserved %#x\n", fmt->fourcc,
|
||||
printf("image fmt: fourcc %d, %s, byte_order %s, bpp %d, depth %d, blue_mask %#x, green_mask %#x, red_mask %#x, reserved %#x %#x %#x %#x\n", fmt->fourcc,
|
||||
fourcc_to_str(fmt->fourcc),
|
||||
fmt->byte_order == 1 ? "VA_LSB_FIRST" : "VA_MSB_FIRST",
|
||||
fmt->bits_per_pixel,
|
||||
|
@ -62,7 +62,10 @@ static void print_va_image_fmt(VAImageFormat *fmt) {
|
|||
fmt->blue_mask,
|
||||
fmt->green_mask,
|
||||
fmt->red_mask,
|
||||
fmt->va_reserved
|
||||
fmt->va_reserved[0],
|
||||
fmt->va_reserved[1],
|
||||
fmt->va_reserved[2],
|
||||
fmt->va_reserved[3]
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -230,7 +233,7 @@ int va_init() {
|
|||
.blue_mask = 0x0000ff00,
|
||||
.green_mask = 0x00ff0000,
|
||||
.red_mask = 0xff000000,
|
||||
.va_reserved = 0x00000000,
|
||||
.va_reserved = {0,0,0,0},
|
||||
};
|
||||
VAImageFormat fmt_bgrx = {
|
||||
.fourcc = KMSVNC_FOURCC_TO_INT('B','G','R','X'),
|
||||
|
@ -240,7 +243,7 @@ int va_init() {
|
|||
.blue_mask = 0xff000000,
|
||||
.green_mask = 0x00ff0000,
|
||||
.red_mask = 0x0000ff00,
|
||||
.va_reserved = 0x00000000,
|
||||
.va_reserved = {0,0,0,0},
|
||||
};
|
||||
VAImageFormat fmt_xrgb = {
|
||||
.fourcc = KMSVNC_FOURCC_TO_INT('X','R','G','B'),
|
||||
|
@ -250,7 +253,7 @@ int va_init() {
|
|||
.blue_mask = 0x000000ff,
|
||||
.green_mask = 0x0000ff00,
|
||||
.red_mask = 0x00ff0000,
|
||||
.va_reserved = 0x00000000,
|
||||
.va_reserved = {0,0,0,0},
|
||||
};
|
||||
VAImageFormat fmt_xbgr = {
|
||||
.fourcc = KMSVNC_FOURCC_TO_INT('X','B','G','R'),
|
||||
|
@ -260,7 +263,7 @@ int va_init() {
|
|||
.blue_mask = 0x00ff0000,
|
||||
.green_mask = 0x0000ff00,
|
||||
.red_mask = 0x000000ff,
|
||||
.va_reserved = 0x00000000,
|
||||
.va_reserved = {0,0,0,0},
|
||||
};
|
||||
va->image = malloc(sizeof(VAImage));
|
||||
if (!va->image) KMSVNC_FATAL("memory allocation error at %s:%d\n", __FILE__, __LINE__);
|
||||
|
|
Loading…
Reference in a new issue