Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
at master 52 lines 1.3 kB view raw
1/* 2 * linux/drivers/video/console/fbcon_rotate.c -- Software Rotation 3 * 4 * Copyright (C) 2005 Antonino Daplas <adaplas @pol.net> 5 * 6 * This file is subject to the terms and conditions of the GNU General Public 7 * License. See the file COPYING in the main directory of this archive for 8 * more details. 9 */ 10 11#include <linux/errno.h> 12#include <linux/fb.h> 13#include <linux/font.h> 14 15#include "fbcon.h" 16#include "fbcon_rotate.h" 17 18int fbcon_rotate_font(struct fb_info *info, struct vc_data *vc) 19{ 20 struct fbcon_par *par = info->fbcon_par; 21 unsigned char *buf; 22 int ret; 23 24 if (par->p->fontdata == par->rotated.fontdata && par->rotate == par->rotated.buf_rotate) 25 return 0; 26 27 par->rotated.fontdata = par->p->fontdata; 28 par->rotated.buf_rotate = par->rotate; 29 30 if (info->fbops->fb_sync) 31 info->fbops->fb_sync(info); 32 33 buf = font_data_rotate(par->rotated.fontdata, vc->vc_font.width, 34 vc->vc_font.height, vc->vc_font.charcount, 35 par->rotated.buf_rotate, par->rotated.buf, 36 &par->rotated.bufsize); 37 if (IS_ERR(buf)) { 38 ret = PTR_ERR(buf); 39 goto err_kfree; 40 } 41 42 par->rotated.buf = buf; 43 44 return 0; 45 46err_kfree: 47 kfree(par->rotated.buf); 48 par->rotated.buf = NULL; /* clear here to avoid output */ 49 par->rotated.bufsize = 0; 50 51 return ret; 52}