23 Commits

Author SHA1 Message Date
Andre Przywara 369c27e683 ui: remove pointless double const in keymap declarations
clang does not like two const specifiers in one declaration, so
remove one to let clang compile kvmtool.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2015-07-20 18:25:48 +01:00
Pekka Enberg 7bcceb95fd kvm tools: Initial GTK+ 3.0 UI
It's barely usable but it isn't getting any better sitting alone in a
private git branch.

You can start a new VM with the GTK UI like this:

  ./vm run --gtk

It's rough around the edges:

- Red and blue color channels are inverted.
- Some keys do not work.
- Mouse does not work.
- GTK assertion failure pops up on shutdown.

but I'm sure there's someone out there that's just dying to improve the
user experience.

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:54 +01:00
Lin Ming 61ebda7762 kvm tools: set "done" to true on SDL window close
Currently, SDL doesn't exit on window close because it stuck in
sdl__stop because "done" is not set to true.

Fix it by setting "done" to true on window close.

Signed-off-by: Lin Ming <minggr@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:54 +01:00
Sasha Levin a4d8c55eb2 kvm tools: Specify names for VM internal threads
Give threads a meaningful name. This makes debugging much easier, and
everything else much prettier.

Suggested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
[ penberg@kernel.org: specify vcpu names ]
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:53 +01:00
Sasha Levin 49a8afd1b9 kvm tools: use init/exit where possible
Switch to using init/exit calls instead of the repeating call blocks in builtin-run.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:53 +01:00
Sasha Levin 07d52d7721 kvm tools: ui improvements
Move the vesa initialization logic into sdl__init() and vnc__init(), builtin-run
shouldn't have to know about the conditions for initializing vesa on it's own.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:53 +01:00
Sasha Levin df4239fb27 kvm tools: move kvm_cpus into struct kvm
There's no reason the array of guest specific vcpus is global. Move it into
struct kvm.

Also split up arch specific vcpu init from the generic code and call it from
the kvm_cpu initializer.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:52 +01:00
Asias He 8fbd11879b kvm tools: Fix sdl hang
Commit b4a932d175c6aa975c456e9b05339aa069c961cb sets sdl's .start
ops to sdl__stop which makes the sdl never start.

Fix it up.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:51 +01:00
Sasha Levin 48d9e01a8c kvm tools: Fixes for UI modules
Fixes include:
 - Error handling
 - Cleanup
 - Standard init/uninit

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
2015-06-01 16:39:51 +01:00
Cyrill Gorcunov 4c61e7f818 kvm tools, sd: Fix array size for keymap
Index is u8 value so array size should be 256.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:50 +01:00
Sasha Levin f9911eba34 kvm tools: Fix SDL exit on window close
We've changed IPC to use sockets instead of signals, but the process of
closing the SDL window was still trigerring an exit signal causing
an ugly message and not cleaning up after itself.

This patch switches that to use the proper method of cleaning up.

Reported-by: Osier Yang <jyang@redhat.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:48 +01:00
Alessandro Guido a022099de1 kvm tools, sdl: Fix "5" key
Use the right set2 scancode for the "5" key.

Signed-off-by: Alessandro Guido <ag@alessandroguido.name>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:48 +01:00
Alessandro Guido 571cf4ba4c kvm tools, ui: Add some missing key codes
Add some missing keys to the SDL ui. This needed a bit of rework of
keyboard event handling since some of the new codes are multi-byte,
so I had to introduce a struct that keeps that information alongside
the code itself. Peculiar cases like PAUSE or PRNT SCRN are special
cased, however they aren't wired yet since I couldn't test them (I think
input grabbing is required to make them work).

Acked-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Alessandro Guido <ag@alessandroguido.name>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:48 +01:00
Pekka Enberg 2a77516ba8 kvm tool, sdl: Set window caption
Fix empty window caption for the tool. We should also display the guest name
but unfortunately the SDL code doesn't know about "struct kvm" so that requires
code reorganization.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:47 +01:00
Liming Wang 6877005879 kvm tools: enable keyboard press repeat for sdl
Set keyboard repeat rate to enable keyboard press repeat.

It means that don't repeat the key value every 50 milliseconds
until 200 milliseconds later when the key is pressed.

Signed-off-by: Liming Wang <walimisdev@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:47 +01:00
Pekka Enberg 1c48f5f86c kvm tools: Stop guest if SDL window is closed
Send SIGKVMSTOP signal to the process if the SDL window is closed. This fixes
an annoying problem where closing the window makes the guest seem like it froze
although it's really running in the background but the UI is unusable.

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:47 +01:00
Sasha Levin 268d0f1b46 kvm tools: Use double buffering with SDL
Page flip every time we copy the buffer over instead of invalidating
rects.
This should improve performance by letting hardware do the page
flipping.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:45 +01:00
Sasha Levin dada710645 kvm tools: Fix some SDL keyboard translations
This patch adds unmapped '<', '>', '|', '-', '+' and '='
which are quite useful in linux.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:45 +01:00
Pekka Enberg ac1fd498f1 kvm, ui: Kill fb_write() function
This patch kills fb_write() and related functions because they're no longer
called as of commit 6768f73 ("kvm tools, vesa: Use guest-mapped memory for
framebuffer").

Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:44 +01:00
Pekka Enberg 175f8e86a1 kvm tools, ui: Add simple keyboard support to SDL UI
This patch wires up hw/i8042.c to the SDL UI for simple guest keyboard support.

Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:44 +01:00
Pekka Enberg b6f60a8557 kvm tools: Kill libvnc dependency from hw/i8042.c
This patch kills the libvnc dependency from hw/i8042.c so we can use the same
hardware driver for SDL UI.

Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:44 +01:00
Pekka Enberg 3f838fece3 kvm tools, ui: Add support for SDL framebuffer output target
This patch adds support for SDL based framebuffer. Use the '--sdl' command line
option to enable the feature.

Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:44 +01:00
Pekka Enberg aba1efa5fb kvm tools, ui: Move VNC specific framebuffer code to ui/vnc.c
This patch makes use of 'struct framebuffer' and moves the VNC code to ui/vnc.c
in preparation for other framebuffer output targets.

Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: John Floren <john@jfloren.net>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
2015-06-01 16:39:44 +01:00