summaryrefslogtreecommitdiffstats
path: root/console.c
Commit message (Collapse)AuthorAgeFilesLines
* pixman: drop obsolete fields from DisplaySurfaceGerd Hoffmann2012-11-011-9/+0
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: don't set PixelFormat alpha fields for 32bppGerd Hoffmann2012-11-011-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>
* console: make qemu_alloc_display staticGerd Hoffmann2012-11-011-24/+24
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* pixman: add pixman image to DisplaySurfaceGerd Hoffmann2012-11-011-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>
* console: remove DisplayAllocatorGerd Hoffmann2012-11-011-33/+19
| | | | | | Causes [temporary] preformance regression with 24bpp vga modes @ sdl. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: untangle gfx & txt updatesGerd Hoffmann2012-11-011-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>
* console: s/TextConsole/QemuConsole/Gerd Hoffmann2012-11-011-36/+36
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* console: move set_mouse + cursor_define callbacksGerd Hoffmann2012-11-011-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>
* TextConsole: saturate escape parameter in TTY_STATE_CSILaszlo Ersek2012-09-231-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>
* console: Clean up bytes per pixel calculationBALATON Zoltan2012-09-141-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>
* qapi: convert screendumpLuiz Capitulino2012-09-051-3/+4
| | | | | | Next commits will update devices to propagate errors. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
* console: vga_hw_screen_dump_ptr: take Error argumentLuiz Capitulino2012-09-051-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>
* console: bounds check whenever changing the cursor due to an escape codeIan Campbell2012-09-041-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>
* console: Fix warning from clang (and potential crash)Stefan Weil2012-08-311-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>
* console: Implementing blinking of cursorJan Kiszka2012-07-141-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>
* optimize screendump for the common non-switch caseGerd Hoffmann2012-02-241-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>
* Remove screendump dummy functions.Gerd Hoffmann2012-02-241-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>
* console: Eliminate text_consoles[]Markus Armbruster2012-02-241-14/+4
| | | | | | | Simply use consoles[] instead. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "qemu-char: Print strerror message on failure" and depsMarkus Armbruster2012-02-241-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>
* console: Fix segfault on screendump without VGA adapterAlexander Graf2012-01-031-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>
* console: Fix qemu_default_pixelformat() for 24 bppMarkus Armbruster2011-12-061-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>
* console: Fix console_putchar() for CSI JMarkus Armbruster2011-12-061-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>
* console: Clean up confusing indentation in console_putchar()Markus Armbruster2011-12-061-9/+9
| | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* console: Fix rendering of VGA underlineMarkus Armbruster2011-11-071-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>
* Fix mismatching allocation and deallocationStefan Weil2011-10-051-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>
* console: Properly switch consoles for screen dumpsJan Kiszka2011-09-161-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>
* curses: fix garbling when chtype != longDevin J. Pohly2011-09-091-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>
* char: remove qemu_chr_send_event()Anthony Liguori2011-08-221-16/+0
| | | | | | It's dead code. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* char: rename qemu_chr_can_read() -> qemu_chr_be_can_read()Anthony Liguori2011-08-221-1/+1
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* char: rename qemu_chr_read() -> qemu_chr_be_write()Anthony Liguori2011-08-221-1/+1
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Use glib memory allocation and free functionsAnthony Liguori2011-08-201-13/+13
| | | | | | qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu-char: Print strerror message on failureKevin Wolf2011-07-231-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>
* Align dummy display to fixed-size active consoleJan Kiszka2011-06-241-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>
* Fix segfault on screendump with -nographicAlexander Graf2011-06-031-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>
* Consolidate DisplaySurface allocation in qemu_alloc_display()Jes Sorensen2011-03-221-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>
* change all rt_clock references to use millisecond resolution accessorsPaolo Bonzini2011-03-211-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>
* remove text_console_optsPaolo Bonzini2011-02-011-6/+2
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* add set_echo implementation for text consolesPaolo Bonzini2011-02-011-1/+16
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* create TextConsole together with the CharDeviceStatePaolo Bonzini2011-02-011-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>
* console: Avoid dereferencing NULL active_consoleStefan Hajnoczi2010-10-031-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>
* Add support for depth 15 to qemu_default_pixelformat()Gerd Hoffmann2010-06-011-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>
* check for active_console before using itGerd Hoffmann2010-06-011-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>
* Remove dead assignments in various common files, spotted by clang analyzerBlue Swirl2010-04-251-1/+0
| | | | | | Value stored is never read. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* move default allocator to console.cPaolo Bonzini2010-02-191-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>
* vc: colorize chardev title line with blue background.Gerd Hoffmann2009-12-121-0/+2
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* chardev: move greeting into vc backend.Gerd Hoffmann2009-12-121-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>
* char: rename qemu_chr_reset to qemu_chr_generic_openAmit Shah2009-11-171-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>
* Revert "Get rid of _t suffix"Anthony Liguori2009-10-011-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>
* Get rid of _t suffixmalc2009-10-011-5/+5
| | | | | | | Some not so obvious bits, slirp and Xen were left alone for the time being. Signed-off-by: malc <av1474@comtv.ru>
* convert vc chardev to QemuOpts.Gerd Hoffmann2009-09-111-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>
OpenPOWER on IntegriCloud