Changes in 4.9.239 vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock vsock/virtio: stop workers during the .remove() USB: gadget: f_ncm: Fix NDP16 datagram validation gpio: tc35894: fix up tc35894 interrupt configuration Input: i8042 - add nopnp quirk for Acer Aspire 5 A515 drm/amdgpu: restore proper ref count in amdgpu_display_crtc_set_config net: dec: de2104x: Increase receive ring size for Tulip rndis_host: increase sleep time in the query-response loop drivers/net/wan/lapbether: Make skb->protocol consistent with the header drivers/net/wan/hdlc: Set skb->protocol before transmitting mac80211: do not allow bigger VHT MPDUs than the hardware supports nfs: Fix security label length not being reset clk: samsung: exynos4: mark 'chipid' clock as CLK_IGNORE_UNUSED iommu/exynos: add missing put_device() call in exynos_iommu_of_xlate() i2c: cpm: Fix i2c_ram structure random32: Restore __latent_entropy attribute on net_rand_state net/packet: fix overflow in tpacket_rcv epoll: do not insert into poll queues until all sanity checks are done epoll: replace ->visited/visited_list with generation count epoll: EPOLL_CTL_ADD: close the race in decision to take fast path ep_create_wakeup_source(): dentry name can change under you... netfilter: ctnetlink: add a range check for l3/l4 protonum fbdev, newport_con: Move FONT_EXTRA_WORDS macros into linux/font.h Fonts: Support FONT_EXTRA_WORDS macros for built-in fonts Revert "ravb: Fixed to be able to unload modules" fbcon: Fix global-out-of-bounds read in fbcon_get_font() net: wireless: nl80211: fix out-of-bounds access in nl80211_del_key() usermodehelper: reset umask to default before executing user process platform/x86: thinkpad_acpi: initialize tp_nvram_state variable platform/x86: thinkpad_acpi: re-initialize ACPI buffer size when reuse driver core: Fix probe_count imbalance in really_probe() perf top: Fix stdio interface input handling with glibc 2.28+ mtd: rawnand: sunxi: Fix the probe error path ftrace: Move RCU is watching check after recursion check macsec: avoid use-after-free in macsec_handle_frame() mm/khugepaged: fix filemap page_to_pgoff(page) != offset sctp: fix sctp_auth_init_hmacs() error path team: set dev->needed_headroom in team_setup_by_port() net: team: fix memory leak in __team_options_register openvswitch: handle DNAT tuple collision drm/amdgpu: prevent double kfree ttm->sg xfrm: clone XFRMA_REPLAY_ESN_VAL in xfrm_do_migrate xfrm: clone whole liftime_cur structure in xfrm_do_migrate net: stmmac: removed enabling eee in EEE set callback xfrm: Use correct address family in xfrm_state_find bonding: set dev->needed_headroom in bond_setup_by_slave() mdio: fix mdio-thunder.c dependency & build error rxrpc: Fix rxkad token xdr encoding rxrpc: Downgrade the BUG() for unsupported token type in rxrpc_read() rxrpc: Fix some missing _bh annotations on locking conn->state_lock rxrpc: Fix server keyring leak perf: Fix task_function_call() error handling mm: khugepaged: recalculate min_free_kbytes after memory hotplug as expected by khugepaged net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails Linux 4.9.239 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I425f266783f834eac9a2eaf95bbf7217a7128595
259 lines
7.0 KiB
C
259 lines
7.0 KiB
C
/*
|
|
* linux/drivers/video/console/fbcon.h -- Low level frame buffer based console driver
|
|
*
|
|
* Copyright (C) 1997 Geert Uytterhoeven
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file COPYING in the main directory of this archive
|
|
* for more details.
|
|
*/
|
|
|
|
#ifndef _VIDEO_FBCON_H
|
|
#define _VIDEO_FBCON_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/vt_buffer.h>
|
|
#include <linux/vt_kern.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
#define FBCON_FLAGS_INIT 1
|
|
#define FBCON_FLAGS_CURSOR_TIMER 2
|
|
|
|
/*
|
|
* This is the interface between the low-level console driver and the
|
|
* low-level frame buffer device
|
|
*/
|
|
|
|
struct display {
|
|
/* Filled in by the low-level console driver */
|
|
const u_char *fontdata;
|
|
int userfont; /* != 0 if fontdata kmalloc()ed */
|
|
u_short scrollmode; /* Scroll Method */
|
|
u_short inverse; /* != 0 text black on white as default */
|
|
short yscroll; /* Hardware scrolling */
|
|
int vrows; /* number of virtual rows */
|
|
int cursor_shape;
|
|
int con_rotate;
|
|
u32 xres_virtual;
|
|
u32 yres_virtual;
|
|
u32 height;
|
|
u32 width;
|
|
u32 bits_per_pixel;
|
|
u32 grayscale;
|
|
u32 nonstd;
|
|
u32 accel_flags;
|
|
u32 rotate;
|
|
struct fb_bitfield red;
|
|
struct fb_bitfield green;
|
|
struct fb_bitfield blue;
|
|
struct fb_bitfield transp;
|
|
const struct fb_videomode *mode;
|
|
};
|
|
|
|
struct fbcon_ops {
|
|
void (*bmove)(struct vc_data *vc, struct fb_info *info, int sy,
|
|
int sx, int dy, int dx, int height, int width);
|
|
void (*clear)(struct vc_data *vc, struct fb_info *info, int sy,
|
|
int sx, int height, int width);
|
|
void (*putcs)(struct vc_data *vc, struct fb_info *info,
|
|
const unsigned short *s, int count, int yy, int xx,
|
|
int fg, int bg);
|
|
void (*clear_margins)(struct vc_data *vc, struct fb_info *info,
|
|
int bottom_only);
|
|
void (*cursor)(struct vc_data *vc, struct fb_info *info, int mode,
|
|
int fg, int bg);
|
|
int (*update_start)(struct fb_info *info);
|
|
int (*rotate_font)(struct fb_info *info, struct vc_data *vc);
|
|
struct fb_var_screeninfo var; /* copy of the current fb_var_screeninfo */
|
|
struct timer_list cursor_timer; /* Cursor timer */
|
|
struct fb_cursor cursor_state;
|
|
struct display *p;
|
|
int currcon; /* Current VC. */
|
|
int cur_blink_jiffies;
|
|
int cursor_flash;
|
|
int cursor_reset;
|
|
int blank_state;
|
|
int graphics;
|
|
int save_graphics; /* for debug enter/leave */
|
|
int flags;
|
|
int rotate;
|
|
int cur_rotate;
|
|
char *cursor_data;
|
|
u8 *fontbuffer;
|
|
u8 *fontdata;
|
|
u8 *cursor_src;
|
|
u32 cursor_size;
|
|
u32 fd_size;
|
|
};
|
|
/*
|
|
* Attribute Decoding
|
|
*/
|
|
|
|
/* Color */
|
|
#define attr_fgcol(fgshift,s) \
|
|
(((s) >> (fgshift)) & 0x0f)
|
|
#define attr_bgcol(bgshift,s) \
|
|
(((s) >> (bgshift)) & 0x0f)
|
|
|
|
/* Monochrome */
|
|
#define attr_bold(s) \
|
|
((s) & 0x200)
|
|
#define attr_reverse(s) \
|
|
((s) & 0x800)
|
|
#define attr_underline(s) \
|
|
((s) & 0x400)
|
|
#define attr_blink(s) \
|
|
((s) & 0x8000)
|
|
|
|
|
|
static inline int mono_col(const struct fb_info *info)
|
|
{
|
|
__u32 max_len;
|
|
max_len = max(info->var.green.length, info->var.red.length);
|
|
max_len = max(info->var.blue.length, max_len);
|
|
return (~(0xfff << max_len)) & 0xff;
|
|
}
|
|
|
|
static inline int attr_col_ec(int shift, struct vc_data *vc,
|
|
struct fb_info *info, int is_fg)
|
|
{
|
|
int is_mono01;
|
|
int col;
|
|
int fg;
|
|
int bg;
|
|
|
|
if (!vc)
|
|
return 0;
|
|
|
|
if (vc->vc_can_do_color)
|
|
return is_fg ? attr_fgcol(shift,vc->vc_video_erase_char)
|
|
: attr_bgcol(shift,vc->vc_video_erase_char);
|
|
|
|
if (!info)
|
|
return 0;
|
|
|
|
col = mono_col(info);
|
|
is_mono01 = info->fix.visual == FB_VISUAL_MONO01;
|
|
|
|
if (attr_reverse(vc->vc_video_erase_char)) {
|
|
fg = is_mono01 ? col : 0;
|
|
bg = is_mono01 ? 0 : col;
|
|
}
|
|
else {
|
|
fg = is_mono01 ? 0 : col;
|
|
bg = is_mono01 ? col : 0;
|
|
}
|
|
|
|
return is_fg ? fg : bg;
|
|
}
|
|
|
|
#define attr_bgcol_ec(bgshift, vc, info) attr_col_ec(bgshift, vc, info, 0)
|
|
#define attr_fgcol_ec(fgshift, vc, info) attr_col_ec(fgshift, vc, info, 1)
|
|
|
|
/*
|
|
* Scroll Method
|
|
*/
|
|
|
|
/* There are several methods fbcon can use to move text around the screen:
|
|
*
|
|
* Operation Pan Wrap
|
|
*---------------------------------------------
|
|
* SCROLL_MOVE copyarea No No
|
|
* SCROLL_PAN_MOVE copyarea Yes No
|
|
* SCROLL_WRAP_MOVE copyarea No Yes
|
|
* SCROLL_REDRAW imageblit No No
|
|
* SCROLL_PAN_REDRAW imageblit Yes No
|
|
* SCROLL_WRAP_REDRAW imageblit No Yes
|
|
*
|
|
* (SCROLL_WRAP_REDRAW is not implemented yet)
|
|
*
|
|
* In general, fbcon will choose the best scrolling
|
|
* method based on the rule below:
|
|
*
|
|
* Pan/Wrap > accel imageblit > accel copyarea >
|
|
* soft imageblit > (soft copyarea)
|
|
*
|
|
* Exception to the rule: Pan + accel copyarea is
|
|
* preferred over Pan + accel imageblit.
|
|
*
|
|
* The above is typical for PCI/AGP cards. Unless
|
|
* overridden, fbcon will never use soft copyarea.
|
|
*
|
|
* If you need to override the above rule, set the
|
|
* appropriate flags in fb_info->flags. For example,
|
|
* to prefer copyarea over imageblit, set
|
|
* FBINFO_READS_FAST.
|
|
*
|
|
* Other notes:
|
|
* + use the hardware engine to move the text
|
|
* (hw-accelerated copyarea() and fillrect())
|
|
* + use hardware-supported panning on a large virtual screen
|
|
* + amifb can not only pan, but also wrap the display by N lines
|
|
* (i.e. visible line i = physical line (i+N) % yres).
|
|
* + read what's already rendered on the screen and
|
|
* write it in a different place (this is cfb_copyarea())
|
|
* + re-render the text to the screen
|
|
*
|
|
* Whether to use wrapping or panning can only be figured out at
|
|
* runtime (when we know whether our font height is a multiple
|
|
* of the pan/wrap step)
|
|
*
|
|
*/
|
|
|
|
#define SCROLL_MOVE 0x001
|
|
#define SCROLL_PAN_MOVE 0x002
|
|
#define SCROLL_WRAP_MOVE 0x003
|
|
#define SCROLL_REDRAW 0x004
|
|
#define SCROLL_PAN_REDRAW 0x005
|
|
|
|
#ifdef CONFIG_FB_TILEBLITTING
|
|
extern void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info);
|
|
#endif
|
|
extern void fbcon_set_bitops(struct fbcon_ops *ops);
|
|
extern int soft_cursor(struct fb_info *info, struct fb_cursor *cursor);
|
|
|
|
#define FBCON_ATTRIBUTE_UNDERLINE 1
|
|
#define FBCON_ATTRIBUTE_REVERSE 2
|
|
#define FBCON_ATTRIBUTE_BOLD 4
|
|
|
|
static inline int real_y(struct display *p, int ypos)
|
|
{
|
|
int rows = p->vrows;
|
|
|
|
ypos += p->yscroll;
|
|
return ypos < rows ? ypos : ypos - rows;
|
|
}
|
|
|
|
|
|
static inline int get_attribute(struct fb_info *info, u16 c)
|
|
{
|
|
int attribute = 0;
|
|
|
|
if (fb_get_color_depth(&info->var, &info->fix) == 1) {
|
|
if (attr_underline(c))
|
|
attribute |= FBCON_ATTRIBUTE_UNDERLINE;
|
|
if (attr_reverse(c))
|
|
attribute |= FBCON_ATTRIBUTE_REVERSE;
|
|
if (attr_bold(c))
|
|
attribute |= FBCON_ATTRIBUTE_BOLD;
|
|
}
|
|
|
|
return attribute;
|
|
}
|
|
|
|
#define FBCON_SWAP(i,r,v) ({ \
|
|
typeof(r) _r = (r); \
|
|
typeof(v) _v = (v); \
|
|
(void) (&_r == &_v); \
|
|
(i == FB_ROTATE_UR || i == FB_ROTATE_UD) ? _r : _v; })
|
|
|
|
#ifdef CONFIG_FRAMEBUFFER_CONSOLE_ROTATION
|
|
extern void fbcon_set_rotate(struct fbcon_ops *ops);
|
|
#else
|
|
#define fbcon_set_rotate(x) do {} while(0)
|
|
#endif /* CONFIG_FRAMEBUFFER_CONSOLE_ROTATION */
|
|
|
|
#endif /* _VIDEO_FBCON_H */
|
|
|