summaryrefslogtreecommitdiff
path: root/console.c
AgeCommit message (Collapse)AuthorFilesLines
2012-11-01pixman: drop obsolete fields from DisplaySurfaceGerd Hoffmann1-9/+0
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01console: don't set PixelFormat alpha fields for 32bppGerd Hoffmann1-3/+0
Currently it is inconstent, PixelFormat->amask is left unset whereas abits and amax and ashift are filled. As an alpha channel doesn't make sense for the vga framebuffer leave all alpha fields clear. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01console: make qemu_alloc_display staticGerd Hoffmann1-24/+24
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01pixman: add pixman image to DisplaySurfaceGerd Hoffmann1-13/+24
Surfaces are now allocated using pixman. DisplaySurface gets new struct fields with pixman image and data. DisplayChangeListeners can easily start using pixman now. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01console: remove DisplayAllocatorGerd Hoffmann1-33/+19
Causes [temporary] preformance regression with 24bpp vga modes @ sdl. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01console: untangle gfx & txt updatesGerd Hoffmann1-28/+31
Stop abusing displaysurface fields for text mode displays. (bpp = 0, width = cols, height = lines). Add flags to displaystate indicating whenever text mode display (curses) or gfx mode displays (sdl, vnc, ...) are present. Add separate displaychangelistener callbacks for text / gfx mode resize & updates. This allows to enable gfx and txt diplays at the same time and also paves the way for more cleanups in the future. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01console: s/TextConsole/QemuConsole/Gerd Hoffmann1-36/+36
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01console: move set_mouse + cursor_define callbacksGerd Hoffmann1-1/+1
When adding DisplayChangeListeners the set_mouse and cursor_define callbacks have been left in DisplayState for some reason. Fix it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-09-23TextConsole: saturate escape parameter in TTY_STATE_CSILaszlo Ersek1-2/+5
Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2012-09-14console: Clean up bytes per pixel calculationBALATON Zoltan1-3/+2
Division with round up is the correct way to compute this even if the only case where division with round down gives incorrect result is probably 15 bpp. This case was explicitely patched up in one of these functions but was unhandled in the other. (I'm not sure about setting 16 bpp for the 15bpp case either but I left that there for now.) Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-09-05qapi: convert screendumpLuiz Capitulino1-3/+4
Next commits will update devices to propagate errors. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-09-05console: vga_hw_screen_dump_ptr: take Error argumentLuiz Capitulino1-1/+1
All devices that register a screen dump callback via graphic_console_init() are updated. The new argument is not used in this commit. Error handling will be added to each device individually later. This change is a preparation to convert the screendump command to the QAPI. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2012-09-04console: bounds check whenever changing the cursor due to an escape codeIan Campbell1-29/+28
This is XSA-17 / CVE-2012-3515 Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-08-31console: Fix warning from clang (and potential crash)Stefan Weil1-1/+1
ccc-analyzer reports this warning: console.c:1090:29: warning: Dereference of null pointer if (active_console->cursor_timer) { ^ Function console_select allows active_console to be NULL, but would crash when accessing cursor_timer. Fix this. Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-07-14console: Implementing blinking of cursorJan Kiszka1-1/+25
Let the text console cursor blink at 2 HZ. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-02-24optimize screendump for the common non-switch caseGerd Hoffmann1-3/+7
switch console only if needed, also pass down whenever the console was switched or not because a displaysurface redraw is only needed in case the console was switched. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-24Remove screendump dummy functions.Gerd Hoffmann1-0/+2
The code in console.c verifies whenever a screen_dump function pointer is present before calling it, so there is no need to supply an dummy function. Remove them. Also report an error to notify the user that he didn't got a screenshot. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-24console: Eliminate text_consoles[]Markus Armbruster1-14/+4
Simply use consoles[] instead. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-24Revert "qemu-char: Print strerror message on failure" and depsMarkus Armbruster1-5/+3
The commit's purpose is laudable: The only way for chardev drivers to communicate an error was to return a NULL pointer, which resulted in an error message that said _that_ something went wrong, but not _why_. It attempts to achieve it by changing the interface to return 0/-errno and update qemu_chr_open_opts() to use strerror() to display a more helpful error message. Unfortunately, it has serious flaws: 1. Backends "socket" and "udp" return bogus error codes, because qemu_chr_open_socket() and qemu_chr_open_udp() assume that unix_listen_opts(), unix_connect_opts(), inet_listen_opts(), inet_connect_opts() and inet_dgram_opts() fail with errno set appropriately. That assumption is wrong, and the commit turns unspecific error messages into misleading error messages. For instance: $ qemu-system-x86_64 -nodefaults -vnc :0 -chardev socket,id=bar,host=xxx inet_connect: host and/or port not specified chardev: opening backend "socket" failed: No such file or directory ENOENT is what happens to be in my errno when the backend returns -errno. Let's put ERANGE there just for giggles: $ qemu-system-x86_64 -nodefaults -vnc :0 -chardev socket,id=bar,host=xxx -drive if=none,iops=99999999999999999999 inet_connect: host and/or port not specified chardev: opening backend "socket" failed: Numerical result out of range Worse: when errno happens to be zero, return -errno erroneously signals success, and qemu_chr_new_from_opts() dies dereferencing uninitialized chr. I observe this with "-serial unix:". 2. All qemu_chr_open_opts() knows about the error is an errno error code. That's simply not enough for a decent message. For instance, when inet_dgram() can't resolve the parameter host, which errno code should it use? What if it can't resolve parameter localaddr? Clue: many backends already report errors in their open methods. Let's revert the flawed commit along with its dependencies, and fix up the silent error paths instead. This reverts commit 6e1db57b2ac9025c2443c665a0d9e78748637b26. Conflicts: console.c hw/baum.c qemu-char.c This reverts commit aad04cd024f0c59f0b96f032cde2e24eb3abba6d. The parts of commit db418a0a "Add stdio char device on windows" that depend on the reverted change fixed up. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-03console: Fix segfault on screendump without VGA adapterAlexander Graf1-1/+3
When trying to create a screen dump without having any VGA adapter inside the guest, QEMU segfaults. This is because it's trying to switch back to the "previous" screen it was on before dumping the VGA screen. Unfortunately, in my case there simply is no previous screen so it accesses a NULL pointer. Fix it by checking if previous_active_console is actually available. This is 1.0 material. Signed-off-by: Alexander Graf <agraf@suse.de>
2011-12-06console: Fix qemu_default_pixelformat() for 24 bppMarkus Armbruster1-0/+1
Falls through to 32 bpp. Harmless, because the only difference is the alpha component, and we're not using that. Spotted by Coverity. Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-06console: Fix console_putchar() for CSI JMarkus Armbruster1-0/+1
It falls through to the code for CSI K. "Erase Down" also does "Erase End of Line", "Erase Up" also does "Erase Start of Line", and "Erase Screen" also does "Erase Line". Happens not to be visible. Fix it anyway. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-06console: Clean up confusing indentation in console_putchar()Markus Armbruster1-9/+9
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-07console: Fix rendering of VGA underlineMarkus Armbruster1-3/+3
vga_putcharxy()'s underline code sets font_data to 0xffff instead of 0xff. vga_putcharxy() then reads dmask16[0xffff >> 4] and dmask4[0xffff >> 6]. In practice, these out-of-bounds subscripts "only" put a few crap bits into the display surface. For 32 bit pixels, there's no array access. font_data's extra bits go straight into the display surface. Broken when commit 6d6f7c28 implemented underline. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-10-05Fix mismatching allocation and deallocationStefan Weil1-1/+1
This error was reported by cppcheck. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-16console: Properly switch consoles for screen dumpsJan Kiszka1-3/+10
Do not mess with active_console, use console_select instead. This fixes corrupt virtual monitor consoles after issuing the screendump command. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-09curses: fix garbling when chtype != longDevin J. Pohly1-0/+2
Qemu currently assumes that chtype is typedef'd to unsigned long, but this is not necessarily the case (ncurses, for instance, can configure this at build-time). This patch uses the predefined chtype if qemu is configured for curses support and falls back to unsigned long otherwise. Fixes bug 568614. Signed-off-by: Devin J. Pohly <djpohly+launchpad@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-22char: remove qemu_chr_send_event()Anthony Liguori1-16/+0
It's dead code. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-22char: rename qemu_chr_can_read() -> qemu_chr_be_can_read()Anthony Liguori1-1/+1
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-22char: rename qemu_chr_read() -> qemu_chr_be_write()Anthony Liguori1-1/+1
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori1-13/+13
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-07-23qemu-char: Print strerror message on failureKevin Wolf1-3/+5
The only way for chardev drivers to communicate an error was to return a NULL pointer, which resulted in an error message that said _that_ something went wrong, but not _why_. This patch changes the interface to return 0/-errno and updates qemu_chr_open_opts to use strerror to display a more helpful error message. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-06-24Align dummy display to fixed-size active consoleJan Kiszka1-1/+8
This fixes e.g. '-vga none -monitor vc:120Cx50C'. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-06-03Fix segfault on screendump with -nographicAlexander Graf1-1/+1
When running -nographic and calling "screendump" on the monitor, qemu segfaults. Fix the invalid pointer dereference by checking for NULL. Signed-off-by: Alexander Graf <agraf@suse.de>
2011-03-22Consolidate DisplaySurface allocation in qemu_alloc_display()Jes Sorensen1-22/+24
This removes various code duplication from console.e and sdl.c Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-03-21change all rt_clock references to use millisecond resolution accessorsPaolo Bonzini1-2/+2
This was done with: sed -i '/get_clock\>.*rt_clock/s/get_clock\>/get_clock_ms/' \ $(git grep -l 'get_clock\>.*rt_clock' ) sed -i '/new_timer\>.*rt_clock/s/new_timer\>/new_timer_ms/' \ $(git grep -l 'new_timer\>.*rt_clock' ) after checking that get_clock and new_timer never occur twice on the same line. There were no missed occurrences; however, even if there had been, they would have been caught by the compiler. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-02-01remove text_console_optsPaolo Bonzini1-6/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-01add set_echo implementation for text consolesPaolo Bonzini1-1/+16
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-01create TextConsole together with the CharDeviceStatePaolo Bonzini1-25/+31
A nicer solution would be to get rid of the opaque pointer and use containment, but it would also be a much bigger patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-10-03console: Avoid dereferencing NULL active_consoleStefan Hajnoczi1-2/+4
The console_select() function does not check that active_console is non-NULL before dereferencing it. When invoked with qemu -nodefaults it is possible to hit this case. This patch checks that active_console is non-NULL before stashing away the old console dimensions in console_select(). Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-06-01Add support for depth 15 to qemu_default_pixelformat()Gerd Hoffmann1-0/+16
Makes qemu_default_pixelformat(15) return pixelformat filled for 15 bit color depth (16 bpp, 5 bits for red,green,blue each, 1 bit unused). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-06-01check for active_console before using itGerd Hoffmann1-1/+1
Other vga_hw_* functions do the same. Fixes a segmentation fault. Trigger: boot with -nodefaults, then connect via vnc. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-04-25Remove dead assignments in various common files, spotted by clang analyzerBlue Swirl1-1/+0
Value stored is never read. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-02-19move default allocator to console.cPaolo Bonzini1-64/+112
Moving stuff in console.c to avoid the need for prototypes makes this patch a bit bigger, but there's no change in the code. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-12vc: colorize chardev title line with blue background.Gerd Hoffmann1-0/+2
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-12-12chardev: move greeting into vc backend.Gerd Hoffmann1-0/+8
Make the 'vc' chardev backend print a title line with the chardev name after initialization, using CharDriverState->label. This replaces the banner printing code in vl.c. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-17char: rename qemu_chr_reset to qemu_chr_generic_openAmit Shah1-1/+1
This function sends out the OPENED event to backends that have drive the chardevs. The 'reset' is now a historical artifact and we can now just call the function for what it is. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-01Revert "Get rid of _t suffix"Anthony Liguori1-5/+5
In the very least, a change like this requires discussion on the list. The naming convention is goofy and it causes a massive merge problem. Something like this _must_ be presented on the list first so people can provide input and cope with it. This reverts commit 99a0949b720a0936da2052cb9a46db04ffc6db29. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-01Get rid of _t suffixmalc1-5/+5
Some not so obvious bits, slirp and Xen were left alone for the time being. Signed-off-by: malc <av1474@comtv.ru>
2009-09-11convert vc chardev to QemuOpts.Gerd Hoffmann1-24/+23
new cmd line syntax: -chardev vc,id=name -chardev vc,id=name,width=pixels,height=pixels -chardev vc,id=name,cols=chars,rows=chars Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>