[misc] common and client project rename to "Looking Glass"

See: https://forum.level1techs.com/t/headless-pci-passthrough-program-name-vote/121779/36
This commit is contained in:
Geoffrey McRae 2017-12-04 02:22:49 +11:00
parent 3156c0e0cb
commit 10e6408022
10 changed files with 50 additions and 37 deletions

View File

@ -1,5 +1,5 @@
KVMGFX Looking Glass
====== =============
Purpose 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 describes the format of the frame and the current mouse coordinates. Frame data
is appended to the buffer after this header. is appended to the buffer after this header.
We have decided upon he name "KVM FrameRelay", or "KVMFR" for this technology.
### Video Transfer ### Video Transfer
The guest runs a program that uses the ivshmem device as a direct transfer The guest runs a program that uses the ivshmem device as a direct transfer

View File

@ -1,5 +1,5 @@
BINARY=kvmgfx-client BINARY=looking-glass-client
CFLAGS=-g -Og -std=gnu99 -march=native -Wall -Werror -I../common -DDEBUG CFLAGS=-g -O3 -std=gnu99 -march=native -Wall -Werror -I../common -DDEBUG
LDFLAGS=-lrt LDFLAGS=-lrt
CFLAGS+=`pkg-config --cflags sdl2` CFLAGS+=`pkg-config --cflags sdl2`

View File

