From d6aceb9a5b7ae46766e4d8845d7b4fe982ba83c0 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 29 Oct 2017 15:50:21 +1100 Subject: [PATCH] [client] added initial YUV444P support, non functional at the moment --- client/KVMGFXHeader.h | 3 ++- client/main.c | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/client/KVMGFXHeader.h b/client/KVMGFXHeader.h index 7b09e004..fbb26f85 100644 --- a/client/KVMGFXHeader.h +++ b/client/KVMGFXHeader.h @@ -6,9 +6,10 @@ typedef enum FrameType FRAME_TYPE_INVALID , FRAME_TYPE_ARGB , // ABGR interleaved: A,R,G,B 32bpp FRAME_TYPE_RGB , // RGB interleaved : R,G,B 24bpp + FRAME_TYPE_XOR , // xor of the previous frame: R, G, B + FRAME_TYPE_YUV444P , // YUV444 planar FRAME_TYPE_YUV420P , // YUV420 12bpp FRAME_TYPE_ARGB10 , // rgb 10 bit packed, a2 b10 r10 - FRAME_TYPE_XOR , // xor of the previous frame: R, G, B FRAME_TYPE_MAX , // sentinel value } FrameType; diff --git a/client/main.c b/client/main.c index 9ea8ace0..35b44dde 100644 --- a/client/main.c +++ b/client/main.c @@ -207,6 +207,16 @@ void drawFunc_XOR(CompFunc compFunc, SDL_Texture * texture, uint8_t * dst, const memset(dst, 0, state.shm->height * state.shm->stride * 3); } +void drawFunc_YUV444P(CompFunc compFunc, SDL_Texture * texture, uint8_t * dst, const uint8_t * src) +{ + compFunc(dst, src, state.shm->height * state.shm->stride * 3); + ivshmem_kick_irq(state.shm->guestID, 0); + + SDL_UnlockTexture(texture); + SDL_RenderCopy(state.renderer, texture, NULL, NULL); + SDL_RenderPresent(state.renderer); +} + void drawFunc_YUV420P(CompFunc compFunc, SDL_Texture * texture, uint8_t * dst, const uint8_t * src) { const unsigned int pixels = state.shm->width * state.shm->height; @@ -285,14 +295,17 @@ int renderThread(void * unused) texture = NULL; } +#define SDL_PIXELFORMAT_YUV444P SDL_PIXELTYPE_ARRAYU8 | SDL_ARRAYORDER_RGB + Uint32 sdlFormat; switch(state.shm->frameType) { case FRAME_TYPE_ARGB : sdlFormat = SDL_PIXELFORMAT_ARGB8888 ; drawFunc = drawFunc_ARGB ; break; case FRAME_TYPE_RGB : sdlFormat = SDL_PIXELFORMAT_RGB24 ; drawFunc = drawFunc_RGB ; break; + case FRAME_TYPE_XOR : sdlFormat = SDL_PIXELFORMAT_RGB24 ; drawFunc = drawFunc_XOR ; break; + case FRAME_TYPE_YUV444P: sdlFormat = SDL_PIXELFORMAT_RGB24 ; drawFunc = drawFunc_YUV444P; break; // incorrect for now case FRAME_TYPE_YUV420P: sdlFormat = SDL_PIXELFORMAT_YV12 ; drawFunc = drawFunc_YUV420P; break; case FRAME_TYPE_ARGB10 : sdlFormat = SDL_PIXELFORMAT_ARGB2101010; drawFunc = drawFunc_ARGB10 ; break; - case FRAME_TYPE_XOR : sdlFormat = SDL_PIXELFORMAT_RGB24 ; drawFunc = drawFunc_XOR ; break; default: format.frameType = FRAME_TYPE_INVALID; continue;