sis_accel.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. /*
  2. * SiS 300/630/730/540/315/550/65x/74x/330/760 frame buffer driver
  3. * for Linux kernels 2.4.x and 2.6.x
  4. *
  5. * 2D acceleration part
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the named License,
  10. * or any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
  20. *
  21. * Based on the XFree86/X.org driver which is
  22. * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
  23. *
  24. * Author: Thomas Winischhofer <thomas@winischhofer.net>
  25. * (see http://www.winischhofer.net/
  26. * for more information and updates)
  27. */
  28. #include <linux/config.h>
  29. #include <linux/version.h>
  30. #include <linux/module.h>
  31. #include <linux/kernel.h>
  32. #include <linux/errno.h>
  33. #include <linux/fb.h>
  34. #include <linux/console.h>
  35. #include <linux/selection.h>
  36. #include <linux/ioport.h>
  37. #include <linux/capability.h>
  38. #include <linux/fs.h>
  39. #include <linux/types.h>
  40. #include <asm/io.h>
  41. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
  42. #include <video/fbcon.h>
  43. #include <video/fbcon-cfb8.h>
  44. #include <video/fbcon-cfb16.h>
  45. #include <video/fbcon-cfb24.h>
  46. #include <video/fbcon-cfb32.h>
  47. #endif
  48. #include "sis.h"
  49. #include "sis_accel.h"
  50. static const u8 sisALUConv[] =
  51. {
  52. 0x00, /* dest = 0; 0, GXclear, 0 */
  53. 0x88, /* dest &= src; DSa, GXand, 0x1 */
  54. 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */
  55. 0xCC, /* dest = src; S, GXcopy, 0x3 */
  56. 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */
  57. 0xAA, /* dest = dest; D, GXnoop, 0x5 */
  58. 0x66, /* dest = ^src; DSx, GXxor, 0x6 */
  59. 0xEE, /* dest |= src; DSo, GXor, 0x7 */
  60. 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */
  61. 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */
  62. 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
  63. 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */
  64. 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */
  65. 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */
  66. 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */
  67. 0xFF, /* dest = 0xFF; 1, GXset, 0xF */
  68. };
  69. /* same ROP but with Pattern as Source */
  70. static const u8 sisPatALUConv[] =
  71. {
  72. 0x00, /* dest = 0; 0, GXclear, 0 */
  73. 0xA0, /* dest &= src; DPa, GXand, 0x1 */
  74. 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */
  75. 0xF0, /* dest = src; P, GXcopy, 0x3 */
  76. 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */
  77. 0xAA, /* dest = dest; D, GXnoop, 0x5 */
  78. 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */
  79. 0xFA, /* dest |= src; DPo, GXor, 0x7 */
  80. 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */
  81. 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */
  82. 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
  83. 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */
  84. 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */
  85. 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */
  86. 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */
  87. 0xFF, /* dest = 0xFF; 1, GXset, 0xF */
  88. };
  89. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,34)
  90. static const int myrops[] = {
  91. 3, 10, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
  92. };
  93. #endif
  94. /* 300 series ----------------------------------------------------- */
  95. #ifdef CONFIG_FB_SIS_300
  96. static void
  97. SiS300Sync(struct sis_video_info *ivideo)
  98. {
  99. SiS300Idle
  100. }
  101. static void
  102. SiS300SetupForScreenToScreenCopy(struct sis_video_info *ivideo, int xdir, int ydir,
  103. int rop, int trans_color)
  104. {
  105. SiS300SetupDSTColorDepth(ivideo->DstColor);
  106. SiS300SetupSRCPitch(ivideo->video_linelength)
  107. SiS300SetupDSTRect(ivideo->video_linelength, 0xffff)
  108. if(trans_color != -1) {
  109. SiS300SetupROP(0x0A)
  110. SiS300SetupSRCTrans(trans_color)
  111. SiS300SetupCMDFlag(TRANSPARENT_BITBLT)
  112. } else {
  113. SiS300SetupROP(sisALUConv[rop])
  114. }
  115. if(xdir > 0) {
  116. SiS300SetupCMDFlag(X_INC)
  117. }
  118. if(ydir > 0) {
  119. SiS300SetupCMDFlag(Y_INC)
  120. }
  121. }
  122. static void
  123. SiS300SubsequentScreenToScreenCopy(struct sis_video_info *ivideo, int src_x,
  124. int src_y, int dst_x, int dst_y, int width, int height)
  125. {
  126. u32 srcbase = 0, dstbase = 0;
  127. if(src_y >= 2048) {
  128. srcbase = ivideo->video_linelength * src_y;
  129. src_y = 0;
  130. }
  131. if(dst_y >= 2048) {
  132. dstbase = ivideo->video_linelength * dst_y;
  133. dst_y = 0;
  134. }
  135. SiS300SetupSRCBase(srcbase);
  136. SiS300SetupDSTBase(dstbase);
  137. if(!(ivideo->CommandReg & X_INC)) {
  138. src_x += width-1;
  139. dst_x += width-1;
  140. }
  141. if(!(ivideo->CommandReg & Y_INC)) {
  142. src_y += height-1;
  143. dst_y += height-1;
  144. }
  145. SiS300SetupRect(width, height)
  146. SiS300SetupSRCXY(src_x, src_y)
  147. SiS300SetupDSTXY(dst_x, dst_y)
  148. SiS300DoCMD
  149. }
  150. static void
  151. SiS300SetupForSolidFill(struct sis_video_info *ivideo, u32 color, int rop)
  152. {
  153. SiS300SetupPATFG(color)
  154. SiS300SetupDSTRect(ivideo->video_linelength, 0xffff)
  155. SiS300SetupDSTColorDepth(ivideo->DstColor);
  156. SiS300SetupROP(sisPatALUConv[rop])
  157. SiS300SetupCMDFlag(PATFG)
  158. }
  159. static void
  160. SiS300SubsequentSolidFillRect(struct sis_video_info *ivideo, int x, int y, int w, int h)
  161. {
  162. u32 dstbase = 0;
  163. if(y >= 2048) {
  164. dstbase = ivideo->video_linelength * y;
  165. y = 0;
  166. }
  167. SiS300SetupDSTBase(dstbase)
  168. SiS300SetupDSTXY(x,y)
  169. SiS300SetupRect(w,h)
  170. SiS300SetupCMDFlag(X_INC | Y_INC | BITBLT)
  171. SiS300DoCMD
  172. }
  173. #endif
  174. /* 315/330 series ------------------------------------------------- */
  175. #ifdef CONFIG_FB_SIS_315
  176. static void
  177. SiS310Sync(struct sis_video_info *ivideo)
  178. {
  179. SiS310Idle
  180. }
  181. static void
  182. SiS310SetupForScreenToScreenCopy(struct sis_video_info *ivideo, int rop, int trans_color)
  183. {
  184. SiS310SetupDSTColorDepth(ivideo->DstColor);
  185. SiS310SetupSRCPitch(ivideo->video_linelength)
  186. SiS310SetupDSTRect(ivideo->video_linelength, 0xffff)
  187. if(trans_color != -1) {
  188. SiS310SetupROP(0x0A)
  189. SiS310SetupSRCTrans(trans_color)
  190. SiS310SetupCMDFlag(TRANSPARENT_BITBLT)
  191. } else {
  192. SiS310SetupROP(sisALUConv[rop])
  193. /* Set command - not needed, both 0 */
  194. /* SiSSetupCMDFlag(BITBLT | SRCVIDEO) */
  195. }
  196. SiS310SetupCMDFlag(ivideo->SiS310_AccelDepth)
  197. /* The 315 series is smart enough to know the direction */
  198. }
  199. static void
  200. SiS310SubsequentScreenToScreenCopy(struct sis_video_info *ivideo, int src_x, int src_y,
  201. int dst_x, int dst_y, int width, int height)
  202. {
  203. u32 srcbase = 0, dstbase = 0;
  204. int mymin = min(src_y, dst_y);
  205. int mymax = max(src_y, dst_y);
  206. /* Although the chip knows the direction to use
  207. * if the source and destination areas overlap,
  208. * that logic fails if we fiddle with the bitmap
  209. * addresses. Therefore, we check if the source
  210. * and destination blitting areas overlap and
  211. * adapt the bitmap addresses synchronously
  212. * if the coordinates exceed the valid range.
  213. * The the areas do not overlap, we do our
  214. * normal check.
  215. */
  216. if((mymax - mymin) < height) {
  217. if((src_y >= 2048) || (dst_y >= 2048)) {
  218. srcbase = ivideo->video_linelength * mymin;
  219. dstbase = ivideo->video_linelength * mymin;
  220. src_y -= mymin;
  221. dst_y -= mymin;
  222. }
  223. } else {
  224. if(src_y >= 2048) {
  225. srcbase = ivideo->video_linelength * src_y;
  226. src_y = 0;
  227. }
  228. if(dst_y >= 2048) {
  229. dstbase = ivideo->video_linelength * dst_y;
  230. dst_y = 0;
  231. }
  232. }
  233. SiS310SetupSRCBase(srcbase);
  234. SiS310SetupDSTBase(dstbase);
  235. SiS310SetupRect(width, height)
  236. SiS310SetupSRCXY(src_x, src_y)
  237. SiS310SetupDSTXY(dst_x, dst_y)
  238. SiS310DoCMD
  239. }
  240. static void
  241. SiS310SetupForSolidFill(struct sis_video_info *ivideo, u32 color, int rop)
  242. {
  243. SiS310SetupPATFG(color)
  244. SiS310SetupDSTRect(ivideo->video_linelength, 0xffff)
  245. SiS310SetupDSTColorDepth(ivideo->DstColor);
  246. SiS310SetupROP(sisPatALUConv[rop])
  247. SiS310SetupCMDFlag(PATFG | ivideo->SiS310_AccelDepth)
  248. }
  249. static void
  250. SiS310SubsequentSolidFillRect(struct sis_video_info *ivideo, int x, int y, int w, int h)
  251. {
  252. u32 dstbase = 0;
  253. if(y >= 2048) {
  254. dstbase = ivideo->video_linelength * y;
  255. y = 0;
  256. }
  257. SiS310SetupDSTBase(dstbase)
  258. SiS310SetupDSTXY(x,y)
  259. SiS310SetupRect(w,h)
  260. SiS310SetupCMDFlag(BITBLT)
  261. SiS310DoCMD
  262. }
  263. #endif
  264. /* --------------------------------------------------------------------- */
  265. /* The exported routines */
  266. int sisfb_initaccel(struct sis_video_info *ivideo)
  267. {
  268. #ifdef SISFB_USE_SPINLOCKS
  269. spin_lock_init(&ivideo->lockaccel);
  270. #endif
  271. return(0);
  272. }
  273. void sisfb_syncaccel(struct sis_video_info *ivideo)
  274. {
  275. if(ivideo->sisvga_engine == SIS_300_VGA) {
  276. #ifdef CONFIG_FB_SIS_300
  277. SiS300Sync(ivideo);
  278. #endif
  279. } else {
  280. #ifdef CONFIG_FB_SIS_315
  281. SiS310Sync(ivideo);
  282. #endif
  283. }
  284. }
  285. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* --------------- 2.5 --------------- */
  286. int fbcon_sis_sync(struct fb_info *info)
  287. {
  288. struct sis_video_info *ivideo = (struct sis_video_info *)info->par;
  289. CRITFLAGS
  290. if(!ivideo->accel)
  291. return 0;
  292. if(ivideo->sisvga_engine == SIS_300_VGA) {
  293. #ifdef CONFIG_FB_SIS_300
  294. SiS300Sync(ivideo);
  295. #endif
  296. } else {
  297. #ifdef CONFIG_FB_SIS_315
  298. SiS310Sync(ivideo);
  299. #endif
  300. }
  301. CRITEND
  302. return 0;
  303. }
  304. void fbcon_sis_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
  305. {
  306. struct sis_video_info *ivideo = (struct sis_video_info *)info->par;
  307. u32 col = 0;
  308. u32 vxres = info->var.xres_virtual;
  309. u32 vyres = info->var.yres_virtual;
  310. int width, height;
  311. CRITFLAGS
  312. if(info->state != FBINFO_STATE_RUNNING) {
  313. return;
  314. }
  315. if(!ivideo->accel) {
  316. cfb_fillrect(info, rect);
  317. return;
  318. }
  319. if(!rect->width || !rect->height || rect->dx >= vxres || rect->dy >= vyres) {
  320. return;
  321. }
  322. /* Clipping */
  323. width = ((rect->dx + rect->width) > vxres) ? (vxres - rect->dx) : rect->width;
  324. height = ((rect->dy + rect->height) > vyres) ? (vyres - rect->dy) : rect->height;
  325. switch(info->var.bits_per_pixel) {
  326. case 8: col = rect->color;
  327. break;
  328. case 16:
  329. case 32: col = ((u32 *)(info->pseudo_palette))[rect->color];
  330. break;
  331. }
  332. if(ivideo->sisvga_engine == SIS_300_VGA) {
  333. #ifdef CONFIG_FB_SIS_300
  334. CRITBEGIN
  335. SiS300SetupForSolidFill(ivideo, col, myrops[rect->rop]);
  336. SiS300SubsequentSolidFillRect(ivideo, rect->dx, rect->dy, width, height);
  337. CRITEND
  338. SiS300Sync(ivideo);
  339. #endif
  340. } else {
  341. #ifdef CONFIG_FB_SIS_315
  342. CRITBEGIN
  343. SiS310SetupForSolidFill(ivideo, col, myrops[rect->rop]);
  344. SiS310SubsequentSolidFillRect(ivideo, rect->dx, rect->dy, width, height);
  345. CRITEND
  346. SiS310Sync(ivideo);
  347. #endif
  348. }
  349. }
  350. void fbcon_sis_copyarea(struct fb_info *info, const struct fb_copyarea *area)
  351. {
  352. struct sis_video_info *ivideo = (struct sis_video_info *)info->par;
  353. u32 vxres = info->var.xres_virtual;
  354. u32 vyres = info->var.yres_virtual;
  355. int width = area->width;
  356. int height = area->height;
  357. CRITFLAGS
  358. if(info->state != FBINFO_STATE_RUNNING) {
  359. return;
  360. }
  361. if(!ivideo->accel) {
  362. cfb_copyarea(info, area);
  363. return;
  364. }
  365. if(!width || !height ||
  366. area->sx >= vxres || area->sy >= vyres ||
  367. area->dx >= vxres || area->dy >= vyres) {
  368. return;
  369. }
  370. /* Clipping */
  371. if((area->sx + width) > vxres) width = vxres - area->sx;
  372. if((area->dx + width) > vxres) width = vxres - area->dx;
  373. if((area->sy + height) > vyres) height = vyres - area->sy;
  374. if((area->dy + height) > vyres) height = vyres - area->dy;
  375. if(ivideo->sisvga_engine == SIS_300_VGA) {
  376. #ifdef CONFIG_FB_SIS_300
  377. int xdir, ydir;
  378. if(area->sx < area->dx) xdir = 0;
  379. else xdir = 1;
  380. if(area->sy < area->dy) ydir = 0;
  381. else ydir = 1;
  382. CRITBEGIN
  383. SiS300SetupForScreenToScreenCopy(ivideo, xdir, ydir, 3, -1);
  384. SiS300SubsequentScreenToScreenCopy(ivideo, area->sx, area->sy, area->dx, area->dy,
  385. width, height);
  386. CRITEND
  387. SiS300Sync(ivideo);
  388. #endif
  389. } else {
  390. #ifdef CONFIG_FB_SIS_315
  391. CRITBEGIN
  392. SiS310SetupForScreenToScreenCopy(ivideo, 3, -1);
  393. SiS310SubsequentScreenToScreenCopy(ivideo, area->sx, area->sy, area->dx, area->dy,
  394. width, height);
  395. CRITEND
  396. SiS310Sync(ivideo);
  397. #endif
  398. }
  399. }
  400. #endif
  401. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* -------------- 2.4 --------------- */
  402. void fbcon_sis_bmove(struct display *p, int srcy, int srcx,
  403. int dsty, int dstx, int height, int width)
  404. {
  405. struct sis_video_info *ivideo = (struct sis_video_info *)p->fb_info->par;
  406. CRITFLAGS
  407. if(!ivideo->accel) {
  408. switch(ivideo->video_bpp) {
  409. case 8:
  410. #ifdef FBCON_HAS_CFB8
  411. fbcon_cfb8_bmove(p, srcy, srcx, dsty, dstx, height, width);
  412. #endif
  413. break;
  414. case 16:
  415. #ifdef FBCON_HAS_CFB16
  416. fbcon_cfb16_bmove(p, srcy, srcx, dsty, dstx, height, width);
  417. #endif
  418. break;
  419. case 32:
  420. #ifdef FBCON_HAS_CFB32
  421. fbcon_cfb32_bmove(p, srcy, srcx, dsty, dstx, height, width);
  422. #endif
  423. break;
  424. }
  425. return;
  426. }
  427. srcx *= fontwidth(p);
  428. srcy *= fontheight(p);
  429. dstx *= fontwidth(p);
  430. dsty *= fontheight(p);
  431. width *= fontwidth(p);
  432. height *= fontheight(p);
  433. if(ivideo->sisvga_engine == SIS_300_VGA) {
  434. #ifdef CONFIG_FB_SIS_300
  435. int xdir, ydir;
  436. if(srcx < dstx) xdir = 0;
  437. else xdir = 1;
  438. if(srcy < dsty) ydir = 0;
  439. else ydir = 1;
  440. CRITBEGIN
  441. SiS300SetupForScreenToScreenCopy(ivideo, xdir, ydir, 3, -1);
  442. SiS300SubsequentScreenToScreenCopy(ivideo, srcx, srcy, dstx, dsty, width, height);
  443. CRITEND
  444. SiS300Sync(ivideo);
  445. #endif
  446. } else {
  447. #ifdef CONFIG_FB_SIS_315
  448. CRITBEGIN
  449. SiS310SetupForScreenToScreenCopy(ivideo, 3, -1);
  450. SiS310SubsequentScreenToScreenCopy(ivideo, srcx, srcy, dstx, dsty, width, height);
  451. CRITEND
  452. SiS310Sync(ivideo);
  453. #endif
  454. }
  455. }
  456. static void fbcon_sis_clear(struct vc_data *conp, struct display *p,
  457. int srcy, int srcx, int height, int width, int color)
  458. {
  459. struct sis_video_info *ivideo = (struct sis_video_info *)p->fb_info->par;
  460. CRITFLAGS
  461. srcx *= fontwidth(p);
  462. srcy *= fontheight(p);
  463. width *= fontwidth(p);
  464. height *= fontheight(p);
  465. if(ivideo->sisvga_engine == SIS_300_VGA) {
  466. #ifdef CONFIG_FB_SIS_300
  467. CRITBEGIN
  468. SiS300SetupForSolidFill(ivideo, color, 3);
  469. SiS300SubsequentSolidFillRect(ivideo, srcx, srcy, width, height);
  470. CRITEND
  471. SiS300Sync(ivideo);
  472. #endif
  473. } else {
  474. #ifdef CONFIG_FB_SIS_315
  475. CRITBEGIN
  476. SiS310SetupForSolidFill(ivideo, color, 3);
  477. SiS310SubsequentSolidFillRect(ivideo, srcx, srcy, width, height);
  478. CRITEND
  479. SiS310Sync(ivideo);
  480. #endif
  481. }
  482. }
  483. void fbcon_sis_clear8(struct vc_data *conp, struct display *p,
  484. int srcy, int srcx, int height, int width)
  485. {
  486. struct sis_video_info *ivideo = (struct sis_video_info *)p->fb_info->par;
  487. u32 bgx;
  488. if(!ivideo->accel) {
  489. #ifdef FBCON_HAS_CFB8
  490. fbcon_cfb8_clear(conp, p, srcy, srcx, height, width);
  491. #endif
  492. return;
  493. }
  494. bgx = attr_bgcol_ec(p, conp);
  495. fbcon_sis_clear(conp, p, srcy, srcx, height, width, bgx);
  496. }
  497. void fbcon_sis_clear16(struct vc_data *conp, struct display *p,
  498. int srcy, int srcx, int height, int width)
  499. {
  500. struct sis_video_info *ivideo = (struct sis_video_info *)p->fb_info->par;
  501. u32 bgx;
  502. if(!ivideo->accel) {
  503. #ifdef FBCON_HAS_CFB16
  504. fbcon_cfb16_clear(conp, p, srcy, srcx, height, width);
  505. #endif
  506. return;
  507. }
  508. bgx = ((u_int16_t*)p->dispsw_data)[attr_bgcol_ec(p, conp)];
  509. fbcon_sis_clear(conp, p, srcy, srcx, height, width, bgx);
  510. }
  511. void fbcon_sis_clear32(struct vc_data *conp, struct display *p,
  512. int srcy, int srcx, int height, int width)
  513. {
  514. struct sis_video_info *ivideo = (struct sis_video_info *)p->fb_info->par;
  515. u32 bgx;
  516. if(!ivideo->accel) {
  517. #ifdef FBCON_HAS_CFB32
  518. fbcon_cfb32_clear(conp, p, srcy, srcx, height, width);
  519. #endif
  520. return;
  521. }
  522. bgx = ((u_int32_t*)p->dispsw_data)[attr_bgcol_ec(p, conp)];
  523. fbcon_sis_clear(conp, p, srcy, srcx, height, width, bgx);
  524. }
  525. void fbcon_sis_revc(struct display *p, int srcx, int srcy)
  526. {
  527. struct sis_video_info *ivideo = (struct sis_video_info *)p->fb_info->par;
  528. CRITFLAGS
  529. if(!ivideo->accel) {
  530. switch(ivideo->video_bpp) {
  531. case 16:
  532. #ifdef FBCON_HAS_CFB16
  533. fbcon_cfb16_revc(p, srcx, srcy);
  534. #endif
  535. break;
  536. case 32:
  537. #ifdef FBCON_HAS_CFB32
  538. fbcon_cfb32_revc(p, srcx, srcy);
  539. #endif
  540. break;
  541. }
  542. return;
  543. }
  544. srcx *= fontwidth(p);
  545. srcy *= fontheight(p);
  546. if(ivideo->sisvga_engine == SIS_300_VGA) {
  547. #ifdef CONFIG_FB_SIS_300
  548. CRITBEGIN
  549. SiS300SetupForSolidFill(ivideo, 0, 0x0a);
  550. SiS300SubsequentSolidFillRect(ivideo, srcx, srcy, fontwidth(p), fontheight(p));
  551. CRITEND
  552. SiS300Sync(ivideo);
  553. #endif
  554. } else {
  555. #ifdef CONFIG_FB_SIS_315
  556. CRITBEGIN
  557. SiS310SetupForSolidFill(ivideo, 0, 0x0a);
  558. SiS310SubsequentSolidFillRect(ivideo, srcx, srcy, fontwidth(p), fontheight(p));
  559. CRITEND
  560. SiS310Sync(ivideo);
  561. #endif
  562. }
  563. }
  564. #ifdef FBCON_HAS_CFB8
  565. struct display_switch fbcon_sis8 = {
  566. .setup = fbcon_cfb8_setup,
  567. .bmove = fbcon_sis_bmove,
  568. .clear = fbcon_sis_clear8,
  569. .putc = fbcon_cfb8_putc,
  570. .putcs = fbcon_cfb8_putcs,
  571. .revc = fbcon_cfb8_revc,
  572. .clear_margins = fbcon_cfb8_clear_margins,
  573. .fontwidthmask = FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16)
  574. };
  575. #endif
  576. #ifdef FBCON_HAS_CFB16
  577. struct display_switch fbcon_sis16 = {
  578. .setup = fbcon_cfb16_setup,
  579. .bmove = fbcon_sis_bmove,
  580. .clear = fbcon_sis_clear16,
  581. .putc = fbcon_cfb16_putc,
  582. .putcs = fbcon_cfb16_putcs,
  583. .revc = fbcon_sis_revc,
  584. .clear_margins = fbcon_cfb16_clear_margins,
  585. .fontwidthmask = FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16)
  586. };
  587. #endif
  588. #ifdef FBCON_HAS_CFB32
  589. struct display_switch fbcon_sis32 = {
  590. .setup = fbcon_cfb32_setup,
  591. .bmove = fbcon_sis_bmove,
  592. .clear = fbcon_sis_clear32,
  593. .putc = fbcon_cfb32_putc,
  594. .putcs = fbcon_cfb32_putcs,
  595. .revc = fbcon_sis_revc,
  596. .clear_margins = fbcon_cfb32_clear_margins,
  597. .fontwidthmask = FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16)
  598. };
  599. #endif
  600. #endif /* KERNEL VERSION */