summaryrefslogtreecommitdiffstats
path: root/drivers/video/console/vgacon.c
Commit message (Collapse)AuthorAgeFilesLines
* vgacon: unconfuse vc_origin when using soft scrollbackNicolas Pitre2019-01-181-3/+4
| | | | | | | | | | | | | | | | | | | | | | | When CONFIG_VGACON_SOFT_SCROLLBACK is selected, the VGA display memory index and vc_visible_origin don't change when scrollback is activated. The actual screen content is saved away and the scrollbackdata is copied over it. However the vt code, and /dev/vcs devices in particular, still expect vc_origin to always point at the actual screen content not the displayed scrollback content. So adjust vc_origin to point at the saved screen content when scrollback is active and set it back to vc_visible_origin when restoring the screen. This fixes /dev/vcsa<n> that return scrollback content when they shouldn't (onli /dev/vcsa without a number should), and also fixes /dev/vcsu that should return scrollback content when scrollback is active but currently doesn't. An unnecessary call to vga_set_mem_top() is also removed. Signed-off-by: Nicolas Pitre <nico@linaro.org> Cc: stable@vger.kernel.org # v4.19+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* video/console/vgacon: Print big fat warning with nomodesetLyude Paul2018-07-241-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's been a pretty good while since kernel modesetting was introduced. It has almost entirely replaced previous solutions which required userspace modesetting, and I can't even recall any drivers off the top of my head for modern day hardware that don't only support one or the other. Even nvidia's ugly blob does not require the use of nomodeset, and only requires that nouveau be blacklisted. Effectively, the only thing nomodeset does in the year 2018 is disable your graphics drivers. Since VESA is a thing, this will give many users the false impression that they've actually fixed an issue they were having with their machine simply because the laptop will boot up to a degraded GUI. This of course, is never actually the case. Things get even worse when you consider that there's still an enormous amount of tutorials users find on the internet that still suggest adding nomodeset, along with various users who have been around long enough to still suggest it. There really isn't any legitimate reason I can see for this to be an option that's used by anyone else other then developers, or properly informed users. So, let's end the confusion and start printing warnings whenever it's enabled. Signed-off-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Jani Nikula <jani.nikula@intel.com> Cc: Kees Cook <keescook@chromium.org> Cc: "Jan H. Schönherr" <jschoenh@amazon.de> Cc: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
* console: Expand dummy functions for CFIKees Cook2018-02-271-10/+10
| | | | | | | | | | | This expands the no-op dummy functions into full prototypes to avoid indirect call mismatches when running under Control Flow Integrity checking, like with Clang's -fsanitize=cfi. Co-Developed-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* vgacon: Set VGA struct resource typesBjorn Helgaas2017-12-191-8/+26
| | | | | | | | | | | | | | | Set the resource type when we reserve VGA-related I/O port resources. The resource code doesn't actually look at the type, so it inserts resources without a type in the tree correctly even without this change. But if we ever print a resource without a type, it looks like this: vga+ [??? 0x000003c0-0x000003df flags 0x0] Setting the type means it will be printed correctly as: vga+ [io 0x000003c0-0x000003df] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
* vgacon: Prevent faulty bootparams.screeninfo from causing harmJan H. Schönherr2017-09-041-3/+2Star
| | | | | | | | | | | | | If a zero for the number of colums or rows manages to slip through, gotoxy() will underflow vc->vc_pos, causing the next action on the referenced memory to end with a page fault. Make the check in vgacon_startup() more pessimistic to prevent that. Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
* console: Make persistent scrollback a boot parameterManuel Schölling2017-01-251-13/+12Star
| | | | | | | | | | | | The impact of the persistent scrollback feature on the code size is rather small, so the config option is removed. The feature stays disabled by default and can be enabled by using the boot command line parameter 'vgacon.scrollback_persistent=1' or by setting VGACON_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT=y. Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de> Suggested-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* console: Add persistent scrollback buffers for all VGA consolesManuel Schölling2017-01-251-53/+89
| | | | | | | | | | | | | | | | | | Add a scrollback buffers for each VGA console. The benefit is that the scrollback history is not flushed when switching between consoles but is persistent. The buffers are allocated on demand when a new console is opened. This breaks tools like clear_console that rely on flushing the scrollback history by switching back and forth between consoles which is why this feature is disabled by default. Use the escape sequence \e[3J instead for flushing the buffer. Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de> Reviewed-by: Andrey Utkin <andrey_utkin@fastmail.com> Tested-by: Andrey Utkin <andrey_utkin@fastmail.com> Tested-by: Adam Borowski <kilobyte@angband.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* console: Add callback to flush scrollback buffer to consw structManuel Schölling2017-01-251-1/+23
| | | | | | | | | | | | | | | This new callback is in preparation for persistent scrollback buffer support for VGA consoles. With a single scrollback buffer for all consoles, we could flush the buffer just by invocating consw->con_switch(). But when each VGA console has its own scrollback buffer, we need a new callback to tell the video console driver which buffer to flush. Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de> Reviewed-by: Andrey Utkin <andrey_utkin@fastmail.com> Tested-by: Andrey Utkin <andrey_utkin@fastmail.com> Tested-by: Adam Borowski <kilobyte@angband.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* console: Move scrollback data into its own structManuel Schölling2017-01-251-44/+47
| | | | | | | | | | | This refactoring is in preparation for persistent scrollback support for VGA console. Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de> Reviewed-by: Andrey Utkin <andrey_utkin@fastmail.com> Tested-by: Andrey Utkin <andrey_utkin@fastmail.com> Tested-by: Adam Borowski <kilobyte@angband.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* vgacon: remove prehistoric macrosJiri Slaby2016-10-271-49/+0Star
| | | | | | | | | | | | | | | | | | | | | These macros: * CAN_LOAD_EGA_FONTS * CAN_LOAD_PALETTE * TRIDENT_GLITCH * VGA_CAN_DO_64KB * SLOW_VGA are either always set or always unset. They come from the linux 2.1 times. And given nobody switched them to some configurable options, I assume nobody actually uses them. So remove the macros and leave in place appropriate branches of the conditional code. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: <linux-fbdev@vger.kernel.org> Cc: <linux-doc@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* vgacon: switch boolean variables to boolJiri Slaby2016-10-271-22/+23
| | | | | | | | | | | | | | | | | | | | | | | | | These variables: * vga_can_do_color * vgacon_text_mode_force * vga_font_is_default * vga_hardscroll_enabled * vga_hardscroll_user_enable * vga_init_done * vga_is_gfx * vga_palette_blanked * vga_512_chars are used exclusively as a boolean value, so make them really a bool. Remove also useless "? true : false". __read_mostly annotations removed too as they obfuscate the code and I doubt they improve anything measurable given the variables are used from .con_scroll, .con_startup and such. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: <linux-fbdev@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vgacon+sisusb, move scrolldelta to a common helperJiri Slaby2016-10-271-25/+2Star
| | | | | | | | | | | | | | | | | | | | | | | The code is mirrorred in scrolldelta implementations of both vgacon and sisusb. Let's move the code to a separate helper where we will perform a common cleanup and further changes. While we are moving the code, make it linear and save one indentation level. This is done by returning from the "!lines" then-branch immediatelly. This allows flushing the else-branch 1 level to the left, obviously. Few more new lines and comments were added too. And do not forget to export the helper function given sisusb can be built as module. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Thomas Winischhofer <thomas@winischhofer.net> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: <linux-fbdev@vger.kernel.org> Cc: <linux-usb@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt, cleanup and document con_scrollJiri Slaby2016-10-271-7/+5Star
| | | | | | | | | | | | | | | | | | | | | | | | Scrolling helpers scrup and scrdown both accept 'top' and 'bottom' as unsigned int. Number of lines 'nr' is accepted as int, but all callers pass down unsigned too. So change the type of 'nr' to unsigned too. Now, promote unsigned int from the helpers up to the con_scroll hook which actually accepted all those as signed int. Next, the 'dir' parameter can have only two values and we define constants for that: SM_UP and SM_DOWN. Switch them to enum and do proper type checking on 'dir' too. Finally, document the behaviour of the hook. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Thomas Winischhofer <thomas@winischhofer.net> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Cc: Helge Deller <deller@gmx.de> Cc: <linux-fbdev@vger.kernel.org> Cc: <linux-usb@vger.kernel.org> Cc: <linux-parisc@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt, convert more macros to functionsJiri Slaby2016-06-251-4/+4
| | | | | | | | | | | | | | | | | Namely convert: * IS_FG -> con_is_fg * DO_UPDATE -> con_should_update * CON_IS_VISIBLE -> con_is_visible DO_UPDATE was a weird name for a yes/no answer, so the new name is con_should_update. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Thomas Winischhofer <thomas@winischhofer.net> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> Cc: linux-usb@vger.kernel.org Cc: linux-fbdev@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt, remove consw->con_bmoveJiri Slaby2016-06-251-1/+0Star
| | | | | | | | | | | | | | | | | It is never called since commit 81732c3b2fede (tty vt: Fix line garbage in virtual console on command line edition) in 3.7. So remove all the callbacks. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Thomas Winischhofer <thomas@winischhofer.net> Cc: linux-usb@vger.kernel.org Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Cc: Helge Deller <deller@gmx.de> Cc: linux-fbdev@vger.kernel.org Cc: linux-parisc@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt, consw->con_set_palette cleanupJiri Slaby2016-06-251-5/+2Star
| | | | | | | | | | | | | | | | | | | | * allow NULL consw->con_set_palette (some consoles define an empty hook) * => remove empty hooks now * return value of consw->con_set_palette is never checked => make the function void * document consw->con_set_palette a bit Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Thomas Winischhofer <thomas@winischhofer.net> Cc: linux-usb@vger.kernel.org Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Cc: Helge Deller <deller@gmx.de> Cc: linux-fbdev@vger.kernel.org Cc: linux-parisc@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt, consw->con_scrolldelta cleanupJiri Slaby2016-06-251-8/+5Star
| | | | | | | | | | | | | | | | | | | | * allow NULL consw->con_scrolldelta (some consoles define an empty hook) * => remove empty hooks now * return value of consw->con_scrolldelta is never checked => make the function void * document consw->con_scrolldelta a bit Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Thomas Winischhofer <thomas@winischhofer.net> Cc: linux-usb@vger.kernel.org Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Cc: Helge Deller <deller@gmx.de> Cc: linux-fbdev@vger.kernel.org Cc: linux-parisc@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: vt, make color_table constJiri Slaby2016-04-301-3/+2Star
| | | | | | | | This means all ->con_set_palette have to have the second parameter const too now. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* video/console: Resolve several shadow warningsMark Rustad2014-10-221-12/+12
| | | | | | | | | Resolve shadow warnings that appear in W=2 builds by renaming the "state" global to "vgastate". Signed-off-by: Mark Rustad <mark.d.rustad@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
* Merge tag 'drm-intel-fixes-2014-06-17' of ↵Dave Airlie2014-06-191-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://anongit.freedesktop.org/drm-intel into drm-next First round of fixes for 3.16-rc, mostly cc: stable, and the vt/vgacon fixes from Daniel [1] to avoid hangs and unclaimed register errors on module load/reload. * tag 'drm-intel-fixes-2014-06-17' of git://anongit.freedesktop.org/drm-intel: drm/i915/bdw: remove erroneous chv specific workarounds from bdw code drm/i915: fix possible refcount leak when resetting forcewake drm/i915: Reorder semaphore deadlock check drm/i95: Initialize active ring->pid to -1 drm/i915: set backlight duty cycle after backlight enable for gen4 drm/i915: Avoid div-by-zero when pixel_multiplier is zero drm/i915: Disable FBC by default also on Haswell and later drm/i915: Kick out vga console drm/i915: Fixup global gtt cleanup vt: Don't ignore unbind errors in vt_unbind vt: Fix up unregistration of vt drivers vt: Fix replacement console check when unbinding
| * drm/i915: Kick out vga consoleDaniel Vetter2014-06-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Touching the VGA resources on an IVB EFI machine causes hard hangs when we then kick out the efifb. Ouch. Apparently this also prevents unclaimed register errors on hsw and hard machine hangs on my i855gm when trying to unbind fbcon. Also, we want this to make I915_FBDEV=n safe. v2: Rebase and pimp commit message. v3: We also need to unregister the vga console, otherwise the unbind of the fb console before module unload might resurrect it again. v4: Ignore errors when the vga console is already unregistered - this can happen when e.g. reloading i915.ko. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67813 Cc: David Herrmann <dh.herrmann@gmail.com> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: linux-fbdev@vger.kernel.org Cc: Jani Nikula <jani.nikula@linux.intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> (v1) Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
* | console: Use explicit pointer type for vc_uni_pagedir* fieldsTakashi Iwai2014-05-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The vc_data.vc_uni_pagedir filed is currently long int, supposedly to be served generically. This, however, leads to lots of cast to pointer, and rather it worsens the readability significantly. Actually, we have now only a single uni_pagedir map implementation, and this won't change likely. So, it'd be much more simple and error-prone to just use the exact pointer for struct uni_pagedir instead of long. Ditto for vc_uni_pagedir_loc. It's a pointer to the uni_pagedir, thus it can be changed similarly to the exact type. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | vgacon: Fix & cleanup refcountingTakashi Iwai2014-05-281-7/+8
|/ | | | | | | | | | | | | | | | The vgacon driver prepares a two element array of uni_pagedir_loc and uses the second item as its own reference counter for sharing the uni_pagedir. And the code assumes blindly that the second item is available if the assigned vc_uni_pagedir isn't the standard one, which might be wrong (although currently it's so). This patch fixes that wrong assumption, and gives a slight cleanup along with it: namely, instead of array, just give the uni_pagedir_loc and a separate refcount variable. It makes the code a bit more understandable at first glance. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* vgacon: fix missing include.Dave Airlie2013-06-271-0/+1
| | | | | | This fixes the build error. Signed-off-by: Dave Airlie <airlied@redhat.com>
* vgacon.c: add cond reschedule points in vgacon_do_font_opMarcelo Tosatti2013-06-261-4/+12
| | | | | | | | | | | | | | | | | | | Booting a 64-vcpu KVM guest, with CONFIG_PREEMPT_VOLUNTARY, can result in a soft lockup: BUG: soft lockup - CPU#41 stuck for 67s! [setfont:1505] RIP: 0010:[<ffffffff812c48da>] [<ffffffff812c48da>] vgacon_do_font_op.clone.0+0x1ba/0x550 This is due to the 8192 (cmapsz) IO operations taking longer than expected due to lock contention in QEMU. Add conditional resched points in between writes allowing other tasks to execute. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Dave Airlie <airlied@redhat.com>
* vgacon/vt: clear buffer attributes when we load a 512 character font (v2)Dave Airlie2013-02-071-7/+15
| | | | | | | | | | | | | | | | | | | | | | When we switch from 256->512 byte font rendering mode, it means the current contents of the screen is being reinterpreted. The bit that holds the high bit of the 9-bit font, may have been previously set, and thus the new font misrenders. The problem case we see is grub2 writes spaces with the bit set, so it ends up with data like 0x820, which gets reinterpreted into 0x120 char which the font translates into G with a circumflex. This flashes up on screen at boot and is quite ugly. A current side effect of this patch though is that any rendering on the screen changes color to a slightly darker color, but at least the screen no longer corrupts. v2: as suggested by hpa, always clear the attribute space, whether we are are going to or from 512 chars. Cc: stable@vger.kernel.org Signed-off-by: Dave Airlie <airlied@redhat.com>
* locking, video: Annotate vga console lock as rawThomas Gleixner2011-09-131-21/+21
| | | | | | | | | | | | The vga_lock lock can be taken in atomic context and therefore cannot be preempted on -rt - annotate it. In mainline this change documents the low level nature of the lock - otherwise there's no functional difference. Lockdep and Sparse checking will work as usual. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* video: fix some comments in drivers/video/console/vgacon.cAmerigo Wang2011-01-251-5/+1Star
| | | | | | | | Now vgacon_scrollback_startup() uses slab, not bootmem, the comment above it is obsolete, so does __init_refok. Signed-off-by: WANG Cong <amwang@redhat.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* vgacon: check for efi machineYannick Heneault2011-01-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | It seems there is a small problem of VGA palette corruption on EFI machine. When the kernel initializes the architecture, it checks if the machine is a EFI machine and assumes that a VGA console can exist. When it initializes the console in vgacon_startup it checks if it can really use the VGA console. I think this is where a check is missing. Currently, the function can fail if a VESA boot mode is detected but not if a EFI boot mode was used. Thus vgacon_startup() doesn't fail and initialize the video card for a real VGA mode. This function changes the first 16entries of the VGA palette. When the efifb driver kicks in, the palette is not restored to default ramp value, thus the 16 first entry remain in a modified state. The following patch prevent this corruption. Signed-off-by: Yannick Heneault <yheneaul@matrox.com> Cc: Dave Airlie <airlied@linux.ie> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* BKL: remove extraneous #include <smp_lock.h>Arnd Bergmann2010-11-171-1/+0Star
| | | | | | | | | | The big kernel lock has been removed from all these files at some point, leaving only the #include. Remove this too as a cleanup. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: fix console_sem lock orderArnd Bergmann2010-08-101-2/+0Star
| | | | | | | | | | | | | | vgacon_do_font_op releases and reacquires the BTM while holding console_sem. This violates the rule that BTM has to be the outer lock whenever we hold both. There does not seem to be any reason to give up the BTM here, so just stop doing that. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* tty: replace BKL with a new tty_lockArnd Bergmann2010-08-101-2/+2
| | | | | | | | | | | As a preparation for replacing the big kernel lock in the TTY layer, wrap all the callers in new macros tty_lock, tty_lock_nested and tty_unlock. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* console/vgacon.c: mark file-local symbol staticThiago Farina2010-03-061-1/+1
| | | | | | | | | warning: symbol 'vgacon_text_mode_force' was not declared. Should it be static? Signed-off-by: Thiago Farina <tfransosi@gmail.com> Acked-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* vgacon: Add support for setting the default cursor stateMatthew Garrett2009-11-141-1/+4
| | | | | | | | | Pass the vga cursor state to the vt layer, ensuring that we don't hide the cursor when the bootloader has deliberately disabled it. Signed-off-by: Matthew Garrett <mjg@redhat.com> LKML-Reference: <1258142222-16092-3-git-send-email-mjg@redhat.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* vc: Add support for hiding the cursor when creating VTsMatthew Garrett2009-11-141-0/+2
| | | | | | | | | | Add support for setting a global default for whether or not a visible cursor should be enabled when creating VCs. The default will be to do so, unless overridden by the user at boot time or by a driver. Signed-off-by: Matthew Garrett <mjg@redhat.com> LKML-Reference: <1258143251-5818-1-git-send-email-mjg@redhat.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* vgacon: prevent vgacon_deinit from touching the hardware for inactive consoles.Francisco Jerez2009-09-231-3/+5
| | | | | | | | | | | | | | | | | | | | | fbcon makes the (reasonable) assumption that it only needs to program the hardware once, when fbcon_init() is called for the foreground console. This doesn't always play well with vgacon because vgacon_deinit() is only doing its job when the last console it owns is closed (when switching from vgacon to fbcon, that's usually *after* fbcon_init() has set the new mode). Depending on the hardware this can cause the wrong framebuffer location to be scanned out (e.g. reproduced on nv05 with the nouveau framebuffer driver). Signed-off-by: Francisco Jerez <currojerez@riseup.net> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* includecheck fix: drivers/video, vgacon.cJaswinder Singh Rajput2009-09-201-1/+0Star
| | | | | | | | | | | | fix the following 'make includecheck' warning: drivers/video/console/vgacon.c: linux/slab.h is included more than once. Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com> Cc: Martin Mares <mj@ucw.cz> Cc: mchehab@infradead.org Cc: Sam Ravnborg <sam@ravnborg.org> LKML-Reference: <1247067624.4382.88.camel@ht.satnam>
* vgacon: use slab allocator instead of the bootmem allocatorPekka Enberg2009-06-111-3/+2Star
| | | | | | | Slab is initialized before the console subsystem so use the slab allocator in vgacon_scrollback_startup(). Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
* vgacon: return the upper half of 512 character fontsStefan Bader2009-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | Uwe Geuder noted that he gets random bitmaps on a text console if he tried to type extended characters (like the e acute). For him everything above unicode 0xa0 was corrupted. After some digging there seems to be a little culprit in vgacon since the beginning of ages (well git). The function vgacon_font_get will store the number of characters correctly in font->charcount but then calls to vgacon_do_font_op(..., 0, 0). Which means only the lower 256 characters are actually stored to the fontdata. The rest is left untouched. So the next time that saved data is used, the garbled font appears. This happens on every switch between text consoles. Addresses https://bugs.launchpad.net/ubuntu/+source/linux/+bug/355057 Signed-off-by: Stefan Bader <stefan.bader@canonical.com> Tested-by: Uwe Geuder <ubuntuLp-ugeuder@sneakemail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* trivial: fix then -> than typos in comments and documentationFrederik Schwarzer2009-01-061-1/+1
| | | | | | | - (better, more, bigger ...) then -> (...) than Signed-off-by: Frederik Schwarzer <schwarzerf@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* DRM: add mode setting supportDave Airlie2008-12-291-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | Add mode setting support to the DRM layer. This is a fairly big chunk of work that allows DRM drivers to provide full output control and configuration capabilities to userspace. It was motivated by several factors: - the fb layer's APIs aren't suited for anything but simple configurations - coordination between the fb layer, DRM layer, and various userspace drivers is poor to non-existent (radeonfb excepted) - user level mode setting drivers makes displaying panic & oops messages more difficult - suspend/resume of graphics state is possible in many more configurations with kernel level support This commit just adds the core DRM part of the mode setting APIs. Driver specific commits using these new structure and APIs will follow. Co-authors: Jesse Barnes <jbarnes@virtuousgeek.org>, Jakob Bornecrantz <jakob@tungstengraphics.com> Contributors: Alan Hourihane <alanh@tungstengraphics.com>, Maarten Maathuis <madman2003@gmail.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
* vgacon: vgacon_scrolldelta simplificationMarcin Slusarz2008-10-161-12/+8Star
| | | | | | | | | | | | There's no point in checking diff == c->vc_rows, because it can be true only when count == 0, but we already checked that. Additionally move variables used only in one block to this block. Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Cc: Antonino Daplas <adaplas@gmail.com> Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* vgacon: optimize scrollingMarcin Slusarz2008-10-161-12/+15
| | | | | | | | | | | Join multiple scr_memcpyw into 1-3 calls (usually 2). (benchmarked average speedup: 1%) Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Cc: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Revert "vt: fix background color on line feed"Linus Torvalds2008-10-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit c9e587abfdec2c2aaa55fab83bcb4972e2f84f9b, and the subsequent commits that fixed it up: - afa9b649 "fbcon: prevent cursor disappearance after switching to 512 character font" - d850a2fa "vt/fbcon: fix background color on line feed" - 7fe3915a "vt/fbcon: update scrl_erase_char after 256/512-glyph font switch" by request of Alan Cox. Quoth Alan: "Unfortunately it's wrong and its been causing breakages because various apps like ncurses expect our previous (and correct) behaviour." Alexander sent out a similar patch. Requested-by: Alan Cox <alan@lxorguk.ukuu.org.uk> Tested-by: Jan Engelhardt <jengelh@medozas.de> Cc: Alexander V. Lukyanov <lav@netis.ru> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* vt: fix background color on line feedJan Engelhardt2008-04-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A command that causes a line feed while a background color is active, such as perl -e 'print "x" x 60, "\e[44m", "x" x 40, "\e[0m\n"' and perl -e 'print "x" x 40, "\e[44m\n", "x" x 40, "\e[0m\n"' causes the line that was started as a result of the line feed to be completely filled with the currently active background color instead of the default color. When scrolling, part of the current screen is memcpy'd/memmove'd to the new region, and the new line(s) that will appear as a result are cleared using memset. However, the lines are cleared with vc->vc_video_erase_char, causing them to be colored with the currently active background color. This is different from X11 terminal emulators which always paint the new lines with the default background color (e.g. `xterm -bg black`). The clear operation (\e[1J and \e[2J) also use vc_video_erase_char, so a new vc->vc_scrl_erase_char is introduced with contains the erase character used for scrolling, which is built from vc->vc_def_color instead of vc->vc_color. Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de> Cc: "Antonino A. Daplas" <adaplas@pol.net> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* vgacon: fix sparse warning about shadowing 'i' symbolMarcin Slusarz2008-02-061-2/+0Star
| | | | | | | Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* Remove magic macros for screen_info structure membersH. Peter Anvin2007-10-171-24/+25
| | | | | | Stop using magic macros for screen_info structure members. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* [x86] remove uses of magic macros for boot_params accessH. Peter Anvin2007-10-171-1/+1
| | | | | | | Instead of using magic macros for boot_params access, simply use the boot_params structure. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* vt/vgacon: Check if screen resize request comes from userspaceAntonino A. Daplas2007-10-161-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Various console drivers are able to resize the screen via the con_resize() hook. This hook is also visible in userspace via the TIOCWINSZ, VT_RESIZE and VT_RESIZEX ioctl's. One particular utility, SVGATextMode, expects that con_resize() of the VGA console will always return success even if the resulting screen is not compatible with the hardware. However, this particular behavior of the VGA console, as reported in Kernel Bugzilla Bug 7513, can cause undefined behavior if the user starts with a console size larger than 80x25. To work around this problem, add an extra parameter to con_resize(). This parameter is ignored by drivers except for vgacon. If this parameter is non-zero, then the resize request came from a VT_RESIZE or VT_RESIZEX ioctl and vgacon will always return success. If this parameter is zero, vgacon will return -EINVAL if the requested size is not compatible with the hardware. The latter is the more correct behavior. With this change, SVGATextMode should still work correctly while in-kernel and stty resize calls can expect correct behavior from vgacon. Signed-off-by: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* console: fix section mismatch warning in vgacon.cSam Ravnborg2007-07-221-1/+5
| | | | | | | | | | | | | | | Fix following section mismatch warning: WARNING: vmlinux.o(.text+0x121e62): Section mismatch: reference to .init.text:__alloc_bootmem (between 'vgacon_startup' and 'vgacon_scrolldelta') Browsing the code it seems that vgacon_scrollback_startup() is only called during the init phase so the reference to the .init.text section is OK. Teach modpost not to warn using ___init_refok. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Acked-by: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>