linux/drivers/video/fbdev/sis/sis_accel.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * SiS 300/540/630[S]/730[S],
 * SiS 315[E|PRO]/550/[M]650/651/[M]661[F|M]X/740/[M]741[GX]/330/[M]760[GX],
 * XGI V3XT/V5/V8, Z7
 * frame buffer driver for Linux kernels >= 2.4.14 and >=2.6.3
 *
 * 2D acceleration part
 *
 * Based on the X driver's sis300_accel.h which is
 *     Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
 * and sis310_accel.h which is
 *     Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
 *
 * Author:   Thomas Winischhofer <[email protected]>:
 *			(see http://www.winischhofer.net/
 *			for more information and updates)
 */

#ifndef _SISFB_ACCEL_H
#define _SISFB_ACCEL_H

/* Guard accelerator accesses with spin_lock_irqsave? Works well without. */
#undef SISFB_USE_SPINLOCKS

#ifdef SISFB_USE_SPINLOCKS
#include <linux/spinlock.h>
#define CRITBEGIN
#define CRITEND
#define CRITFLAGS
#else
#define CRITBEGIN
#define CRITEND
#define CRITFLAGS
#endif

/* Definitions for the SIS engine communication. */

#define PATREGSIZE
#define BR(x)
#define PBR(x)

/* SiS300 engine commands */
#define BITBLT
#define COLOREXP
#define ENCOLOREXP
#define MULTIPLE_SCANLINE
#define LINE
#define TRAPAZOID_FILL
#define TRANSPARENT_BITBLT

/* Additional engine commands for 315 */
#define ALPHA_BLEND
#define A3D_FUNCTION
#define CLEAR_Z_BUFFER
#define GRADIENT_FILL

/* source select */
#define SRCVIDEO
#define SRCSYSTEM
#define SRCCPUBLITBUF
#define SRCAGP

/* Pattern flags */
#define PATFG
#define PATPATREG
#define PATMONO

/* blitting direction (300 series only) */
#define X_INC
#define X_DEC
#define Y_INC
#define Y_DEC

/* Clipping flags */
#define NOCLIP
#define NOMERGECLIP
#define CLIPENABLE
#define CLIPWITHOUTMERGE

/* Transparency */
#define OPAQUE
#define TRANSPARENT

/* ? */
#define DSTAGP
#define DSTVIDEO

/* Subfunctions for Color/Enhanced Color Expansion (315 only) */
#define COLOR_TO_MONO
#define AA_TEXT

/* Some general registers for 315 series */
#define SRC_ADDR
#define SRC_PITCH
#define AGP_BASE
#define SRC_Y
#define SRC_X
#define DST_Y
#define DST_X
#define DST_ADDR
#define DST_PITCH
#define DST_HEIGHT
#define RECT_WIDTH
#define RECT_HEIGHT
#define PAT_FGCOLOR
#define PAT_BGCOLOR
#define SRC_FGCOLOR
#define SRC_BGCOLOR
#define MONO_MASK
#define LEFT_CLIP
#define TOP_CLIP
#define RIGHT_CLIP
#define BOTTOM_CLIP
#define COMMAND_READY
#define FIRE_TRIGGER

#define PATTERN_REG

/* Transparent bitblit registers */
#define TRANS_DST_KEY_HIGH
#define TRANS_DST_KEY_LOW
#define TRANS_SRC_KEY_HIGH
#define TRANS_SRC_KEY_LOW

/* Store queue length in par */
#define CmdQueLen

/* ------------- SiS 300 series -------------- */

/* BR(16) (0x8240):

   bit 31 2D engine: 1 is idle,
   bit 30 3D engine: 1 is idle,
   bit 29 Command queue: 1 is empty
   bits 28:24: Current CPU driven BitBlt buffer stage bit[4:0]
   bits 15:0:  Current command queue length

*/

#define SiS300Idle
/* (do three times, because 2D engine seems quite unsure about whether or not it's idle) */

#define SiS300SetupSRCBase(base)

#define SiS300SetupSRCPitch(pitch)

#define SiS300SetupSRCXY(x,y)

#define SiS300SetupDSTBase(base)

#define SiS300SetupDSTXY(x,y)

#define SiS300SetupDSTRect(x,y)

#define SiS300SetupDSTColorDepth(bpp)

#define SiS300SetupRect(w,h)

#define SiS300SetupPATFG(color)

#define SiS300SetupPATBG(color)

#define SiS300SetupSRCFG(color)

#define SiS300SetupSRCBG(color)

/* 0x8224 src colorkey high */
/* 0x8228 src colorkey low */
/* 0x821c dest colorkey high */
/* 0x8220 dest colorkey low */
#define SiS300SetupSRCTrans(color)

#define SiS300SetupDSTTrans(color)

#define SiS300SetupMONOPAT(p0,p1)

#define SiS300SetupClipLT(left,top)

#define SiS300SetupClipRB(right,bottom)

/* General */
#define SiS300SetupROP(rop)

#define SiS300SetupCMDFlag(flags)

#define SiS300DoCMD

/* -------------- SiS 315/330 series --------------- */

/* Q_STATUS:
   bit 31 = 1: All engines idle and all queues empty
   bit 30 = 1: Hardware Queue (=HW CQ, 2D queue, 3D queue) empty
   bit 29 = 1: 2D engine is idle
   bit 28 = 1: 3D engine is idle
   bit 27 = 1: HW command queue empty
   bit 26 = 1: 2D queue empty
   bit 25 = 1: 3D queue empty
   bit 24 = 1: SW command queue empty
   bits 23:16: 2D counter 3
   bits 15:8:  2D counter 2
   bits 7:0:   2D counter 1
*/

#define SiS310Idle

#define SiS310SetupSRCBase(base)

#define SiS310SetupSRCPitch(pitch)

#define SiS310SetupSRCXY(x,y)

#define SiS310SetupDSTBase(base)

#define SiS310SetupDSTXY(x,y)

#define SiS310SetupDSTRect(x,y)

#define SiS310SetupDSTColorDepth(bpp)

#define SiS310SetupRect(w,h)

#define SiS310SetupPATFG(color)

#define SiS310SetupPATBG(color)

#define SiS310SetupSRCFG(color)

#define SiS310SetupSRCBG(color)

#define SiS310SetupSRCTrans(color)

#define SiS310SetupDSTTrans(color)

#define SiS310SetupMONOPAT(p0,p1)

#define SiS310SetupClipLT(left,top)

#define SiS310SetupClipRB(right,bottom)

#define SiS310SetupROP(rop)

#define SiS310SetupCMDFlag(flags)

#define SiS310DoCMD

int  sisfb_initaccel(struct sis_video_info *ivideo);
void sisfb_syncaccel(struct sis_video_info *ivideo);

int  fbcon_sis_sync(struct fb_info *info);
void fbcon_sis_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
void fbcon_sis_copyarea(struct fb_info *info, const struct fb_copyarea *area);

#endif