@ -1,5 +1,5 @@
/* /*
KVMGFX Client - A KVM Client for VGA Passthrough Looking Glass - KVM FrameRelay (KVMFR) Client
Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com> Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com>
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under

View File

@ -1,5 +1,5 @@
/* /*
KVMGFX Client - A KVM Client for VGA Passthrough Looking Glass - KVM FrameRelay (KVMFR) Client
Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com> Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com>
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under

View File

@ -1,5 +1,5 @@
/* /*
KVMGFX Client - A KVM Client for VGA Passthrough Looking Glass - KVM FrameRelay (KVMFR) Client
Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com> Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com>
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under

View File

@ -1,5 +1,5 @@
/* /*
KVMGFX Client - A KVM Client for VGA Passthrough Looking Glass - KVM FrameRelay (KVMFR) Client
Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com> Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com>
This program is free software; you can redistribute it and/or modify it under 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 "debug.h"
#include "memcpySSE.h" #include "memcpySSE.h"
#include "KVMGFXHeader.h" #include "KVMFR.h"
#include "ivshmem/ivshmem.h" #include "ivshmem/ivshmem.h"
#include "spice/spice.h" #include "spice/spice.h"
#include "kb.h" #include "kb.h"
@ -55,7 +55,7 @@ struct AppState
SDL_Window * window; SDL_Window * window;
SDL_Renderer * renderer; SDL_Renderer * renderer;
struct KVMGFXHeader * shm; struct KVMFRHeader * shm;
unsigned int shmSize; unsigned int shmSize;
}; };
@ -140,7 +140,7 @@ inline void updatePositionInfo()
state.scaleY = (float)state.srcRect.w / (float)state.dstRect.w; 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 return
(s1.frameType != FRAME_TYPE_INVALID) && (s1.frameType != FRAME_TYPE_INVALID) &&
@ -184,8 +184,8 @@ inline bool waitGuest()
int renderThread(void * unused) int renderThread(void * unused)
{ {
struct KVMGFXHeader header; struct KVMFRHeader header;
struct KVMGFXHeader newHeader; struct KVMFRHeader newHeader;
SDL_Texture *texture = NULL; SDL_Texture *texture = NULL;
GLuint vboID[VBO_BUFFERS]; GLuint vboID[VBO_BUFFERS];
GLuint intFormat = 0; GLuint intFormat = 0;
@ -201,7 +201,7 @@ int renderThread(void * unused)
SDL_Texture *textTexture = NULL; SDL_Texture *textTexture = NULL;
SDL_Rect textRect = {0, 0, 0, 0}; 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(&vboID , 0, sizeof(vboID));
memset(&vboTex , 0, sizeof(vboTex)); memset(&vboTex , 0, sizeof(vboTex));
memset(&texPixels, 0, sizeof(texPixels)); memset(&texPixels, 0, sizeof(texPixels));
@ -215,12 +215,12 @@ int renderThread(void * unused)
if (!waitGuest()) if (!waitGuest())
break; 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 // ensure the header magic is valid, this will help prevent crash out when the memory hasn't yet been initialized
if ( if (
memcmp(newHeader.magic, KVMGFX_HEADER_MAGIC, sizeof(KVMGFX_HEADER_MAGIC)) != 0 || memcmp(newHeader.magic, KVMFR_HEADER_MAGIC, sizeof(KVMFR_HEADER_MAGIC)) != 0 ||
newHeader.version != KVMGFX_HEADER_VERSION newHeader.version != KVMFR_HEADER_VERSION
) )
{ {
usleep(1000); usleep(1000);
@ -800,7 +800,7 @@ int run()
} }
state.window = SDL_CreateWindow( state.window = SDL_CreateWindow(
"KVM-GFX Test", "Looking Glass (Client)",
params.center ? SDL_WINDOWPOS_CENTERED : params.x, params.center ? SDL_WINDOWPOS_CENTERED : params.x,
params.center ? SDL_WINDOWPOS_CENTERED : params.y, params.center ? SDL_WINDOWPOS_CENTERED : params.y,
params.w, params.w,
@ -877,7 +877,7 @@ int run()
break; break;
} }
state.shm = (struct KVMGFXHeader *)ivshmem_get_map(); state.shm = (struct KVMFRHeader *)ivshmem_get_map();
if (!state.shm) if (!state.shm)
{ {
DEBUG_ERROR("Failed to map memory"); DEBUG_ERROR("Failed to map memory");
@ -959,6 +959,7 @@ void doHelp(char * app)
snprintf(y, sizeof(y), "%d", params.y); snprintf(y, sizeof(y), "%d", params.y);
fprintf(stderr, fprintf(stderr,
"Looking Glass Client\n"
"Usage: %s [OPTION]...\n" "Usage: %s [OPTION]...\n"
"Example: %s -h\n" "Example: %s -h\n"
"\n" "\n"
@ -1004,7 +1005,7 @@ void doLicense()
{ {
fprintf(stderr, fprintf(stderr,
"\n" "\n"
"KVMGFX Client - A KVM Client for VGA Passthrough\n" "Looking Glass - KVM FrameRelay (KVMFR) Client\n"
"Copyright(C) 2017 Geoffrey McRae <geoff@hostfission.com>\n" "Copyright(C) 2017 Geoffrey McRae <geoff@hostfission.com>\n"
"\n" "\n"
"This program is free software; you can redistribute it and / or modify it under\n" "This program is free software; you can redistribute it and / or modify it under\n"

View File

@ -1,3 +1,21 @@
/*
Looking Glass - KVM FrameRelay (KVMFR) Client
Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com>
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 <stdint.h> #include <stdint.h>
#pragma pack(push,1) #pragma pack(push,1)

View File

@ -1,5 +1,5 @@
/* /*
KVMGFX Client - A KVM Client for VGA Passthrough Looking Glass - KVM FrameRelay (KVMFR) Client
Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com> Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com>
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under

View File

@ -1,5 +1,5 @@
/* /*
KVMGFX Client - A KVM Client for VGA Passthrough Looking Glass - KVM FrameRelay (KVMFR) Client
Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com> Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com>
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under

View File

@ -1,6 +1,5 @@
#pragma once
/* /*
KVMGFX Client - A KVM Client for VGA Passthrough Looking Glass - KVM FrameRelay (KVMFR)
Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com> Copyright (C) 2017 Geoffrey McRae <geoff@hostfission.com>
This program is free software; you can redistribute it and/or modify it under 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 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#pragma once
#include <stdint.h> #include <stdint.h>
#define KVMGFX_HEADER_MAGIC "[[KVMGFXHeader]]" #define KVMFR_HEADER_MAGIC "[[KVMFR]]"
#define KVMGFX_HEADER_VERSION 3 #define KVMFR_HEADER_VERSION 1
typedef enum FrameType typedef enum FrameType
{ {
@ -30,9 +30,9 @@ typedef enum FrameType
FRAME_TYPE_MAX , // sentinel value FRAME_TYPE_MAX , // sentinel value
} FrameType; } FrameType;
struct KVMGFXHeader struct KVMFRHeader
{ {
char magic[sizeof(KVMGFX_HEADER_MAGIC)]; char magic[sizeof(KVMFR_HEADER_MAGIC)];
uint32_t version; // version of this structure uint32_t version; // version of this structure
uint16_t hostID; // the host ivshmem client id uint16_t hostID; // the host ivshmem client id
uint16_t guestID; // the guest 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 int32_t mouseY; // the initial mouse Y position
uint64_t dataLen; // total lengh of the data after this header uint64_t dataLen; // total lengh of the data after this header
uint64_t dataPos; // offset to the frame uint64_t dataPos; // offset to the frame
}; };
#pragma pack(push,1)
struct RLEHeader
{
uint8_t magic[3];
uint16_t length;
};
#pragma pack(pop)