1/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/gfx_rndr.c,v 1.1 2002/12/10 15:12:25 alanh Exp $ */ 2/* 3 * $Workfile: gfx_rndr.c $ 4 * 5 * This file contains routines to program the 2D acceleration hardware: 6 * 7 * gfx_set_bpp 8 * gfx_set_solid_pattern 9 * gfx_set_mono_pattern 10 * gfx_set_color_pattern 11 * gfx_load_color_pattern_line 12 * gfx_set_solid_source 13 * gfx_set_mono_source 14 * gfx_set_raster_operation 15 * gfx_pattern_fill 16 * gfx_color_pattern_fill 17 * gfx_screen_to_screen_blt 18 * gfx_screen_to_screen_xblt 19 * gfx_color_bitmap_to_screen_blt 20 * gfx_color_bitmap_to_screen_xblt 21 * gfx_mono_bitmap_to_screen_blt 22 * gfx_bresenham_line 23 * gfx_wait_until_idle 24 * 25 * NSC_LIC_ALTERNATIVE_PREAMBLE 26 * 27 * Revision 1.0 28 * 29 * National Semiconductor Alternative GPL-BSD License 30 * 31 * National Semiconductor Corporation licenses this software 32 * ("Software"): 33 * 34 * Durango 35 * 36 * under one of the two following licenses, depending on how the 37 * Software is received by the Licensee. 38 * 39 * If this Software is received as part of the Linux Framebuffer or 40 * other GPL licensed software, then the GPL license designated 41 * NSC_LIC_GPL applies to this Software; in all other circumstances 42 * then the BSD-style license designated NSC_LIC_BSD shall apply. 43 * 44 * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ 45 46/* NSC_LIC_BSD 47 * 48 * National Semiconductor Corporation Open Source License for Durango 49 * 50 * (BSD License with Export Notice) 51 * 52 * Copyright (c) 1999-2001 53 * National Semiconductor Corporation. 54 * All rights reserved. 55 * 56 * Redistribution and use in source and binary forms, with or without 57 * modification, are permitted provided that the following conditions 58 * are met: 59 * 60 * * Redistributions of source code must retain the above copyright 61 * notice, this list of conditions and the following disclaimer. 62 * 63 * * Redistributions in binary form must reproduce the above 64 * copyright notice, this list of conditions and the following 65 * disclaimer in the documentation and/or other materials provided 66 * with the distribution. 67 * 68 * * Neither the name of the National Semiconductor Corporation nor 69 * the names of its contributors may be used to endorse or promote 70 * products derived from this software without specific prior 71 * written permission. 72 * 73 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 74 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 75 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 76 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 77 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 78 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 79 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 80 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 81 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 82 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 83 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 84 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 85 * OF SUCH DAMAGE. 86 * 87 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 88 * YOUR JURISDICTION. It is licensee's responsibility to comply with 89 * any export regulations applicable in licensee's jurisdiction. Under 90 * CURRENT (2001) U.S. export regulations this software 91 * is eligible for export from the U.S. and can be downloaded by or 92 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 93 * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 94 * Syria, Sudan, Afghanistan and any other country to which the U.S. 95 * has embargoed goods and services. 96 * 97 * END_NSC_LIC_BSD */ 98 99/* NSC_LIC_GPL 100 * 101 * National Semiconductor Corporation Gnu General Public License for Durango 102 * 103 * (GPL License with Export Notice) 104 * 105 * Copyright (c) 1999-2001 106 * National Semiconductor Corporation. 107 * All rights reserved. 108 * 109 * Redistribution and use in source and binary forms, with or without 110 * modification, are permitted under the terms of the GNU General 111 * Public License as published by the Free Software Foundation; either 112 * version 2 of the License, or (at your option) any later version 113 * 114 * In addition to the terms of the GNU General Public License, neither 115 * the name of the National Semiconductor Corporation nor the names of 116 * its contributors may be used to endorse or promote products derived 117 * from this software without specific prior written permission. 118 * 119 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 120 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 121 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 122 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 123 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 124 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 125 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 126 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 127 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 128 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 129 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 130 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 131 * OF SUCH DAMAGE. See the GNU General Public License for more details. 132 * 133 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 134 * YOUR JURISDICTION. It is licensee's responsibility to comply with 135 * any export regulations applicable in licensee's jurisdiction. Under 136 * CURRENT (2001) U.S. export regulations this software 137 * is eligible for export from the U.S. and can be downloaded by or 138 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 139 * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 140 * Syria, Sudan, Afghanistan and any other country to which the U.S. 141 * has embargoed goods and services. 142 * 143 * You should have received a copy of the GNU General Public License 144 * along with this file; if not, write to the Free Software Foundation, 145 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 146 * 147 * END_NSC_LIC_GPL */ 148 149/* STATIC VARIABLES */ 150 151unsigned short GFXbpp = 16; 152unsigned short GFXbb0Base = 0x400; 153unsigned short GFXbb1Base = 0x930; 154unsigned short GFXbufferWidthPixels = 400; 155 156unsigned short GFXpatternFlags = 0; 157unsigned short GFXsourceFlags = 0; 158unsigned long GFXsavedColor = 0; 159unsigned short GFXsavedRop = 0; 160unsigned short GFXusesDstData = 0; 161 162/* INCLUDE SUPPORT FOR FIRST GENERATION, IF SPECIFIED. */ 163 164#if GFX_2DACCEL_GU1 165#include "rndr_gu1.c" 166#endif 167 168/* INCLUDE SUPPORT FOR SECOND GENERATION, IF SPECIFIED. */ 169 170#if GFX_2DACCEL_GU2 171#include "rndr_gu2.c" 172#endif 173 174void gfx_reset_pitch(unsigned short pitch); 175 176/* WRAPPERS IF DYNAMIC SELECTION */ 177/* Extra layer to call either first or second generation routines. */ 178 179#if GFX_2DACCEL_DYNAMIC 180 181/*--------------------------------------------------------------------------- 182 * gfx_reset_pitch (PRIVATE ROUTINE - NOT PART OF API) 183 *--------------------------------------------------------------------------- 184 */ 185void 186gfx_reset_pitch(unsigned short pitch) 187{ 188# if GFX_2DACCEL_GU2 189 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 190 gu2_reset_pitch(pitch); 191# endif 192} 193 194/*--------------------------------------------------------------------------- 195 * gfx_set_bpp 196 *--------------------------------------------------------------------------- 197 */ 198void 199gfx_set_bpp(unsigned short bpp) 200{ 201# if GFX_2DACCEL_GU1 202 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 203 gu1_set_bpp(bpp); 204# endif 205# if GFX_2DACCEL_GU2 206 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 207 gu2_set_bpp(bpp); 208# endif 209} 210 211/*--------------------------------------------------------------------------- 212 * gfx_set_solid_source 213 *--------------------------------------------------------------------------- 214 */ 215void 216gfx_set_solid_source(unsigned long color) 217{ 218# if GFX_2DACCEL_GU1 219 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 220 gu1_set_solid_source(color); 221# endif 222# if GFX_2DACCEL_GU2 223 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 224 gu2_set_solid_source(color); 225# endif 226} 227 228/*--------------------------------------------------------------------------- 229 * gfx_set_mono_source 230 *--------------------------------------------------------------------------- 231 */ 232void 233gfx_set_mono_source(unsigned long bgcolor, unsigned long fgcolor, 234 unsigned short transparent) 235{ 236# if GFX_2DACCEL_GU1 237 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 238 gu1_set_mono_source(bgcolor, fgcolor, transparent); 239# endif 240# if GFX_2DACCEL_GU2 241 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 242 gu2_set_mono_source(bgcolor, fgcolor, transparent); 243# endif 244} 245 246void 247gfx_set_pattern_flags(unsigned short flags) 248{ 249 GFXpatternFlags |= flags; 250} 251 252/*--------------------------------------------------------------------------- 253 * gfx_set_solid_pattern 254 *--------------------------------------------------------------------------- 255 */ 256void 257gfx_set_solid_pattern(unsigned long color) 258{ 259# if GFX_2DACCEL_GU1 260 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 261 gu1_set_solid_pattern(color); 262# endif 263# if GFX_2DACCEL_GU2 264 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 265 gu2_set_solid_pattern(color); 266# endif 267} 268 269/*--------------------------------------------------------------------------- 270 * gfx_set_mono_pattern 271 *--------------------------------------------------------------------------- 272 */ 273void 274gfx_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor, 275 unsigned long data0, unsigned long data1, 276 unsigned char transparent) 277{ 278# if GFX_2DACCEL_GU1 279 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 280 gu1_set_mono_pattern(bgcolor, fgcolor, data0, data1, transparent); 281# endif 282# if GFX_2DACCEL_GU2 283 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 284 gu2_set_mono_pattern(bgcolor, fgcolor, data0, data1, transparent); 285# endif 286} 287 288/*--------------------------------------------------------------------------- 289 * gfx_set_color_pattern 290 *--------------------------------------------------------------------------- 291 */ 292void 293gfx_set_color_pattern(unsigned long bgcolor, unsigned long fgcolor, 294 unsigned long data0, unsigned long data1, 295 unsigned long data2, unsigned long data3, 296 unsigned char transparent) 297{ 298# if GFX_2DACCEL_GU1 299 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 300 gu1_set_color_pattern(bgcolor, fgcolor, data0, data1, data2, data3, 301 transparent); 302# endif 303# if GFX_2DACCEL_GU2 304 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 305 gu2_set_color_pattern(bgcolor, fgcolor, data0, data1, data2, data3, 306 transparent); 307# endif 308} 309 310/*--------------------------------------------------------------------------- 311 * gfx_load_color_pattern_line 312 *--------------------------------------------------------------------------- 313 */ 314void 315gfx_load_color_pattern_line(short y, unsigned long *pattern_8x8) 316{ 317# if GFX_2DACCEL_GU1 318 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 319 gu1_load_color_pattern_line(y, pattern_8x8); 320# endif 321# if GFX_2DACCEL_GU2 322 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 323 gu2_load_color_pattern_line(y, pattern_8x8); 324# endif 325} 326 327/*--------------------------------------------------------------------------- 328 * gfx_set_raster_operation 329 *--------------------------------------------------------------------------- 330 */ 331void 332gfx_set_raster_operation(unsigned char rop) 333{ 334# if GFX_2DACCEL_GU1 335 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 336 gu1_set_raster_operation(rop); 337# endif 338# if GFX_2DACCEL_GU2 339 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 340 gu2_set_raster_operation(rop); 341# endif 342} 343 344/*--------------------------------------------------------------------------- 345 * gfx_pattern_fill 346 *--------------------------------------------------------------------------- 347 */ 348void 349gfx_pattern_fill(unsigned short x, unsigned short y, 350 unsigned short width, unsigned short height) 351{ 352# if GFX_2DACCEL_GU1 353 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 354 gu1_pattern_fill(x, y, width, height); 355# endif 356# if GFX_2DACCEL_GU2 357 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 358 gu2_pattern_fill(x, y, width, height); 359# endif 360} 361 362/*--------------------------------------------------------------------------- 363 * gfx_color_pattern_fill 364 *--------------------------------------------------------------------------- 365 */ 366void 367gfx_color_pattern_fill(unsigned short x, unsigned short y, 368 unsigned short width, unsigned short height, 369 unsigned long *pattern) 370{ 371# if GFX_2DACCEL_GU1 372 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 373 gu1_color_pattern_fill(x, y, width, height, pattern); 374# endif 375# if GFX_2DACCEL_GU2 376 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 377 gu2_color_pattern_fill(x, y, width, height, pattern); 378# endif 379} 380 381/*--------------------------------------------------------------------------- 382 * gfx_screen_to_screen_blt 383 *--------------------------------------------------------------------------- 384 */ 385void 386gfx_screen_to_screen_blt(unsigned short srcx, unsigned short srcy, 387 unsigned short dstx, unsigned short dsty, 388 unsigned short width, unsigned short height) 389{ 390# if GFX_2DACCEL_GU1 391 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 392 gu1_screen_to_screen_blt(srcx, srcy, dstx, dsty, width, height); 393# endif 394# if GFX_2DACCEL_GU2 395 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 396 gu2_screen_to_screen_blt(srcx, srcy, dstx, dsty, width, height); 397# endif 398} 399 400/*--------------------------------------------------------------------------- 401 * gfx_screen_to_screen_xblt 402 *--------------------------------------------------------------------------- 403 */ 404void 405gfx_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy, 406 unsigned short dstx, unsigned short dsty, 407 unsigned short width, unsigned short height, 408 unsigned long color) 409{ 410# if GFX_2DACCEL_GU1 411 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 412 gu1_screen_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, color); 413# endif 414# if GFX_2DACCEL_GU2 415 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 416 gu2_screen_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, color); 417# endif 418} 419 420/*--------------------------------------------------------------------------- 421 * gfx_color_bitmap_to_screen_blt 422 *--------------------------------------------------------------------------- 423 */ 424void 425gfx_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, 426 unsigned short dstx, unsigned short dsty, 427 unsigned short width, unsigned short height, 428 unsigned char *data, long pitch) 429{ 430# if GFX_2DACCEL_GU1 431 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 432 gu1_color_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, 433 data, pitch); 434# endif 435# if GFX_2DACCEL_GU2 436 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 437 gu2_color_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, 438 data, pitch); 439# endif 440} 441 442/*--------------------------------------------------------------------------- 443 * gfx_color_bitmap_to_screen_xblt 444 *--------------------------------------------------------------------------- 445 */ 446void 447gfx_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy, 448 unsigned short dstx, unsigned short dsty, 449 unsigned short width, unsigned short height, 450 unsigned char *data, long pitch, 451 unsigned long color) 452{ 453# if GFX_2DACCEL_GU1 454 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 455 gu1_color_bitmap_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, 456 data, pitch, color); 457# endif 458# if GFX_2DACCEL_GU2 459 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 460 gu2_color_bitmap_to_screen_xblt(srcx, srcy, dstx, dsty, width, height, 461 data, pitch, color); 462# endif 463} 464 465/*--------------------------------------------------------------------------- 466 * gfx_mono_bitmap_to_screen_blt 467 *--------------------------------------------------------------------------- 468 */ 469void 470gfx_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, 471 unsigned short dstx, unsigned short dsty, 472 unsigned short width, unsigned short height, 473 unsigned char *data, short pitch) 474{ 475# if GFX_2DACCEL_GU1 476 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 477 gu1_mono_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, 478 data, pitch); 479# endif 480# if GFX_2DACCEL_GU2 481 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 482 gu2_mono_bitmap_to_screen_blt(srcx, srcy, dstx, dsty, width, height, 483 data, pitch); 484# endif 485} 486 487/*--------------------------------------------------------------------------- 488 * gfx_text_blt 489 *--------------------------------------------------------------------------- 490 */ 491void 492gfx_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width, 493 unsigned short height, unsigned char *data) 494{ 495# if GFX_2DACCEL_GU1 496 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 497 gu1_text_blt(dstx, dsty, width, height, data); 498# endif 499# if GFX_2DACCEL_GU2 500 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 501 gu2_text_blt(dstx, dsty, width, height, data); 502# endif 503} 504 505/*--------------------------------------------------------------------------- 506 * gfx_bresenham_line 507 *--------------------------------------------------------------------------- 508 */ 509void 510gfx_bresenham_line(unsigned short x, unsigned short y, 511 unsigned short length, unsigned short initerr, 512 unsigned short axialerr, unsigned short diagerr, 513 unsigned short flags) 514{ 515# if GFX_2DACCEL_GU1 516 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 517 gu1_bresenham_line(x, y, length, initerr, axialerr, diagerr, flags); 518# endif 519# if GFX_2DACCEL_GU2 520 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 521 gu2_bresenham_line(x, y, length, initerr, axialerr, diagerr, flags); 522# endif 523} 524 525/*--------------------------------------------------------------------------- 526 * gfx_wait_until_idle 527 *--------------------------------------------------------------------------- 528 */ 529void 530gfx_wait_until_idle(void) 531{ 532# if GFX_2DACCEL_GU1 533 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 534 gu1_wait_until_idle(); 535# endif 536# if GFX_2DACCEL_GU2 537 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 538 gu2_wait_until_idle(); 539# endif 540} 541 542/*--------------------------------------------------------------------------- 543 * gfx_test_blt_pending 544 *--------------------------------------------------------------------------- 545 */ 546int 547gfx_test_blt_pending(void) 548{ 549 int retval = 0; 550 551# if GFX_2DACCEL_GU1 552 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU1) 553 retval = gu1_test_blt_pending(); 554# endif 555# if GFX_2DACCEL_GU2 556 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 557 retval = gu2_test_blt_pending(); 558# endif 559 return (retval); 560} 561 562/*--------------------------------------------------------------------------- 563 * NEW ROUTINES FOR REDCLOUD 564 *--------------------------------------------------------------------------- 565 */ 566 567/*--------------------------------------------------------------------------- 568 * gfx2_set_source_stride 569 *--------------------------------------------------------------------------- 570 */ 571void 572gfx2_set_source_stride(unsigned short stride) 573{ 574# if GFX_2DACCEL_GU2 575 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 576 gu22_set_source_stride(stride); 577# endif 578} 579 580/*--------------------------------------------------------------------------- 581 * gfx2_set_destination_stride 582 *--------------------------------------------------------------------------- 583 */ 584void 585gfx2_set_destination_stride(unsigned short stride) 586{ 587# if GFX_2DACCEL_GU2 588 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 589 gu22_set_destination_stride(stride); 590# endif 591} 592 593/*--------------------------------------------------------------------------- 594 * gfx2_set_pattern_origin 595 *--------------------------------------------------------------------------- 596 */ 597void 598gfx2_set_pattern_origin(int x, int y) 599{ 600# if GFX_2DACCEL_GU2 601 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 602 gu22_set_pattern_origin(x, y); 603# endif 604} 605 606/*--------------------------------------------------------------------------- 607 * gfx2_set_source_transparency 608 *--------------------------------------------------------------------------- 609 */ 610void 611gfx2_set_source_transparency(unsigned long color, unsigned long mask) 612{ 613# if GFX_2DACCEL_GU2 614 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 615 gu22_set_source_transparency(color, mask); 616# endif 617} 618 619/*--------------------------------------------------------------------------- 620 * gfx2_set_alpha_mode 621 *--------------------------------------------------------------------------- 622 */ 623void 624gfx2_set_alpha_mode(int mode) 625{ 626# if GFX_2DACCEL_GU2 627 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 628 gu22_set_alpha_mode(mode); 629# endif 630} 631 632/*--------------------------------------------------------------------------- 633 * gfx2_set_alpha_value 634 *--------------------------------------------------------------------------- 635 */ 636void 637gfx2_set_alpha_value(unsigned char value) 638{ 639# if GFX_2DACCEL_GU2 640 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 641 gu22_set_alpha_value(value); 642# endif 643} 644 645/*--------------------------------------------------------------------------- 646 * gfx2_pattern_fill 647 *--------------------------------------------------------------------------- 648 */ 649void 650gfx2_pattern_fill(unsigned long dstoffset, unsigned short width, 651 unsigned short height) 652{ 653# if GFX_2DACCEL_GU2 654 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 655 gu22_pattern_fill(dstoffset, width, height); 656# endif 657} 658 659/*--------------------------------------------------------------------------- 660 * gfx2_color_pattern_fill 661 *--------------------------------------------------------------------------- 662 */ 663void 664gfx2_color_pattern_fill(unsigned long dstoffset, unsigned short width, 665 unsigned short height, unsigned long *pattern) 666{ 667# if GFX_2DACCEL_GU2 668 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 669 gu22_color_pattern_fill(dstoffset, width, height, pattern); 670# endif 671} 672 673/*--------------------------------------------------------------------------- 674 * gfx2_screen_to_screen_blt 675 *--------------------------------------------------------------------------- 676 */ 677void 678gfx2_screen_to_screen_blt(unsigned long srcoffset, unsigned long dstoffset, 679 unsigned short width, unsigned short height, 680 int flags) 681{ 682# if GFX_2DACCEL_GU2 683 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 684 gu22_screen_to_screen_blt(srcoffset, dstoffset, width, height, flags); 685# endif 686} 687 688/*--------------------------------------------------------------------------- 689 * gfx2_mono_expand_blt 690 *--------------------------------------------------------------------------- 691 */ 692void 693gfx2_mono_expand_blt(unsigned long srcbase, unsigned short srcx, 694 unsigned short srcy, unsigned long dstoffset, 695 unsigned short width, unsigned short height, 696 int byte_packed) 697{ 698# if GFX_2DACCEL_GU2 699 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 700 gu22_mono_expand_blt(srcbase, srcx, srcy, dstoffset, width, height, 701 byte_packed); 702# endif 703} 704 705/*--------------------------------------------------------------------------- 706 * gfx2_color_bitmap_to_screen_blt 707 *--------------------------------------------------------------------------- 708 */ 709void 710gfx2_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, 711 unsigned long dstoffset, unsigned short width, 712 unsigned short height, unsigned char *data, 713 short pitch) 714{ 715# if GFX_2DACCEL_GU2 716 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 717 gu22_color_bitmap_to_screen_blt(srcx, srcy, dstoffset, width, height, 718 data, pitch); 719# endif 720} 721 722/*--------------------------------------------------------------------------- 723 * gfx2_text_blt 724 *--------------------------------------------------------------------------- 725 */ 726void 727gfx2_text_blt(unsigned long dstoffset, unsigned short width, 728 unsigned short height, unsigned char *data) 729{ 730# if GFX_2DACCEL_GU2 731 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 732 gu22_text_blt(dstoffset, width, height, data); 733# endif 734} 735 736/*--------------------------------------------------------------------------- 737 * gfx2_mono_bitmap_to_screen_blt 738 *--------------------------------------------------------------------------- 739 */ 740void 741gfx2_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy, 742 unsigned long dstoffset, unsigned short width, 743 unsigned short height, unsigned char *data, 744 short pitch) 745{ 746# if GFX_2DACCEL_GU2 747 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 748 gu22_mono_bitmap_to_screen_blt(srcx, srcy, dstoffset, width, height, 749 data, pitch); 750# endif 751} 752 753/*--------------------------------------------------------------------------- 754 * gfx2_bresenham_line 755 *--------------------------------------------------------------------------- 756 */ 757void 758gfx2_bresenham_line(unsigned long dstoffset, 759 unsigned short length, unsigned short initerr, 760 unsigned short axialerr, unsigned short diagerr, 761 unsigned short flags) 762{ 763# if GFX_2DACCEL_GU2 764 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 765 gu22_bresenham_line(dstoffset, length, initerr, axialerr, diagerr, 766 flags); 767# endif 768} 769 770/*--------------------------------------------------------------------------- 771 * gfx2_sync_to_vblank 772 *--------------------------------------------------------------------------- 773 */ 774void 775gfx2_sync_to_vblank(void) 776{ 777# if GFX_2DACCEL_GU2 778 if (gfx_2daccel_type & GFX_2DACCEL_TYPE_GU2) 779 gu22_sync_to_vblank(); 780# endif 781} 782 783#endif /* GFX_2DACCEL_DYNAMIC */ 784 785/* END OF FILE */ 786 787