diff options
Diffstat (limited to 'drivers/video/sis/sis_accel.c')
-rw-r--r-- | drivers/video/sis/sis_accel.c | 479 |
1 files changed, 126 insertions, 353 deletions
diff --git a/drivers/video/sis/sis_accel.c b/drivers/video/sis/sis_accel.c index 30e90a553e80..bab933e6c6a6 100644 --- a/drivers/video/sis/sis_accel.c +++ b/drivers/video/sis/sis_accel.c | |||
@@ -1,6 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * SiS 300/630/730/540/315/550/65x/74x/330/760 frame buffer driver | 2 | * SiS 300/540/630[S]/730[S], |
3 | * for Linux kernels 2.4.x and 2.6.x | 3 | * SiS 315[E|PRO]/550/[M]650/651/[M]661[F|M]X/740/[M]741[GX]/330/[M]760[GX], |
4 | * XGI V3XT/V5/V8, Z7 | ||
5 | * frame buffer driver for Linux kernels >= 2.4.14 and >=2.6.3 | ||
4 | * | 6 | * |
5 | * 2D acceleration part | 7 | * 2D acceleration part |
6 | * | 8 | * |
@@ -19,7 +21,7 @@ | |||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA | 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA |
20 | * | 22 | * |
21 | * Based on the XFree86/X.org driver which is | 23 | * Based on the XFree86/X.org driver which is |
22 | * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria | 24 | * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria |
23 | * | 25 | * |
24 | * Author: Thomas Winischhofer <thomas@winischhofer.net> | 26 | * Author: Thomas Winischhofer <thomas@winischhofer.net> |
25 | * (see http://www.winischhofer.net/ | 27 | * (see http://www.winischhofer.net/ |
@@ -30,13 +32,11 @@ | |||
30 | #include <linux/version.h> | 32 | #include <linux/version.h> |
31 | #include <linux/module.h> | 33 | #include <linux/module.h> |
32 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
33 | #include <linux/errno.h> | ||
34 | #include <linux/fb.h> | 35 | #include <linux/fb.h> |
36 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
35 | #include <linux/console.h> | 37 | #include <linux/console.h> |
36 | #include <linux/selection.h> | 38 | #endif |
37 | #include <linux/ioport.h> | 39 | #include <linux/ioport.h> |
38 | #include <linux/capability.h> | ||
39 | #include <linux/fs.h> | ||
40 | #include <linux/types.h> | 40 | #include <linux/types.h> |
41 | 41 | ||
42 | #include <asm/io.h> | 42 | #include <asm/io.h> |
@@ -188,7 +188,7 @@ SiS300SubsequentSolidFillRect(struct sis_video_info *ivideo, int x, int y, int w | |||
188 | } | 188 | } |
189 | #endif | 189 | #endif |
190 | 190 | ||
191 | /* 315/330 series ------------------------------------------------- */ | 191 | /* 315/330/340 series ---------------------------------------------- */ |
192 | 192 | ||
193 | #ifdef CONFIG_FB_SIS_315 | 193 | #ifdef CONFIG_FB_SIS_315 |
194 | static void | 194 | static void |
@@ -202,7 +202,7 @@ SiS310SetupForScreenToScreenCopy(struct sis_video_info *ivideo, int rop, int tra | |||
202 | { | 202 | { |
203 | SiS310SetupDSTColorDepth(ivideo->DstColor); | 203 | SiS310SetupDSTColorDepth(ivideo->DstColor); |
204 | SiS310SetupSRCPitch(ivideo->video_linelength) | 204 | SiS310SetupSRCPitch(ivideo->video_linelength) |
205 | SiS310SetupDSTRect(ivideo->video_linelength, 0xffff) | 205 | SiS310SetupDSTRect(ivideo->video_linelength, 0x0fff) |
206 | if(trans_color != -1) { | 206 | if(trans_color != -1) { |
207 | SiS310SetupROP(0x0A) | 207 | SiS310SetupROP(0x0A) |
208 | SiS310SetupSRCTrans(trans_color) | 208 | SiS310SetupSRCTrans(trans_color) |
@@ -213,7 +213,7 @@ SiS310SetupForScreenToScreenCopy(struct sis_video_info *ivideo, int rop, int tra | |||
213 | /* SiSSetupCMDFlag(BITBLT | SRCVIDEO) */ | 213 | /* SiSSetupCMDFlag(BITBLT | SRCVIDEO) */ |
214 | } | 214 | } |
215 | SiS310SetupCMDFlag(ivideo->SiS310_AccelDepth) | 215 | SiS310SetupCMDFlag(ivideo->SiS310_AccelDepth) |
216 | /* The 315 series is smart enough to know the direction */ | 216 | /* The chip is smart enough to know the direction */ |
217 | } | 217 | } |
218 | 218 | ||
219 | static void | 219 | static void |
@@ -223,35 +223,38 @@ SiS310SubsequentScreenToScreenCopy(struct sis_video_info *ivideo, int src_x, int | |||
223 | u32 srcbase = 0, dstbase = 0; | 223 | u32 srcbase = 0, dstbase = 0; |
224 | int mymin = min(src_y, dst_y); | 224 | int mymin = min(src_y, dst_y); |
225 | int mymax = max(src_y, dst_y); | 225 | int mymax = max(src_y, dst_y); |
226 | 226 | ||
227 | /* Although the chip knows the direction to use | 227 | /* Although the chip knows the direction to use |
228 | * if the source and destination areas overlap, | 228 | * if the source and destination areas overlap, |
229 | * that logic fails if we fiddle with the bitmap | 229 | * that logic fails if we fiddle with the bitmap |
230 | * addresses. Therefore, we check if the source | 230 | * addresses. Therefore, we check if the source |
231 | * and destination blitting areas overlap and | 231 | * and destination blitting areas overlap and |
232 | * adapt the bitmap addresses synchronously | 232 | * adapt the bitmap addresses synchronously |
233 | * if the coordinates exceed the valid range. | 233 | * if the coordinates exceed the valid range. |
234 | * The the areas do not overlap, we do our | 234 | * The the areas do not overlap, we do our |
235 | * normal check. | 235 | * normal check. |
236 | */ | 236 | */ |
237 | if((mymax - mymin) < height) { | 237 | if((mymax - mymin) < height) { |
238 | if((src_y >= 2048) || (dst_y >= 2048)) { | 238 | if((src_y >= 2048) || (dst_y >= 2048)) { |
239 | srcbase = ivideo->video_linelength * mymin; | 239 | srcbase = ivideo->video_linelength * mymin; |
240 | dstbase = ivideo->video_linelength * mymin; | 240 | dstbase = ivideo->video_linelength * mymin; |
241 | src_y -= mymin; | 241 | src_y -= mymin; |
242 | dst_y -= mymin; | 242 | dst_y -= mymin; |
243 | } | 243 | } |
244 | } else { | 244 | } else { |
245 | if(src_y >= 2048) { | 245 | if(src_y >= 2048) { |
246 | srcbase = ivideo->video_linelength * src_y; | 246 | srcbase = ivideo->video_linelength * src_y; |
247 | src_y = 0; | 247 | src_y = 0; |
248 | } | 248 | } |
249 | if(dst_y >= 2048) { | 249 | if(dst_y >= 2048) { |
250 | dstbase = ivideo->video_linelength * dst_y; | 250 | dstbase = ivideo->video_linelength * dst_y; |
251 | dst_y = 0; | 251 | dst_y = 0; |
252 | } | 252 | } |
253 | } | 253 | } |
254 | 254 | ||
255 | srcbase += ivideo->video_offset; | ||
256 | dstbase += ivideo->video_offset; | ||
257 | |||
255 | SiS310SetupSRCBase(srcbase); | 258 | SiS310SetupSRCBase(srcbase); |
256 | SiS310SetupDSTBase(dstbase); | 259 | SiS310SetupDSTBase(dstbase); |
257 | SiS310SetupRect(width, height) | 260 | SiS310SetupRect(width, height) |
@@ -264,7 +267,7 @@ static void | |||
264 | SiS310SetupForSolidFill(struct sis_video_info *ivideo, u32 color, int rop) | 267 | SiS310SetupForSolidFill(struct sis_video_info *ivideo, u32 color, int rop) |
265 | { | 268 | { |
266 | SiS310SetupPATFG(color) | 269 | SiS310SetupPATFG(color) |
267 | SiS310SetupDSTRect(ivideo->video_linelength, 0xffff) | 270 | SiS310SetupDSTRect(ivideo->video_linelength, 0x0fff) |
268 | SiS310SetupDSTColorDepth(ivideo->DstColor); | 271 | SiS310SetupDSTColorDepth(ivideo->DstColor); |
269 | SiS310SetupROP(sisPatALUConv[rop]) | 272 | SiS310SetupROP(sisPatALUConv[rop]) |
270 | SiS310SetupCMDFlag(PATFG | ivideo->SiS310_AccelDepth) | 273 | SiS310SetupCMDFlag(PATFG | ivideo->SiS310_AccelDepth) |
@@ -279,6 +282,7 @@ SiS310SubsequentSolidFillRect(struct sis_video_info *ivideo, int x, int y, int w | |||
279 | dstbase = ivideo->video_linelength * y; | 282 | dstbase = ivideo->video_linelength * y; |
280 | y = 0; | 283 | y = 0; |
281 | } | 284 | } |
285 | dstbase += ivideo->video_offset; | ||
282 | SiS310SetupDSTBase(dstbase) | 286 | SiS310SetupDSTBase(dstbase) |
283 | SiS310SetupDSTXY(x,y) | 287 | SiS310SetupDSTXY(x,y) |
284 | SiS310SetupRect(w,h) | 288 | SiS310SetupRect(w,h) |
@@ -294,384 +298,153 @@ SiS310SubsequentSolidFillRect(struct sis_video_info *ivideo, int x, int y, int w | |||
294 | int sisfb_initaccel(struct sis_video_info *ivideo) | 298 | int sisfb_initaccel(struct sis_video_info *ivideo) |
295 | { | 299 | { |
296 | #ifdef SISFB_USE_SPINLOCKS | 300 | #ifdef SISFB_USE_SPINLOCKS |
297 | spin_lock_init(&ivideo->lockaccel); | 301 | spin_lock_init(&ivideo->lockaccel); |
298 | #endif | 302 | #endif |
299 | return(0); | 303 | return 0; |
300 | } | 304 | } |
301 | 305 | ||
302 | void sisfb_syncaccel(struct sis_video_info *ivideo) | 306 | void sisfb_syncaccel(struct sis_video_info *ivideo) |
303 | { | 307 | { |
304 | if(ivideo->sisvga_engine == SIS_300_VGA) { | 308 | if(ivideo->sisvga_engine == SIS_300_VGA) { |
305 | #ifdef CONFIG_FB_SIS_300 | 309 | #ifdef CONFIG_FB_SIS_300 |
306 | SiS300Sync(ivideo); | 310 | SiS300Sync(ivideo); |
307 | #endif | 311 | #endif |
308 | } else { | 312 | } else { |
309 | #ifdef CONFIG_FB_SIS_315 | 313 | #ifdef CONFIG_FB_SIS_315 |
310 | SiS310Sync(ivideo); | 314 | SiS310Sync(ivideo); |
311 | #endif | 315 | #endif |
312 | } | 316 | } |
313 | } | 317 | } |
314 | 318 | ||
315 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* --------------- 2.5 --------------- */ | 319 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) /* --------------- 2.5 --------------- */ |
316 | 320 | ||
317 | int fbcon_sis_sync(struct fb_info *info) | 321 | int fbcon_sis_sync(struct fb_info *info) |
318 | { | 322 | { |
319 | struct sis_video_info *ivideo = (struct sis_video_info *)info->par; | 323 | struct sis_video_info *ivideo = (struct sis_video_info *)info->par; |
320 | CRITFLAGS | 324 | CRITFLAGS |
321 | 325 | ||
322 | if(!ivideo->accel) | 326 | if((!ivideo->accel) || (!ivideo->engineok)) |
323 | return 0; | 327 | return 0; |
324 | 328 | ||
325 | if(ivideo->sisvga_engine == SIS_300_VGA) { | 329 | CRITBEGIN |
326 | #ifdef CONFIG_FB_SIS_300 | 330 | sisfb_syncaccel(ivideo); |
327 | SiS300Sync(ivideo); | 331 | CRITEND |
328 | #endif | 332 | |
329 | } else { | 333 | return 0; |
330 | #ifdef CONFIG_FB_SIS_315 | ||
331 | SiS310Sync(ivideo); | ||
332 | #endif | ||
333 | } | ||
334 | CRITEND | ||
335 | return 0; | ||
336 | } | 334 | } |
337 | 335 | ||
338 | void fbcon_sis_fillrect(struct fb_info *info, const struct fb_fillrect *rect) | 336 | void fbcon_sis_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
339 | { | 337 | { |
340 | struct sis_video_info *ivideo = (struct sis_video_info *)info->par; | 338 | struct sis_video_info *ivideo = (struct sis_video_info *)info->par; |
341 | u32 col = 0; | 339 | u32 col = 0; |
342 | u32 vxres = info->var.xres_virtual; | 340 | u32 vxres = info->var.xres_virtual; |
343 | u32 vyres = info->var.yres_virtual; | 341 | u32 vyres = info->var.yres_virtual; |
344 | int width, height; | 342 | int width, height; |
345 | CRITFLAGS | 343 | CRITFLAGS |
346 | 344 | ||
347 | if(info->state != FBINFO_STATE_RUNNING) { | 345 | if(info->state != FBINFO_STATE_RUNNING) |
348 | return; | 346 | return; |
349 | } | 347 | |
350 | 348 | if((!ivideo->accel) || (!ivideo->engineok)) { | |
351 | if(!ivideo->accel) { | 349 | cfb_fillrect(info, rect); |
352 | cfb_fillrect(info, rect); | 350 | return; |
353 | return; | 351 | } |
354 | } | 352 | |
355 | 353 | if(!rect->width || !rect->height || rect->dx >= vxres || rect->dy >= vyres) | |
356 | if(!rect->width || !rect->height || rect->dx >= vxres || rect->dy >= vyres) { | 354 | return; |
357 | return; | 355 | |
358 | } | 356 | /* Clipping */ |
359 | 357 | width = ((rect->dx + rect->width) > vxres) ? (vxres - rect->dx) : rect->width; | |
360 | /* Clipping */ | 358 | height = ((rect->dy + rect->height) > vyres) ? (vyres - rect->dy) : rect->height; |
361 | width = ((rect->dx + rect->width) > vxres) ? (vxres - rect->dx) : rect->width; | 359 | |
362 | height = ((rect->dy + rect->height) > vyres) ? (vyres - rect->dy) : rect->height; | 360 | switch(info->var.bits_per_pixel) { |
363 | |||
364 | switch(info->var.bits_per_pixel) { | ||
365 | case 8: col = rect->color; | 361 | case 8: col = rect->color; |
366 | break; | 362 | break; |
367 | case 16: | 363 | case 16: |
368 | case 32: col = ((u32 *)(info->pseudo_palette))[rect->color]; | 364 | case 32: col = ((u32 *)(info->pseudo_palette))[rect->color]; |
369 | break; | 365 | break; |
370 | } | 366 | } |
371 | 367 | ||
372 | if(ivideo->sisvga_engine == SIS_300_VGA) { | 368 | if(ivideo->sisvga_engine == SIS_300_VGA) { |
373 | #ifdef CONFIG_FB_SIS_300 | 369 | #ifdef CONFIG_FB_SIS_300 |
374 | CRITBEGIN | 370 | CRITBEGIN |
375 | SiS300SetupForSolidFill(ivideo, col, myrops[rect->rop]); | 371 | SiS300SetupForSolidFill(ivideo, col, myrops[rect->rop]); |
376 | SiS300SubsequentSolidFillRect(ivideo, rect->dx, rect->dy, width, height); | 372 | SiS300SubsequentSolidFillRect(ivideo, rect->dx, rect->dy, width, height); |
377 | CRITEND | 373 | CRITEND |
378 | SiS300Sync(ivideo); | ||
379 | #endif | 374 | #endif |
380 | } else { | 375 | } else { |
381 | #ifdef CONFIG_FB_SIS_315 | 376 | #ifdef CONFIG_FB_SIS_315 |
382 | CRITBEGIN | 377 | CRITBEGIN |
383 | SiS310SetupForSolidFill(ivideo, col, myrops[rect->rop]); | 378 | SiS310SetupForSolidFill(ivideo, col, myrops[rect->rop]); |
384 | SiS310SubsequentSolidFillRect(ivideo, rect->dx, rect->dy, width, height); | 379 | SiS310SubsequentSolidFillRect(ivideo, rect->dx, rect->dy, width, height); |
385 | CRITEND | 380 | CRITEND |
386 | SiS310Sync(ivideo); | ||
387 | #endif | 381 | #endif |
388 | } | 382 | } |
389 | 383 | ||
384 | sisfb_syncaccel(ivideo); | ||
390 | } | 385 | } |
391 | 386 | ||
392 | void fbcon_sis_copyarea(struct fb_info *info, const struct fb_copyarea *area) | 387 | void fbcon_sis_copyarea(struct fb_info *info, const struct fb_copyarea *area) |
393 | { | 388 | { |
394 | struct sis_video_info *ivideo = (struct sis_video_info *)info->par; | 389 | struct sis_video_info *ivideo = (struct sis_video_info *)info->par; |
395 | u32 vxres = info->var.xres_virtual; | 390 | u32 vxres = info->var.xres_virtual; |
396 | u32 vyres = info->var.yres_virtual; | 391 | u32 vyres = info->var.yres_virtual; |
397 | int width = area->width; | 392 | int width = area->width; |
398 | int height = area->height; | 393 | int height = area->height; |
399 | CRITFLAGS | ||
400 | |||
401 | if(info->state != FBINFO_STATE_RUNNING) { | ||
402 | return; | ||
403 | } | ||
404 | |||
405 | if(!ivideo->accel) { | ||
406 | cfb_copyarea(info, area); | ||
407 | return; | ||
408 | } | ||
409 | |||
410 | if(!width || !height || | ||
411 | area->sx >= vxres || area->sy >= vyres || | ||
412 | area->dx >= vxres || area->dy >= vyres) { | ||
413 | return; | ||
414 | } | ||
415 | |||
416 | /* Clipping */ | ||
417 | if((area->sx + width) > vxres) width = vxres - area->sx; | ||
418 | if((area->dx + width) > vxres) width = vxres - area->dx; | ||
419 | if((area->sy + height) > vyres) height = vyres - area->sy; | ||
420 | if((area->dy + height) > vyres) height = vyres - area->dy; | ||
421 | |||
422 | if(ivideo->sisvga_engine == SIS_300_VGA) { | ||
423 | #ifdef CONFIG_FB_SIS_300 | ||
424 | int xdir, ydir; | ||
425 | |||
426 | if(area->sx < area->dx) xdir = 0; | ||
427 | else xdir = 1; | ||
428 | if(area->sy < area->dy) ydir = 0; | ||
429 | else ydir = 1; | ||
430 | |||
431 | CRITBEGIN | ||
432 | SiS300SetupForScreenToScreenCopy(ivideo, xdir, ydir, 3, -1); | ||
433 | SiS300SubsequentScreenToScreenCopy(ivideo, area->sx, area->sy, area->dx, area->dy, | ||
434 | width, height); | ||
435 | CRITEND | ||
436 | SiS300Sync(ivideo); | ||
437 | #endif | ||
438 | } else { | ||
439 | #ifdef CONFIG_FB_SIS_315 | ||
440 | CRITBEGIN | ||
441 | SiS310SetupForScreenToScreenCopy(ivideo, 3, -1); | ||
442 | SiS310SubsequentScreenToScreenCopy(ivideo, area->sx, area->sy, area->dx, area->dy, | ||
443 | width, height); | ||
444 | CRITEND | ||
445 | SiS310Sync(ivideo); | ||
446 | #endif | ||
447 | } | ||
448 | } | ||
449 | |||
450 | #endif | ||
451 | |||
452 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* -------------- 2.4 --------------- */ | ||
453 | |||
454 | void fbcon_sis_bmove(struct display *p, int srcy, int srcx, | ||
455 | int dsty, int dstx, int height, int width) | ||
456 | { | ||
457 | struct sis_video_info *ivideo = (struct sis_video_info *)p->fb_info->par; | ||
458 | |||
459 | CRITFLAGS | 394 | CRITFLAGS |
460 | 395 | ||
461 | if(!ivideo->accel) { | 396 | if(info->state != FBINFO_STATE_RUNNING) |
462 | switch(ivideo->video_bpp) { | 397 | return; |
463 | case 8: | ||
464 | #ifdef FBCON_HAS_CFB8 | ||
465 | fbcon_cfb8_bmove(p, srcy, srcx, dsty, dstx, height, width); | ||
466 | #endif | ||
467 | break; | ||
468 | case 16: | ||
469 | #ifdef FBCON_HAS_CFB16 | ||
470 | fbcon_cfb16_bmove(p, srcy, srcx, dsty, dstx, height, width); | ||
471 | #endif | ||
472 | break; | ||
473 | case 32: | ||
474 | #ifdef FBCON_HAS_CFB32 | ||
475 | fbcon_cfb32_bmove(p, srcy, srcx, dsty, dstx, height, width); | ||
476 | #endif | ||
477 | break; | ||
478 | } | ||
479 | return; | ||
480 | } | ||
481 | |||
482 | srcx *= fontwidth(p); | ||
483 | srcy *= fontheight(p); | ||
484 | dstx *= fontwidth(p); | ||
485 | dsty *= fontheight(p); | ||
486 | width *= fontwidth(p); | ||
487 | height *= fontheight(p); | ||
488 | 398 | ||
489 | if(ivideo->sisvga_engine == SIS_300_VGA) { | 399 | if((!ivideo->accel) || (!ivideo->engineok)) { |
490 | #ifdef CONFIG_FB_SIS_300 | 400 | cfb_copyarea(info, area); |
491 | int xdir, ydir; | 401 | return; |
492 | |||
493 | if(srcx < dstx) xdir = 0; | ||
494 | else xdir = 1; | ||
495 | if(srcy < dsty) ydir = 0; | ||
496 | else ydir = 1; | ||
497 | |||
498 | CRITBEGIN | ||
499 | SiS300SetupForScreenToScreenCopy(ivideo, xdir, ydir, 3, -1); | ||
500 | SiS300SubsequentScreenToScreenCopy(ivideo, srcx, srcy, dstx, dsty, width, height); | ||
501 | CRITEND | ||
502 | SiS300Sync(ivideo); | ||
503 | #endif | ||
504 | } else { | ||
505 | #ifdef CONFIG_FB_SIS_315 | ||
506 | CRITBEGIN | ||
507 | SiS310SetupForScreenToScreenCopy(ivideo, 3, -1); | ||
508 | SiS310SubsequentScreenToScreenCopy(ivideo, srcx, srcy, dstx, dsty, width, height); | ||
509 | CRITEND | ||
510 | SiS310Sync(ivideo); | ||
511 | #endif | ||
512 | } | 402 | } |
513 | } | ||
514 | 403 | ||
515 | static void fbcon_sis_clear(struct vc_data *conp, struct display *p, | 404 | if(!width || !height || |
516 | int srcy, int srcx, int height, int width, int color) | 405 | area->sx >= vxres || area->sy >= vyres || |
517 | { | 406 | area->dx >= vxres || area->dy >= vyres) |
518 | struct sis_video_info *ivideo = (struct sis_video_info *)p->fb_info->par; | 407 | return; |
519 | CRITFLAGS | ||
520 | 408 | ||
521 | srcx *= fontwidth(p); | 409 | /* Clipping */ |
522 | srcy *= fontheight(p); | 410 | if((area->sx + width) > vxres) width = vxres - area->sx; |
523 | width *= fontwidth(p); | 411 | if((area->dx + width) > vxres) width = vxres - area->dx; |
524 | height *= fontheight(p); | 412 | if((area->sy + height) > vyres) height = vyres - area->sy; |
413 | if((area->dy + height) > vyres) height = vyres - area->dy; | ||
525 | 414 | ||
526 | if(ivideo->sisvga_engine == SIS_300_VGA) { | 415 | if(ivideo->sisvga_engine == SIS_300_VGA) { |
527 | #ifdef CONFIG_FB_SIS_300 | 416 | #ifdef CONFIG_FB_SIS_300 |
528 | CRITBEGIN | 417 | int xdir, ydir; |
529 | SiS300SetupForSolidFill(ivideo, color, 3); | 418 | |
530 | SiS300SubsequentSolidFillRect(ivideo, srcx, srcy, width, height); | 419 | if(area->sx < area->dx) xdir = 0; |
531 | CRITEND | 420 | else xdir = 1; |
532 | SiS300Sync(ivideo); | 421 | if(area->sy < area->dy) ydir = 0; |
422 | else ydir = 1; | ||
423 | |||
424 | CRITBEGIN | ||
425 | SiS300SetupForScreenToScreenCopy(ivideo, xdir, ydir, 3, -1); | ||
426 | SiS300SubsequentScreenToScreenCopy(ivideo, area->sx, area->sy, | ||
427 | area->dx, area->dy, width, height); | ||
428 | CRITEND | ||
533 | #endif | 429 | #endif |
534 | } else { | 430 | } else { |
535 | #ifdef CONFIG_FB_SIS_315 | 431 | #ifdef CONFIG_FB_SIS_315 |
536 | CRITBEGIN | 432 | CRITBEGIN |
537 | SiS310SetupForSolidFill(ivideo, color, 3); | 433 | SiS310SetupForScreenToScreenCopy(ivideo, 3, -1); |
538 | SiS310SubsequentSolidFillRect(ivideo, srcx, srcy, width, height); | 434 | SiS310SubsequentScreenToScreenCopy(ivideo, area->sx, area->sy, |
539 | CRITEND | 435 | area->dx, area->dy, width, height); |
540 | SiS310Sync(ivideo); | 436 | CRITEND |
541 | #endif | ||
542 | } | ||
543 | } | ||
544 | |||
545 | void fbcon_sis_clear8(struct vc_data *conp, struct display *p, | ||
546 | int srcy, int srcx, int height, int width) | ||
547 | { | ||
548 | struct sis_video_info *ivideo = (struct sis_video_info *)p->fb_info->par; | ||
549 | u32 bgx; | ||
550 | |||
551 | if(!ivideo->accel) { | ||
552 | #ifdef FBCON_HAS_CFB8 | ||
553 | fbcon_cfb8_clear(conp, p, srcy, srcx, height, width); | ||
554 | #endif | 437 | #endif |
555 | return; | ||
556 | } | 438 | } |
557 | 439 | ||
558 | bgx = attr_bgcol_ec(p, conp); | 440 | sisfb_syncaccel(ivideo); |
559 | fbcon_sis_clear(conp, p, srcy, srcx, height, width, bgx); | ||
560 | } | 441 | } |
561 | 442 | ||
562 | void fbcon_sis_clear16(struct vc_data *conp, struct display *p, | ||
563 | int srcy, int srcx, int height, int width) | ||
564 | { | ||
565 | struct sis_video_info *ivideo = (struct sis_video_info *)p->fb_info->par; | ||
566 | u32 bgx; | ||
567 | |||
568 | if(!ivideo->accel) { | ||
569 | #ifdef FBCON_HAS_CFB16 | ||
570 | fbcon_cfb16_clear(conp, p, srcy, srcx, height, width); | ||
571 | #endif | 443 | #endif |
572 | return; | ||
573 | } | ||
574 | |||
575 | bgx = ((u_int16_t*)p->dispsw_data)[attr_bgcol_ec(p, conp)]; | ||
576 | fbcon_sis_clear(conp, p, srcy, srcx, height, width, bgx); | ||
577 | } | ||
578 | 444 | ||
579 | void fbcon_sis_clear32(struct vc_data *conp, struct display *p, | 445 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* -------------- 2.4 --------------- */ |
580 | int srcy, int srcx, int height, int width) | ||
581 | { | ||
582 | struct sis_video_info *ivideo = (struct sis_video_info *)p->fb_info->par; | ||
583 | u32 bgx; | ||
584 | |||
585 | if(!ivideo->accel) { | ||
586 | #ifdef FBCON_HAS_CFB32 | ||
587 | fbcon_cfb32_clear(conp, p, srcy, srcx, height, width); | ||
588 | #endif | ||
589 | return; | ||
590 | } | ||
591 | |||
592 | bgx = ((u_int32_t*)p->dispsw_data)[attr_bgcol_ec(p, conp)]; | ||
593 | fbcon_sis_clear(conp, p, srcy, srcx, height, width, bgx); | ||
594 | } | ||
595 | |||
596 | void fbcon_sis_revc(struct display *p, int srcx, int srcy) | ||
597 | { | ||
598 | struct sis_video_info *ivideo = (struct sis_video_info *)p->fb_info->par; | ||
599 | CRITFLAGS | ||
600 | |||
601 | if(!ivideo->accel) { | ||
602 | switch(ivideo->video_bpp) { | ||
603 | case 16: | ||
604 | #ifdef FBCON_HAS_CFB16 | ||
605 | fbcon_cfb16_revc(p, srcx, srcy); | ||
606 | #endif | ||
607 | break; | ||
608 | case 32: | ||
609 | #ifdef FBCON_HAS_CFB32 | ||
610 | fbcon_cfb32_revc(p, srcx, srcy); | ||
611 | #endif | ||
612 | break; | ||
613 | } | ||
614 | return; | ||
615 | } | ||
616 | |||
617 | srcx *= fontwidth(p); | ||
618 | srcy *= fontheight(p); | ||
619 | |||
620 | if(ivideo->sisvga_engine == SIS_300_VGA) { | ||
621 | #ifdef CONFIG_FB_SIS_300 | ||
622 | CRITBEGIN | ||
623 | SiS300SetupForSolidFill(ivideo, 0, 0x0a); | ||
624 | SiS300SubsequentSolidFillRect(ivideo, srcx, srcy, fontwidth(p), fontheight(p)); | ||
625 | CRITEND | ||
626 | SiS300Sync(ivideo); | ||
627 | #endif | ||
628 | } else { | ||
629 | #ifdef CONFIG_FB_SIS_315 | ||
630 | CRITBEGIN | ||
631 | SiS310SetupForSolidFill(ivideo, 0, 0x0a); | ||
632 | SiS310SubsequentSolidFillRect(ivideo, srcx, srcy, fontwidth(p), fontheight(p)); | ||
633 | CRITEND | ||
634 | SiS310Sync(ivideo); | ||
635 | #endif | ||
636 | } | ||
637 | } | ||
638 | 446 | ||
639 | #ifdef FBCON_HAS_CFB8 | 447 | #include "sisfb_accel_2_4.h" |
640 | struct display_switch fbcon_sis8 = { | ||
641 | .setup = fbcon_cfb8_setup, | ||
642 | .bmove = fbcon_sis_bmove, | ||
643 | .clear = fbcon_sis_clear8, | ||
644 | .putc = fbcon_cfb8_putc, | ||
645 | .putcs = fbcon_cfb8_putcs, | ||
646 | .revc = fbcon_cfb8_revc, | ||
647 | .clear_margins = fbcon_cfb8_clear_margins, | ||
648 | .fontwidthmask = FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) | ||
649 | }; | ||
650 | #endif | ||
651 | #ifdef FBCON_HAS_CFB16 | ||
652 | struct display_switch fbcon_sis16 = { | ||
653 | .setup = fbcon_cfb16_setup, | ||
654 | .bmove = fbcon_sis_bmove, | ||
655 | .clear = fbcon_sis_clear16, | ||
656 | .putc = fbcon_cfb16_putc, | ||
657 | .putcs = fbcon_cfb16_putcs, | ||
658 | .revc = fbcon_sis_revc, | ||
659 | .clear_margins = fbcon_cfb16_clear_margins, | ||
660 | .fontwidthmask = FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) | ||
661 | }; | ||
662 | #endif | ||
663 | #ifdef FBCON_HAS_CFB32 | ||
664 | struct display_switch fbcon_sis32 = { | ||
665 | .setup = fbcon_cfb32_setup, | ||
666 | .bmove = fbcon_sis_bmove, | ||
667 | .clear = fbcon_sis_clear32, | ||
668 | .putc = fbcon_cfb32_putc, | ||
669 | .putcs = fbcon_cfb32_putcs, | ||
670 | .revc = fbcon_sis_revc, | ||
671 | .clear_margins = fbcon_cfb32_clear_margins, | ||
672 | .fontwidthmask = FONTWIDTH(4)|FONTWIDTH(8)|FONTWIDTH(12)|FONTWIDTH(16) | ||
673 | }; | ||
674 | #endif | ||
675 | 448 | ||
676 | #endif /* KERNEL VERSION */ | 449 | #endif /* KERNEL VERSION */ |
677 | 450 | ||