diff --git a/README.md b/README.md index 2e3a4647..e222e3dd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -KVMGFX -====== +Looking Glass +============= Purpose ------- @@ -57,6 +57,8 @@ The shared memory segment is intialized by the guest with a strcture that describes the format of the frame and the current mouse coordinates. Frame data is appended to the buffer after this header. +We have decided upon he name "KVM FrameRelay", or "KVMFR" for this technology. + ### Video Transfer The guest runs a program that uses the ivshmem device as a direct transfer diff --git a/client/Makefile b/client/Makefile index dc39109b..8fd0ae48 100644 --- a/client/Makefile +++ b/client/Makefile @@ -1,5 +1,5 @@ -BINARY=kvmgfx-client -CFLAGS=-g -Og -std=gnu99 -march=native -Wall -Werror -I../common -DDEBUG +BINARY=looking-glass-client +CFLAGS=-g -O3 -std=gnu99 -march=native -Wall -Werror -I../common -DDEBUG LDFLAGS=-lrt CFLAGS+=`pkg-config --cflags sdl2` diff --git a/client/ivshmem/ivshmem.c b/client/ivshmem/ivshmem.c index 77072078..8c4a2da7 100644 --- a/client/ivshmem/ivshmem.c +++ b/client/ivshmem/ivshmem.c @@ -1,5 +1,5 @@ /* -KVMGFX Client - A KVM Client for VGA Passthrough +Looking Glass - KVM FrameRelay (KVMFR) Client Copyright (C) 2017 Geoffrey McRae This program is free software; you can redistribute it and/or modify it under diff --git a/client/ivshmem/ivshmem.h b/client/ivshmem/ivshmem.h index ed25694b..1951863f 100644 --- a/client/ivshmem/ivshmem.h +++ b/client/ivshmem/ivshmem.h @@ -1,5 +1,5 @@ /* -KVMGFX Client - A KVM Client for VGA Passthrough +Looking Glass - KVM FrameRelay (KVMFR) Client Copyright (C) 2017 Geoffrey McRae This program is free software; you can redistribute it and/or modify it under diff --git a/client/kb.h b/client/kb.h index 2ce783ae..c0d3cb79 100644 --- a/client/kb.h +++ b/client/kb.h @@ -1,5 +1,5 @@ /* -KVMGFX Client - A KVM Client for VGA Passthrough +Looking Glass - KVM FrameRelay (KVMFR) Client Copyright (C) 2017 Geoffrey McRae This program is free software; you can redistribute it and/or modify it under diff --git a/client/main.c b/client/main.c index bb645c97..8eb765b6 100644 --- a/client/main.c +++ b/client/main.c @@ -1,5 +1,5 @@ /* -KVMGFX Client - A KVM Client for VGA Passthrough +Looking Glass - KVM FrameRelay (KVMFR) Client Copyright (C) 2017 Geoffrey McRae This program is free software; you can redistribute it and/or modify it under @@ -35,7 +35,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA #include "debug.h" #include "memcpySSE.h" -#include "KVMGFXHeader.h" +#include "KVMFR.h" #include "ivshmem/ivshmem.h" #include "spice/spice.h" #include "kb.h" @@ -55,7 +55,7 @@ struct AppState SDL_Window * window; SDL_Renderer * renderer; - struct KVMGFXHeader * shm; + struct KVMFRHeader * shm; unsigned int shmSize; }; @@ -140,7 +140,7 @@ inline void updatePositionInfo() state.scaleY = (float)state.srcRect.w / (float)state.dstRect.w; } -inline bool areFormatsSame(const struct KVMGFXHeader s1, const struct KVMGFXHeader s2) +inline bool areFormatsSame(const struct KVMFRHeader s1, const struct KVMFRHeader s2) { return (s1.frameType != FRAME_TYPE_INVALID) && @@ -184,8 +184,8 @@ inline bool waitGuest() int renderThread(void * unused) { - struct KVMGFXHeader header; - struct KVMGFXHeader newHeader; + struct KVMFRHeader header; + struct KVMFRHeader newHeader; SDL_Texture *texture = NULL; GLuint vboID[VBO_BUFFERS]; GLuint intFormat = 0; @@ -201,7 +201,7 @@ int renderThread(void * unused) SDL_Texture *textTexture = NULL; SDL_Rect textRect = {0, 0, 0, 0}; - memset(&header , 0, sizeof(struct KVMGFXHeader)); + memset(&header , 0, sizeof(struct KVMFRHeader)); memset(&vboID , 0, sizeof(vboID)); memset(&vboTex , 0, sizeof(vboTex)); memset(&texPixels, 0, sizeof(texPixels)); @@ -215,12 +215,12 @@ int renderThread(void * unused) if (!waitGuest()) break; - memcpy(&newHeader, state.shm, sizeof(struct KVMGFXHeader)); + memcpy(&newHeader, state.shm, sizeof(struct KVMFRHeader)); // ensure the header magic is valid, this will help prevent crash out when the memory hasn't yet been initialized if ( - memcmp(newHeader.magic, KVMGFX_HEADER_MAGIC, sizeof(KVMGFX_HEADER_MAGIC)) != 0 || - newHeader.version != KVMGFX_HEADER_VERSION + memcmp(newHeader.magic, KVMFR_HEADER_MAGIC, sizeof(KVMFR_HEADER_MAGIC)) != 0 || + newHeader.version != KVMFR_HEADER_VERSION ) { usleep(1000); @@ -800,7 +800,7 @@ int run() } state.window = SDL_CreateWindow( - "KVM-GFX Test", + "Looking Glass (Client)", params.center ? SDL_WINDOWPOS_CENTERED : params.x, params.center ? SDL_WINDOWPOS_CENTERED : params.y, params.w, @@ -877,7 +877,7 @@ int run() break; } - state.shm = (struct KVMGFXHeader *)ivshmem_get_map(); + state.shm = (struct KVMFRHeader *)ivshmem_get_map(); if (!state.shm) { DEBUG_ERROR("Failed to map memory"); @@ -959,6 +959,7 @@ void doHelp(char * app) snprintf(y, sizeof(y), "%d", params.y); fprintf(stderr, + "Looking Glass Client\n" "Usage: %s [OPTION]...\n" "Example: %s -h\n" "\n" @@ -1004,7 +1005,7 @@ void doLicense() { fprintf(stderr, "\n" - "KVMGFX Client - A KVM Client for VGA Passthrough\n" + "Looking Glass - KVM FrameRelay (KVMFR) Client\n" "Copyright(C) 2017 Geoffrey McRae \n" "\n" "This program is free software; you can redistribute it and / or modify it under\n" diff --git a/client/spice/messages.h b/client/spice/messages.h index 17eb6e68..667dc105 100644 --- a/client/spice/messages.h +++ b/client/spice/messages.h @@ -1,3 +1,21 @@ +/* +Looking Glass - KVM FrameRelay (KVMFR) Client +Copyright (C) 2017 Geoffrey McRae + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include #pragma pack(push,1) diff --git a/client/spice/spice.c b/client/spice/spice.c index 9b1d3408..8f377c7b 100644 --- a/client/spice/spice.c +++ b/client/spice/spice.c @@ -1,5 +1,5 @@ /* -KVMGFX Client - A KVM Client for VGA Passthrough +Looking Glass - KVM FrameRelay (KVMFR) Client Copyright (C) 2017 Geoffrey McRae This program is free software; you can redistribute it and/or modify it under diff --git a/client/spice/spice.h b/client/spice/spice.h index 023f172c..1b3009e4 100644 --- a/client/spice/spice.h +++ b/client/spice/spice.h @@ -1,5 +1,5 @@ /* -KVMGFX Client - A KVM Client for VGA Passthrough +Looking Glass - KVM FrameRelay (KVMFR) Client Copyright (C) 2017 Geoffrey McRae This program is free software; you can redistribute it and/or modify it under diff --git a/common/KVMGFXHeader.h b/common/KVMFR.h similarity index 83% rename from common/KVMGFXHeader.h rename to common/KVMFR.h index 6cefce0e..7168419b 100644 --- a/common/KVMGFXHeader.h +++ b/common/KVMFR.h @@ -1,6 +1,5 @@ -#pragma once /* -KVMGFX Client - A KVM Client for VGA Passthrough +Looking Glass - KVM FrameRelay (KVMFR) Copyright (C) 2017 Geoffrey McRae This program is free software; you can redistribute it and/or modify it under @@ -16,11 +15,12 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#pragma once #include -#define KVMGFX_HEADER_MAGIC "[[KVMGFXHeader]]" -#define KVMGFX_HEADER_VERSION 3 +#define KVMFR_HEADER_MAGIC "[[KVMFR]]" +#define KVMFR_HEADER_VERSION 1 typedef enum FrameType { @@ -30,9 +30,9 @@ typedef enum FrameType FRAME_TYPE_MAX , // sentinel value } FrameType; -struct KVMGFXHeader +struct KVMFRHeader { - char magic[sizeof(KVMGFX_HEADER_MAGIC)]; + char magic[sizeof(KVMFR_HEADER_MAGIC)]; uint32_t version; // version of this structure uint16_t hostID; // the host ivshmem client id uint16_t guestID; // the guest ivshmem client id @@ -44,12 +44,4 @@ struct KVMGFXHeader int32_t mouseY; // the initial mouse Y position uint64_t dataLen; // total lengh of the data after this header uint64_t dataPos; // offset to the frame -}; - -#pragma pack(push,1) -struct RLEHeader -{ - uint8_t magic[3]; - uint16_t length; -}; -#pragma pack(pop) \ No newline at end of file +}; \ No newline at end of file