[client] kick the client sooner to help have the next frame ready in time

This commit is contained in:
Geoffrey McRae 2017-10-26 15:18:57 +11:00
parent 8b756a7b80
commit 9e1aaa29a9
2 changed files with 13 additions and 3 deletions

View File

@ -282,7 +282,7 @@ bool ivshmem_read_msg(int64_t * index, int * fd)
continue; continue;
} }
*fd = *(int*)CMSG_DATA(cmsg); memcpy(fd, CMSG_DATA(cmsg), sizeof(int));
} }
return true; return true;

View File

@ -152,6 +152,8 @@ inline bool areFormatsSame(const struct KVMGFXHeader s1, const struct KVMGFXHead
void drawFunc_ARGB10(CompFunc compFunc, SDL_Texture * texture, uint8_t * dst, const uint8_t * src) void drawFunc_ARGB10(CompFunc compFunc, SDL_Texture * texture, uint8_t * dst, const uint8_t * src)
{ {
SDL_UpdateTexture(texture, NULL, src, state.shm->stride * 4); SDL_UpdateTexture(texture, NULL, src, state.shm->stride * 4);
ivshmem_kick_irq(state.shm->guestID, 0);
SDL_RenderClear(state.renderer); SDL_RenderClear(state.renderer);
SDL_RenderCopy(state.renderer, texture, NULL, NULL); SDL_RenderCopy(state.renderer, texture, NULL, NULL);
@ -161,6 +163,8 @@ void drawFunc_ARGB10(CompFunc compFunc, SDL_Texture * texture, uint8_t * dst, co
void drawFunc_ARGB(CompFunc compFunc, SDL_Texture * texture, uint8_t * dst, const uint8_t * src) void drawFunc_ARGB(CompFunc compFunc, SDL_Texture * texture, uint8_t * dst, const uint8_t * src)
{ {
compFunc(dst, src, state.shm->height * state.shm->stride * 4); compFunc(dst, src, state.shm->height * state.shm->stride * 4);
ivshmem_kick_irq(state.shm->guestID, 0);
SDL_UnlockTexture(texture); SDL_UnlockTexture(texture);
SDL_RenderClear(state.renderer); SDL_RenderClear(state.renderer);
@ -171,6 +175,8 @@ void drawFunc_ARGB(CompFunc compFunc, SDL_Texture * texture, uint8_t * dst, cons
void drawFunc_RGB(CompFunc compFunc, SDL_Texture * texture, uint8_t * dst, const uint8_t * src) void drawFunc_RGB(CompFunc compFunc, SDL_Texture * texture, uint8_t * dst, const uint8_t * src)
{ {
compFunc(dst, src, state.shm->height * state.shm->stride * 3); compFunc(dst, src, state.shm->height * state.shm->stride * 3);
ivshmem_kick_irq(state.shm->guestID, 0);
SDL_UnlockTexture(texture); SDL_UnlockTexture(texture);
SDL_RenderClear(state.renderer); SDL_RenderClear(state.renderer);
@ -182,7 +188,10 @@ void drawFunc_XOR(CompFunc compFunc, SDL_Texture * texture, uint8_t * dst, const
{ {
glEnable(GL_COLOR_LOGIC_OP); glEnable(GL_COLOR_LOGIC_OP);
glLogicOp(GL_XOR); glLogicOp(GL_XOR);
compFunc(dst, src, state.shm->height * state.shm->stride * 3); compFunc(dst, src, state.shm->height * state.shm->stride * 3);
ivshmem_kick_irq(state.shm->guestID, 0);
SDL_UnlockTexture(texture); SDL_UnlockTexture(texture);
if (state.shm->frames == 1) if (state.shm->frames == 1)
SDL_RenderClear(state.renderer); SDL_RenderClear(state.renderer);
@ -203,8 +212,10 @@ void drawFunc_YUV420P(CompFunc compFunc, SDL_Texture * texture, uint8_t * dst, c
src + pixels , state.shm->stride / 2, src + pixels , state.shm->stride / 2,
src + pixels + pixels / 4, state.shm->stride / 2 src + pixels + pixels / 4, state.shm->stride / 2
); );
SDL_RenderClear(state.renderer);
ivshmem_kick_irq(state.shm->guestID, 0);
SDL_RenderClear(state.renderer);
SDL_RenderCopy(state.renderer, texture, NULL, NULL); SDL_RenderCopy(state.renderer, texture, NULL, NULL);
SDL_RenderPresent(state.renderer); SDL_RenderPresent(state.renderer);
} }
@ -337,7 +348,6 @@ int renderThread(void * unused)
glDisable(GL_COLOR_LOGIC_OP); glDisable(GL_COLOR_LOGIC_OP);
drawFunc(compFunc, texture, texPixels, pixels); drawFunc(compFunc, texture, texPixels, pixels);
state.shm->clientFrame = format.frames; state.shm->clientFrame = format.frames;
ivshmem_kick_irq(state.shm->guestID, 0);
} }
SDL_DestroyTexture(texture); SDL_DestroyTexture(texture);