18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
28c2ecf20Sopenharmony_ci#ifndef _UAPI__LINUX_FBIO_H
38c2ecf20Sopenharmony_ci#define _UAPI__LINUX_FBIO_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/compiler.h>
68c2ecf20Sopenharmony_ci#include <linux/types.h>
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci/* Constants used for fbio SunOS compatibility */
98c2ecf20Sopenharmony_ci/* (C) 1996 Miguel de Icaza */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/* Frame buffer types */
128c2ecf20Sopenharmony_ci#define FBTYPE_NOTYPE           -1
138c2ecf20Sopenharmony_ci#define FBTYPE_SUN1BW           0   /* mono */
148c2ecf20Sopenharmony_ci#define FBTYPE_SUN1COLOR        1
158c2ecf20Sopenharmony_ci#define FBTYPE_SUN2BW           2
168c2ecf20Sopenharmony_ci#define FBTYPE_SUN2COLOR        3
178c2ecf20Sopenharmony_ci#define FBTYPE_SUN2GP           4
188c2ecf20Sopenharmony_ci#define FBTYPE_SUN5COLOR        5
198c2ecf20Sopenharmony_ci#define FBTYPE_SUN3COLOR        6
208c2ecf20Sopenharmony_ci#define FBTYPE_MEMCOLOR         7
218c2ecf20Sopenharmony_ci#define FBTYPE_SUN4COLOR        8
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#define FBTYPE_NOTSUN1          9
248c2ecf20Sopenharmony_ci#define FBTYPE_NOTSUN2          10
258c2ecf20Sopenharmony_ci#define FBTYPE_NOTSUN3          11
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#define FBTYPE_SUNFAST_COLOR    12  /* cg6 */
288c2ecf20Sopenharmony_ci#define FBTYPE_SUNROP_COLOR     13
298c2ecf20Sopenharmony_ci#define FBTYPE_SUNFB_VIDEO      14
308c2ecf20Sopenharmony_ci#define FBTYPE_SUNGIFB          15
318c2ecf20Sopenharmony_ci#define FBTYPE_SUNGPLAS         16
328c2ecf20Sopenharmony_ci#define FBTYPE_SUNGP3           17
338c2ecf20Sopenharmony_ci#define FBTYPE_SUNGT            18
348c2ecf20Sopenharmony_ci#define FBTYPE_SUNLEO           19      /* zx Leo card */
358c2ecf20Sopenharmony_ci#define FBTYPE_MDICOLOR         20      /* cg14 */
368c2ecf20Sopenharmony_ci#define FBTYPE_TCXCOLOR		21	/* SUNW,tcx card */
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci#define FBTYPE_LASTPLUSONE      21	/* This is not last + 1 in fact... */
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* Does not seem to be listed in the Sun file either */
418c2ecf20Sopenharmony_ci#define FBTYPE_CREATOR          22
428c2ecf20Sopenharmony_ci#define FBTYPE_PCI_IGA1682	23
438c2ecf20Sopenharmony_ci#define FBTYPE_P9100COLOR	24
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define FBTYPE_PCI_GENERIC	1000
468c2ecf20Sopenharmony_ci#define FBTYPE_PCI_MACH64	1001
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/* fbio ioctls */
498c2ecf20Sopenharmony_ci/* Returned by FBIOGTYPE */
508c2ecf20Sopenharmony_cistruct  fbtype {
518c2ecf20Sopenharmony_ci        int     fb_type;        /* fb type, see above */
528c2ecf20Sopenharmony_ci        int     fb_height;      /* pixels */
538c2ecf20Sopenharmony_ci        int     fb_width;       /* pixels */
548c2ecf20Sopenharmony_ci        int     fb_depth;
558c2ecf20Sopenharmony_ci        int     fb_cmsize;      /* color map entries */
568c2ecf20Sopenharmony_ci        int     fb_size;        /* fb size in bytes */
578c2ecf20Sopenharmony_ci};
588c2ecf20Sopenharmony_ci#define FBIOGTYPE _IOR('F', 0, struct fbtype)
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_cistruct  fbcmap {
618c2ecf20Sopenharmony_ci        int             index;          /* first element (0 origin) */
628c2ecf20Sopenharmony_ci        int             count;
638c2ecf20Sopenharmony_ci        unsigned char   __user *red;
648c2ecf20Sopenharmony_ci        unsigned char   __user *green;
658c2ecf20Sopenharmony_ci        unsigned char   __user *blue;
668c2ecf20Sopenharmony_ci};
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#ifndef __KERNEL__
698c2ecf20Sopenharmony_ci#define FBIOPUTCMAP _IOW('F', 3, struct fbcmap)
708c2ecf20Sopenharmony_ci#define FBIOGETCMAP _IOW('F', 4, struct fbcmap)
718c2ecf20Sopenharmony_ci#endif
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci/* # of device specific values */
748c2ecf20Sopenharmony_ci#define FB_ATTR_NDEVSPECIFIC    8
758c2ecf20Sopenharmony_ci/* # of possible emulations */
768c2ecf20Sopenharmony_ci#define FB_ATTR_NEMUTYPES       4
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_cistruct fbsattr {
798c2ecf20Sopenharmony_ci        int     flags;
808c2ecf20Sopenharmony_ci        int     emu_type;	/* -1 if none */
818c2ecf20Sopenharmony_ci        int     dev_specific[FB_ATTR_NDEVSPECIFIC];
828c2ecf20Sopenharmony_ci};
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_cistruct fbgattr {
858c2ecf20Sopenharmony_ci        int     real_type;	/* real frame buffer type */
868c2ecf20Sopenharmony_ci        int     owner;		/* unknown */
878c2ecf20Sopenharmony_ci        struct fbtype fbtype;	/* real frame buffer fbtype */
888c2ecf20Sopenharmony_ci        struct fbsattr sattr;
898c2ecf20Sopenharmony_ci        int     emu_types[FB_ATTR_NEMUTYPES]; /* supported emulations */
908c2ecf20Sopenharmony_ci};
918c2ecf20Sopenharmony_ci#define FBIOSATTR  _IOW('F', 5, struct fbgattr) /* Unsupported: */
928c2ecf20Sopenharmony_ci#define FBIOGATTR  _IOR('F', 6, struct fbgattr)	/* supported */
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#define FBIOSVIDEO _IOW('F', 7, int)
958c2ecf20Sopenharmony_ci#define FBIOGVIDEO _IOR('F', 8, int)
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_cistruct fbcursor {
988c2ecf20Sopenharmony_ci        short set;              /* what to set, choose from the list above */
998c2ecf20Sopenharmony_ci        short enable;           /* cursor on/off */
1008c2ecf20Sopenharmony_ci        struct fbcurpos pos;    /* cursor position */
1018c2ecf20Sopenharmony_ci        struct fbcurpos hot;    /* cursor hot spot */
1028c2ecf20Sopenharmony_ci        struct fbcmap cmap;     /* color map info */
1038c2ecf20Sopenharmony_ci        struct fbcurpos size;   /* cursor bit map size */
1048c2ecf20Sopenharmony_ci        char __user *image;     /* cursor image bits */
1058c2ecf20Sopenharmony_ci        char __user *mask;      /* cursor mask bits */
1068c2ecf20Sopenharmony_ci};
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci/* set/get cursor attributes/shape */
1098c2ecf20Sopenharmony_ci#define FBIOSCURSOR     _IOW('F', 24, struct fbcursor)
1108c2ecf20Sopenharmony_ci#define FBIOGCURSOR     _IOWR('F', 25, struct fbcursor)
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci/* set/get cursor position */
1138c2ecf20Sopenharmony_ci#define FBIOSCURPOS     _IOW('F', 26, struct fbcurpos)
1148c2ecf20Sopenharmony_ci#define FBIOGCURPOS     _IOW('F', 27, struct fbcurpos)
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci/* get max cursor size */
1178c2ecf20Sopenharmony_ci#define FBIOGCURMAX     _IOR('F', 28, struct fbcurpos)
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci/* wid manipulation */
1208c2ecf20Sopenharmony_cistruct fb_wid_alloc {
1218c2ecf20Sopenharmony_ci#define FB_WID_SHARED_8		0
1228c2ecf20Sopenharmony_ci#define FB_WID_SHARED_24	1
1238c2ecf20Sopenharmony_ci#define FB_WID_DBL_8		2
1248c2ecf20Sopenharmony_ci#define FB_WID_DBL_24		3
1258c2ecf20Sopenharmony_ci	__u32	wa_type;
1268c2ecf20Sopenharmony_ci	__s32	wa_index;	/* Set on return */
1278c2ecf20Sopenharmony_ci	__u32	wa_count;
1288c2ecf20Sopenharmony_ci};
1298c2ecf20Sopenharmony_cistruct fb_wid_item {
1308c2ecf20Sopenharmony_ci	__u32	wi_type;
1318c2ecf20Sopenharmony_ci	__s32	wi_index;
1328c2ecf20Sopenharmony_ci	__u32	wi_attrs;
1338c2ecf20Sopenharmony_ci	__u32	wi_values[32];
1348c2ecf20Sopenharmony_ci};
1358c2ecf20Sopenharmony_cistruct fb_wid_list {
1368c2ecf20Sopenharmony_ci	__u32	wl_flags;
1378c2ecf20Sopenharmony_ci	__u32	wl_count;
1388c2ecf20Sopenharmony_ci	struct fb_wid_item	*wl_list;
1398c2ecf20Sopenharmony_ci};
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci#define FBIO_WID_ALLOC	_IOWR('F', 30, struct fb_wid_alloc)
1428c2ecf20Sopenharmony_ci#define FBIO_WID_FREE	_IOW('F', 31, struct fb_wid_alloc)
1438c2ecf20Sopenharmony_ci#define FBIO_WID_PUT	_IOW('F', 32, struct fb_wid_list)
1448c2ecf20Sopenharmony_ci#define FBIO_WID_GET	_IOWR('F', 33, struct fb_wid_list)
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci/* Creator ioctls */
1478c2ecf20Sopenharmony_ci#define FFB_IOCTL	('F'<<8)
1488c2ecf20Sopenharmony_ci#define FFB_SYS_INFO		(FFB_IOCTL|80)
1498c2ecf20Sopenharmony_ci#define FFB_CLUTREAD		(FFB_IOCTL|81)
1508c2ecf20Sopenharmony_ci#define FFB_CLUTPOST		(FFB_IOCTL|82)
1518c2ecf20Sopenharmony_ci#define FFB_SETDIAGMODE		(FFB_IOCTL|83)
1528c2ecf20Sopenharmony_ci#define FFB_GETMONITORID	(FFB_IOCTL|84)
1538c2ecf20Sopenharmony_ci#define FFB_GETVIDEOMODE	(FFB_IOCTL|85)
1548c2ecf20Sopenharmony_ci#define FFB_SETVIDEOMODE	(FFB_IOCTL|86)
1558c2ecf20Sopenharmony_ci#define FFB_SETSERVER		(FFB_IOCTL|87)
1568c2ecf20Sopenharmony_ci#define FFB_SETOVCTL		(FFB_IOCTL|88)
1578c2ecf20Sopenharmony_ci#define FFB_GETOVCTL		(FFB_IOCTL|89)
1588c2ecf20Sopenharmony_ci#define FFB_GETSAXNUM		(FFB_IOCTL|90)
1598c2ecf20Sopenharmony_ci#define FFB_FBDEBUG		(FFB_IOCTL|91)
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci/* Cg14 ioctls */
1628c2ecf20Sopenharmony_ci#define MDI_IOCTL          ('M'<<8)
1638c2ecf20Sopenharmony_ci#define MDI_RESET          (MDI_IOCTL|1)
1648c2ecf20Sopenharmony_ci#define MDI_GET_CFGINFO    (MDI_IOCTL|2)
1658c2ecf20Sopenharmony_ci#define MDI_SET_PIXELMODE  (MDI_IOCTL|3)
1668c2ecf20Sopenharmony_ci#    define MDI_32_PIX     32
1678c2ecf20Sopenharmony_ci#    define MDI_16_PIX     16
1688c2ecf20Sopenharmony_ci#    define MDI_8_PIX      8
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_cistruct mdi_cfginfo {
1718c2ecf20Sopenharmony_ci	int     mdi_ncluts;     /* Number of implemented CLUTs in this MDI */
1728c2ecf20Sopenharmony_ci        int     mdi_type;       /* FBTYPE name */
1738c2ecf20Sopenharmony_ci        int     mdi_height;     /* height */
1748c2ecf20Sopenharmony_ci        int     mdi_width;      /* width */
1758c2ecf20Sopenharmony_ci        int     mdi_size;       /* available ram */
1768c2ecf20Sopenharmony_ci        int     mdi_mode;       /* 8bpp, 16bpp or 32bpp */
1778c2ecf20Sopenharmony_ci        int     mdi_pixfreq;    /* pixel clock (from PROM) */
1788c2ecf20Sopenharmony_ci};
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci/* SparcLinux specific ioctl for the MDI, should be replaced for
1818c2ecf20Sopenharmony_ci * the SET_XLUT/SET_CLUTn ioctls instead
1828c2ecf20Sopenharmony_ci */
1838c2ecf20Sopenharmony_ci#define MDI_CLEAR_XLUT       (MDI_IOCTL|9)
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ci/* leo & ffb ioctls */
1868c2ecf20Sopenharmony_cistruct fb_clut_alloc {
1878c2ecf20Sopenharmony_ci	__u32	clutid;	/* Set on return */
1888c2ecf20Sopenharmony_ci 	__u32	flag;
1898c2ecf20Sopenharmony_ci 	__u32	index;
1908c2ecf20Sopenharmony_ci};
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_cistruct fb_clut {
1938c2ecf20Sopenharmony_ci#define FB_CLUT_WAIT	0x00000001	/* Not yet implemented */
1948c2ecf20Sopenharmony_ci 	__u32	flag;
1958c2ecf20Sopenharmony_ci 	__u32	clutid;
1968c2ecf20Sopenharmony_ci 	__u32	offset;
1978c2ecf20Sopenharmony_ci 	__u32	count;
1988c2ecf20Sopenharmony_ci 	char *	red;
1998c2ecf20Sopenharmony_ci 	char *	green;
2008c2ecf20Sopenharmony_ci 	char *	blue;
2018c2ecf20Sopenharmony_ci};
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_cistruct fb_clut32 {
2048c2ecf20Sopenharmony_ci 	__u32	flag;
2058c2ecf20Sopenharmony_ci 	__u32	clutid;
2068c2ecf20Sopenharmony_ci 	__u32	offset;
2078c2ecf20Sopenharmony_ci 	__u32	count;
2088c2ecf20Sopenharmony_ci 	__u32	red;
2098c2ecf20Sopenharmony_ci 	__u32	green;
2108c2ecf20Sopenharmony_ci 	__u32	blue;
2118c2ecf20Sopenharmony_ci};
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci#define LEO_CLUTALLOC	_IOWR('L', 53, struct fb_clut_alloc)
2148c2ecf20Sopenharmony_ci#define LEO_CLUTFREE	_IOW('L', 54, struct fb_clut_alloc)
2158c2ecf20Sopenharmony_ci#define LEO_CLUTREAD	_IOW('L', 55, struct fb_clut)
2168c2ecf20Sopenharmony_ci#define LEO_CLUTPOST	_IOW('L', 56, struct fb_clut)
2178c2ecf20Sopenharmony_ci#define LEO_SETGAMMA	_IOW('L', 68, int) /* Not yet implemented */
2188c2ecf20Sopenharmony_ci#define LEO_GETGAMMA	_IOR('L', 69, int) /* Not yet implemented */
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci/* These are exported to userland for applications to use */
2228c2ecf20Sopenharmony_ci/* Mappable offsets for the cg14: control registers */
2238c2ecf20Sopenharmony_ci#define MDI_DIRECT_MAP 0x10000000
2248c2ecf20Sopenharmony_ci#define MDI_CTLREG_MAP 0x20000000
2258c2ecf20Sopenharmony_ci#define MDI_CURSOR_MAP 0x30000000
2268c2ecf20Sopenharmony_ci#define MDI_SHDW_VRT_MAP 0x40000000
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci/* Mappable offsets for the cg14: frame buffer resolutions */
2298c2ecf20Sopenharmony_ci/* 32 bits */
2308c2ecf20Sopenharmony_ci#define MDI_CHUNKY_XBGR_MAP 0x50000000
2318c2ecf20Sopenharmony_ci#define MDI_CHUNKY_BGR_MAP 0x60000000
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci/* 16 bits */
2348c2ecf20Sopenharmony_ci#define MDI_PLANAR_X16_MAP 0x70000000
2358c2ecf20Sopenharmony_ci#define MDI_PLANAR_C16_MAP 0x80000000
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ci/* 8 bit is done as CG3 MMAP offset */
2388c2ecf20Sopenharmony_ci/* 32 bits, planar */
2398c2ecf20Sopenharmony_ci#define MDI_PLANAR_X32_MAP 0x90000000
2408c2ecf20Sopenharmony_ci#define MDI_PLANAR_B32_MAP 0xa0000000
2418c2ecf20Sopenharmony_ci#define MDI_PLANAR_G32_MAP 0xb0000000
2428c2ecf20Sopenharmony_ci#define MDI_PLANAR_R32_MAP 0xc0000000
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci/* Mappable offsets on leo */
2458c2ecf20Sopenharmony_ci#define LEO_SS0_MAP            0x00000000
2468c2ecf20Sopenharmony_ci#define LEO_LC_SS0_USR_MAP     0x00800000
2478c2ecf20Sopenharmony_ci#define LEO_LD_SS0_MAP         0x00801000
2488c2ecf20Sopenharmony_ci#define LEO_LX_CURSOR_MAP      0x00802000
2498c2ecf20Sopenharmony_ci#define LEO_SS1_MAP            0x00803000
2508c2ecf20Sopenharmony_ci#define LEO_LC_SS1_USR_MAP     0x01003000
2518c2ecf20Sopenharmony_ci#define LEO_LD_SS1_MAP         0x01004000
2528c2ecf20Sopenharmony_ci#define LEO_UNK_MAP            0x01005000
2538c2ecf20Sopenharmony_ci#define LEO_LX_KRN_MAP         0x01006000
2548c2ecf20Sopenharmony_ci#define LEO_LC_SS0_KRN_MAP     0x01007000
2558c2ecf20Sopenharmony_ci#define LEO_LC_SS1_KRN_MAP     0x01008000
2568c2ecf20Sopenharmony_ci#define LEO_LD_GBL_MAP         0x01009000
2578c2ecf20Sopenharmony_ci#define LEO_UNK2_MAP           0x0100a000
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci#endif /* _UAPI__LINUX_FBIO_H */
261