Drop Xorg DDX

(cherry picked from commit 4f4b8e00fc)
This commit is contained in:
Michel Dänzer 2020-07-03 16:53:20 +02:00 committed by Olivier Fourdan
parent 46675b1038
commit 6fbc05b703
340 changed files with 6 additions and 140934 deletions

View file

@ -73,7 +73,7 @@ cache:
- '%CYGWIN_ROOT%\home\%USERNAME%\.ccache'
build_script:
- SET PATH=%CYGWIN_ROOT%/bin
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson setup --prefix=/usr -Dxv=false -Dxf86bigfont=true -Dxephyr=true -Dxvfb=true -Dxorg=true -Dpciaccess=false -Dint10=false -Dglamor=false build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson setup --prefix=/usr -Dxv=false -Dxf86bigfont=true -Dxephyr=true -Dxvfb=true -Dglamor=false build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson configure build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ninja -C build"'
- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ccache -s"'

View file

@ -73,7 +73,3 @@ libxserver_xext_vidmode = static_library('libxserver_xext_vidmode',
include_directories: inc,
dependencies: common_dep,
)
if build_xorg
install_data(hdrs_xext, install_dir: xorgsdkdir)
endif

View file

@ -15,7 +15,3 @@ libxserver_composite = static_library('libxserver_composite',
include_directories: inc,
dependencies: common_dep,
)
if build_xorg
install_data(hdrs_composite, install_dir: xorgsdkdir)
endif

View file

@ -22,14 +22,3 @@ endif
if host_machine.system() == 'openbsd'
srcs_config += 'wscons.c'
endif
if build_xorg
install_data('10-quirks.conf',
install_dir: join_paths(get_option('datadir'), 'X11/xorg.conf.d'))
endif
libxserver_config = static_library('libxserver_config',
srcs_config,
include_directories: inc,
dependencies: config_dep,
)

View file

@ -12,7 +12,3 @@ libxserver_dbe = static_library('libxserver_dbe',
include_directories: inc,
dependencies: common_dep,
)
if build_xorg
install_data(hdrs_dbe, install_dir: xorgsdkdir)
endif

View file

@ -16,7 +16,3 @@ if build_dri3
dependencies: [ common_dep, libdrm_dep ],
)
endif
if build_xorg
install_data(hdrs_dri3, install_dir: xorgsdkdir)
endif

View file

@ -16,9 +16,4 @@ libxserver_exa = static_library('libxserver_exa',
srcs_exa,
include_directories: inc,
dependencies: common_dep,
c_args: '-DHAVE_XORG_CONFIG_H'
)
if build_xorg
install_data('exa.h', install_dir: xorgsdkdir)
endif

View file

@ -53,7 +53,3 @@ libxserver_wfb = static_library('libxserver_wfb',
pic: true,
build_by_default: false,
)
if build_xorg
install_data(hdrs_fb, install_dir: xorgsdkdir)
endif

View file

@ -53,7 +53,3 @@ glamor_egl_stubs = static_library('glamor_egl_stubs',
include_directories: inc,
dependencies: common_dep,
)
if build_xorg
install_data('glamor.h', install_dir: xorgsdkdir)
endif

View file

@ -51,7 +51,7 @@ if build_glx
endif
srcs_glxdri2 = []
if build_dri2 or build_dri3
if build_dri3
srcs_glxdri2 = files('glxdri2.c')
endif
@ -78,8 +78,4 @@ if build_glx
dependency('gl', version: '>= 1.2'),
],
)
if build_xorg
install_data(hdrs_vnd, install_dir : xorgsdkdir)
endif
endif

View file

@ -6,10 +6,6 @@ if get_option('xvfb')
subdir('vfb')
endif
if build_xorg
subdir('xfree86')
endif
if build_xwayland
subdir('xwayland')
endif

View file

@ -1,6 +0,0 @@
Xorg
Xorg.wrap
Xorg.sh
xorg.conf.example
sdksyms.c
sdksyms.dep

View file

@ -1,11 +0,0 @@
#!/bin/sh
#
# Execute Xorg.wrap if it exists otherwise execute Xorg directly.
# This allows distros to put the suid wrapper in a separate package.
basedir=@SUID_WRAPPER_DIR@
if [ -x "$basedir"/Xorg.wrap ]; then
exec "$basedir"/Xorg.wrap "$@"
else
exec "$basedir"/Xorg "$@"
fi

View file

@ -1,3 +0,0 @@
# Add & Override for this directory and its subdirectories
xf86Build.h
xf86DefModeSet.c

File diff suppressed because it is too large Load diff

View file

@ -1,67 +0,0 @@
#ifndef __DGAPROC_H
#define __DGAPROC_H
#include <X11/Xproto.h>
#include "pixmap.h"
#define DGA_CONCURRENT_ACCESS 0x00000001
#define DGA_FILL_RECT 0x00000002
#define DGA_BLIT_RECT 0x00000004
#define DGA_BLIT_RECT_TRANS 0x00000008
#define DGA_PIXMAP_AVAILABLE 0x00000010
#define DGA_INTERLACED 0x00010000
#define DGA_DOUBLESCAN 0x00020000
#define DGA_FLIP_IMMEDIATE 0x00000001
#define DGA_FLIP_RETRACE 0x00000002
#define DGA_COMPLETED 0x00000000
#define DGA_PENDING 0x00000001
#define DGA_NEED_ROOT 0x00000001
typedef struct {
int num; /* A unique identifier for the mode (num > 0) */
const char *name; /* name of mode given in the XF86Config */
int VSync_num;
int VSync_den;
int flags; /* DGA_CONCURRENT_ACCESS, etc... */
int imageWidth; /* linear accessible portion (pixels) */
int imageHeight;
int pixmapWidth; /* Xlib accessible portion (pixels) */
int pixmapHeight; /* both fields ignored if no concurrent access */
int bytesPerScanline;
int byteOrder; /* MSBFirst, LSBFirst */
int depth;
int bitsPerPixel;
unsigned long red_mask;
unsigned long green_mask;
unsigned long blue_mask;
short visualClass;
int viewportWidth;
int viewportHeight;
int xViewportStep; /* viewport position granularity */
int yViewportStep;
int maxViewportX; /* max viewport origin */
int maxViewportY;
int viewportFlags; /* types of page flipping possible */
int offset;
int reserved1;
int reserved2;
} XDGAModeRec, *XDGAModePtr;
/* DDX interface */
extern Bool DGAScreenAvailable(ScreenPtr pScreen);
extern Bool DGAActive(int Index);
extern Bool DGAVTSwitch(void);
extern Bool DGAStealButtonEvent(DeviceIntPtr dev, int Index,
int button, int is_down);
extern Bool DGAStealMotionEvent(DeviceIntPtr dev, int Index, int dx, int dy);
extern Bool DGAStealKeyEvent(DeviceIntPtr dev, int Index,
int key_code, int is_down);
#endif /* __DGAPROC_H */

View file

@ -1,168 +0,0 @@
//
// Extra modes to include as default modes in the X server.
//
// $XFree86: xc/programs/Xserver/hw/xfree86/etc/extramodes,v 1.5 2002/06/05 19:43:05 dawes Exp $
//
# 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz
ModeLine "832x624" 57.284 832 864 928 1152 624 625 628 667 -Hsync -Vsync
# 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz
ModeLine "1400x1050" 122.0 1400 1488 1640 1880 1050 1052 1064 1082 +hsync +vsync
# 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz
ModeLine "1400x1050" 155.8 1400 1464 1784 1912 1050 1052 1064 1090 +hsync +vsync
# 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz
Modeline "1920x1440" 341.35 1920 2072 2288 2656 1440 1441 1444 1512 -hsync +vsync
# 2048x1536 @ 60Hz (VESA GTF) hsync: 95.3kHz
Modeline "2048x1536" 266.95 2048 2200 2424 2800 1536 1537 1540 1589 -hsync +vsync
# 2048x1536 @ 75Hz (VESA GTF) hsync: 120.2kHz
Modeline "2048x1536" 340.48 2048 2216 2440 2832 1536 1537 1540 1603 -hsync +vsync
# 2048x1536 @ 85Hz (VESA GTF) hsync: 137.0kHz
Modeline "2048x1536" 388.04 2048 2216 2440 2832 1536 1537 1540 1612 -hsync +vsync
### 16:9 modelines generated by cvt
# 640x360 59.32 Hz (CVT 0.23M9-R) hsync: 22.19 kHz; pclk: 17.75 MHz
Modeline "640x360R" 17.75 640 688 720 800 360 363 368 374 +hsync -vsync
# 640x360 59.84 Hz (CVT 0.23M9) hsync: 22.50 kHz; pclk: 18.00 MHz
Modeline "640x360" 18.00 640 664 720 800 360 363 368 376 -hsync +vsync
# 720x405 58.99 Hz (CVT 0.29M9-R) hsync: 24.72 kHz; pclk: 21.75 MHz
Modeline "720x405R" 21.75 720 768 800 880 405 408 413 419 +hsync -vsync
# 720x405 59.51 Hz (CVT 0.29M9) hsync: 25.11 kHz; pclk: 22.50 MHz
Modeline "720x405" 22.50 720 744 808 896 405 408 413 422 -hsync +vsync
# 864x486 59.57 Hz (CVT 0.42M9-R) hsync: 29.79 kHz; pclk: 30.50 MHz
Modeline "864x486R" 30.50 864 912 944 1024 486 489 494 500 +hsync -vsync
# 864x486 59.92 Hz (CVT 0.42M9) hsync: 30.32 kHz; pclk: 32.50 MHz
Modeline "864x486" 32.50 864 888 968 1072 486 489 494 506 -hsync +vsync
# 960x540 59.82 Hz (CVT 0.52M9-R) hsync: 33.26 kHz; pclk: 37.25 MHz
Modeline "960x540R" 37.25 960 1008 1040 1120 540 543 548 556 +hsync -vsync
# 960x540 59.63 Hz (CVT 0.52M9) hsync: 33.51 kHz; pclk: 40.75 MHz
Modeline "960x540" 40.75 960 992 1088 1216 540 543 548 562 -hsync +vsync
# 1024x576 59.82 Hz (CVT 0.59M9-R) hsync: 35.47 kHz; pclk: 42.00 MHz
Modeline "1024x576R" 42.00 1024 1072 1104 1184 576 579 584 593 +hsync -vsync
# 1024x576 59.90 Hz (CVT 0.59M9) hsync: 35.88 kHz; pclk: 46.50 MHz
Modeline "1024x576" 46.50 1024 1064 1160 1296 576 579 584 599 -hsync +vsync
# 1280x720 59.74 Hz (CVT 0.92M9-R) hsync: 44.27 kHz; pclk: 63.75 MHz
Modeline "1280x720R" 63.75 1280 1328 1360 1440 720 723 728 741 +hsync -vsync
# 1280x720 59.86 Hz (CVT 0.92M9) hsync: 44.77 kHz; pclk: 74.50 MHz
Modeline "1280x720" 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync
# 1368x768 59.85 Hz (CVT) hsync: 47.28 kHz; pclk: 72.25 MHz
Modeline "1368x768R" 72.25 1368 1416 1448 1528 768 771 781 790 +hsync -vsync
# 1368x768 59.88 Hz (CVT) hsync: 47.79 kHz; pclk: 85.25 MHz
Modeline "1368x768" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync
# 1600x900 59.82 Hz (CVT 1.44M9-R) hsync: 55.40 kHz; pclk: 97.50 MHz
Modeline "1600x900R" 97.50 1600 1648 1680 1760 900 903 908 926 +hsync -vsync
# 1600x900 59.95 Hz (CVT 1.44M9) hsync: 55.99 kHz; pclk: 118.25 MHz
Modeline "1600x900" 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync
# 1920x1080 59.93 Hz (CVT 2.07M9-R) hsync: 66.59 kHz; pclk: 138.50 MHz
Modeline "1920x1080R" 138.50 1920 1968 2000 2080 1080 1083 1088 1111 +hsync -vsync
# 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
Modeline "1920x1080" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
# 2048x1152 59.91 Hz (CVT 2.36M9-R) hsync: 70.99 kHz; pclk: 156.75 MHz
Modeline "2048x1152R" 156.75 2048 2096 2128 2208 1152 1155 1160 1185 +hsync -vsync
# 2048x1152 59.90 Hz (CVT 2.36M9) hsync: 71.58 kHz; pclk: 197.00 MHz
Modeline "2048x1152" 197.00 2048 2184 2400 2752 1152 1155 1160 1195 -hsync +vsync
# 2560x1440 59.95 Hz (CVT 3.69M9-R) hsync: 88.79 kHz; pclk: 241.50 MHz
Modeline "2560x1440R" 241.50 2560 2608 2640 2720 1440 1443 1448 1481 +hsync -vsync
# 2560x1440 59.96 Hz (CVT 3.69M9) hsync: 89.52 kHz; pclk: 312.25 MHz
Modeline "2560x1440" 312.25 2560 2752 3024 3488 1440 1443 1448 1493 -hsync +vsync
# 2880x1620 59.97 Hz (CVT 4.67M9-R) hsync: 99.92 kHz; pclk: 303.75 MHz
Modeline "2880x1620R" 303.75 2880 2928 2960 3040 1620 1623 1628 1666 +hsync -vsync
# 2880x1620 59.96 Hz (CVT 4.67M9) hsync: 100.67 kHz; pclk: 396.25 MHz
Modeline "2880x1620" 396.25 2880 3096 3408 3936 1620 1623 1628 1679 -hsync +vsync
# 3200x1800 59.94 Hz (CVT 5.76M9-R) hsync: 111.01 kHz; pclk: 373.00 MHz
Modeline "3200x1800R" 373.00 3200 3248 3280 3360 1800 1803 1808 1852 +hsync -vsync
# 3200x1800 59.96 Hz (CVT 5.76M9) hsync: 111.82 kHz; pclk: 492.00 MHz
Modeline "3200x1800" 492.00 3200 3456 3800 4400 1800 1803 1808 1865 -hsync +vsync
# 3840x2160 59.97 Hz (CVT 8.29M9-R) hsync: 133.25 kHz; pclk: 533.00 MHz
Modeline "3840x2160R" 533.00 3840 3888 3920 4000 2160 2163 2168 2222 +hsync -vsync
# 3840x2160 59.98 Hz (CVT 8.29M9) hsync: 134.18 kHz; pclk: 712.75 MHz
Modeline "3840x2160" 712.75 3840 4160 4576 5312 2160 2163 2168 2237 -hsync +vsync
# 4096x2304 59.98 Hz (CVT 9.44M9-R) hsync: 142.15 kHz; pclk: 605.00 MHz
Modeline "4096x2304R" 605.00 4096 4144 4176 4256 2304 2307 2312 2370 +hsync -vsync
# 4096x2304 59.99 Hz (CVT 9.44M9) hsync: 143.13 kHz; pclk: 813.00 MHz
Modeline "4096x2304" 813.00 4096 4440 4888 5680 2304 2307 2312 2386 -hsync +vsync
# 5120x2880 59.99 Hz (CVT 14.75M9-R) hsync: 177.70 kHz; pclk: 938.25 MHz
Modeline "5120x2880R" 938.25 5120 5168 5200 5280 2880 2883 2888 2962 +hsync -vsync
# 5120x2880 59.99 Hz (CVT 14.75M9) hsync: 178.88 kHz; pclk: 1276.50 MHz
Modeline "5120x2880" 1276.50 5120 5560 6128 7136 2880 2883 2888 2982 -hsync +vsync
# 7680x4320 59.99 Hz (CVT 33.18M9-R) hsync: 266.55 kHz; pclk: 2089.75 MHz
Modeline "7680x4320R" 2089.75 7680 7728 7760 7840 4320 4323 4328 4443 +hsync -vsync
# 7680x4320 59.99 Hz (CVT 33.18M9) hsync: 268.22 kHz; pclk: 2892.50 MHz
Modeline "7680x4320" 2892.50 7680 8376 9232 10784 4320 4323 4328 4471 -hsync +vsync
# 15360x8640 59.99 Hz (CVT 132.71M9-R) hsync: 533.10 kHz; pclk: 8273.75 MHz
Modeline "15360x8640R" 8273.75 15360 15408 15440 15520 8640 8643 8648 8886 +hsync -vsync
# 15360x8640 60.00 Hz (CVT 132.71M9) hsync: 536.27 kHz; pclk: 11669.25 MHz
Modeline "15360x8640" 11669.25 15360 16824 18560 21760 8640 8643 8648 8938 -hsync +vsync
## 16:10 modelines generated by cvt
# 1280x800 59.91 Hz (CVT 1.02MA-R) hsync: 49.31 kHz; pclk: 71.00 MHz
Modeline "1280x800R" 71.00 1280 1328 1360 1440 800 803 809 823 +hsync -vsync
# 1280x800 59.81 Hz (CVT 1.02MA) hsync: 49.70 kHz; pclk: 83.50 MHz
Modeline "1280x800" 83.50 1280 1352 1480 1680 800 803 809 831 -hsync +vsync
# 1400x900 59.88 Hz (CVT) hsync: 55.45 kHz; pclk: 86.50 MHz
Modeline "1400x900R" 86.50 1400 1448 1480 1560 900 903 913 926 +hsync -vsync
# 1400x900 59.96 Hz (CVT) hsync: 56.01 kHz; pclk: 103.50 MHz
Modeline "1400x900" 103.50 1400 1480 1624 1848 900 903 913 934 -hsync +vsync
# 1680x1050 59.88 Hz (CVT 1.76MA-R) hsync: 64.67 kHz; pclk: 119.00 MHz
Modeline "1680x1050R" 119.00 1680 1728 1760 1840 1050 1053 1059 1080 +hsync -vsync
# 1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz
Modeline "1680x1050" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync
# 1920x1200 59.95 Hz (CVT 2.30MA-R) hsync: 74.04 kHz; pclk: 154.00 MHz
Modeline "1920x1200R" 154.00 1920 1968 2000 2080 1200 1203 1209 1235 +hsync -vsync
# 1920x1200 59.88 Hz (CVT 2.30MA) hsync: 74.56 kHz; pclk: 193.25 MHz
Modeline "1920x1200" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync
# 2560x1600 59.97 Hz (CVT 4.10MA-R) hsync: 98.71 kHz; pclk: 268.50 MHz
Modeline "2560x1600R" 268.50 2560 2608 2640 2720 1600 1603 1609 1646 +hsync -vsync
# 2560x1600 59.99 Hz (CVT 4.10MA) hsync: 99.46 kHz; pclk: 348.50 MHz
Modeline "2560x1600" 348.50 2560 2760 3032 3504 1600 1603 1609 1658 -hsync +vsync

View file

@ -1,103 +0,0 @@
srcs_xorg_common = [
'xf86fbBus.c',
'xf86noBus.c',
'xf86Configure.c',
'xf86Bus.c',
'xf86Config.c',
'xf86Cursor.c',
'xf86DPMS.c',
'xf86Events.c',
'xf86Globals.c',
'xf86AutoConfig.c',
'xf86Option.c',
'xf86Init.c',
'xf86VidMode.c',
'xf86fbman.c',
'xf86cmap.c',
'xf86Helper.c',
'xf86PM.c',
'xf86RandR.c',
'xf86Xinput.c',
'xisb.c',
'xf86Mode.c',
'xorgHelper.c',
'xf86Extensions.c',
]
xorg_sdk_headers = [
'compiler.h',
'xf86.h',
'xf86Module.h',
'xf86Opt.h',
'xf86PciInfo.h',
'xf86Priv.h',
'xf86Privstr.h',
'xf86cmap.h',
'xf86fbman.h',
'xf86str.h',
'xf86Xinput.h',
'xisb.h',
'xorgVersion.h',
'xf86sbusBus.h',
'xf86VGAarbiter.h',
'xf86Optionstr.h',
'xf86platformBus.h',
'xf86MatchDrivers.h',
'xaarop.h',
]
fallback_driver = get_option('fallback_input_driver')
if fallback_driver == 'auto'
if host_machine.system() == 'linux'
fallback_driver = 'libinput'
else
fallback_driver = ''
endif
endif
if build_dga
srcs_xorg_common += 'xf86DGA.c'
xorg_sdk_headers += 'dgaproc.h'
endif
if build_xv
srcs_xorg_common += ['xf86xv.c', 'xf86xvmc.c']
xorg_sdk_headers += ['xf86xv.h', 'xf86xvmc.h', 'xf86xvpriv.h']
endif
if build_udev
srcs_xorg_common += 'xf86platformBus.c'
endif
if get_option('pciaccess')
srcs_xorg_common += ['xf86pciBus.c', 'xf86VGAarbiter.c']
if host_machine.cpu() == 'sparc' or host_machine.cpu() == 'sparc64'
srcs_xorg_common += 'xf86sbusBus.c'
endif
endif
srcs_xorg_common += custom_target(
'xf86DefModeSet.c',
output: 'xf86DefModeSet.c',
input: ['modeline2c.awk', 'vesamodes', 'extramodes'],
command: [find_program('awk'), '-f', '@INPUT0@', '@INPUT1@', '@INPUT2@'],
capture: true,
)
xorg_common = static_library('xorg_common',
srcs_xorg_common,
include_directories: [inc, xorg_inc, top_dir_inc],
dependencies: [
common_dep,
dbus_dep,
pciaccess_dep,
libdrm_dep,
],
c_args: [
xorg_c_args,
'-DFALLBACK_INPUT_DRIVER="@0@"'.format(fallback_driver)
],
)
install_data(xorg_sdk_headers, install_dir: xorgsdkdir)

View file

@ -1,93 +0,0 @@
#!/usr/bin/awk -f
#
# Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
# All rights reserved.
#
# Based on Perl script by Dirk Hohndel.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# Usage: modeline2c.awk < modefile > xf86DefModeSet.c
#
BEGIN {
flagsdict[""] = "0"
flagsdict["+hsync +vsync"] = "V_PHSYNC | V_PVSYNC"
flagsdict["+hsync -vsync"] = "V_PHSYNC | V_NVSYNC"
flagsdict["-hsync +vsync"] = "V_NHSYNC | V_PVSYNC"
flagsdict["-hsync -vsync"] = "V_NHSYNC | V_NVSYNC"
flagsdict["+hsync +vsync interlace"] = "V_PHSYNC | V_PVSYNC | V_INTERLACE"
flagsdict["+hsync -vsync interlace"] = "V_PHSYNC | V_NVSYNC | V_INTERLACE"
flagsdict["-hsync +vsync interlace"] = "V_NHSYNC | V_PVSYNC | V_INTERLACE"
flagsdict["-hsync -vsync interlace"] = "V_NHSYNC | V_NVSYNC | V_INTERLACE"
print "/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at"
print " * modeline2c.awk */"
print ""
print "/*"
print " * Author: Joerg Sonnenberger <joerg@NetBSD.org>"
print " * Based on Perl script from Dirk Hohndel <hohndel@XFree86.Org>"
print " */"
print ""
print "#ifdef HAVE_XORG_CONFIG_H"
print "#include <xorg-config.h>"
print "#endif"
print ""
print "#include \"xf86.h\""
print "#include \"xf86Config.h\""
print "#include \"xf86Priv.h\""
print "#include \"xf86_OSlib.h\""
print ""
print "#include \"globals.h\""
print ""
print "#define MODEPREFIX NULL, NULL, NULL, MODE_OK, M_T_DEFAULT"
print "#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0"
print ""
print "const DisplayModeRec xf86DefaultModes [] = {"
modeline = "\t{MODEPREFIX,%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n"
modeline_data = "^[a-zA-Z]+[ \t]+[^ \t]+[ \t0-9.]+"
}
/^[mM][oO][dD][eE][lL][iI][nN][eE]/ {
flags = $0
gsub(modeline_data, "", flags)
flags = tolower(flags)
printf(modeline, $3 * 1000, $4, $5, $6, $7,
$8, $9, $10, $11, flagsdict[flags])
# Half-width double scanned modes
printf(modeline, $3 * 500, $4/2, $5/2, $6/2, $7/2,
$8/2, $9/2, $10/2, $11/2, flagsdict[flags] " | V_DBLSCAN")
}
/^#/ {
print "/*" substr($0, 2) " */"
}
END {
print "};"
printf "const int xf86NumDefaultModes = ARRAY_SIZE(xf86DefaultModes);"
}

View file

@ -1,111 +0,0 @@
//
// Default modes distilled from
// "VESA and Industry Standards and Guide for Computer Display Monitor
// Timing", version 1.0, revision 0.8, adopted September 17, 1998.
//
// $XFree86: xc/programs/Xserver/hw/xfree86/etc/vesamodes,v 1.3 1999/11/16 03:28:03 tsi Exp $
# 640x350 @ 85Hz (VESA) hsync: 37.9kHz
ModeLine "640x350" 31.5 640 672 736 832 350 382 385 445 +hsync -vsync
# 640x400 @ 85Hz (VESA) hsync: 37.9kHz
ModeLine "640x400" 31.5 640 672 736 832 400 401 404 445 -hsync +vsync
# 720x400 @ 85Hz (VESA) hsync: 37.9kHz
ModeLine "720x400" 35.5 720 756 828 936 400 401 404 446 -hsync +vsync
# 640x480 @ 60Hz (Industry standard) hsync: 31.5kHz
ModeLine "640x480" 25.175 640 656 752 800 480 490 492 525 -hsync -vsync
# 640x480 @ 72Hz (VESA) hsync: 37.9kHz
ModeLine "640x480" 31.5 640 664 704 832 480 489 492 520 -hsync -vsync
# 640x480 @ 75Hz (VESA) hsync: 37.5kHz
ModeLine "640x480" 31.5 640 656 720 840 480 481 484 500 -hsync -vsync
# 640x480 @ 85Hz (VESA) hsync: 43.3kHz
ModeLine "640x480" 36.0 640 696 752 832 480 481 484 509 -hsync -vsync
# 800x600 @ 56Hz (VESA) hsync: 35.2kHz
ModeLine "800x600" 36.0 800 824 896 1024 600 601 603 625 +hsync +vsync
# 800x600 @ 60Hz (VESA) hsync: 37.9kHz
ModeLine "800x600" 40.0 800 840 968 1056 600 601 605 628 +hsync +vsync
# 800x600 @ 72Hz (VESA) hsync: 48.1kHz
ModeLine "800x600" 50.0 800 856 976 1040 600 637 643 666 +hsync +vsync
# 800x600 @ 75Hz (VESA) hsync: 46.9kHz
ModeLine "800x600" 49.5 800 816 896 1056 600 601 604 625 +hsync +vsync
# 800x600 @ 85Hz (VESA) hsync: 53.7kHz
ModeLine "800x600" 56.3 800 832 896 1048 600 601 604 631 +hsync +vsync
# 1024x768i @ 43Hz (industry standard) hsync: 35.5kHz
ModeLine "1024x768" 44.9 1024 1032 1208 1264 768 768 776 817 +hsync +vsync Interlace
# 1024x768 @ 60Hz (VESA) hsync: 48.4kHz
ModeLine "1024x768" 65.0 1024 1048 1184 1344 768 771 777 806 -hsync -vsync
# 1024x768 @ 70Hz (VESA) hsync: 56.5kHz
ModeLine "1024x768" 75.0 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
# 1024x768 @ 75Hz (VESA) hsync: 60.0kHz
ModeLine "1024x768" 78.75 1024 1040 1136 1312 768 769 772 800 +hsync +vsync
# 1024x768 @ 85Hz (VESA) hsync: 68.7kHz
ModeLine "1024x768" 94.5 1024 1072 1168 1376 768 769 772 808 +hsync +vsync
# 1152x864 @ 75Hz (VESA) hsync: 67.5kHz
ModeLine "1152x864" 108.0 1152 1216 1344 1600 864 865 868 900 +hsync +vsync
# 1280x960 @ 60Hz (VESA) hsync: 60.0kHz
ModeLine "1280x960" 108.0 1280 1376 1488 1800 960 961 964 1000 +hsync +vsync
# 1280x960 @ 85Hz (VESA) hsync: 85.9kHz
ModeLine "1280x960" 148.5 1280 1344 1504 1728 960 961 964 1011 +hsync +vsync
# 1280x1024 @ 60Hz (VESA) hsync: 64.0kHz
ModeLine "1280x1024" 108.0 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync
# 1280x1024 @ 75Hz (VESA) hsync: 80.0kHz
ModeLine "1280x1024" 135.0 1280 1296 1440 1688 1024 1025 1028 1066 +hsync +vsync
# 1280x1024 @ 85Hz (VESA) hsync: 91.1kHz
ModeLine "1280x1024" 157.5 1280 1344 1504 1728 1024 1025 1028 1072 +hsync +vsync
# 1600x1200 @ 60Hz (VESA) hsync: 75.0kHz
ModeLine "1600x1200" 162.0 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
# 1600x1200 @ 65Hz (VESA) hsync: 81.3kHz
ModeLine "1600x1200" 175.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
# 1600x1200 @ 70Hz (VESA) hsync: 87.5kHz
ModeLine "1600x1200" 189.0 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
# 1600x1200 @ 75Hz (VESA) hsync: 93.8kHz
ModeLine "1600x1200" 202.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
# 1600x1200 @ 85Hz (VESA) hsync: 106.3kHz
ModeLine "1600x1200" 229.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
# 1792x1344 @ 60Hz (VESA) hsync: 83.6kHz
ModeLine "1792x1344" 204.8 1792 1920 2120 2448 1344 1345 1348 1394 -hsync +vsync
# 1792x1344 @ 75Hz (VESA) hsync: 106.3kHz
ModeLine "1792x1344" 261.0 1792 1888 2104 2456 1344 1345 1348 1417 -hsync +vsync
# 1856x1392 @ 60Hz (VESA) hsync: 86.3kHz
ModeLine "1856x1392" 218.3 1856 1952 2176 2528 1392 1393 1396 1439 -hsync +vsync
# 1856x1392 @ 75Hz (VESA) hsync: 112.5kHz
ModeLine "1856x1392" 288.0 1856 1984 2208 2560 1392 1393 1396 1500 -hsync +vsync
# 1920x1440 @ 60Hz (VESA) hsync: 90.0kHz
ModeLine "1920x1440" 234.0 1920 2048 2256 2600 1440 1441 1444 1500 -hsync +vsync
# 1920x1440 @ 75Hz (VESA) hsync: 112.5kHz
ModeLine "1920x1440" 297.0 1920 2064 2288 2640 1440 1441 1444 1500 -hsync +vsync

View file

@ -1,268 +0,0 @@
#ifndef _XAAROP_H
#define _XAAROP_H
#define ROP_DST 0x00000001
#define ROP_SRC 0x00000002
#define ROP_PAT 0x00000004
#define ROP_0 0x00
#define ROP_DPSoon 0x01
#define ROP_DPSona 0x02
#define ROP_PSon 0x03
#define ROP_SDPona 0x04
#define ROP_DPon 0x05
#define ROP_PDSxnon 0x06
#define ROP_PDSaon 0x07
#define ROP_SDPnaa 0x08
#define ROP_PDSxon 0x09
#define ROP_DPna 0x0A
#define ROP_PSDnaon 0x0B
#define ROP_SPna 0x0C
#define ROP_PDSnaon 0x0D
#define ROP_PDSonon 0x0E
#define ROP_Pn 0x0F
#define ROP_PDSona 0x10
#define ROP_DSon 0x11
#define ROP_SDPxnon 0x12
#define ROP_SDPaon 0x13
#define ROP_DPSxnon 0x14
#define ROP_DPSaon 0x15
#define ROP_PSDPSanaxx 0x16
#define ROP_SSPxDSxaxn 0x17
#define ROP_SPxPDxa 0x18
#define ROP_SDPSanaxn 0x19
#define ROP_PDSPaox 0x1A
#define ROP_SDPSxaxn 0x1B
#define ROP_PSDPaox 0x1C
#define ROP_DSPDxaxn 0x1D
#define ROP_PDSox 0x1E
#define ROP_PDSoan 0x1F
#define ROP_DPSnaa 0x20
#define ROP_SDPxon 0x21
#define ROP_DSna 0x22
#define ROP_SPDnaon 0x23
#define ROP_SPxDSxa 0x24
#define ROP_PDSPanaxn 0x25
#define ROP_SDPSaox 0x26
#define ROP_SDPSxnox 0x27
#define ROP_DPSxa 0x28
#define ROP_PSDPSaoxxn 0x29
#define ROP_DPSana 0x2A
#define ROP_SSPxPDxaxn 0x2B
#define ROP_SPDSoax 0x2C
#define ROP_PSDnox 0x2D
#define ROP_PSDPxox 0x2E
#define ROP_PSDnoan 0x2F
#define ROP_PSna 0x30
#define ROP_SDPnaon 0x31
#define ROP_SDPSoox 0x32
#define ROP_Sn 0x33
#define ROP_SPDSaox 0x34
#define ROP_SPDSxnox 0x35
#define ROP_SDPox 0x36
#define ROP_SDPoan 0x37
#define ROP_PSDPoax 0x38
#define ROP_SPDnox 0x39
#define ROP_SPDSxox 0x3A
#define ROP_SPDnoan 0x3B
#define ROP_PSx 0x3C
#define ROP_SPDSonox 0x3D
#define ROP_SPDSnaox 0x3E
#define ROP_PSan 0x3F
#define ROP_PSDnaa 0x40
#define ROP_DPSxon 0x41
#define ROP_SDxPDxa 0x42
#define ROP_SPDSanaxn 0x43
#define ROP_SDna 0x44
#define ROP_DPSnaon 0x45
#define ROP_DSPDaox 0x46
#define ROP_PSDPxaxn 0x47
#define ROP_SDPxa 0x48
#define ROP_PDSPDaoxxn 0x49
#define ROP_DPSDoax 0x4A
#define ROP_PDSnox 0x4B
#define ROP_SDPana 0x4C
#define ROP_SSPxDSxoxn 0x4D
#define ROP_PDSPxox 0x4E
#define ROP_PDSnoan 0x4F
#define ROP_PDna 0x50
#define ROP_DSPnaon 0x51
#define ROP_DPSDaox 0x52
#define ROP_SPDSxaxn 0x53
#define ROP_DPSonon 0x54
#define ROP_Dn 0x55
#define ROP_DPSox 0x56
#define ROP_DPSoan 0x57
#define ROP_PDSPoax 0x58
#define ROP_DPSnox 0x59
#define ROP_DPx 0x5A
#define ROP_DPSDonox 0x5B
#define ROP_DPSDxox 0x5C
#define ROP_DPSnoan 0x5D
#define ROP_DPSDnaox 0x5E
#define ROP_DPan 0x5F
#define ROP_PDSxa 0x60
#define ROP_DSPDSaoxxn 0x61
#define ROP_DSPDoax 0x62
#define ROP_SDPnox 0x63
#define ROP_SDPSoax 0x64
#define ROP_DSPnox 0x65
#define ROP_DSx 0x66
#define ROP_SDPSonox 0x67
#define ROP_DSPDSonoxxn 0x68
#define ROP_PDSxxn 0x69
#define ROP_DPSax 0x6A
#define ROP_PSDPSoaxxn 0x6B
#define ROP_SDPax 0x6C
#define ROP_PDSPDoaxxn 0x6D
#define ROP_SDPSnoax 0x6E
#define ROP_PDSxnan 0x6F
#define ROP_PDSana 0x70
#define ROP_SSDxPDxaxn 0x71
#define ROP_SDPSxox 0x72
#define ROP_SDPnoan 0x73
#define ROP_DSPDxox 0x74
#define ROP_DSPnoan 0x75
#define ROP_SDPSnaox 0x76
#define ROP_DSan 0x77
#define ROP_PDSax 0x78
#define ROP_DSPDSoaxxn 0x79
#define ROP_DPSDnoax 0x7A
#define ROP_SDPxnan 0x7B
#define ROP_SPDSnoax 0x7C
#define ROP_DPSxnan 0x7D
#define ROP_SPxDSxo 0x7E
#define ROP_DPSaan 0x7F
#define ROP_DPSaa 0x80
#define ROP_SPxDSxon 0x81
#define ROP_DPSxna 0x82
#define ROP_SPDSnoaxn 0x83
#define ROP_SDPxna 0x84
#define ROP_PDSPnoaxn 0x85
#define ROP_DSPDSoaxx 0x86
#define ROP_PDSaxn 0x87
#define ROP_DSa 0x88
#define ROP_SDPSnaoxn 0x89
#define ROP_DSPnoa 0x8A
#define ROP_DSPDxoxn 0x8B
#define ROP_SDPnoa 0x8C
#define ROP_SDPSxoxn 0x8D
#define ROP_SSDxPDxax 0x8E
#define ROP_PDSanan 0x8F
#define ROP_PDSxna 0x90
#define ROP_SDPSnoaxn 0x91
#define ROP_DPSDPoaxx 0x92
#define ROP_SPDaxn 0x93
#define ROP_PSDPSoaxx 0x94
#define ROP_DPSaxn 0x95
#define ROP_DPSxx 0x96
#define ROP_PSDPSonoxx 0x97
#define ROP_SDPSonoxn 0x98
#define ROP_DSxn 0x99
#define ROP_DPSnax 0x9A
#define ROP_SDPSoaxn 0x9B
#define ROP_SPDnax 0x9C
#define ROP_DSPDoaxn 0x9D
#define ROP_DSPDSaoxx 0x9E
#define ROP_PDSxan 0x9F
#define ROP_DPa 0xA0
#define ROP_PDSPnaoxn 0xA1
#define ROP_DPSnoa 0xA2
#define ROP_DPSDxoxn 0xA3
#define ROP_PDSPonoxn 0xA4
#define ROP_PDxn 0xA5
#define ROP_DSPnax 0xA6
#define ROP_PDSPoaxn 0xA7
#define ROP_DPSoa 0xA8
#define ROP_DPSoxn 0xA9
#define ROP_D 0xAA
#define ROP_DPSono 0xAB
#define ROP_SPDSxax 0xAC
#define ROP_DPSDaoxn 0xAD
#define ROP_DSPnao 0xAE
#define ROP_DPno 0xAF
#define ROP_PDSnoa 0xB0
#define ROP_PDSPxoxn 0xB1
#define ROP_SSPxDSxox 0xB2
#define ROP_SDPanan 0xB3
#define ROP_PSDnax 0xB4
#define ROP_DPSDoaxn 0xB5
#define ROP_DPSDPaoxx 0xB6
#define ROP_SDPxan 0xB7
#define ROP_PSDPxax 0xB8
#define ROP_DSPDaoxn 0xB9
#define ROP_DPSnao 0xBA
#define ROP_DSno 0xBB
#define ROP_SPDSanax 0xBC
#define ROP_SDxPDxan 0xBD
#define ROP_DPSxo 0xBE
#define ROP_DPSano 0xBF
#define ROP_Psa 0xC0
#define ROP_SPDSnaoxn 0xC1
#define ROP_SPDSonoxn 0xC2
#define ROP_PSxn 0xC3
#define ROP_SPDnoa 0xC4
#define ROP_SPDSxoxn 0xC5
#define ROP_SDPnax 0xC6
#define ROP_PSDPoaxn 0xC7
#define ROP_SDPoa 0xC8
#define ROP_SPDoxn 0xC9
#define ROP_DPSDxax 0xCA
#define ROP_SPDSaoxn 0xCB
#define ROP_S 0xCC
#define ROP_SDPono 0xCD
#define ROP_SDPnao 0xCE
#define ROP_SPno 0xCF
#define ROP_PSDnoa 0xD0
#define ROP_PSDPxoxn 0xD1
#define ROP_PDSnax 0xD2
#define ROP_SPDSoaxn 0xD3
#define ROP_SSPxPDxax 0xD4
#define ROP_DPSanan 0xD5
#define ROP_PSDPSaoxx 0xD6
#define ROP_DPSxan 0xD7
#define ROP_PDSPxax 0xD8
#define ROP_SDPSaoxn 0xD9
#define ROP_DPSDanax 0xDA
#define ROP_SPxDSxan 0xDB
#define ROP_SPDnao 0xDC
#define ROP_SDno 0xDD
#define ROP_SDPxo 0xDE
#define ROP_SDPano 0xDF
#define ROP_PDSoa 0xE0
#define ROP_PDSoxn 0xE1
#define ROP_DSPDxax 0xE2
#define ROP_PSDPaoxn 0xE3
#define ROP_SDPSxax 0xE4
#define ROP_PDSPaoxn 0xE5
#define ROP_SDPSanax 0xE6
#define ROP_SPxPDxan 0xE7
#define ROP_SSPxDSxax 0xE8
#define ROP_DSPDSanaxxn 0xE9
#define ROP_DPSao 0xEA
#define ROP_DPSxno 0xEB
#define ROP_SDPao 0xEC
#define ROP_SDPxno 0xED
#define ROP_DSo 0xEE
#define ROP_SDPnoo 0xEF
#define ROP_P 0xF0
#define ROP_PDSono 0xF1
#define ROP_PDSnao 0xF2
#define ROP_PSno 0xF3
#define ROP_PSDnao 0xF4
#define ROP_PDno 0xF5
#define ROP_PDSxo 0xF6
#define ROP_PDSano 0xF7
#define ROP_PDSao 0xF8
#define ROP_PDSxno 0xF9
#define ROP_DPo 0xFA
#define ROP_DPSnoo 0xFB
#define ROP_PSo 0xFC
#define ROP_PSDnoo 0xFD
#define ROP_DPSoo 0xFE
#define ROP_1 0xFF
#define NO_SRC_ROP(rop) \
((rop == GXnoop) || (rop == GXset) || (rop == GXclear) || (rop == GXinvert))
#endif /* _XAAROP_H */

View file

@ -1,399 +0,0 @@
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains declarations for public XFree86 functions and variables,
* and definitions of public macros.
*
* "public" means available to video drivers.
*/
#ifndef _XF86_H
#define _XF86_H
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#elif HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "xf86str.h"
#include "xf86Opt.h"
#include <X11/Xfuncproto.h>
#include <stdarg.h>
#ifdef RANDR
#include <X11/extensions/randr.h>
#endif
#include "propertyst.h"
/* General parameters */
extern _X_EXPORT int xf86DoConfigure;
extern _X_EXPORT int xf86DoShowOptions;
extern _X_EXPORT Bool xf86DoConfigurePass1;
extern _X_EXPORT Bool xf86ProbeIgnorePrimary;
extern _X_EXPORT Bool xorgHWAccess;
extern _X_EXPORT DevPrivateKeyRec xf86ScreenKeyRec;
#define xf86ScreenKey (&xf86ScreenKeyRec)
extern _X_EXPORT ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */
extern _X_EXPORT const unsigned char byte_reversed[256];
extern _X_EXPORT Bool fbSlotClaimed;
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
extern _X_EXPORT Bool sbusSlotClaimed;
#endif
#if defined(XSERVER_PLATFORM_BUS)
extern _X_EXPORT int platformSlotClaimed;
#endif
extern _X_EXPORT confDRIRec xf86ConfigDRI;
extern _X_EXPORT Bool xf86DRI2Enabled(void);
#define XF86SCRNINFO(p) xf86ScreenToScrn(p)
#define BOOLTOSTRING(b) ((b) ? "TRUE" : "FALSE")
/* Compatibility functions for pre-input-thread drivers */
static inline _X_DEPRECATED int xf86BlockSIGIO(void) { input_lock(); return 0; }
static inline _X_DEPRECATED void xf86UnblockSIGIO(int wasset) { input_unlock(); }
/* Function Prototypes */
#ifndef _NO_XF86_PROTOTYPES
/* PCI related */
#ifdef XSERVER_LIBPCIACCESS
#include <pciaccess.h>
extern _X_EXPORT int pciSlotClaimed;
extern _X_EXPORT Bool xf86CheckPciSlot(const struct pci_device *);
extern _X_EXPORT int xf86ClaimPciSlot(struct pci_device *, DriverPtr drvp,
int chipset, GDevPtr dev, Bool active);
extern _X_EXPORT void xf86UnclaimPciSlot(struct pci_device *, GDevPtr dev);
extern _X_EXPORT Bool xf86ParsePciBusString(const char *busID, int *bus,
int *device, int *func);
extern _X_EXPORT Bool xf86ComparePciBusString(const char *busID, int bus,
int device, int func);
extern _X_EXPORT Bool xf86IsPrimaryPci(struct pci_device *pPci);
extern _X_EXPORT Bool xf86CheckPciMemBase(struct pci_device *pPci,
memType base);
extern _X_EXPORT struct pci_device *xf86GetPciInfoForEntity(int entityIndex);
extern _X_EXPORT int xf86MatchPciInstances(const char *driverName,
int vendorID, SymTabPtr chipsets,
PciChipsets * PCIchipsets,
GDevPtr * devList, int numDevs,
DriverPtr drvp, int **foundEntities);
extern _X_EXPORT ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn,
int scrnFlag, int entityIndex,
PciChipsets * p_chip,
void *dummy, EntityProc init,
EntityProc enter,
EntityProc leave,
void *private);
#else
#define xf86VGAarbiterInit() do {} while (0)
#define xf86VGAarbiterFini() do {} while (0)
#define xf86VGAarbiterLock(x) do {} while (0)
#define xf86VGAarbiterUnlock(x) do {} while (0)
#define xf86VGAarbiterScrnInit(x) do {} while (0)
#define xf86VGAarbiterDeviceDecodes() do {} while (0)
#define xf86VGAarbiterWrapFunctions() do {} while (0)
#endif
/* xf86Bus.c */
extern _X_EXPORT int xf86GetFbInfoForScreen(int scrnIndex);
extern _X_EXPORT int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev,
Bool active);
extern _X_EXPORT int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev,
Bool active);
extern _X_EXPORT Bool xf86DriverHasEntities(DriverPtr drvp);
extern _X_EXPORT void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex);
extern _X_EXPORT void xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn,
int entityIndex,
int instance);
extern _X_EXPORT int xf86GetNumEntityInstances(int entityIndex);
extern _X_EXPORT GDevPtr xf86GetDevFromEntity(int entityIndex, int instance);
extern _X_EXPORT void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn,
int entityIndex);
extern _X_EXPORT EntityInfoPtr xf86GetEntityInfo(int entityIndex);
extern _X_EXPORT Bool xf86IsEntityPrimary(int entityIndex);
extern _X_EXPORT ScrnInfoPtr xf86FindScreenForEntity(int entityIndex);
#define xf86SetLastScrnFlag(e, s) do { } while (0)
extern _X_EXPORT Bool xf86IsEntityShared(int entityIndex);
extern _X_EXPORT void xf86SetEntityShared(int entityIndex);
extern _X_EXPORT Bool xf86IsEntitySharable(int entityIndex);
extern _X_EXPORT void xf86SetEntitySharable(int entityIndex);
extern _X_EXPORT Bool xf86IsPrimInitDone(int entityIndex);
extern _X_EXPORT void xf86SetPrimInitDone(int entityIndex);
extern _X_EXPORT void xf86ClearPrimInitDone(int entityIndex);
extern _X_EXPORT int xf86AllocateEntityPrivateIndex(void);
extern _X_EXPORT DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex);
/* xf86Configure.c */
extern _X_EXPORT GDevPtr xf86AddBusDeviceToConfigure(const char *driver,
BusType bus, void *busData,
int chipset);
/* xf86Cursor.c */
extern _X_EXPORT void xf86LockZoom(ScreenPtr pScreen, int lock);
extern _X_EXPORT void xf86InitViewport(ScrnInfoPtr pScr);
extern _X_EXPORT void xf86SetViewport(ScreenPtr pScreen, int x, int y);
extern _X_EXPORT void xf86ZoomViewport(ScreenPtr pScreen, int zoom);
extern _X_EXPORT Bool xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode);
extern _X_EXPORT void *xf86GetPointerScreenFuncs(void);
extern _X_EXPORT void xf86InitOrigins(void);
extern _X_EXPORT void xf86ReconfigureLayout(void);
/* xf86DPMS.c */
extern _X_EXPORT Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set,
int flags);
/* xf86DGA.c */
#ifdef XFreeXDGA
extern _X_EXPORT Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs,
DGAModePtr modes, int num);
extern _X_EXPORT Bool DGAReInitModes(ScreenPtr pScreen, DGAModePtr modes,
int num);
extern _X_EXPORT xf86SetDGAModeProc xf86SetDGAMode;
#endif
/* xf86Events.c */
typedef struct _InputInfoRec *InputInfoPtr;
extern _X_EXPORT void SetTimeSinceLastInputEvent(void);
extern _X_EXPORT void *xf86AddInputHandler(int fd, InputHandlerProc proc,
void *data);
extern _X_EXPORT int xf86RemoveInputHandler(void *handler);
extern _X_EXPORT void xf86DisableInputHandler(void *handler);
extern _X_EXPORT void xf86EnableInputHandler(void *handler);
extern _X_EXPORT void *xf86AddGeneralHandler(int fd, InputHandlerProc proc,
void *data);
extern _X_EXPORT int xf86RemoveGeneralHandler(void *handler);
extern _X_EXPORT void xf86DisableGeneralHandler(void *handler);
extern _X_EXPORT void xf86EnableGeneralHandler(void *handler);
extern _X_EXPORT InputHandlerProc xf86SetConsoleHandler(InputHandlerProc
handler, void *data);
extern _X_EXPORT void xf86ProcessActionEvent(ActionEvent action, void *arg);
extern _X_EXPORT void xf86PrintBacktrace(void);
extern _X_EXPORT Bool xf86VTOwner(void);
extern _X_EXPORT void xf86VTLeave(void);
extern _X_EXPORT void xf86VTEnter(void);
extern _X_EXPORT void xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo);
extern _X_EXPORT void xf86DisableInputDeviceForVTSwitch(InputInfoPtr pInfo);
/* xf86Helper.c */
extern _X_EXPORT void xf86AddDriver(DriverPtr driver, void *module,
int flags);
extern _X_EXPORT void xf86DeleteDriver(int drvIndex);
extern _X_EXPORT ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags);
extern _X_EXPORT void xf86DeleteScreen(ScrnInfoPtr pScrn);
extern _X_EXPORT int xf86AllocateScrnInfoPrivateIndex(void);
extern _X_EXPORT Bool xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp,
int pad);
extern _X_EXPORT Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp,
int fbbpp, int depth24flags);
extern _X_EXPORT void xf86PrintDepthBpp(ScrnInfoPtr scrp);
extern _X_EXPORT Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask);
extern _X_EXPORT Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual);
extern _X_EXPORT Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma);
extern _X_EXPORT void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y);
extern _X_EXPORT void xf86SetBlackWhitePixels(ScreenPtr pScreen);
extern _X_EXPORT void xf86EnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable);
extern _X_EXPORT void
xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb,
const char *format, va_list args)
_X_ATTRIBUTE_PRINTF(4, 0);
extern _X_EXPORT void
xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
const char *format, ...)
_X_ATTRIBUTE_PRINTF(4, 5);
extern _X_EXPORT void
xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
_X_ATTRIBUTE_PRINTF(3, 4);
extern _X_EXPORT void
xf86MsgVerb(MessageType type, int verb, const char *format, ...)
_X_ATTRIBUTE_PRINTF(3, 4);
extern _X_EXPORT void
xf86Msg(MessageType type, const char *format, ...)
_X_ATTRIBUTE_PRINTF(2, 3);
extern _X_EXPORT void
xf86ErrorFVerb(int verb, const char *format, ...)
_X_ATTRIBUTE_PRINTF(2, 3);
extern _X_EXPORT void
xf86ErrorF(const char *format, ...)
_X_ATTRIBUTE_PRINTF(1, 2);
extern _X_EXPORT const char *
xf86TokenToString(SymTabPtr table, int token);
extern _X_EXPORT int
xf86StringToToken(SymTabPtr table, const char *string);
extern _X_EXPORT void
xf86ShowClocks(ScrnInfoPtr scrp, MessageType from);
extern _X_EXPORT void
xf86PrintChipsets(const char *drvname, const char *drvmsg, SymTabPtr chips);
extern _X_EXPORT int
xf86MatchDevice(const char *drivername, GDevPtr ** driversectlist);
extern _X_EXPORT const char *
xf86GetVisualName(int visual);
extern _X_EXPORT int
xf86GetVerbosity(void);
extern _X_EXPORT int
xf86GetDepth(void);
extern _X_EXPORT rgb
xf86GetWeight(void);
extern _X_EXPORT Gamma
xf86GetGamma(void);
extern _X_EXPORT Bool
xf86ServerIsExiting(void);
extern _X_EXPORT Bool
xf86ServerIsResetting(void);
extern _X_EXPORT Bool
xf86ServerIsOnlyDetecting(void);
extern _X_EXPORT Bool
xf86GetVidModeAllowNonLocal(void);
extern _X_EXPORT Bool
xf86GetVidModeEnabled(void);
extern _X_EXPORT Bool
xf86GetModInDevAllowNonLocal(void);
extern _X_EXPORT Bool
xf86GetModInDevEnabled(void);
extern _X_EXPORT Bool
xf86GetAllowMouseOpenFail(void);
extern _X_EXPORT CARD32
xorgGetVersion(void);
extern _X_EXPORT CARD32
xf86GetModuleVersion(void *module);
extern _X_EXPORT void *
xf86LoadDrvSubModule(DriverPtr drv, const char *name);
extern _X_EXPORT void *
xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name);
extern _X_EXPORT void *
xf86LoadOneModule(const char *name, void *optlist);
extern _X_EXPORT void
xf86UnloadSubModule(void *mod);
extern _X_EXPORT Bool
xf86LoaderCheckSymbol(const char *name);
extern _X_EXPORT void
xf86SetBackingStore(ScreenPtr pScreen);
extern _X_EXPORT void
xf86SetSilkenMouse(ScreenPtr pScreen);
extern _X_EXPORT void *
xf86FindXvOptions(ScrnInfoPtr pScrn, int adapt_index, const char *port_name,
const char **adaptor_name, void **adaptor_options);
extern _X_EXPORT ScrnInfoPtr
xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag,
int entityIndex, EntityProc init,
EntityProc enter, EntityProc leave, void *private);
extern _X_EXPORT Bool
xf86IsScreenPrimary(ScrnInfoPtr pScrn);
extern _X_EXPORT Bool
xf86IsUnblank(int mode);
/* xf86Init.c */
extern _X_EXPORT PixmapFormatPtr
xf86GetPixFormat(ScrnInfoPtr pScrn, int depth);
extern _X_EXPORT int
xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth);
/* xf86Mode.c */
extern _X_EXPORT const char *
xf86ModeStatusToString(ModeStatus status);
extern _X_EXPORT ModeStatus
xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor);
extern _X_EXPORT ModeStatus
xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int flags);
extern _X_EXPORT int
xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
const char **modeNames, ClockRangePtr clockRanges,
int *linePitches, int minPitch, int maxPitch,
int minHeight, int maxHeight, int pitchInc,
int virtualX, int virtualY, int apertureSize,
LookupModeFlags strategy);
extern _X_EXPORT void
xf86DeleteMode(DisplayModePtr * modeList, DisplayModePtr mode);
extern _X_EXPORT void
xf86PruneDriverModes(ScrnInfoPtr scrp);
extern _X_EXPORT void
xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags);
extern _X_EXPORT void
xf86PrintModes(ScrnInfoPtr scrp);
extern _X_EXPORT void
xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges);
/* xf86Option.c */
extern _X_EXPORT void
xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts);
/* xf86RandR.c */
#ifdef RANDR
extern _X_EXPORT Bool
xf86RandRInit(ScreenPtr pScreen);
extern _X_EXPORT Rotation
xf86GetRotation(ScreenPtr pScreen);
extern _X_EXPORT Bool
xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
int newvirtX, int newvirtY,
int newmmWidth, int newmmHeight,
Bool resetMode);
#endif
/* xf86Extensions.c */
extern void xf86ExtensionInit(void);
/* convert ScreenPtr to ScrnInfoPtr */
extern _X_EXPORT ScrnInfoPtr xf86ScreenToScrn(ScreenPtr pScreen);
/* convert ScrnInfoPtr to ScreenPtr */
extern _X_EXPORT ScreenPtr xf86ScrnToScreen(ScrnInfoPtr pScrn);
#endif /* _NO_XF86_PROTOTYPES */
#define XF86_HAS_SCRN_CONV 1 /* define for drivers to use in api compat */
#define XF86_SCRN_INTERFACE 1 /* define for drivers to use in api compat */
/* flags passed to xf86 allocate screen */
#define XF86_ALLOCATE_GPU_SCREEN 1
/* Update the internal total dimensions of all ScreenRecs together */
extern _X_EXPORT void
xf86UpdateDesktopDimensions(void);
#endif /* _XF86_H */

View file

@ -1,443 +0,0 @@
/*
* Copyright 2003 by David H. Dawes.
* Copyright 2003 by X-Oz Technologies.
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*
* Author: David Dawes <dawes@XFree86.Org>.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf86.h"
#include "xf86Parser.h"
#include "xf86tokens.h"
#include "xf86Config.h"
#include "xf86MatchDrivers.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "xf86platformBus.h"
#include "xf86pciBus.h"
#ifdef __sparc__
#include "xf86sbusBus.h"
#endif
#ifdef __sun
#include <sys/visual_io.h>
#include <ctype.h>
#endif
/* Sections for the default built-in configuration. */
#define BUILTIN_DEVICE_NAME \
"\"Builtin Default %s Device %d\""
#define BUILTIN_DEVICE_SECTION_PRE \
"Section \"Device\"\n" \
"\tIdentifier\t" BUILTIN_DEVICE_NAME "\n" \
"\tDriver\t\"%s\"\n"
#define BUILTIN_DEVICE_SECTION_POST \
"EndSection\n\n"
#define BUILTIN_DEVICE_SECTION \
BUILTIN_DEVICE_SECTION_PRE \
BUILTIN_DEVICE_SECTION_POST
#define BUILTIN_SCREEN_NAME \
"\"Builtin Default %s Screen %d\""
#define BUILTIN_SCREEN_SECTION \
"Section \"Screen\"\n" \
"\tIdentifier\t" BUILTIN_SCREEN_NAME "\n" \
"\tDevice\t" BUILTIN_DEVICE_NAME "\n" \
"EndSection\n\n"
#define BUILTIN_LAYOUT_SECTION_PRE \
"Section \"ServerLayout\"\n" \
"\tIdentifier\t\"Builtin Default Layout\"\n"
#define BUILTIN_LAYOUT_SCREEN_LINE \
"\tScreen\t" BUILTIN_SCREEN_NAME "\n"
#define BUILTIN_LAYOUT_SECTION_POST \
"EndSection\n\n"
static const char **builtinConfig = NULL;
static int builtinLines = 0;
static void listPossibleVideoDrivers(XF86MatchedDrivers *md);
/*
* A built-in config file is stored as an array of strings, with each string
* representing a single line. AppendToConfig() breaks up the string "s"
* into lines, and appends those lines it to builtinConfig.
*/
static void
AppendToList(const char *s, const char ***list, int *lines)
{
char *str, *newstr, *p;
str = xnfstrdup(s);
for (p = strtok(str, "\n"); p; p = strtok(NULL, "\n")) {
(*lines)++;
*list = xnfreallocarray(*list, *lines + 1, sizeof(**list));
newstr = xnfalloc(strlen(p) + 2);
strcpy(newstr, p);
strcat(newstr, "\n");
(*list)[*lines - 1] = newstr;
(*list)[*lines] = NULL;
}
free(str);
}
static void
FreeList(const char ***list, int *lines)
{
int i;
for (i = 0; i < *lines; i++) {
free((char *) ((*list)[i]));
}
free(*list);
*list = NULL;
*lines = 0;
}
static void
FreeConfig(void)
{
FreeList(&builtinConfig, &builtinLines);
}
static void
AppendToConfig(const char *s)
{
AppendToList(s, &builtinConfig, &builtinLines);
}
void
xf86AddMatchedDriver(XF86MatchedDrivers *md, const char *driver)
{
int j;
int nmatches = md->nmatches;
for (j = 0; j < nmatches; ++j) {
if (xf86NameCmp(md->matches[j], driver) == 0) {
// Driver already in matched drivers
return;
}
}
if (nmatches < MATCH_DRIVERS_LIMIT) {
md->matches[nmatches] = xnfstrdup(driver);
md->nmatches++;
}
else {
xf86Msg(X_WARNING, "Too many drivers registered, can't add %s\n", driver);
}
}
Bool
xf86AutoConfig(void)
{
XF86MatchedDrivers md;
int i;
const char **cp;
char buf[1024];
ConfigStatus ret;
/* Make sure config rec is there */
if (xf86allocateConfig() != NULL) {
ret = CONFIG_OK; /* OK so far */
}
else {
xf86Msg(X_ERROR, "Couldn't allocate Config record.\n");
return FALSE;
}
listPossibleVideoDrivers(&md);
for (i = 0; i < md.nmatches; i++) {
snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION,
md.matches[i], 0, md.matches[i]);
AppendToConfig(buf);
snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION,
md.matches[i], 0, md.matches[i], 0);
AppendToConfig(buf);
}
AppendToConfig(BUILTIN_LAYOUT_SECTION_PRE);
for (i = 0; i < md.nmatches; i++) {
snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE,
md.matches[i], 0);
AppendToConfig(buf);
}
AppendToConfig(BUILTIN_LAYOUT_SECTION_POST);
for (i = 0; i < md.nmatches; i++) {
free(md.matches[i]);
}
xf86MsgVerb(X_DEFAULT, 0,
"Using default built-in configuration (%d lines)\n",
builtinLines);
xf86MsgVerb(X_DEFAULT, 3, "--- Start of built-in configuration ---\n");
for (cp = builtinConfig; *cp; cp++)
xf86ErrorFVerb(3, "\t%s", *cp);
xf86MsgVerb(X_DEFAULT, 3, "--- End of built-in configuration ---\n");
xf86initConfigFiles();
xf86setBuiltinConfig(builtinConfig);
ret = xf86HandleConfigFile(TRUE);
FreeConfig();
if (ret != CONFIG_OK)
xf86Msg(X_ERROR, "Error parsing the built-in default configuration.\n");
return ret == CONFIG_OK;
}
static void
listPossibleVideoDrivers(XF86MatchedDrivers *md)
{
md->nmatches = 0;
#ifdef XSERVER_PLATFORM_BUS
xf86PlatformMatchDriver(md);
#endif
#ifdef __sun
/* Check for driver type based on /dev/fb type and if valid, use
it instead of PCI bus probe results */
if (xf86Info.consoleFd >= 0) {
struct vis_identifier visid;
const char *cp;
int iret;
SYSCALL(iret = ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid));
if (iret < 0) {
int fbfd;
fbfd = open(xf86SolarisFbDev, O_RDONLY);
if (fbfd >= 0) {
SYSCALL(iret = ioctl(fbfd, VIS_GETIDENTIFIER, &visid));
close(fbfd);
}
}
if (iret < 0) {
xf86Msg(X_WARNING,
"could not get frame buffer identifier from %s\n",
xf86SolarisFbDev);
}
else {
xf86Msg(X_PROBED, "console driver: %s\n", visid.name);
/* Special case from before the general case was set */
if (strcmp(visid.name, "NVDAnvda") == 0) {
xf86AddMatchedDriver(md, "nvidia");
}
/* General case - split into vendor name (initial all-caps
prefix) & driver name (rest of the string). */
if (strcmp(visid.name, "SUNWtext") != 0) {
for (cp = visid.name; (*cp != '\0') && isupper(*cp); cp++) {
/* find end of all uppercase vendor section */
}
if ((cp != visid.name) && (*cp != '\0')) {
char *vendorName = xnfstrdup(visid.name);
vendorName[cp - visid.name] = '\0';
xf86AddMatchedDriver(md, vendorName);
xf86AddMatchedDriver(md, cp);
free(vendorName);
}
}
}
}
#endif
#ifdef __sparc__
char *sbusDriver = sparcDriverName();
if (sbusDriver)
xf86AddMatchedDriver(md, sbusDriver);
#endif
#ifdef XSERVER_LIBPCIACCESS
xf86PciMatchDriver(md);
#endif
#if defined(__linux__)
xf86AddMatchedDriver(md, "modesetting");
#endif
#if !defined(__sun)
/* Fallback to platform default frame buffer driver */
#if !defined(__linux__) && defined(__sparc__)
xf86AddMatchedDriver(md, "wsfb");
#else
xf86AddMatchedDriver(md, "fbdev");
#endif
#endif /* !__sun */
/* Fallback to platform default hardware */
#if defined(__i386__) || defined(__amd64__) || defined(__hurd__)
xf86AddMatchedDriver(md, "vesa");
#elif defined(__sparc__) && !defined(__sun)
xf86AddMatchedDriver(md, "sunffb");
#endif
}
/* copy a screen section and enter the desired driver
* and insert it at i in the list of screens */
static Bool
copyScreen(confScreenPtr oscreen, GDevPtr odev, int i, char *driver)
{
confScreenPtr nscreen;
GDevPtr cptr = NULL;
char *identifier;
nscreen = malloc(sizeof(confScreenRec));
if (!nscreen)
return FALSE;
memcpy(nscreen, oscreen, sizeof(confScreenRec));
cptr = malloc(sizeof(GDevRec));
if (!cptr) {
free(nscreen);
return FALSE;
}
memcpy(cptr, odev, sizeof(GDevRec));
if (asprintf(&identifier, "Autoconfigured Video Device %s", driver)
== -1) {
free(cptr);
free(nscreen);
return FALSE;
}
cptr->driver = driver;
cptr->identifier = identifier;
xf86ConfigLayout.screens[i].screen = nscreen;
/* now associate the new driver entry with the new screen entry */
xf86ConfigLayout.screens[i].screen->device = cptr;
cptr->myScreenSection = xf86ConfigLayout.screens[i].screen;
return TRUE;
}
GDevPtr
autoConfigDevice(GDevPtr preconf_device)
{
GDevPtr ptr = NULL;
XF86MatchedDrivers md;
int num_screens = 0, i;
screenLayoutPtr slp;
if (!xf86configptr) {
return NULL;
}
/* If there's a configured section with no driver chosen, use it */
if (preconf_device) {
ptr = preconf_device;
}
else {
ptr = calloc(1, sizeof(GDevRec));
if (!ptr) {
return NULL;
}
ptr->chipID = -1;
ptr->chipRev = -1;
ptr->irq = -1;
ptr->active = TRUE;
ptr->claimed = FALSE;
ptr->identifier = "Autoconfigured Video Device";
ptr->driver = NULL;
}
if (!ptr->driver) {
/* get all possible video drivers and count them */
listPossibleVideoDrivers(&md);
for (i = 0; i < md.nmatches; i++) {
xf86Msg(X_DEFAULT, "Matched %s as autoconfigured driver %d\n",
md.matches[i], i);
}
slp = xf86ConfigLayout.screens;
if (slp) {
/* count the number of screens and make space for
* a new screen for each additional possible driver
* minus one for the already existing first one
* plus one for the terminating NULL */
for (; slp[num_screens].screen; num_screens++);
xf86ConfigLayout.screens = xnfcalloc(num_screens + md.nmatches,
sizeof(screenLayoutRec));
xf86ConfigLayout.screens[0] = slp[0];
/* do the first match and set that for the original first screen */
ptr->driver = md.matches[0];
if (!xf86ConfigLayout.screens[0].screen->device) {
xf86ConfigLayout.screens[0].screen->device = ptr;
ptr->myScreenSection = xf86ConfigLayout.screens[0].screen;
}
/* for each other driver found, copy the first screen, insert it
* into the list of screens and set the driver */
for (i = 1; i < md.nmatches; i++) {
if (!copyScreen(slp[0].screen, ptr, i, md.matches[i]))
return NULL;
}
/* shift the rest of the original screen list
* to the end of the current screen list
*
* TODO Handle rest of multiple screen sections */
for (i = 1; i < num_screens; i++) {
xf86ConfigLayout.screens[i + md.nmatches] = slp[i];
}
xf86ConfigLayout.screens[num_screens + md.nmatches - 1].screen =
NULL;
free(slp);
}
else {
/* layout does not have any screens, not much to do */
ptr->driver = md.matches[0];
for (i = 1; i < md.nmatches; i++) {
free(md.matches[i]);
}
}
}
xf86Msg(X_DEFAULT, "Assigned the driver to the xf86ConfigLayout\n");
return ptr;
}

View file

@ -1,671 +0,0 @@
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains the interfaces to the bus-specific code
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <X11/X.h>
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"
/* Bus-specific headers */
#include "xf86Bus.h"
#define XF86_OS_PRIVS
#include "xf86_OSproc.h"
#ifdef XSERVER_LIBPCIACCESS
#include "xf86VGAarbiter.h"
#endif
/* Entity data */
EntityPtr *xf86Entities = NULL; /* Bus slots claimed by drivers */
int xf86NumEntities = 0;
static int xf86EntityPrivateCount = 0;
BusRec primaryBus = { BUS_NONE, {0} };
/**
* Call the driver's correct probe function.
*
* If the driver implements the \c DriverRec::PciProbe entry-point and an
* appropriate PCI device (with matching Device section in the xorg.conf file)
* is found, it is called. If \c DriverRec::PciProbe or no devices can be
* successfully probed with it (e.g., only non-PCI devices are available),
* the driver's \c DriverRec::Probe function is called.
*
* \param drv Driver to probe
*
* \return
* If a device can be successfully probed by the driver, \c TRUE is
* returned. Otherwise, \c FALSE is returned.
*/
Bool
xf86CallDriverProbe(DriverPtr drv, Bool detect_only)
{
Bool foundScreen = FALSE;
#ifdef XSERVER_PLATFORM_BUS
/* xf86platformBus.c does not support Xorg -configure */
if (!xf86DoConfigure && drv->platformProbe != NULL) {
foundScreen = xf86platformProbeDev(drv);
}
#endif
#ifdef XSERVER_LIBPCIACCESS
if (!foundScreen && (drv->PciProbe != NULL)) {
if (xf86DoConfigure && xf86DoConfigurePass1) {
assert(detect_only);
foundScreen = xf86PciAddMatchingDev(drv);
}
else {
assert(!detect_only);
foundScreen = xf86PciProbeDev(drv);
}
}
#endif
if (!foundScreen && (drv->Probe != NULL)) {
xf86Msg(X_WARNING, "Falling back to old probe method for %s\n",
drv->driverName);
foundScreen = (*drv->Probe) (drv, (detect_only) ? PROBE_DETECT
: PROBE_DEFAULT);
}
return foundScreen;
}
static screenLayoutPtr
xf86BusConfigMatch(ScrnInfoPtr scrnInfo, Bool is_gpu) {
screenLayoutPtr layout;
int i, j;
for (layout = xf86ConfigLayout.screens; layout->screen != NULL;
layout++) {
for (i = 0; i < scrnInfo->numEntities; i++) {
GDevPtr dev =
xf86GetDevFromEntity(scrnInfo->entityList[i],
scrnInfo->entityInstanceList[i]);
if (is_gpu) {
for (j = 0; j < layout->screen->num_gpu_devices; j++) {
if (dev == layout->screen->gpu_devices[j]) {
/* A match has been found */
return layout;
}
}
} else {
if (dev == layout->screen->device) {
/* A match has been found */
return layout;
}
}
}
}
return NULL;
}
/**
* @return TRUE if all buses are configured and set up correctly and FALSE
* otherwise.
*/
Bool
xf86BusConfig(void)
{
screenLayoutPtr layout;
int i;
/*
* 3 step probe to (hopefully) ensure that we always find at least 1
* (non GPU) screen:
*
* 1. Call each drivers probe function normally,
* Each successful probe will result in an extra entry added to the
* xf86Screens[] list for each instance of the hardware found.
*/
for (i = 0; i < xf86NumDrivers; i++) {
xf86CallDriverProbe(xf86DriverList[i], FALSE);
}
/*
* 2. If no Screens were found, call each drivers probe function with
* ignorePrimary = TRUE, to ensure that we do actually get a
* Screen if there is at least one supported video card.
*/
if (xf86NumScreens == 0) {
xf86ProbeIgnorePrimary = TRUE;
for (i = 0; i < xf86NumDrivers && xf86NumScreens == 0; i++) {
xf86CallDriverProbe(xf86DriverList[i], FALSE);
}
xf86ProbeIgnorePrimary = FALSE;
}
/*
* 3. Call xf86platformAddGPUDevices() to add any additional video cards as
* GPUScreens (GPUScreens are only supported by platformBus drivers).
*/
for (i = 0; i < xf86NumDrivers; i++) {
xf86platformAddGPUDevices(xf86DriverList[i]);
}
/* If nothing was detected, return now */
if (xf86NumScreens == 0) {
xf86Msg(X_ERROR, "No devices detected.\n");
return FALSE;
}
xf86VGAarbiterInit();
/*
* Match up the screens found by the probes against those specified
* in the config file. Remove the ones that won't be used. Sort
* them in the order specified.
*
* What is the best way to do this?
*
* For now, go through the screens allocated by the probes, and
* look for screen config entry which refers to the same device
* section as picked out by the probe.
*
*/
for (i = 0; i < xf86NumScreens; i++) {
layout = xf86BusConfigMatch(xf86Screens[i], FALSE);
if (layout && layout->screen)
xf86Screens[i]->confScreen = layout->screen;
else {
/* No match found */
xf86Msg(X_ERROR,
"Screen %d deleted because of no matching config section.\n",
i);
xf86DeleteScreen(xf86Screens[i--]);
}
}
/* bind GPU conf screen to the configured protocol screen, or 0 if not configured */
for (i = 0; i < xf86NumGPUScreens; i++) {
layout = xf86BusConfigMatch(xf86GPUScreens[i], TRUE);
int scrnum = (layout && layout->screen) ? layout->screen->screennum : 0;
xf86GPUScreens[i]->confScreen = xf86Screens[scrnum]->confScreen;
}
/* If no screens left, return now. */
if (xf86NumScreens == 0) {
xf86Msg(X_ERROR,
"Device(s) detected, but none match those in the config file.\n");
return FALSE;
}
return TRUE;
}
/*
* Call the bus probes relevant to the architecture.
*
* The only one available so far is for PCI and SBUS.
*/
void
xf86BusProbe(void)
{
#ifdef XSERVER_PLATFORM_BUS
xf86platformProbe();
if (ServerIsNotSeat0() && xf86_num_platform_devices > 0)
return;
#endif
#ifdef XSERVER_LIBPCIACCESS
xf86PciProbe();
#endif
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
xf86SbusProbe();
#endif
#ifdef XSERVER_PLATFORM_BUS
xf86platformPrimary();
#endif
}
/*
* Determine what bus type the busID string represents. The start of the
* bus-dependent part of the string is returned as retID.
*/
BusType
StringToBusType(const char *busID, const char **retID)
{
char *p, *s;
BusType ret = BUS_NONE;
/* If no type field, Default to PCI */
if (isdigit(busID[0])) {
if (retID)
*retID = busID;
return BUS_PCI;
}
s = xstrdup(busID);
p = strtok(s, ":");
if (p == NULL || *p == 0) {
free(s);
return BUS_NONE;
}
if (!xf86NameCmp(p, "pci") || !xf86NameCmp(p, "agp"))
ret = BUS_PCI;
if (!xf86NameCmp(p, "sbus"))
ret = BUS_SBUS;
if (!xf86NameCmp(p, "platform"))
ret = BUS_PLATFORM;
if (!xf86NameCmp(p, "usb"))
ret = BUS_USB;
if (ret != BUS_NONE)
if (retID)
*retID = busID + strlen(p) + 1;
free(s);
return ret;
}
int
xf86AllocateEntity(void)
{
xf86NumEntities++;
xf86Entities = xnfreallocarray(xf86Entities,
xf86NumEntities, sizeof(EntityPtr));
xf86Entities[xf86NumEntities - 1] = xnfcalloc(1, sizeof(EntityRec));
xf86Entities[xf86NumEntities - 1]->entityPrivates =
xnfcalloc(xf86EntityPrivateCount, sizeof(DevUnion));
return xf86NumEntities - 1;
}
Bool
xf86IsEntityPrimary(int entityIndex)
{
EntityPtr pEnt = xf86Entities[entityIndex];
#ifdef XSERVER_LIBPCIACCESS
if (primaryBus.type == BUS_PLATFORM && pEnt->bus.type == BUS_PCI)
if (primaryBus.id.plat->pdev)
return MATCH_PCI_DEVICES(pEnt->bus.id.pci, primaryBus.id.plat->pdev);
#endif
if (primaryBus.type != pEnt->bus.type)
return FALSE;
switch (pEnt->bus.type) {
case BUS_PCI:
return pEnt->bus.id.pci == primaryBus.id.pci;
case BUS_SBUS:
return pEnt->bus.id.sbus.fbNum == primaryBus.id.sbus.fbNum;
case BUS_PLATFORM:
return pEnt->bus.id.plat == primaryBus.id.plat;
default:
return FALSE;
}
}
Bool
xf86DriverHasEntities(DriverPtr drvp)
{
int i;
for (i = 0; i < xf86NumEntities; i++) {
if (xf86Entities[i]->driver == drvp)
return TRUE;
}
return FALSE;
}
void
xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex)
{
if (entityIndex == -1)
return;
if (xf86Entities[entityIndex]->inUse &&
!(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL)) {
ErrorF("Requested Entity already in use!\n");
return;
}
pScrn->numEntities++;
pScrn->entityList = xnfreallocarray(pScrn->entityList,
pScrn->numEntities, sizeof(int));
pScrn->entityList[pScrn->numEntities - 1] = entityIndex;
xf86Entities[entityIndex]->inUse = TRUE;
pScrn->entityInstanceList = xnfreallocarray(pScrn->entityInstanceList,
pScrn->numEntities,
sizeof(int));
pScrn->entityInstanceList[pScrn->numEntities - 1] = 0;
}
void
xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex, int instance)
{
int i;
if (entityIndex == -1 || entityIndex >= xf86NumEntities)
return;
for (i = 0; i < pScrn->numEntities; i++) {
if (pScrn->entityList[i] == entityIndex) {
pScrn->entityInstanceList[i] = instance;
break;
}
}
}
/*
* XXX This needs to be updated for the case where a single entity may have
* instances associated with more than one screen.
*/
ScrnInfoPtr
xf86FindScreenForEntity(int entityIndex)
{
int i, j;
if (entityIndex == -1)
return NULL;
if (xf86Screens) {
for (i = 0; i < xf86NumScreens; i++) {
for (j = 0; j < xf86Screens[i]->numEntities; j++) {
if (xf86Screens[i]->entityList[j] == entityIndex)
return xf86Screens[i];
}
}
}
return NULL;
}
void
xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex)
{
int i;
for (i = 0; i < pScrn->numEntities; i++) {
if (pScrn->entityList[i] == entityIndex) {
for (i++; i < pScrn->numEntities; i++)
pScrn->entityList[i - 1] = pScrn->entityList[i];
pScrn->numEntities--;
xf86Entities[entityIndex]->inUse = FALSE;
break;
}
}
}
/*
* xf86ClearEntityListForScreen() - called when a screen is deleted
* to mark its entities unused. Called by xf86DeleteScreen().
*/
void
xf86ClearEntityListForScreen(ScrnInfoPtr pScrn)
{
int i, entityIndex;
if (pScrn->entityList == NULL || pScrn->numEntities == 0)
return;
for (i = 0; i < pScrn->numEntities; i++) {
entityIndex = pScrn->entityList[i];
xf86Entities[entityIndex]->inUse = FALSE;
/* disable resource: call the disable function */
}
free(pScrn->entityList);
free(pScrn->entityInstanceList);
pScrn->entityList = NULL;
pScrn->entityInstanceList = NULL;
}
/*
* Add an extra device section (GDevPtr) to an entity.
*/
void
xf86AddDevToEntity(int entityIndex, GDevPtr dev)
{
EntityPtr pEnt;
if (entityIndex >= xf86NumEntities)
return;
pEnt = xf86Entities[entityIndex];
pEnt->numInstances++;
pEnt->devices = xnfreallocarray(pEnt->devices,
pEnt->numInstances, sizeof(GDevPtr));
pEnt->devices[pEnt->numInstances - 1] = dev;
dev->claimed = TRUE;
}
void
xf86RemoveDevFromEntity(int entityIndex, GDevPtr dev)
{
EntityPtr pEnt;
int i, j;
if (entityIndex >= xf86NumEntities)
return;
pEnt = xf86Entities[entityIndex];
for (i = 0; i < pEnt->numInstances; i++) {
if (pEnt->devices[i] == dev) {
for (j = i; j < pEnt->numInstances - 1; j++)
pEnt->devices[j] = pEnt->devices[j + 1];
break;
}
}
pEnt->numInstances--;
dev->claimed = FALSE;
}
/*
* xf86GetEntityInfo() -- This function hands information from the
* EntityRec struct to the drivers. The EntityRec structure itself
* remains invisible to the driver.
*/
EntityInfoPtr
xf86GetEntityInfo(int entityIndex)
{
EntityInfoPtr pEnt;
int i;
if (entityIndex == -1)
return NULL;
if (entityIndex >= xf86NumEntities)
return NULL;
pEnt = xnfcalloc(1, sizeof(EntityInfoRec));
pEnt->index = entityIndex;
pEnt->location = xf86Entities[entityIndex]->bus;
pEnt->active = xf86Entities[entityIndex]->active;
pEnt->chipset = xf86Entities[entityIndex]->chipset;
pEnt->driver = xf86Entities[entityIndex]->driver;
if ((xf86Entities[entityIndex]->devices) &&
(xf86Entities[entityIndex]->devices[0])) {
for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++)
if (xf86Entities[entityIndex]->devices[i]->screen == 0)
break;
pEnt->device = xf86Entities[entityIndex]->devices[i];
}
else
pEnt->device = NULL;
return pEnt;
}
int
xf86GetNumEntityInstances(int entityIndex)
{
if (entityIndex >= xf86NumEntities)
return -1;
return xf86Entities[entityIndex]->numInstances;
}
GDevPtr
xf86GetDevFromEntity(int entityIndex, int instance)
{
int i;
/* We might not use AddDevtoEntity */
if ((!xf86Entities[entityIndex]->devices) ||
(!xf86Entities[entityIndex]->devices[0]))
return NULL;
if (entityIndex >= xf86NumEntities ||
instance >= xf86Entities[entityIndex]->numInstances)
return NULL;
for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++)
if (xf86Entities[entityIndex]->devices[i]->screen == instance)
return xf86Entities[entityIndex]->devices[i];
return NULL;
}
/*
* xf86PostProbe() -- Allocate all non conflicting resources
* This function gets called by xf86Init().
*/
void
xf86PostProbe(void)
{
if (fbSlotClaimed && (
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
sbusSlotClaimed ||
#endif
#ifdef XSERVER_PLATFORM_BUS
platformSlotClaimed ||
#endif
#ifdef XSERVER_LIBPCIACCESS
pciSlotClaimed
#else
TRUE
#endif
))
FatalError("Cannot run in framebuffer mode. Please specify busIDs "
" for all framebuffer devices\n");
}
Bool
xf86IsEntityShared(int entityIndex)
{
if (entityIndex < xf86NumEntities) {
if (xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL) {
return TRUE;
}
}
return FALSE;
}
void
xf86SetEntityShared(int entityIndex)
{
if (entityIndex < xf86NumEntities) {
xf86Entities[entityIndex]->entityProp |= IS_SHARED_ACCEL;
}
}
Bool
xf86IsEntitySharable(int entityIndex)
{
if (entityIndex < xf86NumEntities) {
if (xf86Entities[entityIndex]->entityProp & ACCEL_IS_SHARABLE) {
return TRUE;
}
}
return FALSE;
}
void
xf86SetEntitySharable(int entityIndex)
{
if (entityIndex < xf86NumEntities) {
xf86Entities[entityIndex]->entityProp |= ACCEL_IS_SHARABLE;
}
}
Bool
xf86IsPrimInitDone(int entityIndex)
{
if (entityIndex < xf86NumEntities) {
if (xf86Entities[entityIndex]->entityProp & SA_PRIM_INIT_DONE) {
return TRUE;
}
}
return FALSE;
}
void
xf86SetPrimInitDone(int entityIndex)
{
if (entityIndex < xf86NumEntities) {
xf86Entities[entityIndex]->entityProp |= SA_PRIM_INIT_DONE;
}
}
void
xf86ClearPrimInitDone(int entityIndex)
{
if (entityIndex < xf86NumEntities) {
xf86Entities[entityIndex]->entityProp &= ~SA_PRIM_INIT_DONE;
}
}
/*
* Allocate a private in the entities.
*/
int
xf86AllocateEntityPrivateIndex(void)
{
int idx, i;
EntityPtr pEnt;
DevUnion *nprivs;
idx = xf86EntityPrivateCount++;
for (i = 0; i < xf86NumEntities; i++) {
pEnt = xf86Entities[i];
nprivs = xnfreallocarray(pEnt->entityPrivates,
xf86EntityPrivateCount, sizeof(DevUnion));
/* Zero the new private */
memset(&nprivs[idx], 0, sizeof(DevUnion));
pEnt->entityPrivates = nprivs;
}
return idx;
}
DevUnion *
xf86GetEntityPrivate(int entityIndex, int privIndex)
{
if (entityIndex >= xf86NumEntities || privIndex >= xf86EntityPrivateCount)
return NULL;
return &(xf86Entities[entityIndex]->entityPrivates[privIndex]);
}

View file

@ -1,70 +0,0 @@
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains definitions of the bus-related data structures/types.
* Everything contained here is private to xf86Bus.c. In particular the
* video drivers must not include this file.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#ifndef _XF86_BUS_H
#define _XF86_BUS_H
#include "xf86pciBus.h"
#if defined(__sparc__) || defined(__sparc)
#include "xf86sbusBus.h"
#endif
#include "xf86platformBus.h"
typedef struct {
DriverPtr driver;
int chipset;
int entityProp;
Bool active;
Bool inUse;
BusRec bus;
DevUnion *entityPrivates;
int numInstances;
GDevPtr *devices;
} EntityRec, *EntityPtr;
#define ACCEL_IS_SHARABLE 0x100
#define IS_SHARED_ACCEL 0x200
#define SA_PRIM_INIT_DONE 0x400
extern EntityPtr *xf86Entities;
extern int xf86NumEntities;
extern BusRec primaryBus;
int xf86AllocateEntity(void);
BusType StringToBusType(const char *busID, const char **retID);
#endif /* _XF86_BUS_H */

File diff suppressed because it is too large Load diff

View file

@ -1,71 +0,0 @@
/*
* Copyright (c) 1997-2000 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#ifndef _xf86_config_h
#define _xf86_config_h
#include "xf86Optrec.h"
#include "xf86Parser.h"
#include "xf86str.h"
#ifdef HAVE_PARSER_DECLS
/*
* global structure that holds the result of parsing the config file
*/
extern _X_EXPORT XF86ConfigPtr xf86configptr;
#endif
typedef enum _ConfigStatus {
CONFIG_OK = 0,
CONFIG_PARSE_ERROR,
CONFIG_NOFILE
} ConfigStatus;
typedef struct _ModuleDefault {
const char *name;
Bool toLoad;
XF86OptionPtr load_opt;
} ModuleDefault;
/*
* prototypes
*/
const char **xf86ModulelistFromConfig(void ***);
const char **xf86DriverlistFromConfig(void);
const char **xf86InputDriverlistFromConfig(void);
Bool xf86BuiltinInputDriver(const char *);
ConfigStatus xf86HandleConfigFile(Bool);
Bool xf86AutoConfig(void);
GDevPtr autoConfigDevice(GDevPtr preconf_device);
#endif /* _xf86_config_h */

View file

@ -1,881 +0,0 @@
/*
* Copyright 2000-2002 by Alan Hourihane, Flint Mountain, North Wales.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Alan Hourihane not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Alan Hourihane makes no representations
* about the suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
* ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* Author: Alan Hourihane, alanh@fairlite.demon.co.uk
*
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf86.h"
#include "xf86Config.h"
#include "xf86_OSlib.h"
#include "xf86Priv.h"
#define IN_XSERVER
#include "Configint.h"
#include "xf86DDC.h"
#include "xf86pciBus.h"
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
#include "xf86Bus.h"
#include "xf86Sbus.h"
#endif
#include "misc.h"
#include "loaderProcs.h"
typedef struct _DevToConfig {
GDevRec GDev;
struct pci_device *pVideo;
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
sbusDevicePtr sVideo;
#endif
int iDriver;
} DevToConfigRec, *DevToConfigPtr;
static DevToConfigPtr DevToConfig = NULL;
static int nDevToConfig = 0, CurrentDriver;
xf86MonPtr ConfiguredMonitor;
Bool xf86DoConfigurePass1 = TRUE;
static Bool foundMouse = FALSE;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
static const char *DFLT_MOUSE_DEV = "/dev/sysmouse";
static const char *DFLT_MOUSE_PROTO = "auto";
#elif defined(__linux__)
static const char *DFLT_MOUSE_DEV = "/dev/input/mice";
static const char *DFLT_MOUSE_PROTO = "auto";
#elif defined(WSCONS_SUPPORT)
static const char *DFLT_MOUSE_DEV = "/dev/wsmouse";
static const char *DFLT_MOUSE_PROTO = "wsmouse";
#else
static const char *DFLT_MOUSE_DEV = "/dev/mouse";
static const char *DFLT_MOUSE_PROTO = "auto";
#endif
/*
* This is called by the driver, either through xf86Match???Instances() or
* directly. We allocate a GDevRec and fill it in as much as we can, letting
* the caller fill in the rest and/or change it as it sees fit.
*/
GDevPtr
xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData,
int chipset)
{
int ret, i, j;
char *lower_driver;
if (!xf86DoConfigure || !xf86DoConfigurePass1)
return NULL;
/* Check for duplicates */
for (i = 0; i < nDevToConfig; i++) {
switch (bus) {
#ifdef XSERVER_LIBPCIACCESS
case BUS_PCI:
ret = xf86PciConfigure(busData, DevToConfig[i].pVideo);
break;
#endif
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
case BUS_SBUS:
ret = xf86SbusConfigure(busData, DevToConfig[i].sVideo);
break;
#endif
default:
return NULL;
}
if (ret == 0)
goto out;
}
/* Allocate new structure occurrence */
i = nDevToConfig++;
DevToConfig =
xnfreallocarray(DevToConfig, nDevToConfig, sizeof(DevToConfigRec));
memset(DevToConfig + i, 0, sizeof(DevToConfigRec));
DevToConfig[i].GDev.chipID =
DevToConfig[i].GDev.chipRev = DevToConfig[i].GDev.irq = -1;
DevToConfig[i].iDriver = CurrentDriver;
/* Fill in what we know, converting the driver name to lower case */
lower_driver = xnfalloc(strlen(driver) + 1);
for (j = 0; (lower_driver[j] = tolower(driver[j])); j++);
DevToConfig[i].GDev.driver = lower_driver;
switch (bus) {
#ifdef XSERVER_LIBPCIACCESS
case BUS_PCI:
DevToConfig[i].pVideo = busData;
xf86PciConfigureNewDev(busData, DevToConfig[i].pVideo,
&DevToConfig[i].GDev, &chipset);
break;
#endif
#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
case BUS_SBUS:
DevToConfig[i].sVideo = busData;
xf86SbusConfigureNewDev(busData, DevToConfig[i].sVideo,
&DevToConfig[i].GDev);
break;
#endif
default:
break;
}
/* Get driver's available options */
if (xf86DriverList[CurrentDriver]->AvailableOptions)
DevToConfig[i].GDev.options = (OptionInfoPtr)
(*xf86DriverList[CurrentDriver]->AvailableOptions) (chipset, bus);
return &DevToConfig[i].GDev;
out:
return NULL;
}
static XF86ConfInputPtr
configureInputSection(void)
{
XF86ConfInputPtr mouse = NULL;
parsePrologue(XF86ConfInputPtr, XF86ConfInputRec);
ptr->inp_identifier = xnfstrdup("Keyboard0");
ptr->inp_driver = xnfstrdup("kbd");
ptr->list.next = NULL;
/* Crude mechanism to auto-detect mouse (os dependent) */
{
int fd;
fd = open(DFLT_MOUSE_DEV, 0);
if (fd != -1) {
foundMouse = TRUE;
close(fd);
}
}
mouse = calloc(1, sizeof(XF86ConfInputRec));
mouse->inp_identifier = xnfstrdup("Mouse0");
mouse->inp_driver = xnfstrdup("mouse");
mouse->inp_option_lst =
xf86addNewOption(mouse->inp_option_lst, xnfstrdup("Protocol"),
xnfstrdup(DFLT_MOUSE_PROTO));
mouse->inp_option_lst =
xf86addNewOption(mouse->inp_option_lst, xnfstrdup("Device"),
xnfstrdup(DFLT_MOUSE_DEV));
mouse->inp_option_lst =
xf86addNewOption(mouse->inp_option_lst, xnfstrdup("ZAxisMapping"),
xnfstrdup("4 5 6 7"));
ptr = (XF86ConfInputPtr) xf86addListItem((glp) ptr, (glp) mouse);
return ptr;
}
static XF86ConfScreenPtr
configureScreenSection(int screennum)
{
int i;
int depths[] = { 1, 4, 8, 15, 16, 24 /*, 32 */ };
char *tmp;
parsePrologue(XF86ConfScreenPtr, XF86ConfScreenRec);
XNFasprintf(&tmp, "Screen%d", screennum);
ptr->scrn_identifier = tmp;
XNFasprintf(&tmp, "Monitor%d", screennum);
ptr->scrn_monitor_str = tmp;
XNFasprintf(&tmp, "Card%d", screennum);
ptr->scrn_device_str = tmp;
for (i = 0; i < ARRAY_SIZE(depths); i++) {
XF86ConfDisplayPtr conf_display;
conf_display = calloc(1, sizeof(XF86ConfDisplayRec));
conf_display->disp_depth = depths[i];
conf_display->disp_black.red = conf_display->disp_white.red = -1;
conf_display->disp_black.green = conf_display->disp_white.green = -1;
conf_display->disp_black.blue = conf_display->disp_white.blue = -1;
ptr->scrn_display_lst = (XF86ConfDisplayPtr) xf86addListItem((glp) ptr->
scrn_display_lst,
(glp)
conf_display);
}
return ptr;
}
static const char *
optionTypeToString(OptionValueType type)
{
switch (type) {
case OPTV_NONE:
return "";
case OPTV_INTEGER:
return "<i>";
case OPTV_STRING:
return "<str>";
case OPTV_ANYSTR:
return "[<str>]";
case OPTV_REAL:
return "<f>";
case OPTV_BOOLEAN:
return "[<bool>]";
case OPTV_FREQ:
return "<freq>";
case OPTV_PERCENT:
return "<percent>";
default:
return "";
}
}
static XF86ConfDevicePtr
configureDeviceSection(int screennum)
{
OptionInfoPtr p;
int i = 0;
char *identifier;
parsePrologue(XF86ConfDevicePtr, XF86ConfDeviceRec);
/* Move device info to parser structure */
if (asprintf(&identifier, "Card%d", screennum) == -1)
identifier = NULL;
ptr->dev_identifier = identifier;
ptr->dev_chipset = DevToConfig[screennum].GDev.chipset;
ptr->dev_busid = DevToConfig[screennum].GDev.busID;
ptr->dev_driver = DevToConfig[screennum].GDev.driver;
ptr->dev_ramdac = DevToConfig[screennum].GDev.ramdac;
for (i = 0; i < MAXDACSPEEDS; i++)
ptr->dev_dacSpeeds[i] = DevToConfig[screennum].GDev.dacSpeeds[i];
ptr->dev_videoram = DevToConfig[screennum].GDev.videoRam;
ptr->dev_mem_base = DevToConfig[screennum].GDev.MemBase;
ptr->dev_io_base = DevToConfig[screennum].GDev.IOBase;
ptr->dev_clockchip = DevToConfig[screennum].GDev.clockchip;
for (i = 0; (i < MAXCLOCKS) && (i < DevToConfig[screennum].GDev.numclocks);
i++)
ptr->dev_clock[i] = DevToConfig[screennum].GDev.clock[i];
ptr->dev_clocks = i;
ptr->dev_chipid = DevToConfig[screennum].GDev.chipID;
ptr->dev_chiprev = DevToConfig[screennum].GDev.chipRev;
ptr->dev_irq = DevToConfig[screennum].GDev.irq;
/* Make sure older drivers don't segv */
if (DevToConfig[screennum].GDev.options) {
/* Fill in the available driver options for people to use */
const char *descrip =
" ### Available Driver options are:-\n"
" ### Values: <i>: integer, <f>: float, "
"<bool>: \"True\"/\"False\",\n"
" ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n"
" ### <percent>: \"<f>%\"\n"
" ### [arg]: arg optional\n";
ptr->dev_comment = xnfstrdup(descrip);
if (ptr->dev_comment) {
for (p = DevToConfig[screennum].GDev.options; p->name != NULL; p++) {
char *p_e;
const char *prefix = " #Option ";
const char *middle = " \t# ";
const char *suffix = "\n";
const char *opttype = optionTypeToString(p->type);
char *optname;
int len = strlen(ptr->dev_comment) + strlen(prefix) +
strlen(middle) + strlen(suffix) + 1;
if (asprintf(&optname, "\"%s\"", p->name) == -1)
break;
len += max(20, strlen(optname));
len += strlen(opttype);
ptr->dev_comment = realloc(ptr->dev_comment, len);
if (!ptr->dev_comment)
break;
p_e = ptr->dev_comment + strlen(ptr->dev_comment);
sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle,
opttype, suffix);
free(optname);
}
}
}
return ptr;
}
static XF86ConfLayoutPtr
configureLayoutSection(void)
{
int scrnum = 0;
parsePrologue(XF86ConfLayoutPtr, XF86ConfLayoutRec);
ptr->lay_identifier = "X.org Configured";
{
XF86ConfInputrefPtr iptr;
iptr = malloc(sizeof(XF86ConfInputrefRec));
iptr->list.next = NULL;
iptr->iref_option_lst = NULL;
iptr->iref_inputdev_str = xnfstrdup("Mouse0");
iptr->iref_option_lst =
xf86addNewOption(iptr->iref_option_lst, xnfstrdup("CorePointer"),
NULL);
ptr->lay_input_lst = (XF86ConfInputrefPtr)
xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr);
}
{
XF86ConfInputrefPtr iptr;
iptr = malloc(sizeof(XF86ConfInputrefRec));
iptr->list.next = NULL;
iptr->iref_option_lst = NULL;
iptr->iref_inputdev_str = xnfstrdup("Keyboard0");
iptr->iref_option_lst =
xf86addNewOption(iptr->iref_option_lst, xnfstrdup("CoreKeyboard"),
NULL);
ptr->lay_input_lst = (XF86ConfInputrefPtr)
xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr);
}
for (scrnum = 0; scrnum < nDevToConfig; scrnum++) {
XF86ConfAdjacencyPtr aptr;
char *tmp;
aptr = malloc(sizeof(XF86ConfAdjacencyRec));
aptr->list.next = NULL;
aptr->adj_x = 0;
aptr->adj_y = 0;
aptr->adj_scrnum = scrnum;
XNFasprintf(&tmp, "Screen%d", scrnum);
aptr->adj_screen_str = tmp;
if (scrnum == 0) {
aptr->adj_where = CONF_ADJ_ABSOLUTE;
aptr->adj_refscreen = NULL;
}
else {
aptr->adj_where = CONF_ADJ_RIGHTOF;
XNFasprintf(&tmp, "Screen%d", scrnum - 1);
aptr->adj_refscreen = tmp;
}
ptr->lay_adjacency_lst =
(XF86ConfAdjacencyPtr) xf86addListItem((glp) ptr->lay_adjacency_lst,
(glp) aptr);
}
return ptr;
}
static XF86ConfFlagsPtr
configureFlagsSection(void)
{
parsePrologue(XF86ConfFlagsPtr, XF86ConfFlagsRec);
return ptr;
}
static XF86ConfModulePtr
configureModuleSection(void)
{
const char **elist, **el;
parsePrologue(XF86ConfModulePtr, XF86ConfModuleRec);
elist = LoaderListDir("extensions", NULL);
if (elist) {
for (el = elist; *el; el++) {
XF86LoadPtr module;
module = calloc(1, sizeof(XF86LoadRec));
module->load_name = *el;
ptr->mod_load_lst = (XF86LoadPtr) xf86addListItem((glp) ptr->
mod_load_lst,
(glp) module);
}
free(elist);
}
return ptr;
}
static XF86ConfFilesPtr
configureFilesSection(void)
{
parsePrologue(XF86ConfFilesPtr, XF86ConfFilesRec);
if (xf86ModulePath)
ptr->file_modulepath = xnfstrdup(xf86ModulePath);
if (defaultFontPath)
ptr->file_fontpath = xnfstrdup(defaultFontPath);
return ptr;
}
static XF86ConfMonitorPtr
configureMonitorSection(int screennum)
{
char *tmp;
parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec);
XNFasprintf(&tmp, "Monitor%d", screennum);
ptr->mon_identifier = tmp;
ptr->mon_vendor = xnfstrdup("Monitor Vendor");
ptr->mon_modelname = xnfstrdup("Monitor Model");
return ptr;
}
/* Initialize Configure Monitor from Detailed Timing Block */
static void
handle_detailed_input(struct detailed_monitor_section *det_mon, void *data)
{
XF86ConfMonitorPtr ptr = (XF86ConfMonitorPtr) data;
switch (det_mon->type) {
case DS_NAME:
ptr->mon_modelname = realloc(ptr->mon_modelname,
strlen((char *) (det_mon->section.name)) +
1);
strcpy(ptr->mon_modelname, (char *) (det_mon->section.name));
break;
case DS_RANGES:
ptr->mon_hsync[ptr->mon_n_hsync].lo = det_mon->section.ranges.min_h;
ptr->mon_hsync[ptr->mon_n_hsync].hi = det_mon->section.ranges.max_h;
ptr->mon_n_vrefresh = 1;
ptr->mon_vrefresh[ptr->mon_n_hsync].lo = det_mon->section.ranges.min_v;
ptr->mon_vrefresh[ptr->mon_n_hsync].hi = det_mon->section.ranges.max_v;
ptr->mon_n_hsync++;
default:
break;
}
}
static XF86ConfMonitorPtr
configureDDCMonitorSection(int screennum)
{
int len, mon_width, mon_height;
#define displaySizeMaxLen 80
char displaySize_string[displaySizeMaxLen];
int displaySizeLen;
char *tmp;
parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec);
XNFasprintf(&tmp, "Monitor%d", screennum);
ptr->mon_identifier = tmp;
ptr->mon_vendor = xnfstrdup(ConfiguredMonitor->vendor.name);
XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
/* features in centimetres, we want millimetres */
mon_width = 10 * ConfiguredMonitor->features.hsize;
mon_height = 10 * ConfiguredMonitor->features.vsize;
#ifdef CONFIGURE_DISPLAYSIZE
ptr->mon_width = mon_width;
ptr->mon_height = mon_height;
#else
if (mon_width && mon_height) {
/* when values available add DisplaySize option AS A COMMENT */
displaySizeLen = snprintf(displaySize_string, displaySizeMaxLen,
"\t#DisplaySize\t%5d %5d\t# mm\n",
mon_width, mon_height);
if (displaySizeLen > 0 && displaySizeLen < displaySizeMaxLen) {
if (ptr->mon_comment) {
len = strlen(ptr->mon_comment);
}
else {
len = 0;
}
if ((ptr->mon_comment =
realloc(ptr->mon_comment,
len + strlen(displaySize_string) + 1))) {
strcpy(ptr->mon_comment + len, displaySize_string);
}
}
}
#endif /* def CONFIGURE_DISPLAYSIZE */
xf86ForEachDetailedBlock(ConfiguredMonitor, handle_detailed_input, ptr);
if (ConfiguredMonitor->features.dpms) {
ptr->mon_option_lst =
xf86addNewOption(ptr->mon_option_lst, xnfstrdup("DPMS"), NULL);
}
return ptr;
}
static int
is_fallback(const char *s)
{
/* later entries are less preferred */
const char *fallback[5] = { "modesetting", "fbdev", "vesa", "wsfb", NULL };
int i;
for (i = 0; fallback[i]; i++)
if (strstr(s, fallback[i]))
return i;
return -1;
}
static int
driver_sort(const void *_l, const void *_r)
{
const char *l = *(const char **)_l;
const char *r = *(const char **)_r;
int left = is_fallback(l);
int right = is_fallback(r);
/* neither is a fallback, asciibetize */
if (left == -1 && right == -1)
return strcmp(l, r);
/* left is a fallback, right is not */
if (left >= 0 && right == -1)
return 1;
/* right is a fallback, left is not */
if (right >= 0 && left == -1)
return -1;
/* both are fallbacks, decide which is worse */
return left - right;
}
static void
fixup_video_driver_list(const char **drivers)
{
const char **end;
/* walk to the end of the list */
for (end = drivers; *end && **end; end++);
qsort(drivers, end - drivers, sizeof(const char *), driver_sort);
}
static const char **
GenerateDriverList(void)
{
const char **ret;
static const char *patlist[] = { "(.*)_drv\\.so", NULL };
ret = LoaderListDir("drivers", patlist);
/* fix up the probe order for video drivers */
if (ret != NULL)
fixup_video_driver_list(ret);
return ret;
}
void
DoConfigure(void)
{
int i, j, screennum = -1;
const char *home = NULL;
char filename[PATH_MAX];
const char *addslash = "";
XF86ConfigPtr xf86config = NULL;
const char **vlist, **vl;
int *dev2screen;
vlist = GenerateDriverList();
if (!vlist) {
ErrorF("Missing output drivers. Configuration failed.\n");
goto bail;
}
ErrorF("List of video drivers:\n");
for (vl = vlist; *vl; vl++)
ErrorF("\t%s\n", *vl);
/* Load all the drivers that were found. */
xf86LoadModules(vlist, NULL);
free(vlist);
xorgHWAccess = xf86EnableIO();
/* Create XF86Config file structure */
xf86config = calloc(1, sizeof(XF86ConfigRec));
/* Call all of the probe functions, reporting the results. */
for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) {
Bool found_screen;
DriverRec *const drv = xf86DriverList[CurrentDriver];
found_screen = xf86CallDriverProbe(drv, TRUE);
if (found_screen && drv->Identify) {
(*drv->Identify) (0);
}
}
if (nDevToConfig <= 0) {
ErrorF("No devices to configure. Configuration failed.\n");
goto bail;
}
/* Add device, monitor and screen sections for detected devices */
for (screennum = 0; screennum < nDevToConfig; screennum++) {
XF86ConfDevicePtr device_ptr;
XF86ConfMonitorPtr monitor_ptr;
XF86ConfScreenPtr screen_ptr;
device_ptr = configureDeviceSection(screennum);
xf86config->conf_device_lst = (XF86ConfDevicePtr) xf86addListItem((glp)
xf86config->
conf_device_lst,
(glp)
device_ptr);
monitor_ptr = configureMonitorSection(screennum);
xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) monitor_ptr);
screen_ptr = configureScreenSection(screennum);
xf86config->conf_screen_lst = (XF86ConfScreenPtr) xf86addListItem((glp)
xf86config->
conf_screen_lst,
(glp)
screen_ptr);
}
xf86config->conf_files = configureFilesSection();
xf86config->conf_modules = configureModuleSection();
xf86config->conf_flags = configureFlagsSection();
xf86config->conf_videoadaptor_lst = NULL;
xf86config->conf_modes_lst = NULL;
xf86config->conf_vendor_lst = NULL;
xf86config->conf_dri = NULL;
xf86config->conf_input_lst = configureInputSection();
xf86config->conf_layout_lst = configureLayoutSection();
home = getenv("HOME");
if ((home == NULL) || (home[0] == '\0')) {
home = "/";
}
else {
/* Determine if trailing slash is present or needed */
int l = strlen(home);
if (home[l - 1] != '/') {
addslash = "/";
}
}
snprintf(filename, sizeof(filename), "%s%s" XF86CONFIGFILE ".new",
home, addslash);
if (xf86writeConfigFile(filename, xf86config) == 0) {
xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
filename, strerror(errno));
goto bail;
}
xf86DoConfigurePass1 = FALSE;
/* Try to get DDC information filled in */
xf86ConfigFile = filename;
if (xf86HandleConfigFile(FALSE) != CONFIG_OK) {
goto bail;
}
xf86DoConfigurePass1 = FALSE;
dev2screen = xnfcalloc(nDevToConfig, sizeof(int));
{
Bool *driverProbed = xnfcalloc(xf86NumDrivers, sizeof(Bool));
for (screennum = 0; screennum < nDevToConfig; screennum++) {
int k, l, n, oldNumScreens;
i = DevToConfig[screennum].iDriver;
if (driverProbed[i])
continue;
driverProbed[i] = TRUE;
oldNumScreens = xf86NumScreens;
xf86CallDriverProbe(xf86DriverList[i], FALSE);
/* reorder */
k = screennum > 0 ? screennum : 1;
for (l = oldNumScreens; l < xf86NumScreens; l++) {
/* is screen primary? */
Bool primary = FALSE;
for (n = 0; n < xf86Screens[l]->numEntities; n++) {
if (xf86IsEntityPrimary(xf86Screens[l]->entityList[n])) {
dev2screen[0] = l;
primary = TRUE;
break;
}
}
if (primary)
continue;
/* not primary: assign it to next device of same driver */
/*
* NOTE: we assume that devices in DevToConfig
* and xf86Screens[] have the same order except
* for the primary device which always comes first.
*/
for (; k < nDevToConfig; k++) {
if (DevToConfig[k].iDriver == i) {
dev2screen[k++] = l;
break;
}
}
}
}
free(driverProbed);
}
if (nDevToConfig != xf86NumScreens) {
ErrorF("Number of created screens does not match number of detected"
" devices.\n Configuration failed.\n");
goto bail;
}
xf86PostProbe();
for (j = 0; j < xf86NumScreens; j++) {
xf86Screens[j]->scrnIndex = j;
}
xf86freeMonitorList(xf86config->conf_monitor_lst);
xf86config->conf_monitor_lst = NULL;
xf86freeScreenList(xf86config->conf_screen_lst);
xf86config->conf_screen_lst = NULL;
for (j = 0; j < xf86NumScreens; j++) {
XF86ConfMonitorPtr monitor_ptr;
XF86ConfScreenPtr screen_ptr;
ConfiguredMonitor = NULL;
if ((*xf86Screens[dev2screen[j]]->PreInit) &&
(*xf86Screens[dev2screen[j]]->PreInit) (xf86Screens[dev2screen[j]],
PROBE_DETECT) &&
ConfiguredMonitor) {
monitor_ptr = configureDDCMonitorSection(j);
}
else {
monitor_ptr = configureMonitorSection(j);
}
screen_ptr = configureScreenSection(j);
xf86config->conf_monitor_lst = (XF86ConfMonitorPtr) xf86addListItem((glp) xf86config->conf_monitor_lst, (glp) monitor_ptr);
xf86config->conf_screen_lst = (XF86ConfScreenPtr) xf86addListItem((glp)
xf86config->
conf_screen_lst,
(glp)
screen_ptr);
}
if (xf86writeConfigFile(filename, xf86config) == 0) {
xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
filename, strerror(errno));
goto bail;
}
ErrorF("\n");
if (!foundMouse) {
ErrorF("\n" __XSERVERNAME__ " is not able to detect your mouse.\n"
"Edit the file and correct the Device.\n");
}
else {
ErrorF("\n" __XSERVERNAME__ " detected your mouse at device %s.\n"
"Please check your config if the mouse is still not\n"
"operational, as by default " __XSERVERNAME__
" tries to autodetect\n" "the protocol.\n", DFLT_MOUSE_DEV);
}
if (xf86NumScreens > 1) {
ErrorF("\n" __XSERVERNAME__
" has configured a multihead system, please check your config.\n");
}
ErrorF("\nYour %s file is %s\n\n", XF86CONFIGFILE, filename);
ErrorF("To test the server, run 'X -config %s'\n\n", filename);
bail:
OsCleanup(TRUE);
ddxGiveUp(EXIT_ERR_CONFIGURE);
fflush(stderr);
exit(0);
}
/* Xorg -showopts:
* For each driver module installed, print out the list
* of options and their argument types, then exit
*
* Author: Marcus Schaefer, ms@suse.de
*/
void
DoShowOptions(void)
{
int i = 0;
const char **vlist = NULL;
char *pSymbol = 0;
XF86ModuleData *initData = 0;
if (!(vlist = GenerateDriverList())) {
ErrorF("Missing output drivers\n");
goto bail;
}
xf86LoadModules(vlist, 0);
free(vlist);
for (i = 0; i < xf86NumDrivers; i++) {
if (xf86DriverList[i]->AvailableOptions) {
const OptionInfoRec *pOption =
(*xf86DriverList[i]->AvailableOptions) (0, 0);
if (!pOption) {
ErrorF("(EE) Couldn't read option table for %s driver\n",
xf86DriverList[i]->driverName);
continue;
}
XNFasprintf(&pSymbol, "%sModuleData",
xf86DriverList[i]->driverName);
initData = LoaderSymbol(pSymbol);
if (initData) {
XF86ModuleVersionInfo *vers = initData->vers;
const OptionInfoRec *p;
ErrorF("Driver[%d]:%s[%s] {\n",
i, xf86DriverList[i]->driverName, vers->vendor);
for (p = pOption; p->name != NULL; p++) {
ErrorF("\t%s:%s\n", p->name, optionTypeToString(p->type));
}
ErrorF("}\n");
}
}
}
bail:
OsCleanup(TRUE);
ddxGiveUp(EXIT_ERR_DRIVERS);
fflush(stderr);
exit(0);
}

View file

@ -1,858 +0,0 @@
/*
* Copyright (c) 1994-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include <X11/Xmd.h>
#include "input.h"
#include "cursor.h"
#include "mipointer.h"
#include "scrnintstr.h"
#include "globals.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSproc.h"
#include <X11/extensions/XIproto.h>
#include "xf86Xinput.h"
#ifdef XFreeXDGA
#include "dgaproc.h"
#endif
typedef struct _xf86EdgeRec {
short screen;
short start;
short end;
DDXPointRec offset;
struct _xf86EdgeRec *next;
} xf86EdgeRec, *xf86EdgePtr;
typedef struct {
xf86EdgePtr left, right, up, down;
} xf86ScreenLayoutRec, *xf86ScreenLayoutPtr;
static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y);
static void xf86CrossScreen(ScreenPtr pScreen, Bool entering);
static void xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
static void xf86PointerMoved(ScrnInfoPtr pScrn, int x, int y);
static miPointerScreenFuncRec xf86PointerScreenFuncs = {
xf86CursorOffScreen,
xf86CrossScreen,
xf86WarpCursor,
};
static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS];
/*
* xf86InitViewport --
* Initialize paning & zooming parameters, so that a driver must only
* check what resolutions are possible and whether the virtual area
* is valid if specified.
*/
void
xf86InitViewport(ScrnInfoPtr pScr)
{
pScr->PointerMoved = xf86PointerMoved;
/*
* Compute the initial Viewport if necessary
*/
if (pScr->display) {
if (pScr->display->frameX0 < 0) {
pScr->frameX0 = (pScr->virtualX - pScr->modes->HDisplay) / 2;
pScr->frameY0 = (pScr->virtualY - pScr->modes->VDisplay) / 2;
}
else {
pScr->frameX0 = pScr->display->frameX0;
pScr->frameY0 = pScr->display->frameY0;
}
}
pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;
pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;
/*
* Now adjust the initial Viewport, so it lies within the virtual area
*/
if (pScr->frameX1 >= pScr->virtualX) {
pScr->frameX0 = pScr->virtualX - pScr->modes->HDisplay;
pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;
}
if (pScr->frameY1 >= pScr->virtualY) {
pScr->frameY0 = pScr->virtualY - pScr->modes->VDisplay;
pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;
}
}
/*
* xf86SetViewport --
* Scroll the visual part of the screen so the pointer is visible.
*/
void
xf86SetViewport(ScreenPtr pScreen, int x, int y)
{
ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen);
(*pScr->PointerMoved) (pScr, x, y);
}
static void
xf86PointerMoved(ScrnInfoPtr pScr, int x, int y)
{
Bool frameChanged = FALSE;
/*
* check whether (x,y) belongs to the visual part of the screen
* if not, change the base of the displayed frame occurring
*/
if (pScr->frameX0 > x) {
pScr->frameX0 = x;
pScr->frameX1 = x + pScr->currentMode->HDisplay - 1;
frameChanged = TRUE;
}
if (pScr->frameX1 < x) {
pScr->frameX1 = x + 1;
pScr->frameX0 = x - pScr->currentMode->HDisplay + 1;
frameChanged = TRUE;
}
if (pScr->frameY0 > y) {
pScr->frameY0 = y;
pScr->frameY1 = y + pScr->currentMode->VDisplay - 1;
frameChanged = TRUE;
}
if (pScr->frameY1 < y) {
pScr->frameY1 = y;
pScr->frameY0 = y - pScr->currentMode->VDisplay + 1;
frameChanged = TRUE;
}
if (frameChanged && pScr->AdjustFrame != NULL)
pScr->AdjustFrame(pScr, pScr->frameX0, pScr->frameY0);
}
/*
* xf86LockZoom --
* Enable/disable ZoomViewport
*/
void
xf86LockZoom(ScreenPtr pScreen, Bool lock)
{
ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen);
pScr->zoomLocked = lock;
}
/*
* xf86SwitchMode --
* This is called by both keyboard processing and the VidMode extension to
* set a new mode.
*/
Bool
xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
{
ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen);
ScreenPtr pCursorScreen;
Bool Switched;
int px, py;
DeviceIntPtr dev, it;
if (!pScr->vtSema || !mode || !pScr->SwitchMode)
return FALSE;
#ifdef XFreeXDGA
if (DGAActive(pScr->scrnIndex))
return FALSE;
#endif
if (mode == pScr->currentMode)
return TRUE;
if (mode->HDisplay > pScr->virtualX || mode->VDisplay > pScr->virtualY)
return FALSE;
/* Let's take an educated guess for which pointer to take here. And about as
educated as it gets is to take the first pointer we find.
*/
for (dev = inputInfo.devices; dev; dev = dev->next) {
if (IsPointerDevice(dev) && dev->spriteInfo->spriteOwner)
break;
}
pCursorScreen = miPointerGetScreen(dev);
if (pScreen == pCursorScreen)
miPointerGetPosition(dev, &px, &py);
input_lock();
Switched = (*pScr->SwitchMode) (pScr, mode);
if (Switched) {
pScr->currentMode = mode;
/*
* Adjust frame for new display size.
* Frame is centered around cursor position if cursor is on same screen.
*/
if (pScreen == pCursorScreen)
pScr->frameX0 = px - (mode->HDisplay / 2) + 1;
else
pScr->frameX0 =
(pScr->frameX0 + pScr->frameX1 + 1 - mode->HDisplay) / 2;
if (pScr->frameX0 < 0)
pScr->frameX0 = 0;
pScr->frameX1 = pScr->frameX0 + mode->HDisplay - 1;
if (pScr->frameX1 >= pScr->virtualX) {
pScr->frameX0 = pScr->virtualX - mode->HDisplay;
pScr->frameX1 = pScr->virtualX - 1;
}
if (pScreen == pCursorScreen)
pScr->frameY0 = py - (mode->VDisplay / 2) + 1;
else
pScr->frameY0 =
(pScr->frameY0 + pScr->frameY1 + 1 - mode->VDisplay) / 2;
if (pScr->frameY0 < 0)
pScr->frameY0 = 0;
pScr->frameY1 = pScr->frameY0 + mode->VDisplay - 1;
if (pScr->frameY1 >= pScr->virtualY) {
pScr->frameY0 = pScr->virtualY - mode->VDisplay;
pScr->frameY1 = pScr->virtualY - 1;
}
}
input_unlock();
if (pScr->AdjustFrame)
(*pScr->AdjustFrame) (pScr, pScr->frameX0, pScr->frameY0);
/* The original code centered the frame around the cursor if possible.
* Since this is hard to achieve with multiple cursors, we do the following:
* - center around the first pointer
* - move all other pointers to the nearest edge on the screen (or leave
* them unmodified if they are within the boundaries).
*/
if (pScreen == pCursorScreen) {
xf86WarpCursor(dev, pScreen, px, py);
}
for (it = inputInfo.devices; it; it = it->next) {
if (it == dev)
continue;
if (IsPointerDevice(it) && it->spriteInfo->spriteOwner) {
pCursorScreen = miPointerGetScreen(it);
if (pScreen == pCursorScreen) {
miPointerGetPosition(it, &px, &py);
if (px < pScr->frameX0)
px = pScr->frameX0;
else if (px > pScr->frameX1)
px = pScr->frameX1;
if (py < pScr->frameY0)
py = pScr->frameY0;
else if (py > pScr->frameY1)
py = pScr->frameY1;
xf86WarpCursor(it, pScreen, px, py);
}
}
}
return Switched;
}
/*
* xf86ZoomViewport --
* Reinitialize the visual part of the screen for another mode.
*/
void
xf86ZoomViewport(ScreenPtr pScreen, int zoom)
{
ScrnInfoPtr pScr = xf86ScreenToScrn(pScreen);
DisplayModePtr mode;
if (pScr->zoomLocked || !(mode = pScr->currentMode))
return;
do {
if (zoom > 0)
mode = mode->next;
else
mode = mode->prev;
} while (mode != pScr->currentMode && !(mode->type & M_T_USERDEF));
(void) xf86SwitchMode(pScreen, mode);
}
static xf86EdgePtr
FindEdge(xf86EdgePtr edge, int val)
{
while (edge && (edge->end <= val))
edge = edge->next;
if (edge && (edge->start <= val))
return edge;
return NULL;
}
/*
* xf86CursorOffScreen --
* Check whether it is necessary to switch to another screen
*/
static Bool
xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
{
xf86EdgePtr edge;
int tmp;
if (screenInfo.numScreens == 1)
return FALSE;
if (*x < 0) {
tmp = *y;
if (tmp < 0)
tmp = 0;
if (tmp >= (*pScreen)->height)
tmp = (*pScreen)->height - 1;
if ((edge = xf86ScreenLayout[(*pScreen)->myNum].left))
edge = FindEdge(edge, tmp);
if (!edge)
*x = 0;
else {
*x += edge->offset.x;
*y += edge->offset.y;
*pScreen = xf86Screens[edge->screen]->pScreen;
}
}
if (*x >= (*pScreen)->width) {
tmp = *y;
if (tmp < 0)
tmp = 0;
if (tmp >= (*pScreen)->height)
tmp = (*pScreen)->height - 1;
if ((edge = xf86ScreenLayout[(*pScreen)->myNum].right))
edge = FindEdge(edge, tmp);
if (!edge)
*x = (*pScreen)->width - 1;
else {
*x += edge->offset.x;
*y += edge->offset.y;
*pScreen = xf86Screens[edge->screen]->pScreen;
}
}
if (*y < 0) {
tmp = *x;
if (tmp < 0)
tmp = 0;
if (tmp >= (*pScreen)->width)
tmp = (*pScreen)->width - 1;
if ((edge = xf86ScreenLayout[(*pScreen)->myNum].up))
edge = FindEdge(edge, tmp);
if (!edge)
*y = 0;
else {
*x += edge->offset.x;
*y += edge->offset.y;
*pScreen = xf86Screens[edge->screen]->pScreen;
}
}
if (*y >= (*pScreen)->height) {
tmp = *x;
if (tmp < 0)
tmp = 0;
if (tmp >= (*pScreen)->width)
tmp = (*pScreen)->width - 1;
if ((edge = xf86ScreenLayout[(*pScreen)->myNum].down))
edge = FindEdge(edge, tmp);
if (!edge)
*y = (*pScreen)->height - 1;
else {
*x += edge->offset.x;
*y += edge->offset.y;
(*pScreen) = xf86Screens[edge->screen]->pScreen;
}
}
return TRUE;
}
/*
* xf86CrossScreen --
* Switch to another screen
*
* Currently nothing special happens, but mi assumes the CrossScreen
* method exists.
*/
static void
xf86CrossScreen(ScreenPtr pScreen, Bool entering)
{
}
/*
* xf86WarpCursor --
* Warp possible to another screen
*/
/* ARGSUSED */
static void
xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
input_lock();
miPointerWarpCursor(pDev, pScreen, x, y);
xf86Info.currentScreen = pScreen;
input_unlock();
}
void *
xf86GetPointerScreenFuncs(void)
{
return (void *) &xf86PointerScreenFuncs;
}
static xf86EdgePtr
AddEdge(xf86EdgePtr edge,
short min, short max, short dx, short dy, short screen)
{
xf86EdgePtr pEdge = edge, pPrev = NULL, pNew;
while (1) {
while (pEdge && (min >= pEdge->end)) {
pPrev = pEdge;
pEdge = pEdge->next;
}
if (!pEdge) {
if (!(pNew = malloc(sizeof(xf86EdgeRec))))
break;
pNew->screen = screen;
pNew->start = min;
pNew->end = max;
pNew->offset.x = dx;
pNew->offset.y = dy;
pNew->next = NULL;
if (pPrev)
pPrev->next = pNew;
else
edge = pNew;
break;
}
else if (min < pEdge->start) {
if (!(pNew = malloc(sizeof(xf86EdgeRec))))
break;
pNew->screen = screen;
pNew->start = min;
pNew->offset.x = dx;
pNew->offset.y = dy;
pNew->next = pEdge;
if (pPrev)
pPrev->next = pNew;
else
edge = pNew;
if (max <= pEdge->start) {
pNew->end = max;
break;
}
else {
pNew->end = pEdge->start;
min = pEdge->end;
}
}
else
min = pEdge->end;
pPrev = pEdge;
pEdge = pEdge->next;
if (max <= min)
break;
}
return edge;
}
static void
FillOutEdge(xf86EdgePtr pEdge, int limit)
{
xf86EdgePtr pNext;
int diff;
if (pEdge->start > 0)
pEdge->start = 0;
while ((pNext = pEdge->next)) {
diff = pNext->start - pEdge->end;
if (diff > 0) {
pEdge->end += diff >> 1;
pNext->start -= diff - (diff >> 1);
}
pEdge = pNext;
}
if (pEdge->end < limit)
pEdge->end = limit;
}
/*
* xf86InitOrigins() can deal with a maximum of 32 screens
* on 32 bit architectures, 64 on 64 bit architectures.
*/
void
xf86InitOrigins(void)
{
unsigned long screensLeft, prevScreensLeft, mask;
screenLayoutPtr screen;
ScreenPtr pScreen, refScreen;
int x1, x2, y1, y2, left, right, top, bottom;
int i, j, ref, minX, minY, min, max;
xf86ScreenLayoutPtr pLayout;
Bool OldStyleConfig = FALSE;
memset(xf86ScreenLayout, 0, MAXSCREENS * sizeof(xf86ScreenLayoutRec));
screensLeft = prevScreensLeft = (1 << xf86NumScreens) - 1;
while (1) {
for (mask = screensLeft, i = 0; mask; mask >>= 1, i++) {
if (!(mask & 1L))
continue;
screen = &xf86ConfigLayout.screens[i];
if (screen->refscreen != NULL &&
screen->refscreen->screennum >= xf86NumScreens) {
screensLeft &= ~(1 << i);
xf86Msg(X_WARNING,
"Not including screen \"%s\" in origins calculation.\n",
screen->screen->id);
continue;
}
pScreen = xf86Screens[i]->pScreen;
switch (screen->where) {
case PosObsolete:
OldStyleConfig = TRUE;
pLayout = &xf86ScreenLayout[i];
/* force edge lists */
if (screen->left) {
ref = screen->left->screennum;
if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
ErrorF("Referenced uninitialized screen in Layout!\n");
break;
}
pLayout->left = AddEdge(pLayout->left,
0, pScreen->height,
xf86Screens[ref]->pScreen->width, 0,
ref);
}
if (screen->right) {
ref = screen->right->screennum;
if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
ErrorF("Referenced uninitialized screen in Layout!\n");
break;
}
pLayout->right = AddEdge(pLayout->right,
0, pScreen->height,
-pScreen->width, 0, ref);
}
if (screen->top) {
ref = screen->top->screennum;
if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
ErrorF("Referenced uninitialized screen in Layout!\n");
break;
}
pLayout->up = AddEdge(pLayout->up,
0, pScreen->width,
0, xf86Screens[ref]->pScreen->height,
ref);
}
if (screen->bottom) {
ref = screen->bottom->screennum;
if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
ErrorF("Referenced uninitialized screen in Layout!\n");
break;
}
pLayout->down = AddEdge(pLayout->down,
0, pScreen->width, 0,
-pScreen->height, ref);
}
/* we could also try to place it based on those
relative locations if we wanted to */
screen->x = screen->y = 0;
/* FALLTHROUGH */
case PosAbsolute:
pScreen->x = screen->x;
pScreen->y = screen->y;
screensLeft &= ~(1 << i);
break;
case PosRelative:
ref = screen->refscreen->screennum;
if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
ErrorF("Referenced uninitialized screen in Layout!\n");
break;
}
if (screensLeft & (1 << ref))
break;
refScreen = xf86Screens[ref]->pScreen;
pScreen->x = refScreen->x + screen->x;
pScreen->y = refScreen->y + screen->y;
screensLeft &= ~(1 << i);
break;
case PosRightOf:
ref = screen->refscreen->screennum;
if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
ErrorF("Referenced uninitialized screen in Layout!\n");
break;
}
if (screensLeft & (1 << ref))
break;
refScreen = xf86Screens[ref]->pScreen;
pScreen->x = refScreen->x + refScreen->width;
pScreen->y = refScreen->y;
screensLeft &= ~(1 << i);
break;
case PosLeftOf:
ref = screen->refscreen->screennum;
if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
ErrorF("Referenced uninitialized screen in Layout!\n");
break;
}
if (screensLeft & (1 << ref))
break;
refScreen = xf86Screens[ref]->pScreen;
pScreen->x = refScreen->x - pScreen->width;
pScreen->y = refScreen->y;
screensLeft &= ~(1 << i);
break;
case PosBelow:
ref = screen->refscreen->screennum;
if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
ErrorF("Referenced uninitialized screen in Layout!\n");
break;
}
if (screensLeft & (1 << ref))
break;
refScreen = xf86Screens[ref]->pScreen;
pScreen->x = refScreen->x;
pScreen->y = refScreen->y + refScreen->height;
screensLeft &= ~(1 << i);
break;
case PosAbove:
ref = screen->refscreen->screennum;
if (!xf86Screens[ref] || !xf86Screens[ref]->pScreen) {
ErrorF("Referenced uninitialized screen in Layout!\n");
break;
}
if (screensLeft & (1 << ref))
break;
refScreen = xf86Screens[ref]->pScreen;
pScreen->x = refScreen->x;
pScreen->y = refScreen->y - pScreen->height;
screensLeft &= ~(1 << i);
break;
default:
ErrorF("Illegal placement keyword in Layout!\n");
break;
}
}
if (!screensLeft)
break;
if (screensLeft == prevScreensLeft) {
/* All the remaining screens are referencing each other.
Assign a value to one of them and go through again */
i = 0;
while (!((1 << i) & screensLeft)) {
i++;
}
ref = xf86ConfigLayout.screens[i].refscreen->screennum;
xf86Screens[ref]->pScreen->x = xf86Screens[ref]->pScreen->y = 0;
screensLeft &= ~(1 << ref);
}
prevScreensLeft = screensLeft;
}
/* justify the topmost and leftmost to (0,0) */
minX = xf86Screens[0]->pScreen->x;
minY = xf86Screens[0]->pScreen->y;
for (i = 1; i < xf86NumScreens; i++) {
if (xf86Screens[i]->pScreen->x < minX)
minX = xf86Screens[i]->pScreen->x;
if (xf86Screens[i]->pScreen->y < minY)
minY = xf86Screens[i]->pScreen->y;
}
if (minX || minY) {
for (i = 0; i < xf86NumScreens; i++) {
xf86Screens[i]->pScreen->x -= minX;
xf86Screens[i]->pScreen->y -= minY;
}
}
/* Create the edge lists */
if (!OldStyleConfig) {
for (i = 0; i < xf86NumScreens; i++) {
pLayout = &xf86ScreenLayout[i];
pScreen = xf86Screens[i]->pScreen;
left = pScreen->x;
right = left + pScreen->width;
top = pScreen->y;
bottom = top + pScreen->height;
for (j = 0; j < xf86NumScreens; j++) {
if (i == j)
continue;
refScreen = xf86Screens[j]->pScreen;
x1 = refScreen->x;
x2 = x1 + refScreen->width;
y1 = refScreen->y;
y2 = y1 + refScreen->height;
if ((bottom > y1) && (top < y2)) {
min = y1 - top;
if (min < 0)
min = 0;
max = pScreen->height - (bottom - y2);
if (max > pScreen->height)
max = pScreen->height;
if (((left - 1) >= x1) && ((left - 1) < x2))
pLayout->left = AddEdge(pLayout->left, min, max,
pScreen->x - refScreen->x,
pScreen->y - refScreen->y, j);
if ((right >= x1) && (right < x2))
pLayout->right = AddEdge(pLayout->right, min, max,
pScreen->x - refScreen->x,
pScreen->y - refScreen->y, j);
}
if ((left < x2) && (right > x1)) {
min = x1 - left;
if (min < 0)
min = 0;
max = pScreen->width - (right - x2);
if (max > pScreen->width)
max = pScreen->width;
if (((top - 1) >= y1) && ((top - 1) < y2))
pLayout->up = AddEdge(pLayout->up, min, max,
pScreen->x - refScreen->x,
pScreen->y - refScreen->y, j);
if ((bottom >= y1) && (bottom < y2))
pLayout->down = AddEdge(pLayout->down, min, max,
pScreen->x - refScreen->x,
pScreen->y - refScreen->y, j);
}
}
}
}
if (!OldStyleConfig) {
for (i = 0; i < xf86NumScreens; i++) {
pLayout = &xf86ScreenLayout[i];
pScreen = xf86Screens[i]->pScreen;
if (pLayout->left)
FillOutEdge(pLayout->left, pScreen->height);
if (pLayout->right)
FillOutEdge(pLayout->right, pScreen->height);
if (pLayout->up)
FillOutEdge(pLayout->up, pScreen->width);
if (pLayout->down)
FillOutEdge(pLayout->down, pScreen->width);
}
}
update_desktop_dimensions();
}
void
xf86ReconfigureLayout(void)
{
int i;
for (i = 0; i < MAXSCREENS; i++) {
xf86ScreenLayoutPtr sl = &xf86ScreenLayout[i];
/* we don't have to zero these, xf86InitOrigins() takes care of that */
free(sl->left);
free(sl->right);
free(sl->up);
free(sl->down);
}
xf86InitOrigins();
}

File diff suppressed because it is too large Load diff

View file

@ -1,91 +0,0 @@
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains the DPMS functions required by the extension.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include "os.h"
#include "globals.h"
#include "windowstr.h"
#include "xf86.h"
#include "xf86Priv.h"
#ifdef DPMSExtension
#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
#endif
#ifdef XSERVER_LIBPCIACCESS
#include "xf86VGAarbiter.h"
#endif
#ifdef DPMSExtension
static void
xf86DPMS(ScreenPtr pScreen, int level)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
if (pScrn->DPMSSet && pScrn->vtSema) {
xf86VGAarbiterLock(pScrn);
pScrn->DPMSSet(pScrn, level, 0);
xf86VGAarbiterUnlock(pScrn);
}
}
#endif
Bool
xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags)
{
#ifdef DPMSExtension
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
void *DPMSOpt;
MessageType enabled_from = X_DEFAULT;
Bool enabled = TRUE;
DPMSOpt = xf86FindOption(pScrn->options, "dpms");
if (DPMSDisabledSwitch) {
enabled_from = X_CMDLINE;
enabled = FALSE;
}
else if (DPMSOpt) {
enabled_from = X_CONFIG;
enabled = xf86CheckBoolOption(pScrn->options, "dpms", FALSE);
xf86MarkOptionUsed(DPMSOpt);
}
if (enabled) {
xf86DrvMsg(pScreen->myNum, enabled_from, "DPMS enabled\n");
pScrn->DPMSSet = set;
pScreen->DPMS = xf86DPMS;
}
return TRUE;
#else
return FALSE;
#endif
}

View file

@ -1,723 +0,0 @@
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Thomas Roell not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Thomas Roell makes no representations
* about the suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
* THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
*/
/*
* Copyright (c) 1994-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/* [JCH-96/01/21] Extended std reverse map to four buttons. */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/Xatom.h>
#include "misc.h"
#include "xf86.h"
#include "xf86Priv.h"
#define XF86_OS_PRIVS
#include "xf86_OSlib.h"
#include <X11/keysym.h>
#ifdef XFreeXDGA
#include "dgaproc.h"
#endif
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "inputstr.h"
#include "xf86Xinput.h"
#include "mi.h"
#include "mipointer.h"
#include "xkbsrv.h"
#include "xkbstr.h"
#ifdef DPMSExtension
#include <X11/extensions/dpmsconst.h>
#include "dpmsproc.h"
#endif
#include "xf86platformBus.h"
#include "systemd-logind.h"
extern void (*xf86OSPMClose) (void);
static void xf86VTSwitch(void);
/*
* Allow arbitrary drivers or other XFree86 code to register with our main
* Wakeup handler.
*/
typedef struct x_IHRec {
int fd;
InputHandlerProc ihproc;
void *data;
Bool enabled;
Bool is_input;
struct x_IHRec *next;
} IHRec, *IHPtr;
static IHPtr InputHandlers = NULL;
/*
* TimeSinceLastInputEvent --
* Function used for screensaver purposes by the os module. Returns the
* time in milliseconds since there last was any input.
*/
int
TimeSinceLastInputEvent(void)
{
if (xf86Info.lastEventTime == 0) {
xf86Info.lastEventTime = GetTimeInMillis();
}
return GetTimeInMillis() - xf86Info.lastEventTime;
}
/*
* SetTimeSinceLastInputEvent --
* Set the lastEventTime to now.
*/
void
SetTimeSinceLastInputEvent(void)
{
xf86Info.lastEventTime = GetTimeInMillis();
}
/*
* ProcessInputEvents --
* Retrieve all waiting input events and pass them to DIX in their
* correct chronological order. Only reads from the system pointer
* and keyboard.
*/
void
ProcessInputEvents(void)
{
int x, y;
mieqProcessInputEvents();
/* FIXME: This is a problem if we have multiple pointers */
miPointerGetPosition(inputInfo.pointer, &x, &y);
xf86SetViewport(xf86Info.currentScreen, x, y);
}
/*
* Handle keyboard events that cause some kind of "action"
* (i.e., server termination, video mode changes, VT switches, etc.)
*/
void
xf86ProcessActionEvent(ActionEvent action, void *arg)
{
DebugF("ProcessActionEvent(%d,%p)\n", (int) action, arg);
switch (action) {
case ACTION_TERMINATE:
if (!xf86Info.dontZap) {
xf86Msg(X_INFO, "Server zapped. Shutting down.\n");
GiveUp(0);
}
break;
case ACTION_NEXT_MODE:
if (!xf86Info.dontZoom)
xf86ZoomViewport(xf86Info.currentScreen, 1);
break;
case ACTION_PREV_MODE:
if (!xf86Info.dontZoom)
xf86ZoomViewport(xf86Info.currentScreen, -1);
break;
case ACTION_SWITCHSCREEN:
if (!xf86Info.dontVTSwitch && arg) {
int vtno = *((int *) arg);
if (vtno != xf86Info.vtno) {
if (!xf86VTActivate(vtno)) {
ErrorF("Failed to switch from vt%02d to vt%02d: %s\n",
xf86Info.vtno, vtno, strerror(errno));
}
}
}
break;
case ACTION_SWITCHSCREEN_NEXT:
if (!xf86Info.dontVTSwitch) {
if (!xf86VTActivate(xf86Info.vtno + 1)) {
/* If first try failed, assume this is the last VT and
* try wrapping around to the first vt.
*/
if (!xf86VTActivate(1)) {
ErrorF("Failed to switch from vt%02d to next vt: %s\n",
xf86Info.vtno, strerror(errno));
}
}
}
break;
case ACTION_SWITCHSCREEN_PREV:
if (!xf86Info.dontVTSwitch && xf86Info.vtno > 0) {
if (!xf86VTActivate(xf86Info.vtno - 1)) {
/* Don't know what the maximum VT is, so can't wrap around */
ErrorF("Failed to switch from vt%02d to previous vt: %s\n",
xf86Info.vtno, strerror(errno));
}
}
break;
default:
break;
}
}
/*
* xf86Wakeup --
* Os wakeup handler.
*/
/* ARGSUSED */
void
xf86Wakeup(void *blockData, int err)
{
if (xf86VTSwitchPending())
xf86VTSwitch();
}
/*
* xf86ReadInput --
* input thread handler
*/
static void
xf86ReadInput(int fd, int ready, void *closure)
{
InputInfoPtr pInfo = closure;
pInfo->read_input(pInfo);
}
/*
* xf86AddEnabledDevice --
*
*/
void
xf86AddEnabledDevice(InputInfoPtr pInfo)
{
InputThreadRegisterDev(pInfo->fd, xf86ReadInput, pInfo);
}
/*
* xf86RemoveEnabledDevice --
*
*/
void
xf86RemoveEnabledDevice(InputInfoPtr pInfo)
{
InputThreadUnregisterDev(pInfo->fd);
}
/*
* xf86PrintBacktrace --
* Print a stack backtrace for debugging purposes.
*/
void
xf86PrintBacktrace(void)
{
xorg_backtrace();
}
static void
xf86ReleaseKeys(DeviceIntPtr pDev)
{
KeyClassPtr keyc;
int i;
if (!pDev || !pDev->key)
return;
keyc = pDev->key;
/*
* Hmm... here is the biggest hack of every time !
* It may be possible that a switch-vt procedure has finished BEFORE
* you released all keys necessary to do this. That peculiar behavior
* can fool the X-server pretty much, cause it assumes that some keys
* were not released. TWM may stuck almost completely....
* OK, what we are doing here is after returning from the vt-switch
* explicitly unrelease all keyboard keys before the input-devices
* are re-enabled.
*/
for (i = keyc->xkbInfo->desc->min_key_code;
i < keyc->xkbInfo->desc->max_key_code; i++) {
if (key_is_down(pDev, i, KEY_POSTED)) {
input_lock();
QueueKeyboardEvents(pDev, KeyRelease, i);
input_unlock();
}
}
}
void
xf86DisableInputDeviceForVTSwitch(InputInfoPtr pInfo)
{
if (!pInfo->dev)
return;
if (!pInfo->dev->enabled)
pInfo->flags |= XI86_DEVICE_DISABLED;
xf86ReleaseKeys(pInfo->dev);
ProcessInputEvents();
DisableDevice(pInfo->dev, TRUE);
}
void
xf86EnableInputDeviceForVTSwitch(InputInfoPtr pInfo)
{
if (pInfo->dev && (pInfo->flags & XI86_DEVICE_DISABLED) == 0)
EnableDevice(pInfo->dev, TRUE);
pInfo->flags &= ~XI86_DEVICE_DISABLED;
}
/*
* xf86UpdateHasVTProperty --
* Update a flag property on the root window to say whether the server VT
* is currently the active one as some clients need to know this.
*/
static void
xf86UpdateHasVTProperty(Bool hasVT)
{
Atom property_name;
int32_t value = hasVT ? 1 : 0;
int i;
property_name = MakeAtom(HAS_VT_ATOM_NAME, sizeof(HAS_VT_ATOM_NAME) - 1,
FALSE);
if (property_name == BAD_RESOURCE)
FatalError("Failed to retrieve \"HAS_VT\" atom\n");
for (i = 0; i < xf86NumScreens; i++) {
dixChangeWindowProperty(serverClient,
xf86ScrnToScreen(xf86Screens[i])->root,
property_name, XA_INTEGER, 32,
PropModeReplace, 1, &value, TRUE);
}
}
void
xf86VTLeave(void)
{
int i;
InputInfoPtr pInfo;
IHPtr ih;
DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE));
#ifdef DPMSExtension
if (DPMSPowerLevel != DPMSModeOn)
DPMSSet(serverClient, DPMSModeOn);
#endif
for (i = 0; i < xf86NumScreens; i++) {
if (!(dispatchException & DE_TERMINATE))
if (xf86Screens[i]->EnableDisableFBAccess)
(*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE);
}
/*
* Keep the order: Disable Device > LeaveVT
* EnterVT > EnableDevice
*/
for (ih = InputHandlers; ih; ih = ih->next) {
if (ih->is_input)
xf86DisableInputHandler(ih);
else
xf86DisableGeneralHandler(ih);
}
for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
xf86DisableInputDeviceForVTSwitch(pInfo);
input_lock();
for (i = 0; i < xf86NumScreens; i++)
xf86Screens[i]->LeaveVT(xf86Screens[i]);
for (i = 0; i < xf86NumGPUScreens; i++)
xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]);
if (systemd_logind_controls_session()) {
systemd_logind_drop_master();
}
if (!xf86VTSwitchAway())
goto switch_failed;
if (xf86OSPMClose)
xf86OSPMClose();
xf86OSPMClose = NULL;
for (i = 0; i < xf86NumScreens; i++) {
/*
* zero all access functions to
* trap calls when switched away.
*/
xf86Screens[i]->vtSema = FALSE;
}
if (xorgHWAccess)
xf86DisableIO();
xf86UpdateHasVTProperty(FALSE);
return;
switch_failed:
DebugF("xf86VTSwitch: Leave failed\n");
for (i = 0; i < xf86NumScreens; i++) {
if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
FatalError("EnterVT failed for screen %d\n", i);
}
for (i = 0; i < xf86NumGPUScreens; i++) {
if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
FatalError("EnterVT failed for gpu screen %d\n", i);
}
if (!(dispatchException & DE_TERMINATE)) {
for (i = 0; i < xf86NumScreens; i++) {
if (xf86Screens[i]->EnableDisableFBAccess)
(*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
}
}
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next)
xf86EnableInputDeviceForVTSwitch(pInfo);
for (ih = InputHandlers; ih; ih = ih->next) {
if (ih->is_input)
xf86EnableInputHandler(ih);
else
xf86EnableGeneralHandler(ih);
}
input_unlock();
}
void
xf86VTEnter(void)
{
int i;
InputInfoPtr pInfo;
IHPtr ih;
DebugF("xf86VTSwitch: Entering\n");
if (!xf86VTSwitchTo())
return;
xf86OSPMClose = xf86OSPMOpen();
if (xorgHWAccess)
xf86EnableIO();
for (i = 0; i < xf86NumScreens; i++) {
xf86Screens[i]->vtSema = TRUE;
if (!xf86Screens[i]->EnterVT(xf86Screens[i]))
FatalError("EnterVT failed for screen %d\n", i);
}
for (i = 0; i < xf86NumGPUScreens; i++) {
xf86GPUScreens[i]->vtSema = TRUE;
if (!xf86GPUScreens[i]->EnterVT(xf86GPUScreens[i]))
FatalError("EnterVT failed for gpu screen %d\n", i);
}
for (i = 0; i < xf86NumScreens; i++) {
if (xf86Screens[i]->EnableDisableFBAccess)
(*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
}
/* Turn screen saver off when switching back */
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
/* Devices with server managed fds get enabled on logind resume */
if (!(pInfo->flags & XI86_SERVER_FD))
xf86EnableInputDeviceForVTSwitch(pInfo);
}
for (ih = InputHandlers; ih; ih = ih->next) {
if (ih->is_input)
xf86EnableInputHandler(ih);
else
xf86EnableGeneralHandler(ih);
}
#ifdef XSERVER_PLATFORM_BUS
/* check for any new output devices */
xf86platformVTProbe();
#endif
xf86UpdateHasVTProperty(TRUE);
input_unlock();
}
/*
* xf86VTSwitch --
* Handle requests for switching the vt.
*/
static void
xf86VTSwitch(void)
{
DebugF("xf86VTSwitch()\n");
#ifdef XFreeXDGA
if (!DGAVTSwitch())
return;
#endif
/*
* Since all screens are currently all in the same state it is sufficient
* check the first. This might change in future.
*
* VTLeave is always handled here (VT_PROCESS guarantees this is safe),
* if we use systemd_logind xf86VTEnter() gets called by systemd-logind.c
* once it has resumed all drm nodes.
*/
if (xf86VTOwner())
xf86VTLeave();
else if (!systemd_logind_controls_session())
xf86VTEnter();
}
/* Input handler registration */
static void
xf86InputHandlerNotify(int fd, int ready, void *data)
{
IHPtr ih = data;
if (ih->enabled && ih->fd >= 0 && ih->ihproc) {
ih->ihproc(ih->fd, ih->data);
}
}
static void *
addInputHandler(int fd, InputHandlerProc proc, void *data)
{
IHPtr ih;
if (fd < 0 || !proc)
return NULL;
ih = calloc(sizeof(*ih), 1);
if (!ih)
return NULL;
ih->fd = fd;
ih->ihproc = proc;
ih->data = data;
ih->enabled = TRUE;
if (!SetNotifyFd(fd, xf86InputHandlerNotify, X_NOTIFY_READ, ih)) {
free(ih);
return NULL;
}
ih->next = InputHandlers;
InputHandlers = ih;
return ih;
}
void *
xf86AddInputHandler(int fd, InputHandlerProc proc, void *data)
{
IHPtr ih = addInputHandler(fd, proc, data);
if (ih)
ih->is_input = TRUE;
return ih;
}
void *
xf86AddGeneralHandler(int fd, InputHandlerProc proc, void *data)
{
IHPtr ih = addInputHandler(fd, proc, data);
return ih;
}
/**
* Set the handler for the console's fd. Replaces (and returns) the previous
* handler or NULL, whichever appropriate.
* proc may be NULL if the server should not handle events on the console.
*/
InputHandlerProc
xf86SetConsoleHandler(InputHandlerProc proc, void *data)
{
static IHPtr handler = NULL;
InputHandlerProc old_proc = NULL;
if (handler) {
old_proc = handler->ihproc;
xf86RemoveGeneralHandler(handler);
}
handler = xf86AddGeneralHandler(xf86Info.consoleFd, proc, data);
return old_proc;
}
static void
removeInputHandler(IHPtr ih)
{
IHPtr p;
if (ih->fd >= 0)
RemoveNotifyFd(ih->fd);
if (ih == InputHandlers)
InputHandlers = ih->next;
else {
p = InputHandlers;
while (p && p->next != ih)
p = p->next;
if (ih)
p->next = ih->next;
}
free(ih);
}
int
xf86RemoveInputHandler(void *handler)
{
IHPtr ih;
int fd;
if (!handler)
return -1;
ih = handler;
fd = ih->fd;
removeInputHandler(ih);
return fd;
}
int
xf86RemoveGeneralHandler(void *handler)
{
IHPtr ih;
int fd;
if (!handler)
return -1;
ih = handler;
fd = ih->fd;
removeInputHandler(ih);
return fd;
}
void
xf86DisableInputHandler(void *handler)
{
IHPtr ih;
if (!handler)
return;
ih = handler;
ih->enabled = FALSE;
if (ih->fd >= 0)
RemoveNotifyFd(ih->fd);
}
void
xf86DisableGeneralHandler(void *handler)
{
IHPtr ih;
if (!handler)
return;
ih = handler;
ih->enabled = FALSE;
if (ih->fd >= 0)
RemoveNotifyFd(ih->fd);
}
void
xf86EnableInputHandler(void *handler)
{
IHPtr ih;
if (!handler)
return;
ih = handler;
ih->enabled = TRUE;
if (ih->fd >= 0)
SetNotifyFd(ih->fd, xf86InputHandlerNotify, X_NOTIFY_READ, ih);
}
void
xf86EnableGeneralHandler(void *handler)
{
IHPtr ih;
if (!handler)
return;
ih = handler;
ih->enabled = TRUE;
if (ih->fd >= 0)
SetNotifyFd(ih->fd, xf86InputHandlerNotify, X_NOTIFY_READ, ih);
}
void
DDXRingBell(int volume, int pitch, int duration)
{
xf86OSRingBell(volume, pitch, duration);
}
Bool
xf86VTOwner(void)
{
/* at system startup xf86Screens[0] won't be set - but we will own the VT */
if (xf86NumScreens == 0)
return TRUE;
return xf86Screens[0]->vtSema;
}

View file

@ -1,139 +0,0 @@
/*
* Copyright © 2011 Daniel Stone
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Author: Daniel Stone <daniel@fooishbar.org>
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "extension.h"
#include "extinit.h"
#include "globals.h"
#include "xf86.h"
#include "xf86Config.h"
#include "xf86Module.h"
#include "xf86Extensions.h"
#include "xf86Opt.h"
#include "optionstr.h"
#ifdef XSELINUX
#include "xselinux.h"
#endif
#ifdef XFreeXDGA
#include <X11/extensions/xf86dgaproto.h>
#endif
#ifdef XF86VIDMODE
#include <X11/extensions/xf86vmproto.h>
#include "vidmodestr.h"
#endif
/*
* DDX-specific extensions.
*/
static const ExtensionModule extensionModules[] = {
#ifdef XF86VIDMODE
{
XFree86VidModeExtensionInit,
XF86VIDMODENAME,
&noXFree86VidModeExtension
},
#endif
#ifdef XFreeXDGA
{
XFree86DGAExtensionInit,
XF86DGANAME,
&noXFree86DGAExtension
},
#endif
#ifdef XF86DRI
{
XFree86DRIExtensionInit,
"XFree86-DRI",
&noXFree86DRIExtension
},
#endif
#ifdef DRI2
{
DRI2ExtensionInit,
DRI2_NAME,
&noDRI2Extension
}
#endif
};
static void
load_extension_config(void)
{
XF86ConfModulePtr mod_con = xf86configptr->conf_modules;
XF86LoadPtr modp;
/* Only the best. */
if (!mod_con)
return;
nt_list_for_each_entry(modp, mod_con->mod_load_lst, list.next) {
InputOption *opt;
if (strcasecmp(modp->load_name, "extmod") != 0)
continue;
/* extmod options are of the form "omit <extension-name>" */
nt_list_for_each_entry(opt, modp->load_opt, list.next) {
const char *key = input_option_get_key(opt);
if (strncasecmp(key, "omit", 4) != 0 || strlen(key) < 5)
continue;
if (EnableDisableExtension(key + 4, FALSE))
xf86MarkOptionUsed(opt);
}
#ifdef XSELINUX
if ((opt = xf86FindOption(modp->load_opt,
"SELinux mode disabled"))) {
xf86MarkOptionUsed(opt);
selinuxEnforcingState = SELINUX_MODE_DISABLED;
}
if ((opt = xf86FindOption(modp->load_opt,
"SELinux mode permissive"))) {
xf86MarkOptionUsed(opt);
selinuxEnforcingState = SELINUX_MODE_PERMISSIVE;
}
if ((opt = xf86FindOption(modp->load_opt,
"SELinux mode enforcing"))) {
xf86MarkOptionUsed(opt);
selinuxEnforcingState = SELINUX_MODE_ENFORCING;
}
#endif
}
}
void
xf86ExtensionInit(void)
{
load_extension_config();
LoadExtensionList(extensionModules, ARRAY_SIZE(extensionModules), TRUE);
}

View file

@ -1,55 +0,0 @@
/*
* Copyright © 2011 Daniel Stone
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Author: Daniel Stone <daniel@fooishbar.org>
*/
#ifndef XF86EXTENSIONS_H
#define XF86EXTENSIONS_H
#include "extnsionst.h"
#ifdef XF86DRI
extern _X_EXPORT Bool noXFree86DRIExtension;
extern void XFree86DRIExtensionInit(void);
#endif
#ifdef DRI2
#include <X11/extensions/dri2proto.h>
extern _X_EXPORT Bool noDRI2Extension;
extern void DRI2ExtensionInit(void);
#endif
#ifdef XF86VIDMODE
#include <X11/extensions/xf86vmproto.h>
extern _X_EXPORT Bool noXFree86VidModeExtension;
extern void XFree86VidModeExtensionInit(void);
#endif
#ifdef XFreeXDGA
#include <X11/extensions/xf86dgaproto.h>
extern _X_EXPORT Bool noXFree86DGAExtension;
extern void XFree86DGAExtensionInit(void);
extern void XFree86DGARegister(void);
#endif
#endif

View file

@ -1,200 +0,0 @@
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains all the XFree86 global variables.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include "os.h"
#include "windowstr.h"
#include "propertyst.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86Parser.h"
#include "xf86Xinput.h"
#include "xf86InPriv.h"
#include "xf86Config.h"
/* Globals that video drivers may access */
DevPrivateKeyRec xf86CreateRootWindowKeyRec;
DevPrivateKeyRec xf86ScreenKeyRec;
ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */
ScrnInfoPtr *xf86GPUScreens = NULL; /* List of ScrnInfos */
int xf86DRMMasterFd = -1; /* Command line argument for DRM master file descriptor */
const unsigned char byte_reversed[256] = {
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
};
/* Globals that input drivers may access */
InputInfoPtr xf86InputDevs = NULL;
/* Globals that video drivers may not access */
xf86InfoRec xf86Info = {
.consoleFd = -1,
.vtno = -1,
.lastEventTime = -1,
.vtRequestsPending = FALSE,
#ifdef __sun
.vtPendingNum = -1,
#endif
.dontVTSwitch = FALSE,
.autoVTSwitch = TRUE,
.ShareVTs = FALSE,
.dontZap = FALSE,
.dontZoom = FALSE,
.currentScreen = NULL,
#ifdef CSRG_BASED
.consType = -1,
#endif
.allowMouseOpenFail = FALSE,
.vidModeEnabled = TRUE,
.vidModeAllowNonLocal = FALSE,
.miscModInDevEnabled = TRUE,
.miscModInDevAllowNonLocal = FALSE,
.pmFlag = TRUE,
#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) || defined(CONFIG_WSCONS)
.forceInputDevices = FALSE,
.autoAddDevices = TRUE,
.autoEnableDevices = TRUE,
#else
.forceInputDevices = TRUE,
.autoAddDevices = FALSE,
.autoEnableDevices = FALSE,
#endif
#if defined(CONFIG_UDEV_KMS)
.autoAddGPU = TRUE,
#else
.autoAddGPU = FALSE,
#endif
.autoBindGPU = TRUE,
};
const char *xf86ConfigFile = NULL;
const char *xf86ConfigDir = NULL;
const char *xf86ModulePath = DEFAULT_MODULE_PATH;
MessageType xf86ModPathFrom = X_DEFAULT;
const char *xf86LogFile = DEFAULT_LOGDIR "/" DEFAULT_LOGPREFIX;
MessageType xf86LogFileFrom = X_DEFAULT;
Bool xf86LogFileWasOpened = FALSE;
serverLayoutRec xf86ConfigLayout = { NULL, };
confDRIRec xf86ConfigDRI = { 0, };
XF86ConfigPtr xf86configptr = NULL;
Bool xf86Resetting = FALSE;
Bool xf86Initialising = FALSE;
Bool xf86DoConfigure = FALSE;
Bool xf86ProbeIgnorePrimary = FALSE;
Bool xf86DoShowOptions = FALSE;
DriverPtr *xf86DriverList = NULL;
int xf86NumDrivers = 0;
InputDriverPtr *xf86InputDriverList = NULL;
int xf86NumInputDrivers = 0;
int xf86NumScreens = 0;
int xf86NumGPUScreens = 0;
const char *xf86VisualNames[] = {
"StaticGray",
"GrayScale",
"StaticColor",
"PseudoColor",
"TrueColor",
"DirectColor"
};
/* Parameters set only from the command line */
Bool xf86fpFlag = FALSE;
Bool xf86sFlag = FALSE;
Bool xf86bsEnableFlag = FALSE;
Bool xf86bsDisableFlag = FALSE;
Bool xf86silkenMouseDisableFlag = FALSE;
Bool xf86xkbdirFlag = FALSE;
#ifdef HAVE_ACPI
Bool xf86acpiDisableFlag = FALSE;
#endif
char *xf86LayoutName = NULL;
char *xf86ScreenName = NULL;
char *xf86PointerName = NULL;
char *xf86KeyboardName = NULL;
int xf86Verbose = DEFAULT_VERBOSE;
int xf86LogVerbose = DEFAULT_LOG_VERBOSE;
int xf86FbBpp = -1;
int xf86Depth = -1;
rgb xf86Weight = { 0, 0, 0 };
Gamma xf86Gamma = { 0.0, 0.0, 0.0 };
Bool xf86AllowMouseOpenFail = FALSE;
Bool xf86AutoBindGPUDisabled = FALSE;
#ifdef XF86VIDMODE
Bool xf86VidModeDisabled = FALSE;
Bool xf86VidModeAllowNonLocal = FALSE;
#endif
Bool xorgHWAccess = FALSE;

File diff suppressed because it is too large Load diff

View file

@ -1,40 +0,0 @@
/*
* Copyright (c) 1999 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#ifndef _xf86InPriv_h
#define _xf86InPriv_h
/* xf86Globals.c */
extern InputDriverPtr *xf86InputDriverList;
extern int xf86NumInputDrivers;
#endif /* _xf86InPriv_h */

File diff suppressed because it is too large Load diff

View file

@ -1,40 +0,0 @@
/*
* Copyright © 2015 NVIDIA Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef _xf86_match_drivers_h
#define _xf86_match_drivers_h
#define MATCH_DRIVERS_LIMIT 20
typedef struct _XF86MatchedDrivers {
char *matches[MATCH_DRIVERS_LIMIT];
int nmatches;
} XF86MatchedDrivers;
/*
* prototypes
*/
void xf86AddMatchedDriver(XF86MatchedDrivers *, const char *);
#endif /* _xf86_match_drivers_h */

File diff suppressed because it is too large Load diff

View file

@ -1,176 +0,0 @@
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains the parts of the loader interface that are visible
* to modules. This is the only loader-related header that modules should
* include.
*
* It should include a bare minimum of other headers.
*
* Longer term, the module/loader code should probably live directly under
* Xserver/.
*
* XXX This file arguably belongs in xfree86/loader/.
*/
#ifndef _XF86MODULE_H
#define _XF86MODULE_H
#include <X11/Xfuncproto.h>
#include <X11/Xdefs.h>
#include <X11/Xmd.h>
#ifndef NULL
#define NULL ((void *)0)
#endif
#define DEFAULT_LIST ((char *)-1)
/* Built-in ABI classes. These definitions must not be changed. */
#define ABI_CLASS_NONE NULL
#define ABI_CLASS_ANSIC "X.Org ANSI C Emulation"
#define ABI_CLASS_VIDEODRV "X.Org Video Driver"
#define ABI_CLASS_XINPUT "X.Org XInput driver"
#define ABI_CLASS_EXTENSION "X.Org Server Extension"
#define ABI_MINOR_MASK 0x0000FFFF
#define ABI_MAJOR_MASK 0xFFFF0000
#define GET_ABI_MINOR(v) ((v) & ABI_MINOR_MASK)
#define GET_ABI_MAJOR(v) (((v) & ABI_MAJOR_MASK) >> 16)
#define SET_ABI_VERSION(maj, min) \
((((maj) << 16) & ABI_MAJOR_MASK) | ((min) & ABI_MINOR_MASK))
/*
* ABI versions. Each version has a major and minor revision. Modules
* using lower minor revisions must work with servers of a higher minor
* revision. There is no compatibility between different major revisions.
* Whenever the ABI_ANSIC_VERSION is changed, the others must also be
* changed. The minor revision mask is 0x0000FFFF and the major revision
* mask is 0xFFFF0000.
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(25, 3)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(24, 4)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(10, 0)
#define MODINFOSTRING1 0xef23fdc5
#define MODINFOSTRING2 0x10dc023a
#ifndef MODULEVENDORSTRING
#define MODULEVENDORSTRING "X.Org Foundation"
#endif
/* Error return codes for errmaj */
typedef enum {
LDR_NOERROR = 0,
LDR_NOMEM, /* memory allocation failed */
LDR_NOENT, /* Module file does not exist */
LDR_NOLOAD, /* type specific loader failed */
LDR_ONCEONLY, /* Module should only be loaded once (not an error) */
LDR_MISMATCH, /* the module didn't match the spec'd requirements */
LDR_BADUSAGE, /* LoadModule is called with bad arguments */
LDR_INVALID, /* The module doesn't have a valid ModuleData object */
LDR_BADOS, /* The module doesn't support the OS */
LDR_MODSPECIFIC /* A module-specific error in the SetupProc */
} LoaderErrorCode;
/*
* Some common module classes. The moduleclass can be used to identify
* that modules loaded are of the correct type. This is a finer
* classification than the ABI classes even though the default set of
* classes have the same names. For example, not all modules that require
* the video driver ABI are themselves video drivers.
*/
#define MOD_CLASS_NONE NULL
#define MOD_CLASS_VIDEODRV "X.Org Video Driver"
#define MOD_CLASS_XINPUT "X.Org XInput Driver"
#define MOD_CLASS_EXTENSION "X.Org Server Extension"
/* This structure is expected to be returned by the initfunc */
typedef struct {
const char *modname; /* name of module, e.g. "foo" */
const char *vendor; /* vendor specific string */
CARD32 _modinfo1_; /* constant MODINFOSTRING1/2 to find */
CARD32 _modinfo2_; /* infoarea with a binary editor or sign tool */
CARD32 xf86version; /* contains XF86_VERSION_CURRENT */
CARD8 majorversion; /* module-specific major version */
CARD8 minorversion; /* module-specific minor version */
CARD16 patchlevel; /* module-specific patch level */
const char *abiclass; /* ABI class that the module uses */
CARD32 abiversion; /* ABI version */
const char *moduleclass; /* module class description */
CARD32 checksum[4]; /* contains a digital signature of the */
/* version info structure */
} XF86ModuleVersionInfo;
/*
* This structure can be used to callers of LoadModule and LoadSubModule to
* specify version and/or ABI requirements.
*/
typedef struct {
CARD8 majorversion; /* module-specific major version */
CARD8 minorversion; /* moudle-specific minor version */
CARD16 patchlevel; /* module-specific patch level */
const char *abiclass; /* ABI class that the module uses */
CARD32 abiversion; /* ABI version */
const char *moduleclass; /* module class */
} XF86ModReqInfo;
#define MODULE_VERSION_NUMERIC(maj, min, patch) \
((((maj) & 0xFF) << 24) | (((min) & 0xFF) << 16) | (patch & 0xFFFF))
#define GET_MODULE_MAJOR_VERSION(vers) (((vers) >> 24) & 0xFF)
#define GET_MODULE_MINOR_VERSION(vers) (((vers) >> 16) & 0xFF)
#define GET_MODULE_PATCHLEVEL(vers) ((vers) & 0xFFFF)
#define INITARGS void
/* Prototypes for Loader functions that are exported to modules */
extern _X_EXPORT void *LoadSubModule(void *, const char *, const char **,
const char **, void *,
const XF86ModReqInfo *, int *, int *);
extern _X_EXPORT void UnloadSubModule(void *);
extern _X_EXPORT void UnloadModule(void *);
extern _X_EXPORT void *LoaderSymbol(const char *);
extern _X_EXPORT void *LoaderSymbolFromModule(void *, const char *);
extern _X_EXPORT void LoaderErrorMsg(const char *, const char *, int, int);
extern _X_EXPORT Bool LoaderShouldIgnoreABI(void);
extern _X_EXPORT int LoaderGetABIVersion(const char *abiclass);
typedef void *(*ModuleSetupProc) (void *, void *, int *, int *);
typedef void (*ModuleTearDownProc) (void *);
#define MODULESETUPPROTO(func) void *func(void *, void *, int*, int*)
#define MODULETEARDOWNPROTO(func) void func(void *)
typedef struct {
XF86ModuleVersionInfo *vers;
ModuleSetupProc setup;
ModuleTearDownProc teardown;
} XF86ModuleData;
#endif /* _XF86STR_H */

View file

@ -1,158 +0,0 @@
/*
* Copyright (c) 1998-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/* Option handling things that ModuleSetup procs can use */
#ifndef _XF86_OPT_H_
#define _XF86_OPT_H_
#include "xf86Optionstr.h"
typedef struct {
double freq;
int units;
} OptFrequency;
typedef union {
unsigned long num;
const char *str;
double realnum;
Bool boolean;
OptFrequency freq;
} ValueUnion;
typedef enum {
OPTV_NONE = 0,
OPTV_INTEGER,
OPTV_STRING, /* a non-empty string */
OPTV_ANYSTR, /* Any string, including an empty one */
OPTV_REAL,
OPTV_BOOLEAN,
OPTV_PERCENT,
OPTV_FREQ
} OptionValueType;
typedef enum {
OPTUNITS_HZ = 1,
OPTUNITS_KHZ,
OPTUNITS_MHZ
} OptFreqUnits;
typedef struct {
int token;
const char *name;
OptionValueType type;
ValueUnion value;
Bool found;
} OptionInfoRec, *OptionInfoPtr;
extern _X_EXPORT int xf86SetIntOption(XF86OptionPtr optlist, const char *name,
int deflt);
extern _X_EXPORT double xf86SetRealOption(XF86OptionPtr optlist,
const char *name, double deflt);
extern _X_EXPORT char *xf86SetStrOption(XF86OptionPtr optlist, const char *name,
const char *deflt);
extern _X_EXPORT int xf86SetBoolOption(XF86OptionPtr list, const char *name,
int deflt);
extern _X_EXPORT double xf86SetPercentOption(XF86OptionPtr list,
const char *name, double deflt);
extern _X_EXPORT int xf86CheckIntOption(XF86OptionPtr optlist, const char *name,
int deflt);
extern _X_EXPORT double xf86CheckRealOption(XF86OptionPtr optlist,
const char *name, double deflt);
extern _X_EXPORT char *xf86CheckStrOption(XF86OptionPtr optlist,
const char *name, const char *deflt);
extern _X_EXPORT int xf86CheckBoolOption(XF86OptionPtr list, const char *name,
int deflt);
extern _X_EXPORT double xf86CheckPercentOption(XF86OptionPtr list,
const char *name, double deflt);
extern _X_EXPORT XF86OptionPtr xf86AddNewOption(XF86OptionPtr head,
const char *name,
const char *val);
extern _X_EXPORT XF86OptionPtr xf86NewOption(char *name, char *value);
extern _X_EXPORT XF86OptionPtr xf86NextOption(XF86OptionPtr list);
extern _X_EXPORT XF86OptionPtr xf86OptionListCreate(const char **options,
int count, int used);
extern _X_EXPORT XF86OptionPtr xf86OptionListMerge(XF86OptionPtr head,
XF86OptionPtr tail);
extern _X_EXPORT XF86OptionPtr xf86OptionListDuplicate(XF86OptionPtr list);
extern _X_EXPORT void xf86OptionListFree(XF86OptionPtr opt);
extern _X_EXPORT char *xf86OptionName(XF86OptionPtr opt);
extern _X_EXPORT char *xf86OptionValue(XF86OptionPtr opt);
extern _X_EXPORT void xf86OptionListReport(XF86OptionPtr parm);
extern _X_EXPORT XF86OptionPtr xf86FindOption(XF86OptionPtr options,
const char *name);
extern _X_EXPORT const char *xf86FindOptionValue(XF86OptionPtr options,
const char *name);
extern _X_EXPORT void xf86MarkOptionUsed(XF86OptionPtr option);
extern _X_EXPORT void xf86MarkOptionUsedByName(XF86OptionPtr options,
const char *name);
extern _X_EXPORT Bool xf86CheckIfOptionUsed(XF86OptionPtr option);
extern _X_EXPORT Bool xf86CheckIfOptionUsedByName(XF86OptionPtr options,
const char *name);
extern _X_EXPORT void xf86ShowUnusedOptions(int scrnIndex,
XF86OptionPtr options);
extern _X_EXPORT void xf86ProcessOptions(int scrnIndex, XF86OptionPtr options,
OptionInfoPtr optinfo);
extern _X_EXPORT OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec * table,
int token);
extern _X_EXPORT const char *xf86TokenToOptName(const OptionInfoRec * table,
int token);
extern _X_EXPORT Bool xf86IsOptionSet(const OptionInfoRec * table, int token);
extern _X_EXPORT const char *xf86GetOptValString(const OptionInfoRec * table,
int token);
extern _X_EXPORT Bool xf86GetOptValInteger(const OptionInfoRec * table,
int token, int *value);
extern _X_EXPORT Bool xf86GetOptValULong(const OptionInfoRec * table, int token,
unsigned long *value);
extern _X_EXPORT Bool xf86GetOptValReal(const OptionInfoRec * table, int token,
double *value);
extern _X_EXPORT Bool xf86GetOptValFreq(const OptionInfoRec * table, int token,
OptFreqUnits expectedUnits,
double *value);
extern _X_EXPORT Bool xf86GetOptValBool(const OptionInfoRec * table, int token,
Bool *value);
extern _X_EXPORT Bool xf86ReturnOptValBool(const OptionInfoRec * table,
int token, Bool def);
extern _X_EXPORT int xf86NameCmp(const char *s1, const char *s2);
extern _X_EXPORT char *xf86NormalizeName(const char *s);
extern _X_EXPORT XF86OptionPtr xf86ReplaceIntOption(XF86OptionPtr optlist,
const char *name,
const int val);
extern _X_EXPORT XF86OptionPtr xf86ReplaceRealOption(XF86OptionPtr optlist,
const char *name,
const double val);
extern _X_EXPORT XF86OptionPtr xf86ReplaceBoolOption(XF86OptionPtr optlist,
const char *name,
const Bool val);
extern _X_EXPORT XF86OptionPtr xf86ReplacePercentOption(XF86OptionPtr optlist,
const char *name,
const double val);
extern _X_EXPORT XF86OptionPtr xf86ReplaceStrOption(XF86OptionPtr optlist,
const char *name,
const char *val);
#endif

View file

@ -1,923 +0,0 @@
/*
* Copyright (c) 1998-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* Author: David Dawes <dawes@xfree86.org>
*
* This file includes public option handling functions.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <stdlib.h>
#include <ctype.h>
#include <X11/X.h>
#include "os.h"
#include "xf86.h"
#include "xf86Opt.h"
#include "xf86Xinput.h"
#include "xf86Optrec.h"
#include "xf86Parser.h"
#include "xf86platformBus.h" /* For OutputClass functions */
#include "optionstr.h"
static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options,
OptionInfoPtr p, Bool markUsed);
/*
* xf86CollectOptions collects the options from each of the config file
* sections used by the screen and puts the combined list in pScrn->options.
* This function requires that the following have been initialised:
*
* pScrn->confScreen
* pScrn->Entities[i]->device
* pScrn->display
* pScrn->monitor
*
* The extraOpts parameter may optionally contain a list of additional options
* to include.
*
* The order of precedence for options is:
*
* extraOpts, display, confScreen, monitor, device, outputClassOptions
*/
void
xf86CollectOptions(ScrnInfoPtr pScrn, XF86OptionPtr extraOpts)
{
XF86OptionPtr tmp;
XF86OptionPtr extras = (XF86OptionPtr) extraOpts;
GDevPtr device;
int i;
pScrn->options = NULL;
for (i = pScrn->numEntities - 1; i >= 0; i--) {
xf86MergeOutputClassOptions(pScrn->entityList[i], &pScrn->options);
device = xf86GetDevFromEntity(pScrn->entityList[i],
pScrn->entityInstanceList[i]);
if (device && device->options) {
tmp = xf86optionListDup(device->options);
if (pScrn->options)
pScrn->options = xf86optionListMerge(pScrn->options, tmp);
else
pScrn->options = tmp;
}
}
if (pScrn->monitor->options) {
tmp = xf86optionListDup(pScrn->monitor->options);
if (pScrn->options)
pScrn->options = xf86optionListMerge(pScrn->options, tmp);
else
pScrn->options = tmp;
}
if (pScrn->confScreen->options) {
tmp = xf86optionListDup(pScrn->confScreen->options);
if (pScrn->options)
pScrn->options = xf86optionListMerge(pScrn->options, tmp);
else
pScrn->options = tmp;
}
if (pScrn->display->options) {
tmp = xf86optionListDup(pScrn->display->options);
if (pScrn->options)
pScrn->options = xf86optionListMerge(pScrn->options, tmp);
else
pScrn->options = tmp;
}
if (extras) {
tmp = xf86optionListDup(extras);
if (pScrn->options)
pScrn->options = xf86optionListMerge(pScrn->options, tmp);
else
pScrn->options = tmp;
}
}
/*
* xf86CollectInputOptions collects extra options for an InputDevice (other
* than those added by the config backend).
* The options are merged into the existing ones and thus take precedence
* over the others.
*/
void
xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts)
{
if (defaultOpts) {
XF86OptionPtr tmp = xf86optionListCreate(defaultOpts, -1, 0);
if (pInfo->options)
pInfo->options = xf86optionListMerge(tmp, pInfo->options);
else
pInfo->options = tmp;
}
}
/**
* Duplicate the option list passed in. The returned pointer will be a newly
* allocated option list and must be freed by the caller.
*/
XF86OptionPtr
xf86OptionListDuplicate(XF86OptionPtr options)
{
XF86OptionPtr o = NULL;
while (options) {
o = xf86AddNewOption(o, xf86OptionName(options),
xf86OptionValue(options));
options = xf86nextOption(options);
}
return o;
}
/* Created for new XInput stuff -- essentially extensions to the parser */
static int
LookupIntOption(XF86OptionPtr optlist, const char *name, int deflt,
Bool markUsed)
{
OptionInfoRec o;
o.name = name;
o.type = OPTV_INTEGER;
if (ParseOptionValue(-1, optlist, &o, markUsed))
deflt = o.value.num;
return deflt;
}
static double
LookupRealOption(XF86OptionPtr optlist, const char *name, double deflt,
Bool markUsed)
{
OptionInfoRec o;
o.name = name;
o.type = OPTV_REAL;
if (ParseOptionValue(-1, optlist, &o, markUsed))
deflt = o.value.realnum;
return deflt;
}
static char *
LookupStrOption(XF86OptionPtr optlist, const char *name, const char *deflt,
Bool markUsed)
{
OptionInfoRec o;
o.name = name;
o.type = OPTV_STRING;
if (ParseOptionValue(-1, optlist, &o, markUsed))
deflt = o.value.str;
if (deflt)
return strdup(deflt);
else
return NULL;
}
static int
LookupBoolOption(XF86OptionPtr optlist, const char *name, int deflt,
Bool markUsed)
{
OptionInfoRec o;
o.name = name;
o.type = OPTV_BOOLEAN;
if (ParseOptionValue(-1, optlist, &o, markUsed))
deflt = o.value.boolean;
return deflt;
}
static double
LookupPercentOption(XF86OptionPtr optlist, const char *name, double deflt,
Bool markUsed)
{
OptionInfoRec o;
o.name = name;
o.type = OPTV_PERCENT;
if (ParseOptionValue(-1, optlist, &o, markUsed))
deflt = o.value.realnum;
return deflt;
}
/* These xf86Set* functions are intended for use by non-screen specific code */
int
xf86SetIntOption(XF86OptionPtr optlist, const char *name, int deflt)
{
return LookupIntOption(optlist, name, deflt, TRUE);
}
double
xf86SetRealOption(XF86OptionPtr optlist, const char *name, double deflt)
{
return LookupRealOption(optlist, name, deflt, TRUE);
}
char *
xf86SetStrOption(XF86OptionPtr optlist, const char *name, const char *deflt)
{
return LookupStrOption(optlist, name, deflt, TRUE);
}
int
xf86SetBoolOption(XF86OptionPtr optlist, const char *name, int deflt)
{
return LookupBoolOption(optlist, name, deflt, TRUE);
}
double
xf86SetPercentOption(XF86OptionPtr optlist, const char *name, double deflt)
{
return LookupPercentOption(optlist, name, deflt, TRUE);
}
/*
* These are like the Set*Option functions, but they don't mark the options
* as used.
*/
int
xf86CheckIntOption(XF86OptionPtr optlist, const char *name, int deflt)
{
return LookupIntOption(optlist, name, deflt, FALSE);
}
double
xf86CheckRealOption(XF86OptionPtr optlist, const char *name, double deflt)
{
return LookupRealOption(optlist, name, deflt, FALSE);
}
char *
xf86CheckStrOption(XF86OptionPtr optlist, const char *name, const char *deflt)
{
return LookupStrOption(optlist, name, deflt, FALSE);
}
int
xf86CheckBoolOption(XF86OptionPtr optlist, const char *name, int deflt)
{
return LookupBoolOption(optlist, name, deflt, FALSE);
}
double
xf86CheckPercentOption(XF86OptionPtr optlist, const char *name, double deflt)
{
return LookupPercentOption(optlist, name, deflt, FALSE);
}
/*
* xf86AddNewOption() has the required property of replacing the option value
* if the option is already present.
*/
XF86OptionPtr
xf86ReplaceIntOption(XF86OptionPtr optlist, const char *name, const int val)
{
char tmp[16];
snprintf(tmp, sizeof(tmp), "%i", val);
return xf86AddNewOption(optlist, name, tmp);
}
XF86OptionPtr
xf86ReplaceRealOption(XF86OptionPtr optlist, const char *name, const double val)
{
char tmp[32];
snprintf(tmp, sizeof(tmp), "%f", val);
return xf86AddNewOption(optlist, name, tmp);
}
XF86OptionPtr
xf86ReplaceBoolOption(XF86OptionPtr optlist, const char *name, const Bool val)
{
return xf86AddNewOption(optlist, name, val ? "True" : "False");
}
XF86OptionPtr
xf86ReplacePercentOption(XF86OptionPtr optlist, const char *name,
const double val)
{
char tmp[16];
snprintf(tmp, sizeof(tmp), "%lf%%", val);
return xf86AddNewOption(optlist, name, tmp);
}
XF86OptionPtr
xf86ReplaceStrOption(XF86OptionPtr optlist, const char *name, const char *val)
{
return xf86AddNewOption(optlist, name, val);
}
XF86OptionPtr
xf86AddNewOption(XF86OptionPtr head, const char *name, const char *val)
{
/* XXX These should actually be allocated in the parser library. */
char *tmp = val ? strdup(val) : NULL;
char *tmp_name = strdup(name);
return xf86addNewOption(head, tmp_name, tmp);
}
XF86OptionPtr
xf86NewOption(char *name, char *value)
{
return xf86newOption(name, value);
}
XF86OptionPtr
xf86NextOption(XF86OptionPtr list)
{
return xf86nextOption(list);
}
XF86OptionPtr
xf86OptionListCreate(const char **options, int count, int used)
{
return xf86optionListCreate(options, count, used);
}
XF86OptionPtr
xf86OptionListMerge(XF86OptionPtr head, XF86OptionPtr tail)
{
return xf86optionListMerge(head, tail);
}
void
xf86OptionListFree(XF86OptionPtr opt)
{
xf86optionListFree(opt);
}
char *
xf86OptionName(XF86OptionPtr opt)
{
return xf86optionName(opt);
}
char *
xf86OptionValue(XF86OptionPtr opt)
{
return xf86optionValue(opt);
}
void
xf86OptionListReport(XF86OptionPtr parm)
{
XF86OptionPtr opts = parm;
while (opts) {
if (xf86optionValue(opts))
xf86ErrorFVerb(5, "\tOption \"%s\" \"%s\"\n",
xf86optionName(opts), xf86optionValue(opts));
else
xf86ErrorFVerb(5, "\tOption \"%s\"\n", xf86optionName(opts));
opts = xf86nextOption(opts);
}
}
/* End of XInput-caused section */
XF86OptionPtr
xf86FindOption(XF86OptionPtr options, const char *name)
{
return xf86findOption(options, name);
}
const char *
xf86FindOptionValue(XF86OptionPtr options, const char *name)
{
return xf86findOptionValue(options, name);
}
void
xf86MarkOptionUsed(XF86OptionPtr option)
{
if (option != NULL)
option->opt_used = TRUE;
}
void
xf86MarkOptionUsedByName(XF86OptionPtr options, const char *name)
{
XF86OptionPtr opt;
opt = xf86findOption(options, name);
if (opt != NULL)
opt->opt_used = TRUE;
}
Bool
xf86CheckIfOptionUsed(XF86OptionPtr option)
{
if (option != NULL)
return option->opt_used;
else
return FALSE;
}
Bool
xf86CheckIfOptionUsedByName(XF86OptionPtr options, const char *name)
{
XF86OptionPtr opt;
opt = xf86findOption(options, name);
if (opt != NULL)
return opt->opt_used;
else
return FALSE;
}
void
xf86ShowUnusedOptions(int scrnIndex, XF86OptionPtr opt)
{
while (opt) {
if (opt->opt_name && !opt->opt_used) {
xf86DrvMsg(scrnIndex, X_WARNING, "Option \"%s\" is not used\n",
opt->opt_name);
}
opt = opt->list.next;
}
}
static Bool
GetBoolValue(OptionInfoPtr p, const char *s)
{
return xf86getBoolValue(&p->value.boolean, s);
}
static Bool
ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p,
Bool markUsed)
{
const char *s;
char *end;
Bool wasUsed = FALSE;
if ((s = xf86findOptionValue(options, p->name)) != NULL) {
if (markUsed) {
wasUsed = xf86CheckIfOptionUsedByName(options, p->name);
xf86MarkOptionUsedByName(options, p->name);
}
switch (p->type) {
case OPTV_INTEGER:
if (*s == '\0') {
if (markUsed) {
xf86DrvMsg(scrnIndex, X_WARNING,
"Option \"%s\" requires an integer value\n",
p->name);
}
p->found = FALSE;
}
else {
p->value.num = strtoul(s, &end, 0);
if (*end == '\0') {
p->found = TRUE;
}
else {
if (markUsed) {
xf86DrvMsg(scrnIndex, X_WARNING,
"Option \"%s\" requires an integer value\n",
p->name);
}
p->found = FALSE;
}
}
break;
case OPTV_STRING:
if (*s == '\0') {
if (markUsed) {
xf86DrvMsg(scrnIndex, X_WARNING,
"Option \"%s\" requires a string value\n",
p->name);
}
p->found = FALSE;
}
else {
p->value.str = s;
p->found = TRUE;
}
break;
case OPTV_ANYSTR:
p->value.str = s;
p->found = TRUE;
break;
case OPTV_REAL:
if (*s == '\0') {
if (markUsed) {
xf86DrvMsg(scrnIndex, X_WARNING,
"Option \"%s\" requires a floating point "
"value\n", p->name);
}
p->found = FALSE;
}
else {
p->value.realnum = strtod(s, &end);
if (*end == '\0') {
p->found = TRUE;
}
else {
if (markUsed) {
xf86DrvMsg(scrnIndex, X_WARNING,
"Option \"%s\" requires a floating point "
"value\n", p->name);
}
p->found = FALSE;
}
}
break;
case OPTV_BOOLEAN:
if (GetBoolValue(p, s)) {
p->found = TRUE;
}
else {
if (markUsed) {
xf86DrvMsg(scrnIndex, X_WARNING,
"Option \"%s\" requires a boolean value\n",
p->name);
}
p->found = FALSE;
}
break;
case OPTV_PERCENT:
{
char tmp = 0;
/* awkward match, but %% doesn't increase the match counter,
* hence 100 looks the same as 100% to the caller of sccanf
*/
if (sscanf(s, "%lf%c", &p->value.realnum, &tmp) != 2 || tmp != '%') {
if (markUsed) {
xf86DrvMsg(scrnIndex, X_WARNING,
"Option \"%s\" requires a percent value\n",
p->name);
}
p->found = FALSE;
}
else {
p->found = TRUE;
}
}
break;
case OPTV_FREQ:
if (*s == '\0') {
if (markUsed) {
xf86DrvMsg(scrnIndex, X_WARNING,
"Option \"%s\" requires a frequency value\n",
p->name);
}
p->found = FALSE;
}
else {
double freq = strtod(s, &end);
int units = 0;
if (end != s) {
p->found = TRUE;
if (!xf86NameCmp(end, "Hz"))
units = 1;
else if (!xf86NameCmp(end, "kHz") || !xf86NameCmp(end, "k"))
units = 1000;
else if (!xf86NameCmp(end, "MHz") || !xf86NameCmp(end, "M"))
units = 1000000;
else {
if (markUsed) {
xf86DrvMsg(scrnIndex, X_WARNING,
"Option \"%s\" requires a frequency value\n",
p->name);
}
p->found = FALSE;
}
if (p->found)
freq *= (double) units;
}
else {
if (markUsed) {
xf86DrvMsg(scrnIndex, X_WARNING,
"Option \"%s\" requires a frequency value\n",
p->name);
}
p->found = FALSE;
}
if (p->found) {
p->value.freq.freq = freq;
p->value.freq.units = units;
}
}
break;
case OPTV_NONE:
/* Should never get here */
p->found = FALSE;
break;
}
if (p->found && markUsed) {
int verb = 2;
if (wasUsed)
verb = 4;
xf86DrvMsgVerb(scrnIndex, X_CONFIG, verb, "Option \"%s\"", p->name);
if (!(p->type == OPTV_BOOLEAN && *s == 0)) {
xf86ErrorFVerb(verb, " \"%s\"", s);
}
xf86ErrorFVerb(verb, "\n");
}
}
else if (p->type == OPTV_BOOLEAN) {
/* Look for matches with options with or without a "No" prefix. */
char *n, *newn;
OptionInfoRec opt;
n = xf86NormalizeName(p->name);
if (!n) {
p->found = FALSE;
return FALSE;
}
if (strncmp(n, "no", 2) == 0) {
newn = n + 2;
}
else {
free(n);
if (asprintf(&n, "No%s", p->name) == -1) {
p->found = FALSE;
return FALSE;
}
newn = n;
}
if ((s = xf86findOptionValue(options, newn)) != NULL) {
if (markUsed)
xf86MarkOptionUsedByName(options, newn);
if (GetBoolValue(&opt, s)) {
p->value.boolean = !opt.value.boolean;
p->found = TRUE;
}
else {
xf86DrvMsg(scrnIndex, X_WARNING,
"Option \"%s\" requires a boolean value\n", newn);
p->found = FALSE;
}
}
else {
p->found = FALSE;
}
if (p->found && markUsed) {
xf86DrvMsgVerb(scrnIndex, X_CONFIG, 2, "Option \"%s\"", newn);
if (*s != 0) {
xf86ErrorFVerb(2, " \"%s\"", s);
}
xf86ErrorFVerb(2, "\n");
}
free(n);
}
else {
p->found = FALSE;
}
return p->found;
}
void
xf86ProcessOptions(int scrnIndex, XF86OptionPtr options, OptionInfoPtr optinfo)
{
OptionInfoPtr p;
for (p = optinfo; p->name != NULL; p++) {
ParseOptionValue(scrnIndex, options, p, TRUE);
}
}
OptionInfoPtr
xf86TokenToOptinfo(const OptionInfoRec * table, int token)
{
const OptionInfoRec *p, *match = NULL, *set = NULL;
if (!table) {
ErrorF("xf86TokenToOptinfo: table is NULL\n");
return NULL;
}
for (p = table; p->token >= 0; p++) {
if (p->token == token) {
match = p;
if (p->found)
set = p;
}
}
if (set)
return (OptionInfoPtr) set;
else if (match)
return (OptionInfoPtr) match;
else
return NULL;
}
const char *
xf86TokenToOptName(const OptionInfoRec * table, int token)
{
const OptionInfoRec *p;
p = xf86TokenToOptinfo(table, token);
return p ? p->name : NULL;
}
Bool
xf86IsOptionSet(const OptionInfoRec * table, int token)
{
OptionInfoPtr p;
p = xf86TokenToOptinfo(table, token);
return p && p->found;
}
const char *
xf86GetOptValString(const OptionInfoRec * table, int token)
{
OptionInfoPtr p;
p = xf86TokenToOptinfo(table, token);
if (p && p->found)
return p->value.str;
else
return NULL;
}
Bool
xf86GetOptValInteger(const OptionInfoRec * table, int token, int *value)
{
OptionInfoPtr p;
p = xf86TokenToOptinfo(table, token);
if (p && p->found) {
*value = p->value.num;
return TRUE;
}
else
return FALSE;
}
Bool
xf86GetOptValULong(const OptionInfoRec * table, int token, unsigned long *value)
{
OptionInfoPtr p;
p = xf86TokenToOptinfo(table, token);
if (p && p->found) {
*value = p->value.num;
return TRUE;
}
else
return FALSE;
}
Bool
xf86GetOptValReal(const OptionInfoRec * table, int token, double *value)
{
OptionInfoPtr p;
p = xf86TokenToOptinfo(table, token);
if (p && p->found) {
*value = p->value.realnum;
return TRUE;
}
else
return FALSE;
}
Bool
xf86GetOptValFreq(const OptionInfoRec * table, int token,
OptFreqUnits expectedUnits, double *value)
{
OptionInfoPtr p;
p = xf86TokenToOptinfo(table, token);
if (p && p->found) {
if (p->value.freq.units > 0) {
/* Units give, so the scaling is known. */
switch (expectedUnits) {
case OPTUNITS_HZ:
*value = p->value.freq.freq;
break;
case OPTUNITS_KHZ:
*value = p->value.freq.freq / 1000.0;
break;
case OPTUNITS_MHZ:
*value = p->value.freq.freq / 1000000.0;
break;
}
}
else {
/* No units given, so try to guess the scaling. */
switch (expectedUnits) {
case OPTUNITS_HZ:
*value = p->value.freq.freq;
break;
case OPTUNITS_KHZ:
if (p->value.freq.freq > 1000.0)
*value = p->value.freq.freq / 1000.0;
else
*value = p->value.freq.freq;
break;
case OPTUNITS_MHZ:
if (p->value.freq.freq > 1000000.0)
*value = p->value.freq.freq / 1000000.0;
else if (p->value.freq.freq > 1000.0)
*value = p->value.freq.freq / 1000.0;
else
*value = p->value.freq.freq;
}
}
return TRUE;
}
else
return FALSE;
}
Bool
xf86GetOptValBool(const OptionInfoRec * table, int token, Bool *value)
{
OptionInfoPtr p;
p = xf86TokenToOptinfo(table, token);
if (p && p->found) {
*value = p->value.boolean;
return TRUE;
}
else
return FALSE;
}
Bool
xf86ReturnOptValBool(const OptionInfoRec * table, int token, Bool def)
{
OptionInfoPtr p;
p = xf86TokenToOptinfo(table, token);
if (p && p->found) {
return p->value.boolean;
}
else
return def;
}
int
xf86NameCmp(const char *s1, const char *s2)
{
return xf86nameCompare(s1, s2);
}
char *
xf86NormalizeName(const char *s)
{
char *ret, *q;
const char *p;
if (s == NULL)
return NULL;
ret = malloc(strlen(s) + 1);
for (p = s, q = ret; *p != 0; p++) {
switch (*p) {
case '_':
case ' ':
case '\t':
continue;
default:
if (isupper(*p))
*q++ = tolower(*p);
else
*q++ = *p;
}
}
*q = '\0';
return ret;
}

View file

@ -1,42 +0,0 @@
/*
* Copyright © 2011 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
#ifndef XF86OPTIONSTR_H
#define XF86OPTIONSTR_H
#include "list.h"
/*
* All options are stored using this data type.
*/
typedef struct _XF86OptionRec {
GenericListRec list;
const char *opt_name;
const char *opt_val;
int opt_used;
const char *opt_comment;
} XF86OptionRec;
typedef struct _InputOption *XF86OptionPtr;
#endif

View file

@ -1,234 +0,0 @@
/*
* Copyright (c) 2000-2002 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86Xinput.h"
#include "xf86_OSproc.h"
int (*xf86PMGetEventFromOs) (int fd, pmEvent * events, int num) = NULL;
pmWait (*xf86PMConfirmEventToOs) (int fd, pmEvent event) = NULL;
static Bool suspended = FALSE;
static int
eventName(pmEvent event, const char **str)
{
switch (event) {
case XF86_APM_SYS_STANDBY:
*str = "System Standby Request";
return 0;
case XF86_APM_SYS_SUSPEND:
*str = "System Suspend Request";
return 0;
case XF86_APM_CRITICAL_SUSPEND:
*str = "Critical Suspend";
return 0;
case XF86_APM_USER_STANDBY:
*str = "User System Standby Request";
return 0;
case XF86_APM_USER_SUSPEND:
*str = "User System Suspend Request";
return 0;
case XF86_APM_STANDBY_RESUME:
*str = "System Standby Resume";
return 0;
case XF86_APM_NORMAL_RESUME:
*str = "Normal Resume System";
return 0;
case XF86_APM_CRITICAL_RESUME:
*str = "Critical Resume System";
return 0;
case XF86_APM_LOW_BATTERY:
*str = "Battery Low";
return 3;
case XF86_APM_POWER_STATUS_CHANGE:
*str = "Power Status Change";
return 3;
case XF86_APM_UPDATE_TIME:
*str = "Update Time";
return 3;
case XF86_APM_CAPABILITY_CHANGED:
*str = "Capability Changed";
return 3;
case XF86_APM_STANDBY_FAILED:
*str = "Standby Request Failed";
return 0;
case XF86_APM_SUSPEND_FAILED:
*str = "Suspend Request Failed";
return 0;
default:
*str = "Unknown Event";
return 0;
}
}
static void
suspend(pmEvent event, Bool undo)
{
int i;
InputInfoPtr pInfo;
for (i = 0; i < xf86NumScreens; i++) {
if (xf86Screens[i]->EnableDisableFBAccess)
(*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], FALSE);
}
pInfo = xf86InputDevs;
while (pInfo) {
DisableDevice(pInfo->dev, TRUE);
pInfo = pInfo->next;
}
input_lock();
for (i = 0; i < xf86NumScreens; i++) {
if (xf86Screens[i]->PMEvent)
xf86Screens[i]->PMEvent(xf86Screens[i], event, undo);
else {
xf86Screens[i]->LeaveVT(xf86Screens[i]);
xf86Screens[i]->vtSema = FALSE;
}
}
}
static void
resume(pmEvent event, Bool undo)
{
int i;
InputInfoPtr pInfo;
for (i = 0; i < xf86NumScreens; i++) {
if (xf86Screens[i]->PMEvent)
xf86Screens[i]->PMEvent(xf86Screens[i], event, undo);
else {
xf86Screens[i]->vtSema = TRUE;
xf86Screens[i]->EnterVT(xf86Screens[i]);
}
}
input_unlock();
for (i = 0; i < xf86NumScreens; i++) {
if (xf86Screens[i]->EnableDisableFBAccess)
(*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE);
}
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
pInfo = xf86InputDevs;
while (pInfo) {
EnableDevice(pInfo->dev, TRUE);
pInfo = pInfo->next;
}
}
static void
DoApmEvent(pmEvent event, Bool undo)
{
int i;
switch (event) {
#if 0
case XF86_APM_SYS_STANDBY:
case XF86_APM_USER_STANDBY:
#endif
case XF86_APM_SYS_SUSPEND:
case XF86_APM_CRITICAL_SUSPEND: /*do we want to delay a critical suspend? */
case XF86_APM_USER_SUSPEND:
/* should we do this ? */
if (!undo && !suspended) {
suspend(event, undo);
suspended = TRUE;
}
else if (undo && suspended) {
resume(event, undo);
suspended = FALSE;
}
break;
#if 0
case XF86_APM_STANDBY_RESUME:
#endif
case XF86_APM_NORMAL_RESUME:
case XF86_APM_CRITICAL_RESUME:
if (suspended) {
resume(event, undo);
suspended = FALSE;
}
break;
default:
input_lock();
for (i = 0; i < xf86NumScreens; i++) {
if (xf86Screens[i]->PMEvent) {
xf86Screens[i]->PMEvent(xf86Screens[i], event, undo);
}
}
input_unlock();
break;
}
}
#define MAX_NO_EVENTS 8
void
xf86HandlePMEvents(int fd, void *data)
{
pmEvent events[MAX_NO_EVENTS];
int i, n;
Bool wait = FALSE;
if (!xf86PMGetEventFromOs)
return;
if ((n = xf86PMGetEventFromOs(fd, events, MAX_NO_EVENTS))) {
do {
for (i = 0; i < n; i++) {
const char *str = NULL;
int verb = eventName(events[i], &str);
xf86MsgVerb(X_INFO, verb, "PM Event received: %s\n", str);
DoApmEvent(events[i], FALSE);
switch (xf86PMConfirmEventToOs(fd, events[i])) {
case PM_WAIT:
wait = TRUE;
break;
case PM_CONTINUE:
wait = FALSE;
break;
case PM_FAILED:
DoApmEvent(events[i], TRUE);
wait = FALSE;
break;
default:
break;
}
}
if (wait)
n = xf86PMGetEventFromOs(fd, events, MAX_NO_EVENTS);
else
break;
} while (1);
}
}

View file

@ -1,732 +0,0 @@
/*
* Copyright (c) 1995-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains macros for the PCI Vendor and Device IDs for video
* cards plus a few other things that are needed in drivers or elsewhere.
* This information is used in several ways:
* 1. It is used by drivers and/or other code.
* 2. It is used by the pciid2c.pl script to determine what vendor data to
* include in the pcidata module that the X server loads.
* 3. A side-effect of 2. affects how config-generation works for
* otherwise "unknown" cards.
*
* Don't add entries here for vendors that don't make video cards,
* or for non-video devices unless they're needed by a driver or elsewhere.
* A comprehensive set of PCI vendor, device and subsystem data is
* auto-generated from the ../etc/pci.ids file using the pciids2c.pl script,
* and is used in scanpci utility. Don't modify the pci.ids file. If
* new/corrected entries are required, add them to ../etc/extrapci.ids.
*/
#ifndef _XF86_PCIINFO_H
#define _XF86_PCIINFO_H
#warning "xf86PciInfo.h is deprecated. For greater compatibility, drivers should include necessary PCI IDs locally rather than relying on this file from xorg-server."
/* PCI Pseudo Vendor */
#define PCI_VENDOR_GENERIC 0x00FF
#define PCI_VENDOR_REAL3D 0x003D
#define PCI_VENDOR_COMPAQ 0x0E11
#define PCI_VENDOR_ATI 0x1002
#define PCI_VENDOR_AVANCE 0x1005
#define PCI_VENDOR_TSENG 0x100C
#define PCI_VENDOR_NS 0x100B
#define PCI_VENDOR_WEITEK 0x100E
#define PCI_VENDOR_VIDEOLOGIC 0x1010
#define PCI_VENDOR_DIGITAL 0x1011
#define PCI_VENDOR_CIRRUS 0x1013
#define PCI_VENDOR_AMD 0x1022
#define PCI_VENDOR_TRIDENT 0x1023
#define PCI_VENDOR_ALI 0x1025
#define PCI_VENDOR_DELL 0x1028
#define PCI_VENDOR_MATROX 0x102B
#define PCI_VENDOR_CHIPSTECH 0x102C
#define PCI_VENDOR_MIRO 0x1031
#define PCI_VENDOR_NEC 0x1033
#define PCI_VENDOR_SIS 0x1039
#define PCI_VENDOR_HP 0x103C
#define PCI_VENDOR_SGS 0x104A
#define PCI_VENDOR_TI 0x104C
#define PCI_VENDOR_SONY 0x104D
#define PCI_VENDOR_OAK 0x104E
#define PCI_VENDOR_MOTOROLA 0x1057
#define PCI_VENDOR_NUMNINE 0x105D
#define PCI_VENDOR_CYRIX 0x1078
#define PCI_VENDOR_SUN 0x108E
#define PCI_VENDOR_DIAMOND 0x1092
#define PCI_VENDOR_BROOKTREE 0x109E
#define PCI_VENDOR_NEOMAGIC 0x10C8
#define PCI_VENDOR_NVIDIA 0x10DE
#define PCI_VENDOR_IMS 0x10E0
#define PCI_VENDOR_INTEGRAPHICS 0x10EA
#define PCI_VENDOR_ALLIANCE 0x1142
#define PCI_VENDOR_RENDITION 0x1163
#define PCI_VENDOR_3DFX 0x121A
#define PCI_VENDOR_SMI 0x126F
#define PCI_VENDOR_TRITECH 0x1292
#define PCI_VENDOR_NVIDIA_SGS 0x12D2
#define PCI_VENDOR_VMWARE 0x15AD
#define PCI_VENDOR_AST 0x1A03
#define PCI_VENDOR_3DLABS 0x3D3D
#define PCI_VENDOR_AVANCE_2 0x4005
#define PCI_VENDOR_HERCULES 0x4843
#define PCI_VENDOR_S3 0x5333
#define PCI_VENDOR_INTEL 0x8086
#define PCI_VENDOR_ARK 0xEDD8
/* Generic */
#define PCI_CHIP_VGA 0x0000
#define PCI_CHIP_8514 0x0001
/* Real 3D */
#define PCI_CHIP_I740_PCI 0x00D1
/* Compaq */
#define PCI_CHIP_QV1280 0x3033
/* ATI */
#define PCI_CHIP_RV380_3150 0x3150
#define PCI_CHIP_RV380_3151 0x3151
#define PCI_CHIP_RV380_3152 0x3152
#define PCI_CHIP_RV380_3153 0x3153
#define PCI_CHIP_RV380_3154 0x3154
#define PCI_CHIP_RV380_3156 0x3156
#define PCI_CHIP_RV380_3E50 0x3E50
#define PCI_CHIP_RV380_3E51 0x3E51
#define PCI_CHIP_RV380_3E52 0x3E52
#define PCI_CHIP_RV380_3E53 0x3E53
#define PCI_CHIP_RV380_3E54 0x3E54
#define PCI_CHIP_RV380_3E56 0x3E56
#define PCI_CHIP_RS100_4136 0x4136
#define PCI_CHIP_RS200_4137 0x4137
#define PCI_CHIP_R300_AD 0x4144
#define PCI_CHIP_R300_AE 0x4145
#define PCI_CHIP_R300_AF 0x4146
#define PCI_CHIP_R300_AG 0x4147
#define PCI_CHIP_R350_AH 0x4148
#define PCI_CHIP_R350_AI 0x4149
#define PCI_CHIP_R350_AJ 0x414A
#define PCI_CHIP_R350_AK 0x414B
#define PCI_CHIP_RV350_AP 0x4150
#define PCI_CHIP_RV350_AQ 0x4151
#define PCI_CHIP_RV360_AR 0x4152
#define PCI_CHIP_RV350_AS 0x4153
#define PCI_CHIP_RV350_AT 0x4154
#define PCI_CHIP_RV350_4155 0x4155
#define PCI_CHIP_RV350_AV 0x4156
#define PCI_CHIP_MACH32 0x4158
#define PCI_CHIP_RS250_4237 0x4237
#define PCI_CHIP_R200_BB 0x4242
#define PCI_CHIP_R200_BC 0x4243
#define PCI_CHIP_RS100_4336 0x4336
#define PCI_CHIP_RS200_4337 0x4337
#define PCI_CHIP_MACH64CT 0x4354
#define PCI_CHIP_MACH64CX 0x4358
#define PCI_CHIP_RS250_4437 0x4437
#define PCI_CHIP_MACH64ET 0x4554
#define PCI_CHIP_MACH64GB 0x4742
#define PCI_CHIP_MACH64GD 0x4744
#define PCI_CHIP_MACH64GI 0x4749
#define PCI_CHIP_MACH64GL 0x474C
#define PCI_CHIP_MACH64GM 0x474D
#define PCI_CHIP_MACH64GN 0x474E
#define PCI_CHIP_MACH64GO 0x474F
#define PCI_CHIP_MACH64GP 0x4750
#define PCI_CHIP_MACH64GQ 0x4751
#define PCI_CHIP_MACH64GR 0x4752
#define PCI_CHIP_MACH64GS 0x4753
#define PCI_CHIP_MACH64GT 0x4754
#define PCI_CHIP_MACH64GU 0x4755
#define PCI_CHIP_MACH64GV 0x4756
#define PCI_CHIP_MACH64GW 0x4757
#define PCI_CHIP_MACH64GX 0x4758
#define PCI_CHIP_MACH64GY 0x4759
#define PCI_CHIP_MACH64GZ 0x475A
#define PCI_CHIP_RV250_Id 0x4964
#define PCI_CHIP_RV250_Ie 0x4965
#define PCI_CHIP_RV250_If 0x4966
#define PCI_CHIP_RV250_Ig 0x4967
#define PCI_CHIP_R420_JH 0x4A48
#define PCI_CHIP_R420_JI 0x4A49
#define PCI_CHIP_R420_JJ 0x4A4A
#define PCI_CHIP_R420_JK 0x4A4B
#define PCI_CHIP_R420_JL 0x4A4C
#define PCI_CHIP_R420_JM 0x4A4D
#define PCI_CHIP_R420_JN 0x4A4E
#define PCI_CHIP_R420_4A4F 0x4A4F
#define PCI_CHIP_R420_JP 0x4A50
#define PCI_CHIP_R420_4A54 0x4A54
#define PCI_CHIP_R481_4B49 0x4B49
#define PCI_CHIP_R481_4B4A 0x4B4A
#define PCI_CHIP_R481_4B4B 0x4B4B
#define PCI_CHIP_R481_4B4C 0x4B4C
#define PCI_CHIP_MACH64LB 0x4C42
#define PCI_CHIP_MACH64LD 0x4C44
#define PCI_CHIP_RAGE128LE 0x4C45
#define PCI_CHIP_RAGE128LF 0x4C46
#define PCI_CHIP_MACH64LG 0x4C47
#define PCI_CHIP_MACH64LI 0x4C49
#define PCI_CHIP_MACH64LM 0x4C4D
#define PCI_CHIP_MACH64LN 0x4C4E
#define PCI_CHIP_MACH64LP 0x4C50
#define PCI_CHIP_MACH64LQ 0x4C51
#define PCI_CHIP_MACH64LR 0x4C52
#define PCI_CHIP_MACH64LS 0x4C53
#define PCI_CHIP_RADEON_LW 0x4C57
#define PCI_CHIP_RADEON_LX 0x4C58
#define PCI_CHIP_RADEON_LY 0x4C59
#define PCI_CHIP_RADEON_LZ 0x4C5A
#define PCI_CHIP_RV250_Ld 0x4C64
#define PCI_CHIP_RV250_Le 0x4C65
#define PCI_CHIP_RV250_Lf 0x4C66
#define PCI_CHIP_RV250_Lg 0x4C67
#define PCI_CHIP_RV250_Ln 0x4C6E
#define PCI_CHIP_RAGE128MF 0x4D46
#define PCI_CHIP_RAGE128ML 0x4D4C
#define PCI_CHIP_R300_ND 0x4E44
#define PCI_CHIP_R300_NE 0x4E45
#define PCI_CHIP_R300_NF 0x4E46
#define PCI_CHIP_R300_NG 0x4E47
#define PCI_CHIP_R350_NH 0x4E48
#define PCI_CHIP_R350_NI 0x4E49
#define PCI_CHIP_R360_NJ 0x4E4A
#define PCI_CHIP_R350_NK 0x4E4B
#define PCI_CHIP_RV350_NP 0x4E50
#define PCI_CHIP_RV350_NQ 0x4E51
#define PCI_CHIP_RV350_NR 0x4E52
#define PCI_CHIP_RV350_NS 0x4E53
#define PCI_CHIP_RV350_NT 0x4E54
#define PCI_CHIP_RV350_NV 0x4E56
#define PCI_CHIP_RAGE128PA 0x5041
#define PCI_CHIP_RAGE128PB 0x5042
#define PCI_CHIP_RAGE128PC 0x5043
#define PCI_CHIP_RAGE128PD 0x5044
#define PCI_CHIP_RAGE128PE 0x5045
#define PCI_CHIP_RAGE128PF 0x5046
#define PCI_CHIP_RAGE128PG 0x5047
#define PCI_CHIP_RAGE128PH 0x5048
#define PCI_CHIP_RAGE128PI 0x5049
#define PCI_CHIP_RAGE128PJ 0x504A
#define PCI_CHIP_RAGE128PK 0x504B
#define PCI_CHIP_RAGE128PL 0x504C
#define PCI_CHIP_RAGE128PM 0x504D
#define PCI_CHIP_RAGE128PN 0x504E
#define PCI_CHIP_RAGE128PO 0x504F
#define PCI_CHIP_RAGE128PP 0x5050
#define PCI_CHIP_RAGE128PQ 0x5051
#define PCI_CHIP_RAGE128PR 0x5052
#define PCI_CHIP_RAGE128PS 0x5053
#define PCI_CHIP_RAGE128PT 0x5054
#define PCI_CHIP_RAGE128PU 0x5055
#define PCI_CHIP_RAGE128PV 0x5056
#define PCI_CHIP_RAGE128PW 0x5057
#define PCI_CHIP_RAGE128PX 0x5058
#define PCI_CHIP_RADEON_QD 0x5144
#define PCI_CHIP_RADEON_QE 0x5145
#define PCI_CHIP_RADEON_QF 0x5146
#define PCI_CHIP_RADEON_QG 0x5147
#define PCI_CHIP_R200_QH 0x5148
#define PCI_CHIP_R200_QI 0x5149
#define PCI_CHIP_R200_QJ 0x514A
#define PCI_CHIP_R200_QK 0x514B
#define PCI_CHIP_R200_QL 0x514C
#define PCI_CHIP_R200_QM 0x514D
#define PCI_CHIP_R200_QN 0x514E
#define PCI_CHIP_R200_QO 0x514F
#define PCI_CHIP_RV200_QW 0x5157
#define PCI_CHIP_RV200_QX 0x5158
#define PCI_CHIP_RV100_QY 0x5159
#define PCI_CHIP_RV100_QZ 0x515A
#define PCI_CHIP_RN50_515E 0x515E
#define PCI_CHIP_RAGE128RE 0x5245
#define PCI_CHIP_RAGE128RF 0x5246
#define PCI_CHIP_RAGE128RG 0x5247
#define PCI_CHIP_RAGE128RK 0x524B
#define PCI_CHIP_RAGE128RL 0x524C
#define PCI_CHIP_RAGE128SE 0x5345
#define PCI_CHIP_RAGE128SF 0x5346
#define PCI_CHIP_RAGE128SG 0x5347
#define PCI_CHIP_RAGE128SH 0x5348
#define PCI_CHIP_RAGE128SK 0x534B
#define PCI_CHIP_RAGE128SL 0x534C
#define PCI_CHIP_RAGE128SM 0x534D
#define PCI_CHIP_RAGE128SN 0x534E
#define PCI_CHIP_RAGE128TF 0x5446
#define PCI_CHIP_RAGE128TL 0x544C
#define PCI_CHIP_RAGE128TR 0x5452
#define PCI_CHIP_RAGE128TS 0x5453
#define PCI_CHIP_RAGE128TT 0x5454
#define PCI_CHIP_RAGE128TU 0x5455
#define PCI_CHIP_RV370_5460 0x5460
#define PCI_CHIP_RV370_5461 0x5461
#define PCI_CHIP_RV370_5462 0x5462
#define PCI_CHIP_RV370_5463 0x5463
#define PCI_CHIP_RV370_5464 0x5464
#define PCI_CHIP_RV370_5465 0x5465
#define PCI_CHIP_RV370_5466 0x5466
#define PCI_CHIP_RV370_5467 0x5467
#define PCI_CHIP_R423_UH 0x5548
#define PCI_CHIP_R423_UI 0x5549
#define PCI_CHIP_R423_UJ 0x554A
#define PCI_CHIP_R423_UK 0x554B
#define PCI_CHIP_R430_554C 0x554C
#define PCI_CHIP_R430_554D 0x554D
#define PCI_CHIP_R430_554E 0x554E
#define PCI_CHIP_R430_554F 0x554F
#define PCI_CHIP_R423_5550 0x5550
#define PCI_CHIP_R423_UQ 0x5551
#define PCI_CHIP_R423_UR 0x5552
#define PCI_CHIP_R423_UT 0x5554
#define PCI_CHIP_RV410_564A 0x564A
#define PCI_CHIP_RV410_564B 0x564B
#define PCI_CHIP_RV410_564F 0x564F
#define PCI_CHIP_RV410_5652 0x5652
#define PCI_CHIP_RV410_5653 0x5653
#define PCI_CHIP_MACH64VT 0x5654
#define PCI_CHIP_MACH64VU 0x5655
#define PCI_CHIP_MACH64VV 0x5656
#define PCI_CHIP_RS300_5834 0x5834
#define PCI_CHIP_RS300_5835 0x5835
#define PCI_CHIP_RS300_5836 0x5836
#define PCI_CHIP_RS300_5837 0x5837
#define PCI_CHIP_RS480_5954 0x5954
#define PCI_CHIP_RS480_5955 0x5955
#define PCI_CHIP_RV280_5960 0x5960
#define PCI_CHIP_RV280_5961 0x5961
#define PCI_CHIP_RV280_5962 0x5962
#define PCI_CHIP_RV280_5964 0x5964
#define PCI_CHIP_RV280_5965 0x5965
#define PCI_CHIP_RN50_5969 0x5969
#define PCI_CHIP_RS482_5974 0x5974
#define PCI_CHIP_RS482_5975 0x5975
#define PCI_CHIP_RS400_5A41 0x5A41
#define PCI_CHIP_RS400_5A42 0x5A42
#define PCI_CHIP_RC410_5A61 0x5A61
#define PCI_CHIP_RC410_5A62 0x5A62
#define PCI_CHIP_RV370_5B60 0x5B60
#define PCI_CHIP_RV370_5B61 0x5B61
#define PCI_CHIP_RV370_5B62 0x5B62
#define PCI_CHIP_RV370_5B63 0x5B63
#define PCI_CHIP_RV370_5B64 0x5B64
#define PCI_CHIP_RV370_5B65 0x5B65
#define PCI_CHIP_RV370_5B66 0x5B66
#define PCI_CHIP_RV370_5B67 0x5B67
#define PCI_CHIP_RV280_5C61 0x5C61
#define PCI_CHIP_RV280_5C63 0x5C63
#define PCI_CHIP_R430_5D48 0x5D48
#define PCI_CHIP_R430_5D49 0x5D49
#define PCI_CHIP_R430_5D4A 0x5D4A
#define PCI_CHIP_R480_5D4C 0x5D4C
#define PCI_CHIP_R480_5D4D 0x5D4D
#define PCI_CHIP_R480_5D4E 0x5D4E
#define PCI_CHIP_R480_5D4F 0x5D4F
#define PCI_CHIP_R480_5D50 0x5D50
#define PCI_CHIP_R480_5D52 0x5D52
#define PCI_CHIP_R423_5D57 0x5D57
#define PCI_CHIP_RV410_5E48 0x5E48
#define PCI_CHIP_RV410_5E4A 0x5E4A
#define PCI_CHIP_RV410_5E4B 0x5E4B
#define PCI_CHIP_RV410_5E4C 0x5E4C
#define PCI_CHIP_RV410_5E4D 0x5E4D
#define PCI_CHIP_RV410_5E4F 0x5E4F
#define PCI_CHIP_RS350_7834 0x7834
#define PCI_CHIP_RS350_7835 0x7835
/* ASPEED Technology (AST) */
#define PCI_CHIP_AST2000 0x2000
/* Avance Logic */
#define PCI_CHIP_ALG2064 0x2064
#define PCI_CHIP_ALG2301 0x2301
#define PCI_CHIP_ALG2501 0x2501
/* Tseng */
#define PCI_CHIP_ET4000_W32P_A 0x3202
#define PCI_CHIP_ET4000_W32P_B 0x3205
#define PCI_CHIP_ET4000_W32P_D 0x3206
#define PCI_CHIP_ET4000_W32P_C 0x3207
#define PCI_CHIP_ET6000 0x3208
#define PCI_CHIP_ET6300 0x4702
/* Weitek */
#define PCI_CHIP_P9000 0x9001
#define PCI_CHIP_P9100 0x9100
/* Digital */
#define PCI_CHIP_DC21050 0x0001
#define PCI_CHIP_DEC21030 0x0004
#define PCI_CHIP_TGA2 0x000D
/* Cirrus Logic */
#define PCI_CHIP_GD7548 0x0038
#define PCI_CHIP_GD7555 0x0040
#define PCI_CHIP_GD5430 0x00A0
#define PCI_CHIP_GD5434_4 0x00A4
#define PCI_CHIP_GD5434_8 0x00A8
#define PCI_CHIP_GD5436 0x00AC
#define PCI_CHIP_GD5446 0x00B8
#define PCI_CHIP_GD5480 0x00BC
#define PCI_CHIP_GD5462 0x00D0
#define PCI_CHIP_GD5464 0x00D4
#define PCI_CHIP_GD5464BD 0x00D5
#define PCI_CHIP_GD5465 0x00D6
#define PCI_CHIP_6729 0x1100
#define PCI_CHIP_6832 0x1110
#define PCI_CHIP_GD7542 0x1200
#define PCI_CHIP_GD7543 0x1202
#define PCI_CHIP_GD7541 0x1204
/* AMD */
#define PCI_CHIP_AMD761 0x700E
/* Trident */
#define PCI_CHIP_2100 0x2100
#define PCI_CHIP_8400 0x8400
#define PCI_CHIP_8420 0x8420
#define PCI_CHIP_8500 0x8500
#define PCI_CHIP_8520 0x8520
#define PCI_CHIP_8600 0x8600
#define PCI_CHIP_8620 0x8620
#define PCI_CHIP_8820 0x8820
#define PCI_CHIP_9320 0x9320
#define PCI_CHIP_9388 0x9388
#define PCI_CHIP_9397 0x9397
#define PCI_CHIP_939A 0x939A
#define PCI_CHIP_9420 0x9420
#define PCI_CHIP_9440 0x9440
#define PCI_CHIP_9520 0x9520
#define PCI_CHIP_9525 0x9525
#define PCI_CHIP_9540 0x9540
#define PCI_CHIP_9660 0x9660
#define PCI_CHIP_9750 0x9750
#define PCI_CHIP_9850 0x9850
#define PCI_CHIP_9880 0x9880
#define PCI_CHIP_9910 0x9910
/* ALI */
#define PCI_CHIP_M1435 0x1435
/* Matrox */
#define PCI_CHIP_MGA2085 0x0518
#define PCI_CHIP_MGA2064 0x0519
#define PCI_CHIP_MGA1064 0x051A
#define PCI_CHIP_MGA2164 0x051B
#define PCI_CHIP_MGA2164_AGP 0x051F
#define PCI_CHIP_MGAG200_PCI 0x0520
#define PCI_CHIP_MGAG200 0x0521
#define PCI_CHIP_MGAG400 0x0525
#define PCI_CHIP_MGAG550 0x2527
#define PCI_CHIP_IMPRESSION 0x0D10
#define PCI_CHIP_MGAG100_PCI 0x1000
#define PCI_CHIP_MGAG100 0x1001
#define PCI_CARD_G400_TH 0x2179
#define PCI_CARD_MILL_G200_SD 0xFF00
#define PCI_CARD_PROD_G100_SD 0xFF01
#define PCI_CARD_MYST_G200_SD 0xFF02
#define PCI_CARD_MILL_G200_SG 0xFF03
#define PCI_CARD_MARV_G200_SD 0xFF04
/* Chips & Tech */
#define PCI_CHIP_65545 0x00D8
#define PCI_CHIP_65548 0x00DC
#define PCI_CHIP_65550 0x00E0
#define PCI_CHIP_65554 0x00E4
#define PCI_CHIP_65555 0x00E5
#define PCI_CHIP_68554 0x00F4
#define PCI_CHIP_69000 0x00C0
#define PCI_CHIP_69030 0x0C30
/* Miro */
#define PCI_CHIP_ZR36050 0x5601
/* NEC */
#define PCI_CHIP_POWER_VR 0x0046
/* SiS */
#define PCI_CHIP_SG86C201 0x0001
#define PCI_CHIP_SG86C202 0x0002
#define PCI_CHIP_SG85C503 0x0008
#define PCI_CHIP_SIS5597 0x0200
/* Agregado por Carlos Duclos & Manuel Jander */
#define PCI_CHIP_SIS82C204 0x0204
#define PCI_CHIP_SG86C205 0x0205
#define PCI_CHIP_SG86C215 0x0215
#define PCI_CHIP_SG86C225 0x0225
#define PCI_CHIP_85C501 0x0406
#define PCI_CHIP_85C496 0x0496
#define PCI_CHIP_85C601 0x0601
#define PCI_CHIP_85C5107 0x5107
#define PCI_CHIP_85C5511 0x5511
#define PCI_CHIP_85C5513 0x5513
#define PCI_CHIP_SIS5571 0x5571
#define PCI_CHIP_SIS5597_2 0x5597
#define PCI_CHIP_SIS530 0x6306
#define PCI_CHIP_SIS6326 0x6326
#define PCI_CHIP_SIS7001 0x7001
#define PCI_CHIP_SIS300 0x0300
#define PCI_CHIP_SIS315H 0x0310
#define PCI_CHIP_SIS315PRO 0x0325
#define PCI_CHIP_SIS330 0x0330
#define PCI_CHIP_SIS630 0x6300
#define PCI_CHIP_SIS540 0x5300
#define PCI_CHIP_SIS550 0x5315
#define PCI_CHIP_SIS650 0x6325
#define PCI_CHIP_SIS730 0x7300
/* Hewlett-Packard */
#define PCI_CHIP_ELROY 0x1054
#define PCI_CHIP_ZX1_SBA 0x1229
#define PCI_CHIP_ZX1_IOC 0x122A
#define PCI_CHIP_ZX1_LBA 0x122E /* a.k.a. Mercury */
#define PCI_CHIP_ZX1_AGP8 0x12B4 /* a.k.a. QuickSilver */
#define PCI_CHIP_ZX2_LBA 0x12EE
#define PCI_CHIP_ZX2_SBA 0x4030
#define PCI_CHIP_ZX2_IOC 0x4031
#define PCI_CHIP_ZX2_PCIE 0x4037
/* SGS */
#define PCI_CHIP_STG2000 0x0008
#define PCI_CHIP_STG1764 0x0009
#define PCI_CHIP_KYROII 0x0010
/* Texas Instruments */
#define PCI_CHIP_TI_PERMEDIA 0x3D04
#define PCI_CHIP_TI_PERMEDIA2 0x3D07
/* Oak */
#define PCI_CHIP_OTI107 0x0107
/* Number Nine */
#define PCI_CHIP_I128 0x2309
#define PCI_CHIP_I128_2 0x2339
#define PCI_CHIP_I128_T2R 0x493D
#define PCI_CHIP_I128_T2R4 0x5348
/* Sun */
#define PCI_CHIP_EBUS 0x1000
#define PCI_CHIP_HAPPY_MEAL 0x1001
#define PCI_CHIP_SIMBA 0x5000
#define PCI_CHIP_PSYCHO 0x8000
#define PCI_CHIP_SCHIZO 0x8001
#define PCI_CHIP_SABRE 0xA000
#define PCI_CHIP_HUMMINGBIRD 0xA001
/* BrookTree */
#define PCI_CHIP_BT848 0x0350
#define PCI_CHIP_BT849 0x0351
/* NVIDIA */
#define PCI_CHIP_NV1 0x0008
#define PCI_CHIP_DAC64 0x0009
#define PCI_CHIP_TNT 0x0020
#define PCI_CHIP_TNT2 0x0028
#define PCI_CHIP_UTNT2 0x0029
#define PCI_CHIP_VTNT2 0x002C
#define PCI_CHIP_UVTNT2 0x002D
#define PCI_CHIP_ITNT2 0x00A0
#define PCI_CHIP_GEFORCE_256 0x0100
#define PCI_CHIP_GEFORCE_DDR 0x0101
#define PCI_CHIP_QUADRO 0x0103
#define PCI_CHIP_GEFORCE2_MX 0x0110
#define PCI_CHIP_GEFORCE2_MX_100 0x0111
#define PCI_CHIP_GEFORCE2_GO 0x0112
#define PCI_CHIP_QUADRO2_MXR 0x0113
#define PCI_CHIP_GEFORCE2_GTS 0x0150
#define PCI_CHIP_GEFORCE2_TI 0x0151
#define PCI_CHIP_GEFORCE2_ULTRA 0x0152
#define PCI_CHIP_QUADRO2_PRO 0x0153
#define PCI_CHIP_GEFORCE4_MX_460 0x0170
#define PCI_CHIP_GEFORCE4_MX_440 0x0171
#define PCI_CHIP_GEFORCE4_MX_420 0x0172
#define PCI_CHIP_GEFORCE4_440_GO 0x0174
#define PCI_CHIP_GEFORCE4_420_GO 0x0175
#define PCI_CHIP_GEFORCE4_420_GO_M32 0x0176
#define PCI_CHIP_QUADRO4_500XGL 0x0178
#define PCI_CHIP_GEFORCE4_440_GO_M64 0x0179
#define PCI_CHIP_QUADRO4_200 0x017A
#define PCI_CHIP_QUADRO4_550XGL 0x017B
#define PCI_CHIP_QUADRO4_500_GOGL 0x017C
#define PCI_CHIP_IGEFORCE2 0x01A0
#define PCI_CHIP_GEFORCE3 0x0200
#define PCI_CHIP_GEFORCE3_TI_200 0x0201
#define PCI_CHIP_GEFORCE3_TI_500 0x0202
#define PCI_CHIP_QUADRO_DCC 0x0203
#define PCI_CHIP_GEFORCE4_TI_4600 0x0250
#define PCI_CHIP_GEFORCE4_TI_4400 0x0251
#define PCI_CHIP_GEFORCE4_TI_4200 0x0253
#define PCI_CHIP_QUADRO4_900XGL 0x0258
#define PCI_CHIP_QUADRO4_750XGL 0x0259
#define PCI_CHIP_QUADRO4_700XGL 0x025B
/* NVIDIA & SGS */
#define PCI_CHIP_RIVA128 0x0018
/* IMS */
#define PCI_CHIP_IMSTT128 0x9128
#define PCI_CHIP_IMSTT3D 0x9135
/* Alliance Semiconductor */
#define PCI_CHIP_AP6410 0x3210
#define PCI_CHIP_AP6422 0x6422
#define PCI_CHIP_AT24 0x6424
#define PCI_CHIP_AT3D 0x643D
/* 3dfx Interactive */
#define PCI_CHIP_VOODOO_GRAPHICS 0x0001
#define PCI_CHIP_VOODOO2 0x0002
#define PCI_CHIP_BANSHEE 0x0003
#define PCI_CHIP_VOODOO3 0x0005
#define PCI_CHIP_VOODOO5 0x0009
#define PCI_CARD_VOODOO3_2000 0x0036
#define PCI_CARD_VOODOO3_3000 0x003A
/* Rendition */
#define PCI_CHIP_V1000 0x0001
#define PCI_CHIP_V2x00 0x2000
/* 3Dlabs */
#define PCI_CHIP_300SX 0x0001
#define PCI_CHIP_500TX 0x0002
#define PCI_CHIP_DELTA 0x0003
#define PCI_CHIP_PERMEDIA 0x0004
#define PCI_CHIP_MX 0x0006
#define PCI_CHIP_PERMEDIA2 0x0007
#define PCI_CHIP_GAMMA 0x0008
#define PCI_CHIP_PERMEDIA2V 0x0009
#define PCI_CHIP_PERMEDIA3 0x000A
#define PCI_CHIP_PERMEDIA4 0x000C
#define PCI_CHIP_R4 0x000D
#define PCI_CHIP_GAMMA2 0x000E
#define PCI_CHIP_R4ALT 0x0011
/* S3 */
#define PCI_CHIP_PLATO 0x0551
#define PCI_CHIP_VIRGE 0x5631
#define PCI_CHIP_TRIO 0x8811
#define PCI_CHIP_AURORA64VP 0x8812
#define PCI_CHIP_TRIO64UVP 0x8814
#define PCI_CHIP_VIRGE_VX 0x883D
#define PCI_CHIP_868 0x8880
#define PCI_CHIP_928 0x88B0
#define PCI_CHIP_864_0 0x88C0
#define PCI_CHIP_864_1 0x88C1
#define PCI_CHIP_964_0 0x88D0
#define PCI_CHIP_964_1 0x88D1
#define PCI_CHIP_968 0x88F0
#define PCI_CHIP_TRIO64V2_DXGX 0x8901
#define PCI_CHIP_PLATO_PX 0x8902
#define PCI_CHIP_Trio3D 0x8904
#define PCI_CHIP_VIRGE_DXGX 0x8A01
#define PCI_CHIP_VIRGE_GX2 0x8A10
#define PCI_CHIP_Trio3D_2X 0x8A13
#define PCI_CHIP_SAVAGE3D 0x8A20
#define PCI_CHIP_SAVAGE3D_MV 0x8A21
#define PCI_CHIP_SAVAGE4 0x8A22
#define PCI_CHIP_PROSAVAGE_PM 0x8A25
#define PCI_CHIP_PROSAVAGE_KM 0x8A26
#define PCI_CHIP_VIRGE_MX 0x8C01
#define PCI_CHIP_VIRGE_MXPLUS 0x8C02
#define PCI_CHIP_VIRGE_MXP 0x8C03
#define PCI_CHIP_SAVAGE_MX_MV 0x8C10
#define PCI_CHIP_SAVAGE_MX 0x8C11
#define PCI_CHIP_SAVAGE_IX_MV 0x8C12
#define PCI_CHIP_SAVAGE_IX 0x8C13
#define PCI_CHIP_SUPSAV_MX128 0x8C22
#define PCI_CHIP_SUPSAV_MX64 0x8C24
#define PCI_CHIP_SUPSAV_MX64C 0x8C26
#define PCI_CHIP_SUPSAV_IX128SDR 0x8C2A
#define PCI_CHIP_SUPSAV_IX128DDR 0x8C2B
#define PCI_CHIP_SUPSAV_IX64SDR 0x8C2C
#define PCI_CHIP_SUPSAV_IX64DDR 0x8C2D
#define PCI_CHIP_SUPSAV_IXCSDR 0x8C2E
#define PCI_CHIP_SUPSAV_IXCDDR 0x8C2F
#define PCI_CHIP_S3TWISTER_P 0x8D01
#define PCI_CHIP_S3TWISTER_K 0x8D02
#define PCI_CHIP_PROSAVAGE_DDR 0x8D03
#define PCI_CHIP_PROSAVAGE_DDRK 0x8D04
#define PCI_CHIP_SAVAGE2000 0x9102
/* ARK Logic */
#define PCI_CHIP_1000PV 0xA091
#define PCI_CHIP_2000PV 0xA099
#define PCI_CHIP_2000MT 0xA0A1
#define PCI_CHIP_2000MI 0xA0A9
/* Tritech Microelectronics */
#define PCI_CHIP_TR25202 0xFC02
/* Neomagic */
#define PCI_CHIP_NM2070 0x0001
#define PCI_CHIP_NM2090 0x0002
#define PCI_CHIP_NM2093 0x0003
#define PCI_CHIP_NM2097 0x0083
#define PCI_CHIP_NM2160 0x0004
#define PCI_CHIP_NM2200 0x0005
#define PCI_CHIP_NM2230 0x0025
#define PCI_CHIP_NM2360 0x0006
#define PCI_CHIP_NM2380 0x0016
/* Intel */
#define PCI_CHIP_I815_BRIDGE 0x1130
#define PCI_CHIP_I815 0x1132
#define PCI_CHIP_82801_P2P 0x244E
#define PCI_CHIP_845_G_BRIDGE 0x2560
#define PCI_CHIP_845_G 0x2562
#define PCI_CHIP_I830_M_BRIDGE 0x3575
#define PCI_CHIP_I830_M 0x3577
#define PCI_CHIP_I810_BRIDGE 0x7120
#define PCI_CHIP_I810 0x7121
#define PCI_CHIP_I810_DC100_BRIDGE 0x7122
#define PCI_CHIP_I810_DC100 0x7123
#define PCI_CHIP_I810_E_BRIDGE 0x7124
#define PCI_CHIP_I810_E 0x7125
#define PCI_CHIP_I740_AGP 0x7800
#define PCI_CHIP_460GX_PXB 0x84CB
#define PCI_CHIP_460GX_SAC 0x84E0
#define PCI_CHIP_460GX_GXB_2 0x84E2 /* PCI function 2 */
#define PCI_CHIP_460GX_WXB 0x84E6
#define PCI_CHIP_460GX_GXB_1 0x84EA /* PCI function 1 */
/* Silicon Motion Inc. */
#define PCI_CHIP_SMI910 0x0910
#define PCI_CHIP_SMI810 0x0810
#define PCI_CHIP_SMI820 0x0820
#define PCI_CHIP_SMI710 0x0710
#define PCI_CHIP_SMI712 0x0712
#define PCI_CHIP_SMI720 0x0720
#define PCI_CHIP_SMI731 0x0730
/* VMware */
#define PCI_CHIP_VMWARE0405 0x0405
#define PCI_CHIP_VMWARE0710 0x0710
#endif /* _XF86_PCIINFO_H */

View file

@ -1,166 +0,0 @@
/*
* Copyright (c) 1997-2002 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains declarations for private XFree86 functions and variables,
* and definitions of private macros.
*
* "private" means not available to video drivers.
*/
#ifndef _XF86PRIV_H
#define _XF86PRIV_H
#include "xf86Privstr.h"
#include "propertyst.h"
#include "input.h"
/*
* Parameters set ONLY from the command line options
* The global state of these things is held in xf86InfoRec (when appropriate).
*/
extern _X_EXPORT const char *xf86ConfigFile;
extern _X_EXPORT const char *xf86ConfigDir;
extern _X_EXPORT Bool xf86AllowMouseOpenFail;
extern _X_EXPORT Bool xf86AutoBindGPUDisabled;
#ifdef XF86VIDMODE
extern _X_EXPORT Bool xf86VidModeDisabled;
extern _X_EXPORT Bool xf86VidModeAllowNonLocal;
#endif
extern _X_EXPORT Bool xf86fpFlag;
extern _X_EXPORT Bool xf86sFlag;
extern _X_EXPORT Bool xf86bsEnableFlag;
extern _X_EXPORT Bool xf86bsDisableFlag;
extern _X_EXPORT Bool xf86silkenMouseDisableFlag;
extern _X_EXPORT Bool xf86xkbdirFlag;
#ifdef HAVE_ACPI
extern _X_EXPORT Bool xf86acpiDisableFlag;
#endif
extern _X_EXPORT char *xf86LayoutName;
extern _X_EXPORT char *xf86ScreenName;
extern _X_EXPORT char *xf86PointerName;
extern _X_EXPORT char *xf86KeyboardName;
extern _X_EXPORT int xf86FbBpp;
extern _X_EXPORT int xf86Depth;
extern _X_EXPORT rgb xf86Weight;
extern _X_EXPORT Gamma xf86Gamma;
/* Other parameters */
extern _X_EXPORT xf86InfoRec xf86Info;
extern _X_EXPORT const char *xf86ModulePath;
extern _X_EXPORT MessageType xf86ModPathFrom;
extern _X_EXPORT const char *xf86LogFile;
extern _X_EXPORT MessageType xf86LogFileFrom;
extern _X_EXPORT Bool xf86LogFileWasOpened;
extern _X_EXPORT serverLayoutRec xf86ConfigLayout;
extern _X_EXPORT DriverPtr *xf86DriverList;
extern _X_EXPORT int xf86NumDrivers;
extern _X_EXPORT Bool xf86Resetting;
extern Bool xf86Initialising;
extern _X_EXPORT int xf86NumScreens;
extern _X_EXPORT const char *xf86VisualNames[];
extern _X_EXPORT int xf86Verbose; /* verbosity level */
extern _X_EXPORT int xf86LogVerbose; /* log file verbosity level */
extern _X_EXPORT ScrnInfoPtr *xf86GPUScreens; /* List of pointers to ScrnInfoRecs */
extern _X_EXPORT int xf86NumGPUScreens;
extern _X_EXPORT int xf86DRMMasterFd; /* Command line argument for DRM master file descriptor */
#ifndef DEFAULT_VERBOSE
#define DEFAULT_VERBOSE 0
#endif
#ifndef DEFAULT_LOG_VERBOSE
#define DEFAULT_LOG_VERBOSE 3
#endif
#ifndef DEFAULT_DPI
#define DEFAULT_DPI 96
#endif
/* Function Prototypes */
#ifndef _NO_XF86_PROTOTYPES
/* xf86Bus.c */
extern _X_EXPORT Bool xf86BusConfig(void);
extern _X_EXPORT void xf86BusProbe(void);
extern _X_EXPORT void xf86PostProbe(void);
extern _X_EXPORT void xf86ClearEntityListForScreen(ScrnInfoPtr pScrn);
extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev);
extern _X_EXPORT void xf86RemoveDevFromEntity(int entityIndex, GDevPtr dev);
/* xf86Config.c */
extern _X_EXPORT Bool xf86PathIsSafe(const char *path);
/* xf86DefaultModes */
extern _X_EXPORT const DisplayModeRec xf86DefaultModes[];
extern _X_EXPORT const int xf86NumDefaultModes;
/* xf86Configure.c */
extern _X_EXPORT void
DoConfigure(void)
_X_NORETURN;
extern _X_EXPORT void
DoShowOptions(void)
_X_NORETURN;
/* xf86Events.c */
extern _X_EXPORT void
xf86Wakeup(void *blockData, int err);
extern _X_EXPORT void
xf86HandlePMEvents(int fd, void *data);
extern _X_EXPORT int (*xf86PMGetEventFromOs) (int fd, pmEvent * events,
int num);
extern _X_EXPORT pmWait (*xf86PMConfirmEventToOs) (int fd, pmEvent event);
/* xf86Helper.c */
extern _X_EXPORT void
xf86LogInit(void);
extern _X_EXPORT void
xf86CloseLog(enum ExitCode error);
/* xf86Init.c */
extern _X_EXPORT Bool
xf86LoadModules(const char **list, void **optlist);
extern _X_EXPORT int
xf86SetVerbosity(int verb);
extern _X_EXPORT int
xf86SetLogVerbosity(int verb);
extern _X_EXPORT Bool
xf86CallDriverProbe(struct _DriverRec *drv, Bool detect_only);
extern _X_EXPORT Bool
xf86PrivsElevated(void);
extern _X_EXPORT Bool
xf86HasTTYs(void);
#endif /* _NO_XF86_PROTOTYPES */
#endif /* _XF86PRIV_H */

View file

@ -1,126 +0,0 @@
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains definitions of the private XFree86 data structures/types.
* None of the data structures here should be used by video drivers.
*/
#ifndef _XF86PRIVSTR_H
#define _XF86PRIVSTR_H
#include "xf86str.h"
typedef enum {
XF86_GlxVisualsMinimal,
XF86_GlxVisualsTypical,
XF86_GlxVisualsAll,
} XF86_GlxVisuals;
/*
* xf86InfoRec contains global parameters which the video drivers never
* need to access. Global parameters which the video drivers do need
* should be individual globals.
*/
typedef struct {
int consoleFd;
int vtno;
/* event handler part */
int lastEventTime;
Bool vtRequestsPending;
#ifdef __sun
int vtPendingNum;
#endif
Bool dontVTSwitch;
Bool autoVTSwitch;
Bool ShareVTs;
Bool dontZap;
Bool dontZoom;
/* graphics part */
ScreenPtr currentScreen;
#if defined(CSRG_BASED) || defined(__FreeBSD_kernel__)
int consType; /* Which console driver? */
#endif
/* Other things */
Bool allowMouseOpenFail;
Bool vidModeEnabled; /* VidMode extension enabled */
Bool vidModeAllowNonLocal; /* allow non-local VidMode
* connections */
Bool miscModInDevEnabled; /* Allow input devices to be
* changed */
Bool miscModInDevAllowNonLocal;
Bool pmFlag;
MessageType iglxFrom;
XF86_GlxVisuals glxVisuals;
MessageType glxVisualsFrom;
Bool useDefaultFontPath;
Bool ignoreABI;
Bool forceInputDevices; /* force xorg.conf or built-in input devices */
Bool autoAddDevices; /* Whether to succeed NIDR, or ignore. */
Bool autoEnableDevices; /* Whether to enable, or let the client
* control. */
Bool dri2;
MessageType dri2From;
Bool autoAddGPU;
const char *debug;
Bool autoBindGPU;
} xf86InfoRec, *xf86InfoPtr;
/* ISC's cc can't handle ~ of UL constants, so explicitly type cast them. */
#define XLED1 ((unsigned long) 0x00000001)
#define XLED2 ((unsigned long) 0x00000002)
#define XLED3 ((unsigned long) 0x00000004)
#define XLED4 ((unsigned long) 0x00000008)
#define XCAPS ((unsigned long) 0x20000000)
#define XNUM ((unsigned long) 0x40000000)
#define XSCR ((unsigned long) 0x80000000)
#define XCOMP ((unsigned long) 0x00008000)
/* BSD console driver types (consType) */
#if defined(CSRG_BASED) || defined(__FreeBSD_kernel__)
#define PCCONS 0
#define CODRV011 1
#define CODRV01X 2
#define SYSCONS 8
#define PCVT 16
#define WSCONS 32
#endif
/* Root window property to tell clients whether our VT is currently active.
* Name chosen to match the "XFree86_VT" property. */
#define HAS_VT_ATOM_NAME "XFree86_has_VT"
#endif /* _XF86PRIVSTR_H */

View file

@ -1,444 +0,0 @@
/*
*
* Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include "os.h"
#include "globals.h"
#include "xf86.h"
#include "xf86str.h"
#include "xf86Priv.h"
#include "xf86DDC.h"
#include "mipointer.h"
#include <randrstr.h>
#include "inputstr.h"
typedef struct _xf86RandRInfo {
CloseScreenProcPtr CloseScreen;
int virtualX;
int virtualY;
int mmWidth;
int mmHeight;
Rotation rotation;
} XF86RandRInfoRec, *XF86RandRInfoPtr;
static DevPrivateKeyRec xf86RandRKeyRec;
static DevPrivateKey xf86RandRKey;
#define XF86RANDRINFO(p) ((XF86RandRInfoPtr)dixLookupPrivate(&(p)->devPrivates, xf86RandRKey))
static int
xf86RandRModeRefresh(DisplayModePtr mode)
{
if (mode->VRefresh)
return (int) (mode->VRefresh + 0.5);
else if (mode->Clock == 0)
return 0;
else
return (int) (mode->Clock * 1000.0 / mode->HTotal / mode->VTotal + 0.5);
}
static Bool
xf86RandRGetInfo(ScreenPtr pScreen, Rotation * rotations)
{
RRScreenSizePtr pSize;
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode;
int refresh0 = 60;
xorgRRModeMM RRModeMM;
*rotations = RR_Rotate_0;
for (mode = scrp->modes; mode != NULL; mode = mode->next) {
int refresh = xf86RandRModeRefresh(mode);
if (mode == scrp->modes)
refresh0 = refresh;
RRModeMM.mode = mode;
RRModeMM.virtX = randrp->virtualX;
RRModeMM.virtY = randrp->virtualY;
RRModeMM.mmWidth = randrp->mmWidth;
RRModeMM.mmHeight = randrp->mmHeight;
if (scrp->DriverFunc) {
(*scrp->DriverFunc) (scrp, RR_GET_MODE_MM, &RRModeMM);
}
pSize = RRRegisterSize(pScreen,
mode->HDisplay, mode->VDisplay,
RRModeMM.mmWidth, RRModeMM.mmHeight);
if (!pSize)
return FALSE;
RRRegisterRate(pScreen, pSize, refresh);
if (mode == scrp->currentMode &&
mode->HDisplay == scrp->virtualX &&
mode->VDisplay == scrp->virtualY)
RRSetCurrentConfig(pScreen, randrp->rotation, refresh, pSize);
if (mode->next == scrp->modes)
break;
}
if (scrp->currentMode->HDisplay != randrp->virtualX ||
scrp->currentMode->VDisplay != randrp->virtualY) {
mode = scrp->modes;
RRModeMM.mode = NULL;
RRModeMM.virtX = randrp->virtualX;
RRModeMM.virtY = randrp->virtualY;
RRModeMM.mmWidth = randrp->mmWidth;
RRModeMM.mmHeight = randrp->mmHeight;
if (scrp->DriverFunc) {
(*scrp->DriverFunc) (scrp, RR_GET_MODE_MM, &RRModeMM);
}
pSize = RRRegisterSize(pScreen,
randrp->virtualX, randrp->virtualY,
RRModeMM.mmWidth, RRModeMM.mmHeight);
if (!pSize)
return FALSE;
RRRegisterRate(pScreen, pSize, refresh0);
if (scrp->virtualX == randrp->virtualX &&
scrp->virtualY == randrp->virtualY) {
RRSetCurrentConfig(pScreen, randrp->rotation, refresh0, pSize);
}
}
/* If there is driver support for randr, let it set our supported rotations */
if (scrp->DriverFunc) {
xorgRRRotation RRRotation;
RRRotation.RRRotations = *rotations;
if (!(*scrp->DriverFunc) (scrp, RR_GET_INFO, &RRRotation))
return TRUE;
*rotations = RRRotation.RRRotations;
}
return TRUE;
}
static Bool
xf86RandRSetMode(ScreenPtr pScreen,
DisplayModePtr mode,
Bool useVirtual, int mmWidth, int mmHeight)
{
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
int oldWidth = pScreen->width;
int oldHeight = pScreen->height;
int oldmmWidth = pScreen->mmWidth;
int oldmmHeight = pScreen->mmHeight;
int oldVirtualX = scrp->virtualX;
int oldVirtualY = scrp->virtualY;
WindowPtr pRoot = pScreen->root;
Bool ret = TRUE;
if (pRoot && scrp->vtSema)
(*scrp->EnableDisableFBAccess) (scrp, FALSE);
if (useVirtual) {
scrp->virtualX = randrp->virtualX;
scrp->virtualY = randrp->virtualY;
}
else {
scrp->virtualX = mode->HDisplay;
scrp->virtualY = mode->VDisplay;
}
/*
* The DIX forgets the physical dimensions we passed into RRRegisterSize, so
* reconstruct them if possible.
*/
if (scrp->DriverFunc) {
xorgRRModeMM RRModeMM;
RRModeMM.mode = mode;
RRModeMM.virtX = scrp->virtualX;
RRModeMM.virtY = scrp->virtualY;
RRModeMM.mmWidth = mmWidth;
RRModeMM.mmHeight = mmHeight;
(*scrp->DriverFunc) (scrp, RR_GET_MODE_MM, &RRModeMM);
mmWidth = RRModeMM.mmWidth;
mmHeight = RRModeMM.mmHeight;
}
if (randrp->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
/* If the screen is rotated 90 or 270 degrees, swap the sizes. */
pScreen->width = scrp->virtualY;
pScreen->height = scrp->virtualX;
pScreen->mmWidth = mmHeight;
pScreen->mmHeight = mmWidth;
}
else {
pScreen->width = scrp->virtualX;
pScreen->height = scrp->virtualY;
pScreen->mmWidth = mmWidth;
pScreen->mmHeight = mmHeight;
}
if (!xf86SwitchMode(pScreen, mode)) {
pScreen->width = oldWidth;
pScreen->height = oldHeight;
pScreen->mmWidth = oldmmWidth;
pScreen->mmHeight = oldmmHeight;
scrp->virtualX = oldVirtualX;
scrp->virtualY = oldVirtualY;
ret = FALSE;
}
/*
* Make sure the layout is correct
*/
xf86ReconfigureLayout();
if (scrp->vtSema) {
/*
* Make sure the whole screen is visible
*/
xf86SetViewport (pScreen, pScreen->width, pScreen->height);
xf86SetViewport (pScreen, 0, 0);
if (pRoot)
(*scrp->EnableDisableFBAccess) (scrp, TRUE);
}
return ret;
}
static Bool
xf86RandRSetConfig(ScreenPtr pScreen,
Rotation rotation, int rate, RRScreenSizePtr pSize)
{
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode;
int pos[MAXDEVICES][2];
Bool useVirtual = FALSE;
Rotation oldRotation = randrp->rotation;
DeviceIntPtr dev;
Bool view_adjusted = FALSE;
for (dev = inputInfo.devices; dev; dev = dev->next) {
if (!IsMaster(dev) && !IsFloating(dev))
continue;
miPointerGetPosition(dev, &pos[dev->id][0], &pos[dev->id][1]);
}
for (mode = scrp->modes;; mode = mode->next) {
if (mode->HDisplay == pSize->width &&
mode->VDisplay == pSize->height &&
(rate == 0 || xf86RandRModeRefresh(mode) == rate))
break;
if (mode->next == scrp->modes) {
if (pSize->width == randrp->virtualX &&
pSize->height == randrp->virtualY) {
mode = scrp->modes;
useVirtual = TRUE;
break;
}
return FALSE;
}
}
if (randrp->rotation != rotation) {
/* Have the driver do its thing. */
if (scrp->DriverFunc) {
xorgRRRotation RRRotation;
RRRotation.RRConfig.rotation = rotation;
RRRotation.RRConfig.rate = rate;
RRRotation.RRConfig.width = pSize->width;
RRRotation.RRConfig.height = pSize->height;
/*
* Currently we need to rely on HW support for rotation.
*/
if (!(*scrp->DriverFunc) (scrp, RR_SET_CONFIG, &RRRotation))
return FALSE;
}
else
return FALSE;
randrp->rotation = rotation;
}
if (!xf86RandRSetMode
(pScreen, mode, useVirtual, pSize->mmWidth, pSize->mmHeight)) {
if (randrp->rotation != oldRotation) {
/* Have the driver undo its thing. */
if (scrp->DriverFunc) {
xorgRRRotation RRRotation;
RRRotation.RRConfig.rotation = oldRotation;
RRRotation.RRConfig.rate =
xf86RandRModeRefresh(scrp->currentMode);
RRRotation.RRConfig.width = scrp->virtualX;
RRRotation.RRConfig.height = scrp->virtualY;
(*scrp->DriverFunc) (scrp, RR_SET_CONFIG, &RRRotation);
}
randrp->rotation = oldRotation;
}
return FALSE;
}
update_desktop_dimensions();
/*
* Move the cursor back where it belongs; SwitchMode repositions it
* FIXME: duplicated code, see modes/xf86RandR12.c
*/
for (dev = inputInfo.devices; dev; dev = dev->next) {
if (!IsMaster(dev) && !IsFloating(dev))
continue;
if (pScreen == miPointerGetScreen(dev)) {
int px = pos[dev->id][0];
int py = pos[dev->id][1];
px = (px >= pScreen->width ? (pScreen->width - 1) : px);
py = (py >= pScreen->height ? (pScreen->height - 1) : py);
/* Setting the viewpoint makes only sense on one device */
if (!view_adjusted && IsMaster(dev)) {
xf86SetViewport(pScreen, px, py);
view_adjusted = TRUE;
}
(*pScreen->SetCursorPosition) (dev, pScreen, px, py, FALSE);
}
}
return TRUE;
}
/*
* Reset size back to original
*/
static Bool
xf86RandRCloseScreen(ScreenPtr pScreen)
{
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
scrp->virtualX = pScreen->width = randrp->virtualX;
scrp->virtualY = pScreen->height = randrp->virtualY;
scrp->currentMode = scrp->modes;
pScreen->CloseScreen = randrp->CloseScreen;
free(randrp);
dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, NULL);
return (*pScreen->CloseScreen) (pScreen);
}
Rotation
xf86GetRotation(ScreenPtr pScreen)
{
if (xf86RandRKey == NULL)
return RR_Rotate_0;
return XF86RANDRINFO(pScreen)->rotation;
}
/* Function to change RandR's idea of the virtual screen size */
Bool
xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
int newvirtX, int newvirtY, int newmmWidth,
int newmmHeight, Bool resetMode)
{
XF86RandRInfoPtr randrp;
if (xf86RandRKey == NULL)
return FALSE;
randrp = XF86RANDRINFO(pScreen);
if (randrp == NULL)
return FALSE;
if (newvirtX > 0)
randrp->virtualX = newvirtX;
if (newvirtY > 0)
randrp->virtualY = newvirtY;
if (newmmWidth > 0)
randrp->mmWidth = newmmWidth;
if (newmmHeight > 0)
randrp->mmHeight = newmmHeight;
/* This is only for during server start */
if (resetMode) {
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
return (xf86RandRSetMode(pScreen,
pScrn->currentMode,
TRUE, pScreen->mmWidth, pScreen->mmHeight));
}
return TRUE;
}
Bool
xf86RandRInit(ScreenPtr pScreen)
{
rrScrPrivPtr rp;
XF86RandRInfoPtr randrp;
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
#ifdef PANORAMIX
/* XXX disable RandR when using Xinerama */
if (!noPanoramiXExtension)
return TRUE;
#endif
xf86RandRKey = &xf86RandRKeyRec;
if (!dixRegisterPrivateKey(&xf86RandRKeyRec, PRIVATE_SCREEN, 0))
return FALSE;
randrp = malloc(sizeof(XF86RandRInfoRec));
if (!randrp)
return FALSE;
if (!RRScreenInit(pScreen)) {
free(randrp);
return FALSE;
}
rp = rrGetScrPriv(pScreen);
rp->rrGetInfo = xf86RandRGetInfo;
rp->rrSetConfig = xf86RandRSetConfig;
randrp->virtualX = scrp->virtualX;
randrp->virtualY = scrp->virtualY;
randrp->mmWidth = pScreen->mmWidth;
randrp->mmHeight = pScreen->mmHeight;
randrp->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xf86RandRCloseScreen;
randrp->rotation = RR_Rotate_0;
dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, randrp);
return TRUE;
}

File diff suppressed because it is too large Load diff

View file

@ -1,49 +0,0 @@
/*
* Copyright (c) 2009 Tiago Vignatti
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __XF86VGAARBITER_H
#define __XF86VGAARBITER_H
#include "screenint.h"
#include "misc.h"
#include "xf86.h"
/* Functions */
extern void xf86VGAarbiterInit(void);
extern void xf86VGAarbiterFini(void);
void xf86VGAarbiterScrnInit(ScrnInfoPtr pScrn);
extern Bool xf86VGAarbiterWrapFunctions(void);
extern void xf86VGAarbiterLock(ScrnInfoPtr pScrn);
extern void xf86VGAarbiterUnlock(ScrnInfoPtr pScrn);
/* allow a driver to remove itself from arbiter - really should be
* done in the kernel though */
extern _X_EXPORT void xf86VGAarbiterDeviceDecodes(ScrnInfoPtr pScrn, int rsrc);
/* DRI and arbiter are really not possible together,
* you really want to remove the card from arbitration if you can */
extern _X_EXPORT Bool xf86VGAarbiterAllowDRI(ScreenPtr pScreen);
#endif /* __XF86VGAARBITER_H */

View file

@ -1,276 +0,0 @@
/*
* Copyright (c) 2009 Tiago Vignatti
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "misc.h"
#include "xf86.h"
#include "xf86_OSproc.h"
#include <X11/X.h>
#include "colormapst.h"
#include "scrnintstr.h"
#include "screenint.h"
#include "gcstruct.h"
#include "pixmapstr.h"
#include "pixmap.h"
#include "windowstr.h"
#include "window.h"
#include "xf86str.h"
#include "mipointer.h"
#include "mipointrst.h"
#include "picturestr.h"
#define WRAP_SCREEN(x,y) {pScreenPriv->x = pScreen->x; pScreen->x = y;}
#define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x
#define SCREEN_PRIV() ((VGAarbiterScreenPtr) dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey))
#define SCREEN_PROLOG(x) (pScreen->x = SCREEN_PRIV()->x)
#define SCREEN_EPILOG(x,y) do { \
SCREEN_PRIV()->x = pScreen->x; \
pScreen->x = y; \
} while (0)
#define WRAP_PICT(x,y) if (ps) {pScreenPriv->x = ps->x;\
ps->x = y;}
#define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;}
#define PICTURE_PROLOGUE(field) ps->field = \
((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
VGAarbiterScreenKey))->field
#define PICTURE_EPILOGUE(field, wrap) ps->field = wrap
#define WRAP_SCREEN_INFO(x,y) do {pScreenPriv->x = pScrn->x; pScrn->x = y;} while(0)
#define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x
#define SPRITE_PROLOG \
miPointerScreenPtr PointPriv; \
VGAarbiterScreenPtr pScreenPriv; \
input_lock(); \
PointPriv = dixLookupPrivate(&pScreen->devPrivates, \
miPointerScreenKey); \
pScreenPriv = dixLookupPrivate(&(pScreen)->devPrivates, \
VGAarbiterScreenKey); \
PointPriv->spriteFuncs = pScreenPriv->miSprite; \
#define SPRITE_EPILOG \
pScreenPriv->miSprite = PointPriv->spriteFuncs; \
PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; \
input_unlock();
#define WRAP_SPRITE do { pScreenPriv->miSprite = PointPriv->spriteFuncs;\
PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; \
} while (0)
#define UNWRAP_SPRITE PointPriv->spriteFuncs = pScreenPriv->miSprite
#define GC_WRAP(x) pGCPriv->wrapOps = (x)->ops;\
pGCPriv->wrapFuncs = (x)->funcs; (x)->ops = &VGAarbiterGCOps;\
(x)->funcs = &VGAarbiterGCFuncs;
#define GC_UNWRAP(x) VGAarbiterGCPtr pGCPriv = \
(VGAarbiterGCPtr)dixLookupPrivate(&(x)->devPrivates, VGAarbiterGCKey);\
(x)->ops = pGCPriv->wrapOps; (x)->funcs = pGCPriv->wrapFuncs;
static inline void
VGAGet(ScreenPtr pScreen)
{
pci_device_vgaarb_set_target(xf86ScreenToScrn(pScreen)->vgaDev);
pci_device_vgaarb_lock();
}
static inline void
VGAPut(void)
{
pci_device_vgaarb_unlock();
}
typedef struct _VGAarbiterScreen {
CreateGCProcPtr CreateGC;
CloseScreenProcPtr CloseScreen;
ScreenBlockHandlerProcPtr BlockHandler;
ScreenWakeupHandlerProcPtr WakeupHandler;
GetImageProcPtr GetImage;
GetSpansProcPtr GetSpans;
SourceValidateProcPtr SourceValidate;
CopyWindowProcPtr CopyWindow;
ClearToBackgroundProcPtr ClearToBackground;
CreatePixmapProcPtr CreatePixmap;
SaveScreenProcPtr SaveScreen;
/* Colormap */
StoreColorsProcPtr StoreColors;
/* Cursor */
DisplayCursorProcPtr DisplayCursor;
RealizeCursorProcPtr RealizeCursor;
UnrealizeCursorProcPtr UnrealizeCursor;
RecolorCursorProcPtr RecolorCursor;
SetCursorPositionProcPtr SetCursorPosition;
void (*AdjustFrame) (ScrnInfoPtr, int, int);
Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr);
Bool (*EnterVT) (ScrnInfoPtr);
void (*LeaveVT) (ScrnInfoPtr);
void (*FreeScreen) (ScrnInfoPtr);
miPointerSpriteFuncPtr miSprite;
CompositeProcPtr Composite;
GlyphsProcPtr Glyphs;
CompositeRectsProcPtr CompositeRects;
} VGAarbiterScreenRec, *VGAarbiterScreenPtr;
typedef struct _VGAarbiterGC {
const GCOps *wrapOps;
const GCFuncs *wrapFuncs;
} VGAarbiterGCRec, *VGAarbiterGCPtr;
/* Screen funcs */
static void VGAarbiterBlockHandler(ScreenPtr pScreen, void *pTimeout);
static void VGAarbiterWakeupHandler(ScreenPtr pScreen, int result);
static Bool VGAarbiterCloseScreen(ScreenPtr pScreen);
static void VGAarbiterGetImage(DrawablePtr pDrawable, int sx, int sy, int w,
int h, unsigned int format,
unsigned long planemask, char *pdstLine);
static void VGAarbiterGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
int *pwidth, int nspans, char *pdstStart);
static void VGAarbiterSourceValidate(DrawablePtr pDrawable, int x, int y,
int width, int height,
unsigned int subWindowMode);
static void VGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
RegionPtr prgnSrc);
static void VGAarbiterClearToBackground(WindowPtr pWin, int x, int y, int w,
int h, Bool generateExposures);
static PixmapPtr VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h,
int depth, unsigned int usage_hint);
static Bool VGAarbiterCreateGC(GCPtr pGC);
static Bool VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank);
static void VGAarbiterStoreColors(ColormapPtr pmap, int ndef, xColorItem
* pdefs);
static void VGAarbiterRecolorCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
CursorPtr pCurs, Bool displayed);
static Bool VGAarbiterRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
CursorPtr pCursor);
static Bool VGAarbiterUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
CursorPtr pCursor);
static Bool VGAarbiterDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
CursorPtr pCursor);
static Bool VGAarbiterSetCursorPosition(DeviceIntPtr pDev, ScreenPtr
pScreen, int x, int y,
Bool generateEvent);
static void VGAarbiterAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
static Bool VGAarbiterSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
static Bool VGAarbiterEnterVT(ScrnInfoPtr pScrn);
static void VGAarbiterLeaveVT(ScrnInfoPtr pScrn);
static void VGAarbiterFreeScreen(ScrnInfoPtr pScrn);
/* GC funcs */
static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes,
DrawablePtr pDraw);
static void VGAarbiterChangeGC(GCPtr pGC, unsigned long mask);
static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
static void VGAarbiterDestroyGC(GCPtr pGC);
static void VGAarbiterChangeClip(GCPtr pGC, int type, void *pvalue,
int nrects);
static void VGAarbiterDestroyClip(GCPtr pGC);
static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
/* GC ops */
static void VGAarbiterFillSpans(DrawablePtr pDraw, GC * pGC, int nInit,
DDXPointPtr pptInit, int *pwidthInit,
int fSorted);
static void VGAarbiterSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc,
register DDXPointPtr ppt, int *pwidth,
int nspans, int fSorted);
static void VGAarbiterPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x,
int y, int w, int h, int leftPad, int format,
char *pImage);
static RegionPtr VGAarbiterCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
GC * pGC, int srcx, int srcy, int width,
int height, int dstx, int dsty);
static RegionPtr VGAarbiterCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
GCPtr pGC, int srcx, int srcy, int width,
int height, int dstx, int dsty,
unsigned long bitPlane);
static void VGAarbiterPolyPoint(DrawablePtr pDraw, GCPtr pGC, int mode, int npt,
xPoint * pptInit);
static void VGAarbiterPolylines(DrawablePtr pDraw, GCPtr pGC, int mode, int npt,
DDXPointPtr pptInit);
static void VGAarbiterPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg,
xSegment * pSeg);
static void VGAarbiterPolyRectangle(DrawablePtr pDraw, GCPtr pGC,
int nRectsInit, xRectangle *pRectsInit);
static void VGAarbiterPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
xArc * parcs);
static void VGAarbiterFillPolygon(DrawablePtr pDraw, GCPtr pGC, int shape,
int mode, int count, DDXPointPtr ptsIn);
static void VGAarbiterPolyFillRect(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
xRectangle *prectInit);
static void VGAarbiterPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
xArc * parcs);
static int VGAarbiterPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
int count, char *chars);
static int VGAarbiterPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
int count, unsigned short *chars);
static void VGAarbiterImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
int count, char *chars);
static void VGAarbiterImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
int count, unsigned short *chars);
static void VGAarbiterImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
int yInit, unsigned int nglyph,
CharInfoPtr * ppci, void *pglyphBase);
static void VGAarbiterPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
int yInit, unsigned int nglyph,
CharInfoPtr * ppci, void *pglyphBase);
static void VGAarbiterPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr
pDraw, int dx, int dy, int xOrg, int yOrg);
/* miSpriteFuncs */
static Bool VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr
pScreen, CursorPtr pCur);
static Bool VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr
pScreen, CursorPtr pCur);
static void VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
CursorPtr pCur, int x, int y);
static void VGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
int x, int y);
static Bool VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev,
ScreenPtr pScreen);
static void VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
static void VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
PicturePtr pDst, INT16 xSrc, INT16 ySrc,
INT16 xMask, INT16 yMask, INT16 xDst,
INT16 yDst, CARD16 width, CARD16 height);
static void VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
int nlist, GlyphListPtr list, GlyphPtr * glyphs);
static void VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst,
xRenderColor * color, int nRect,
xRectangle *rects);

View file

@ -1,463 +0,0 @@
/*
* Copyright (c) 1999-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains the VidMode functions required by the extension.
* These have been added to avoid the need for the higher level extension
* code to access the private XFree86 data structures directly. Wherever
* possible this code uses the functions in xf86Mode.c to do the work,
* so that two version of code that do similar things don't have to be
* maintained.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "extinit.h"
#ifdef XF86VIDMODE
#include "vidmodestr.h"
#include "xf86Privstr.h"
#include "xf86Extensions.h"
#include "xf86cmap.h"
static vidMonitorValue
xf86VidModeGetMonitorValue(ScreenPtr pScreen, int valtyp, int indx)
{
vidMonitorValue ret = { NULL, };
MonPtr monitor;
ScrnInfoPtr pScrn;
pScrn = xf86ScreenToScrn(pScreen);
monitor = pScrn->monitor;
switch (valtyp) {
case VIDMODE_MON_VENDOR:
ret.ptr = monitor->vendor;
break;
case VIDMODE_MON_MODEL:
ret.ptr = monitor->model;
break;
case VIDMODE_MON_NHSYNC:
ret.i = monitor->nHsync;
break;
case VIDMODE_MON_NVREFRESH:
ret.i = monitor->nVrefresh;
break;
case VIDMODE_MON_HSYNC_LO:
ret.f = (100.0 * monitor->hsync[indx].lo);
break;
case VIDMODE_MON_HSYNC_HI:
ret.f = (100.0 * monitor->hsync[indx].hi);
break;
case VIDMODE_MON_VREFRESH_LO:
ret.f = (100.0 * monitor->vrefresh[indx].lo);
break;
case VIDMODE_MON_VREFRESH_HI:
ret.f = (100.0 * monitor->vrefresh[indx].hi);
break;
}
return ret;
}
static Bool
xf86VidModeGetCurrentModeline(ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock)
{
ScrnInfoPtr pScrn;
pScrn = xf86ScreenToScrn(pScreen);
if (pScrn->currentMode) {
*mode = pScrn->currentMode;
*dotClock = pScrn->currentMode->Clock;
return TRUE;
}
return FALSE;
}
static int
xf86VidModeGetDotClock(ScreenPtr pScreen, int Clock)
{
ScrnInfoPtr pScrn;
pScrn = xf86ScreenToScrn(pScreen);
if ((pScrn->progClock) || (Clock >= MAXCLOCKS))
return Clock;
else
return pScrn->clock[Clock];
}
static int
xf86VidModeGetNumOfClocks(ScreenPtr pScreen, Bool *progClock)
{
ScrnInfoPtr pScrn;
pScrn = xf86ScreenToScrn(pScreen);
if (pScrn->progClock) {
*progClock = TRUE;
return 0;
}
else {
*progClock = FALSE;
return pScrn->numClocks;
}
}
static Bool
xf86VidModeGetClocks(ScreenPtr pScreen, int *Clocks)
{
ScrnInfoPtr pScrn;
int i;
pScrn = xf86ScreenToScrn(pScreen);
if (pScrn->progClock)
return FALSE;
for (i = 0; i < pScrn->numClocks; i++)
*Clocks++ = pScrn->clock[i];
return TRUE;
}
static Bool
xf86VidModeGetNextModeline(ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock)
{
VidModePtr pVidMode;
DisplayModePtr p;
pVidMode = VidModeGetPtr(pScreen);
for (p = pVidMode->Next; p != NULL && p != pVidMode->First; p = p->next) {
if (p->status == MODE_OK) {
pVidMode->Next = p->next;
*mode = p;
*dotClock = xf86VidModeGetDotClock(pScreen, p->Clock);
return TRUE;
}
}
return FALSE;
}
static Bool
xf86VidModeGetFirstModeline(ScreenPtr pScreen, DisplayModePtr *mode, int *dotClock)
{
ScrnInfoPtr pScrn;
VidModePtr pVidMode;
pScrn = xf86ScreenToScrn(pScreen);
if (pScrn->modes == NULL)
return FALSE;
pVidMode = VidModeGetPtr(pScreen);
pVidMode->First = pScrn->modes;
pVidMode->Next = pVidMode->First->next;
if (pVidMode->First->status == MODE_OK) {
*mode = pVidMode->First;
*dotClock = xf86VidModeGetDotClock(pScreen, pVidMode->First->Clock);
return TRUE;
}
return xf86VidModeGetNextModeline(pScreen, mode, dotClock);
}
static Bool
xf86VidModeDeleteModeline(ScreenPtr pScreen, DisplayModePtr mode)
{
ScrnInfoPtr pScrn;
if (mode == NULL)
return FALSE;
pScrn = xf86ScreenToScrn(pScreen);
xf86DeleteMode(&(pScrn->modes), mode);
return TRUE;
}
static Bool
xf86VidModeZoomViewport(ScreenPtr pScreen, int zoom)
{
xf86ZoomViewport(pScreen, zoom);
return TRUE;
}
static Bool
xf86VidModeSetViewPort(ScreenPtr pScreen, int x, int y)
{
ScrnInfoPtr pScrn;
pScrn = xf86ScreenToScrn(pScreen);
pScrn->frameX0 = min(max(x, 0),
pScrn->virtualX - pScrn->currentMode->HDisplay);
pScrn->frameX1 = pScrn->frameX0 + pScrn->currentMode->HDisplay - 1;
pScrn->frameY0 = min(max(y, 0),
pScrn->virtualY - pScrn->currentMode->VDisplay);
pScrn->frameY1 = pScrn->frameY0 + pScrn->currentMode->VDisplay - 1;
if (pScrn->AdjustFrame != NULL)
(pScrn->AdjustFrame) (pScrn, pScrn->frameX0, pScrn->frameY0);
return TRUE;
}
static Bool
xf86VidModeGetViewPort(ScreenPtr pScreen, int *x, int *y)
{
ScrnInfoPtr pScrn;
pScrn = xf86ScreenToScrn(pScreen);
*x = pScrn->frameX0;
*y = pScrn->frameY0;
return TRUE;
}
static Bool
xf86VidModeSwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
{
ScrnInfoPtr pScrn;
DisplayModePtr pTmpMode;
Bool retval;
pScrn = xf86ScreenToScrn(pScreen);
/* save in case we fail */
pTmpMode = pScrn->currentMode;
/* Force a mode switch */
pScrn->currentMode = NULL;
retval = xf86SwitchMode(pScrn->pScreen, mode);
/* we failed: restore it */
if (retval == FALSE)
pScrn->currentMode = pTmpMode;
return retval;
}
static Bool
xf86VidModeLockZoom(ScreenPtr pScreen, Bool lock)
{
if (xf86Info.dontZoom)
return FALSE;
xf86LockZoom(pScreen, lock);
return TRUE;
}
static ModeStatus
xf86VidModeCheckModeForMonitor(ScreenPtr pScreen, DisplayModePtr mode)
{
ScrnInfoPtr pScrn;
if (mode == NULL)
return MODE_ERROR;
pScrn = xf86ScreenToScrn(pScreen);
return xf86CheckModeForMonitor(mode, pScrn->monitor);
}
static ModeStatus
xf86VidModeCheckModeForDriver(ScreenPtr pScreen, DisplayModePtr mode)
{
ScrnInfoPtr pScrn;
if (mode == NULL)
return MODE_ERROR;
pScrn = xf86ScreenToScrn(pScreen);
return xf86CheckModeForDriver(pScrn, mode, 0);
}
static void
xf86VidModeSetCrtcForMode(ScreenPtr pScreen, DisplayModePtr mode)
{
ScrnInfoPtr pScrn;
DisplayModePtr ScreenModes;
if (mode == NULL)
return;
/* Ugly hack so that the xf86Mode.c function can be used without change */
pScrn = xf86ScreenToScrn(pScreen);
ScreenModes = pScrn->modes;
pScrn->modes = mode;
xf86SetCrtcForModes(pScrn, pScrn->adjustFlags);
pScrn->modes = ScreenModes;
return;
}
static Bool
xf86VidModeAddModeline(ScreenPtr pScreen, DisplayModePtr mode)
{
ScrnInfoPtr pScrn;
if (mode == NULL)
return FALSE;
pScrn = xf86ScreenToScrn(pScreen);
mode->name = strdup(""); /* freed by deletemode */
mode->status = MODE_OK;
mode->next = pScrn->modes->next;
mode->prev = pScrn->modes;
pScrn->modes->next = mode;
if (mode->next != NULL)
mode->next->prev = mode;
return TRUE;
}
static int
xf86VidModeGetNumOfModes(ScreenPtr pScreen)
{
DisplayModePtr mode = NULL;
int dotClock = 0, nummodes = 0;
if (!xf86VidModeGetFirstModeline(pScreen, &mode, &dotClock))
return nummodes;
do {
nummodes++;
if (!xf86VidModeGetNextModeline(pScreen, &mode, &dotClock))
return nummodes;
} while (TRUE);
}
static Bool
xf86VidModeSetGamma(ScreenPtr pScreen, float red, float green, float blue)
{
Gamma gamma;
gamma.red = red;
gamma.green = green;
gamma.blue = blue;
if (xf86ChangeGamma(pScreen, gamma) != Success)
return FALSE;
else
return TRUE;
}
static Bool
xf86VidModeGetGamma(ScreenPtr pScreen, float *red, float *green, float *blue)
{
ScrnInfoPtr pScrn;
pScrn = xf86ScreenToScrn(pScreen);
*red = pScrn->gamma.red;
*green = pScrn->gamma.green;
*blue = pScrn->gamma.blue;
return TRUE;
}
static Bool
xf86VidModeSetGammaRamp(ScreenPtr pScreen, int size, CARD16 *r, CARD16 *g, CARD16 *b)
{
xf86ChangeGammaRamp(pScreen, size, r, g, b);
return TRUE;
}
static Bool
xf86VidModeGetGammaRamp(ScreenPtr pScreen, int size, CARD16 *r, CARD16 *g, CARD16 *b)
{
xf86GetGammaRamp(pScreen, size, r, g, b);
return TRUE;
}
static Bool
xf86VidModeInit(ScreenPtr pScreen)
{
VidModePtr pVidMode;
if (!xf86GetVidModeEnabled()) {
DebugF("!xf86GetVidModeEnabled()\n");
return FALSE;
}
pVidMode = VidModeInit(pScreen);
if (!pVidMode)
return FALSE;
pVidMode->Flags = 0;
pVidMode->Next = NULL;
pVidMode->GetMonitorValue = xf86VidModeGetMonitorValue;
pVidMode->GetCurrentModeline = xf86VidModeGetCurrentModeline;
pVidMode->GetFirstModeline = xf86VidModeGetFirstModeline;
pVidMode->GetNextModeline = xf86VidModeGetNextModeline;
pVidMode->DeleteModeline = xf86VidModeDeleteModeline;
pVidMode->ZoomViewport = xf86VidModeZoomViewport;
pVidMode->GetViewPort = xf86VidModeGetViewPort;
pVidMode->SetViewPort = xf86VidModeSetViewPort;
pVidMode->SwitchMode = xf86VidModeSwitchMode;
pVidMode->LockZoom = xf86VidModeLockZoom;
pVidMode->GetNumOfClocks = xf86VidModeGetNumOfClocks;
pVidMode->GetClocks = xf86VidModeGetClocks;
pVidMode->CheckModeForMonitor = xf86VidModeCheckModeForMonitor;
pVidMode->CheckModeForDriver = xf86VidModeCheckModeForDriver;
pVidMode->SetCrtcForMode = xf86VidModeSetCrtcForMode;
pVidMode->AddModeline = xf86VidModeAddModeline;
pVidMode->GetDotClock = xf86VidModeGetDotClock;
pVidMode->GetNumOfModes = xf86VidModeGetNumOfModes;
pVidMode->SetGamma = xf86VidModeSetGamma;
pVidMode->GetGamma = xf86VidModeGetGamma;
pVidMode->SetGammaRamp = xf86VidModeSetGammaRamp;
pVidMode->GetGammaRamp = xf86VidModeGetGammaRamp;
pVidMode->GetGammaRampSize = xf86GetGammaRampSize; /* use xf86cmap API directly */
return TRUE;
}
void
XFree86VidModeExtensionInit(void)
{
int i;
Bool enabled = FALSE;
DebugF("XFree86VidModeExtensionInit");
/* This means that the DDX doesn't want the vidmode extension enabled */
if (!xf86GetVidModeEnabled())
return;
for (i = 0; i < screenInfo.numScreens; i++) {
if (xf86VidModeInit (screenInfo.screens[i]))
enabled = TRUE;
}
/* This means that the DDX doesn't want the vidmode extension enabled */
if (!enabled)
return;
VidModeAddExtension(xf86GetVidModeAllowNonLocal());
}
#endif /* XF86VIDMODE */

File diff suppressed because it is too large Load diff

View file

@ -1,225 +0,0 @@
/*
* Copyright 1995-1999 by Frederic Lepied, France. <Lepied@XFree86.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Frederic Lepied not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Frederic Lepied makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* FREDERIC LEPIED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL FREDERIC LEPIED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
*/
/*
* Copyright (c) 2000-2002 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifndef _xf86Xinput_h
#define _xf86Xinput_h
#include "xf86.h"
#include "xf86str.h"
#include "inputstr.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
/* Input device flags */
#define XI86_ALWAYS_CORE 0x04 /* device always controls the pointer */
/* the device sends Xinput and core pointer events */
#define XI86_SEND_CORE_EVENTS XI86_ALWAYS_CORE
/* 0x08 is reserved for legacy XI86_SEND_DRAG_EVENTS, do not use for now */
/* server-internal only */
#define XI86_DEVICE_DISABLED 0x10 /* device was disabled before vt switch */
#define XI86_SERVER_FD 0x20 /* fd is managed by xserver */
/* Input device driver capabilities */
#define XI86_DRV_CAP_SERVER_FD 0x01
/* This holds the input driver entry and module information. */
typedef struct _InputDriverRec {
int driverVersion;
const char *driverName;
void (*Identify) (int flags);
int (*PreInit) (struct _InputDriverRec * drv,
struct _InputInfoRec * pInfo, int flags);
void (*UnInit) (struct _InputDriverRec * drv,
struct _InputInfoRec * pInfo, int flags);
void *module;
const char **default_options;
int capabilities;
} InputDriverRec, *InputDriverPtr;
/* This is to input devices what the ScrnInfoRec is to screens. */
struct _InputInfoRec {
struct _InputInfoRec *next;
char *name;
char *driver;
int flags;
Bool (*device_control) (DeviceIntPtr device, int what);
void (*read_input) (struct _InputInfoRec * local);
int (*control_proc) (struct _InputInfoRec * local, xDeviceCtl * control);
int (*switch_mode) (ClientPtr client, DeviceIntPtr dev, int mode);
int (*set_device_valuators)
(struct _InputInfoRec * local,
int *valuators, int first_valuator, int num_valuators);
int fd;
int major;
int minor;
DeviceIntPtr dev;
void *private;
const char *type_name;
InputDriverPtr drv;
void *module;
XF86OptionPtr options;
InputAttributes *attrs;
};
/* xf86Globals.c */
extern InputInfoPtr xf86InputDevs;
/* xf86Xinput.c */
extern _X_EXPORT void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
int first_valuator, int num_valuators,
...);
extern _X_EXPORT void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute,
int first_valuator,
int num_valuators,
const int *valuators);
extern _X_EXPORT void xf86PostMotionEventM(DeviceIntPtr device, int is_absolute,
const ValuatorMask *mask);
extern _X_EXPORT void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
int first_valuator,
int num_valuators, ...);
extern _X_EXPORT void xf86PostProximityEventP(DeviceIntPtr device, int is_in,
int first_valuator,
int num_valuators,
const int *valuators);
extern _X_EXPORT void xf86PostProximityEventM(DeviceIntPtr device, int is_in,
const ValuatorMask *mask);
extern _X_EXPORT void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute,
int button, int is_down,
int first_valuator, int num_valuators,
...);
extern _X_EXPORT void xf86PostButtonEventP(DeviceIntPtr device, int is_absolute,
int button, int is_down,
int first_valuator,
int num_valuators,
const int *valuators);
extern _X_EXPORT void xf86PostButtonEventM(DeviceIntPtr device, int is_absolute,
int button, int is_down,
const ValuatorMask *mask);
extern _X_EXPORT void xf86PostKeyEvent(DeviceIntPtr device,
unsigned int key_code, int is_down);
extern _X_EXPORT void xf86PostKeyEventM(DeviceIntPtr device,
unsigned int key_code, int is_down);
extern _X_EXPORT void xf86PostKeyEventP(DeviceIntPtr device,
unsigned int key_code, int is_down);
extern _X_EXPORT void xf86PostKeyboardEvent(DeviceIntPtr device,
unsigned int key_code, int is_down);
extern _X_EXPORT void xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid,
uint16_t type, uint32_t flags,
const ValuatorMask *mask);
extern _X_EXPORT void xf86PostGesturePinchEvent(DeviceIntPtr dev, uint16_t type,
uint16_t num_touches,
uint32_t flags,
double delta_x, double delta_y,
double delta_unaccel_x,
double delta_unaccel_y,
double scale, double delta_angle);
extern _X_EXPORT void xf86PostGestureSwipeEvent(DeviceIntPtr dev, uint16_t type,
uint16_t num_touches,
uint32_t flags,
double delta_x, double delta_y,
double delta_unaccel_x,
double delta_unaccel_y);
extern _X_EXPORT InputInfoPtr xf86FirstLocalDevice(void);
extern _X_EXPORT int xf86ScaleAxis(int Cx, int to_max, int to_min, int from_max,
int from_min);
extern _X_EXPORT void xf86ProcessCommonOptions(InputInfoPtr pInfo,
XF86OptionPtr options);
extern _X_EXPORT Bool xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum,
Atom label, int minval,
int maxval, int resolution,
int min_res, int max_res,
int mode);
extern _X_EXPORT void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
extern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo);
extern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
extern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
extern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev);
extern _X_EXPORT void xf86InputEnableVTProbe(void);
/* not exported */
int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL is_auto);
InputInfoPtr xf86AllocateInput(void);
/* xf86Helper.c */
extern _X_EXPORT void xf86AddInputDriver(InputDriverPtr driver, void *module,
int flags);
extern _X_EXPORT void xf86DeleteInputDriver(int drvIndex);
extern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name);
extern _X_EXPORT InputInfoPtr xf86LookupInput(const char *name);
extern _X_EXPORT void xf86DeleteInput(InputInfoPtr pInp, int flags);
extern _X_EXPORT void xf86MotionHistoryAllocate(InputInfoPtr pInfo);
extern _X_EXPORT void
xf86IDrvMsgVerb(InputInfoPtr dev,
MessageType type, int verb, const char *format, ...)
_X_ATTRIBUTE_PRINTF(4, 5);
extern _X_EXPORT void
xf86IDrvMsg(InputInfoPtr dev, MessageType type, const char *format, ...)
_X_ATTRIBUTE_PRINTF(3, 4);
extern _X_EXPORT void
xf86VIDrvMsgVerb(InputInfoPtr dev,
MessageType type, int verb, const char *format, va_list args)
_X_ATTRIBUTE_PRINTF(4, 0);
extern _X_EXPORT void xf86AddInputEventDrainCallback(CallbackProcPtr callback,
void *param);
extern _X_EXPORT void xf86RemoveInputEventDrainCallback(CallbackProcPtr callback,
void *param);
/* xf86Option.c */
extern _X_EXPORT void
xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts);
#endif /* _xf86Xinput_h */

File diff suppressed because it is too large Load diff

View file

@ -1,67 +0,0 @@
/*
* Copyright (c) 1998-2001 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifndef _XF86CMAP_H
#define _XF86CMAP_H
#include "xf86str.h"
#include "colormapst.h"
#define CMAP_PALETTED_TRUECOLOR 0x0000001
#define CMAP_RELOAD_ON_MODE_SWITCH 0x0000002
#define CMAP_LOAD_EVEN_IF_OFFSCREEN 0x0000004
extern _X_EXPORT Bool xf86HandleColormaps(ScreenPtr pScreen,
int maxCol,
int sigRGBbits,
xf86LoadPaletteProc * loadPalette,
xf86SetOverscanProc * setOverscan,
unsigned int flags);
extern _X_EXPORT Bool xf86ColormapAllocatePrivates(ScrnInfoPtr pScrn);
extern _X_EXPORT int
xf86ChangeGamma(ScreenPtr pScreen, Gamma newGamma);
extern _X_EXPORT int
xf86ChangeGammaRamp(ScreenPtr pScreen,
int size,
unsigned short *red,
unsigned short *green, unsigned short *blue);
extern _X_EXPORT int xf86GetGammaRampSize(ScreenPtr pScreen);
extern _X_EXPORT int
xf86GetGammaRamp(ScreenPtr pScreen,
int size,
unsigned short *red,
unsigned short *green, unsigned short *blue);
#endif /* _XF86CMAP_H */

View file

@ -1,100 +0,0 @@
/*
* Copyright (c) 2000-2001 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains the interfaces to the bus-specific code
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <X11/X.h>
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86Bus.h"
#define XF86_OS_PRIVS
#include "xf86_OSproc.h"
Bool fbSlotClaimed = FALSE;
int
xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active)
{
EntityPtr p;
int num;
#ifdef XSERVER_PLATFORM_BUS
if (platformSlotClaimed)
return -1;
#endif
#ifdef XSERVER_LIBPCIACCESS
if (pciSlotClaimed)
return -1;
#endif
#if defined(__sparc__) || defined (__sparc64__)
if (sbusSlotClaimed)
return -1;
#endif
num = xf86AllocateEntity();
p = xf86Entities[num];
p->driver = drvp;
p->chipset = 0;
p->bus.type = BUS_NONE;
p->active = active;
p->inUse = FALSE;
xf86AddDevToEntity(num, dev);
fbSlotClaimed = TRUE;
return num;
}
/*
* Get the list of FB "slots" claimed by a screen
*/
int
xf86GetFbInfoForScreen(int scrnIndex)
{
int num = 0;
int i;
EntityPtr p;
for (i = 0; i < xf86Screens[scrnIndex]->numEntities; i++) {
p = xf86Entities[xf86Screens[scrnIndex]->entityList[i]];
if (p->bus.type == BUS_NONE) {
num++;
}
}
return num;
}

File diff suppressed because it is too large Load diff

View file

@ -1,171 +0,0 @@
/*
* Copyright (c) 1998-2001 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifndef _XF86FBMAN_H
#define _XF86FBMAN_H
#include "scrnintstr.h"
#include "regionstr.h"
#define FAVOR_AREA_THEN_WIDTH 0
#define FAVOR_AREA_THEN_HEIGHT 1
#define FAVOR_WIDTH_THEN_AREA 2
#define FAVOR_HEIGHT_THEN_AREA 3
#define PRIORITY_LOW 0
#define PRIORITY_NORMAL 1
#define PRIORITY_EXTREME 2
typedef struct _FBArea {
ScreenPtr pScreen;
BoxRec box;
int granularity;
void (*MoveAreaCallback) (struct _FBArea *, struct _FBArea *);
void (*RemoveAreaCallback) (struct _FBArea *);
DevUnion devPrivate;
} FBArea, *FBAreaPtr;
typedef struct _FBLinear {
ScreenPtr pScreen;
int size;
int offset;
int granularity;
void (*MoveLinearCallback) (struct _FBLinear *, struct _FBLinear *);
void (*RemoveLinearCallback) (struct _FBLinear *);
DevUnion devPrivate;
} FBLinear, *FBLinearPtr;
typedef void (*FreeBoxCallbackProcPtr) (ScreenPtr, RegionPtr, void *);
typedef void (*MoveAreaCallbackProcPtr) (FBAreaPtr, FBAreaPtr);
typedef void (*RemoveAreaCallbackProcPtr) (FBAreaPtr);
typedef void (*MoveLinearCallbackProcPtr) (FBLinearPtr, FBLinearPtr);
typedef void (*RemoveLinearCallbackProcPtr) (FBLinearPtr);
typedef struct {
FBAreaPtr(*AllocateOffscreenArea) (ScreenPtr pScreen,
int w, int h,
int granularity,
MoveAreaCallbackProcPtr moveCB,
RemoveAreaCallbackProcPtr removeCB,
void *privData);
void (*FreeOffscreenArea) (FBAreaPtr area);
Bool (*ResizeOffscreenArea) (FBAreaPtr area, int w, int h);
Bool (*QueryLargestOffscreenArea) (ScreenPtr pScreen,
int *width, int *height,
int granularity,
int preferences, int priority);
Bool (*RegisterFreeBoxCallback) (ScreenPtr pScreen,
FreeBoxCallbackProcPtr FreeBoxCallback,
void *devPriv);
/* linear functions */
FBLinearPtr(*AllocateOffscreenLinear) (ScreenPtr pScreen,
int size,
int granularity,
MoveLinearCallbackProcPtr moveCB,
RemoveLinearCallbackProcPtr
removeCB, void *privData);
void (*FreeOffscreenLinear) (FBLinearPtr area);
Bool (*ResizeOffscreenLinear) (FBLinearPtr area, int size);
Bool (*QueryLargestOffscreenLinear) (ScreenPtr pScreen,
int *size,
int granularity, int priority);
Bool (*PurgeOffscreenAreas) (ScreenPtr);
} FBManagerFuncs, *FBManagerFuncsPtr;
extern _X_EXPORT Bool xf86RegisterOffscreenManager(ScreenPtr pScreen,
FBManagerFuncsPtr funcs);
extern _X_EXPORT Bool
xf86InitFBManagerRegion(ScreenPtr pScreen, RegionPtr ScreenRegion);
extern _X_EXPORT Bool
xf86InitFBManagerArea(ScreenPtr pScreen, int PixalArea, int Verbosity);
extern _X_EXPORT Bool
xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox);
extern _X_EXPORT Bool
xf86InitFBManagerLinear(ScreenPtr pScreen, int offset, int size);
extern _X_EXPORT Bool
xf86FBManagerRunning(ScreenPtr pScreen);
extern _X_EXPORT FBAreaPtr
xf86AllocateOffscreenArea(ScreenPtr pScreen,
int w, int h,
int granularity,
MoveAreaCallbackProcPtr moveCB,
RemoveAreaCallbackProcPtr removeCB, void *privData);
extern _X_EXPORT FBAreaPtr
xf86AllocateLinearOffscreenArea(ScreenPtr pScreen,
int length,
int granularity,
MoveAreaCallbackProcPtr moveCB,
RemoveAreaCallbackProcPtr removeCB,
void *privData);
extern _X_EXPORT FBLinearPtr
xf86AllocateOffscreenLinear(ScreenPtr pScreen,
int length,
int granularity,
MoveLinearCallbackProcPtr moveCB,
RemoveLinearCallbackProcPtr removeCB,
void *privData);
extern _X_EXPORT void xf86FreeOffscreenArea(FBAreaPtr area);
extern _X_EXPORT void xf86FreeOffscreenLinear(FBLinearPtr area);
extern _X_EXPORT Bool
xf86ResizeOffscreenArea(FBAreaPtr resize, int w, int h);
extern _X_EXPORT Bool
xf86ResizeOffscreenLinear(FBLinearPtr resize, int size);
extern _X_EXPORT Bool
xf86RegisterFreeBoxCallback(ScreenPtr pScreen,
FreeBoxCallbackProcPtr FreeBoxCallback,
void *devPriv);
extern _X_EXPORT Bool
xf86PurgeUnlockedOffscreenAreas(ScreenPtr pScreen);
extern _X_EXPORT Bool
xf86QueryLargestOffscreenArea(ScreenPtr pScreen,
int *width, int *height,
int granularity, int preferences, int priority);
extern _X_EXPORT Bool
xf86QueryLargestOffscreenLinear(ScreenPtr pScreen,
int *size, int granularity, int priority);
#endif /* _XF86FBMAN_H */

View file

@ -1,65 +0,0 @@
/*
* Copyright (c) 2000-2002 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains the interfaces to the bus-specific code
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <X11/X.h>
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86Bus.h"
#define XF86_OS_PRIVS
#include "xf86_OSproc.h"
int
xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active)
{
EntityPtr p;
int num;
num = xf86AllocateEntity();
p = xf86Entities[num];
p->driver = drvp;
p->chipset = 0;
p->bus.type = BUS_NONE;
p->active = active;
p->inUse = FALSE;
xf86AddDevToEntity(num, dev);
return num;
}

File diff suppressed because it is too large Load diff

View file

@ -1,57 +0,0 @@
/*
* Copyright (c) 1999-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#ifndef _XF86_PCI_BUS_H
#define _XF86_PCI_BUS_H
#include "xf86MatchDrivers.h"
void xf86PciProbe(void);
Bool xf86PciAddMatchingDev(DriverPtr drvp);
Bool xf86PciProbeDev(DriverPtr drvp);
void xf86PciIsolateDevice(const char *argument);
void xf86PciMatchDriver(XF86MatchedDrivers *md);
Bool xf86PciConfigure(void *busData, struct pci_device *pDev);
void xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
GDevRec * GDev, int *chipset);
#define MATCH_PCI_DEVICES(x, y) (((x)->domain == (y)->domain) && \
((x)->bus == (y)->bus) && \
((x)->func == (y)->func) && \
((x)->dev == (y)->dev))
void
xf86MatchDriverFromFiles(uint16_t match_vendor, uint16_t match_chip,
XF86MatchedDrivers *md);
void
xf86VideoPtrToDriverList(struct pci_device *dev, XF86MatchedDrivers *md);
#endif /* _XF86_PCI_BUS_H */

View file

@ -1,771 +0,0 @@
/*
* Copyright © 2012 Red Hat.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Author: Dave Airlie <airlied@redhat.com>
*/
/*
* This file contains the interfaces to the bus-specific code
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#ifdef XSERVER_PLATFORM_BUS
#include <errno.h>
#include <pciaccess.h>
#include <fcntl.h>
#include <unistd.h>
#include "os.h"
#include "hotplug.h"
#include "systemd-logind.h"
#include "loaderProcs.h"
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86Priv.h"
#include "xf86str.h"
#include "xf86Bus.h"
#include "Pci.h"
#include "xf86platformBus.h"
#include "xf86Config.h"
#include "xf86Crtc.h"
#include "randrstr.h"
int platformSlotClaimed;
int xf86_num_platform_devices;
struct xf86_platform_device *xf86_platform_devices;
int
xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned)
{
xf86_platform_devices = xnfreallocarray(xf86_platform_devices,
xf86_num_platform_devices + 1,
sizeof(struct xf86_platform_device));
xf86_platform_devices[xf86_num_platform_devices].attribs = attribs;
xf86_platform_devices[xf86_num_platform_devices].pdev = NULL;
xf86_platform_devices[xf86_num_platform_devices].flags =
unowned ? XF86_PDEV_UNOWNED : 0;
xf86_num_platform_devices++;
return 0;
}
int
xf86_remove_platform_device(int dev_index)
{
int j;
config_odev_free_attributes(xf86_platform_devices[dev_index].attribs);
for (j = dev_index; j < xf86_num_platform_devices - 1; j++)
memcpy(&xf86_platform_devices[j], &xf86_platform_devices[j + 1], sizeof(struct xf86_platform_device));
xf86_num_platform_devices--;
return 0;
}
Bool
xf86_get_platform_device_unowned(int index)
{
return (xf86_platform_devices[index].flags & XF86_PDEV_UNOWNED) ?
TRUE : FALSE;
}
struct xf86_platform_device *
xf86_find_platform_device_by_devnum(int major, int minor)
{
int i, attr_major, attr_minor;
for (i = 0; i < xf86_num_platform_devices; i++) {
attr_major = xf86_platform_odev_attributes(i)->major;
attr_minor = xf86_platform_odev_attributes(i)->minor;
if (attr_major == major && attr_minor == minor)
return &xf86_platform_devices[i];
}
return NULL;
}
/*
* xf86IsPrimaryPlatform() -- return TRUE if primary device
* is a platform device and it matches this one.
*/
static Bool
xf86IsPrimaryPlatform(struct xf86_platform_device *plat)
{
/* Add max. 1 screen for the IgnorePrimary fallback path */
if (xf86ProbeIgnorePrimary && xf86NumScreens == 0)
return TRUE;
if (primaryBus.type == BUS_PLATFORM)
return plat == primaryBus.id.plat;
#ifdef XSERVER_LIBPCIACCESS
if (primaryBus.type == BUS_PCI)
if (plat->pdev)
if (MATCH_PCI_DEVICES(primaryBus.id.pci, plat->pdev))
return TRUE;
#endif
return FALSE;
}
static void
platform_find_pci_info(struct xf86_platform_device *pd, char *busid)
{
struct pci_slot_match devmatch;
struct pci_device *info;
struct pci_device_iterator *iter;
int ret;
ret = sscanf(busid, "pci:%04x:%02x:%02x.%u",
&devmatch.domain, &devmatch.bus, &devmatch.dev,
&devmatch.func);
if (ret != 4)
return;
iter = pci_slot_match_iterator_create(&devmatch);
info = pci_device_next(iter);
if (info)
pd->pdev = info;
pci_iterator_destroy(iter);
}
static Bool
xf86_check_platform_slot(const struct xf86_platform_device *pd)
{
int i;
for (i = 0; i < xf86NumEntities; i++) {
const EntityPtr u = xf86Entities[i];
if (pd->pdev && u->bus.type == BUS_PCI &&
MATCH_PCI_DEVICES(pd->pdev, u->bus.id.pci)) {
return FALSE;
}
if ((u->bus.type == BUS_PLATFORM) && (pd == u->bus.id.plat)) {
return FALSE;
}
}
return TRUE;
}
static Bool
MatchToken(const char *value, struct xorg_list *patterns,
int (*compare)(const char *, const char *))
{
const xf86MatchGroup *group;
/* If there are no patterns, accept the match */
if (xorg_list_is_empty(patterns))
return TRUE;
/* If there are patterns but no attribute, reject the match */
if (!value)
return FALSE;
/*
* Otherwise, iterate the list of patterns ensuring each entry has a
* match. Each list entry is a separate Match line of the same type.
*/
xorg_list_for_each_entry(group, patterns, entry) {
Bool match = FALSE;
char *const *cur;
for (cur = group->values; *cur; cur++) {
if ((*compare)(value, *cur) == 0) {
match = TRUE;
break;
}
}
if (!match)
return FALSE;
}
/* All the entries in the list matched the attribute */
return TRUE;
}
static Bool
OutputClassMatches(const XF86ConfOutputClassPtr oclass,
struct xf86_platform_device *dev)
{
char *driver = dev->attribs->driver;
if (!MatchToken(driver, &oclass->match_driver, strcmp))
return FALSE;
return TRUE;
}
static void
xf86OutputClassDriverList(int index, XF86MatchedDrivers *md)
{
XF86ConfOutputClassPtr cl;
for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
if (OutputClassMatches(cl, &xf86_platform_devices[index])) {
char *path = xf86_platform_odev_attributes(index)->path;
xf86Msg(X_INFO, "Applying OutputClass \"%s\" to %s\n",
cl->identifier, path);
xf86Msg(X_NONE, "\tloading driver: %s\n", cl->driver);
xf86AddMatchedDriver(md, cl->driver);
}
}
}
/**
* @return The numbers of found devices that match with the current system
* drivers.
*/
void
xf86PlatformMatchDriver(XF86MatchedDrivers *md)
{
int i;
struct pci_device *info = NULL;
int pass = 0;
for (pass = 0; pass < 2; pass++) {
for (i = 0; i < xf86_num_platform_devices; i++) {
if (xf86IsPrimaryPlatform(&xf86_platform_devices[i]) && (pass == 1))
continue;
else if (!xf86IsPrimaryPlatform(&xf86_platform_devices[i]) && (pass == 0))
continue;
xf86OutputClassDriverList(i, md);
info = xf86_platform_devices[i].pdev;
#ifdef __linux__
if (info)
xf86MatchDriverFromFiles(info->vendor_id, info->device_id, md);
#endif
if (info != NULL) {
xf86VideoPtrToDriverList(info, md);
}
}
}
}
int
xf86platformProbe(void)
{
int i;
Bool pci = TRUE;
XF86ConfOutputClassPtr cl, cl_head = (xf86configptr) ?
xf86configptr->conf_outputclass_lst : NULL;
char *old_path, *path = NULL;
config_odev_probe(xf86PlatformDeviceProbe);
if (!xf86scanpci()) {
pci = FALSE;
}
for (i = 0; i < xf86_num_platform_devices; i++) {
char *busid = xf86_platform_odev_attributes(i)->busid;
if (pci && busid && (strncmp(busid, "pci:", 4) == 0)) {
platform_find_pci_info(&xf86_platform_devices[i], busid);
}
/*
* Deal with OutputClass ModulePath directives, these must be
* processed before we do any module loading.
*/
for (cl = cl_head; cl; cl = cl->list.next) {
if (!OutputClassMatches(cl, &xf86_platform_devices[i]))
continue;
if (cl->modulepath && xf86ModPathFrom != X_CMDLINE) {
old_path = path;
XNFasprintf(&path, "%s,%s", cl->modulepath,
path ? path : xf86ModulePath);
free(old_path);
xf86Msg(X_CONFIG, "OutputClass \"%s\" ModulePath extended to \"%s\"\n",
cl->identifier, path);
LoaderSetPath(path);
}
}
}
free(path);
/* First see if there is an OutputClass match marking a device as primary */
for (i = 0; i < xf86_num_platform_devices; i++) {
struct xf86_platform_device *dev = &xf86_platform_devices[i];
for (cl = cl_head; cl; cl = cl->list.next) {
if (!OutputClassMatches(cl, dev))
continue;
if (xf86CheckBoolOption(cl->option_lst, "PrimaryGPU", FALSE)) {
xf86Msg(X_CONFIG, "OutputClass \"%s\" setting %s as PrimaryGPU\n",
cl->identifier, dev->attribs->path);
primaryBus.type = BUS_PLATFORM;
primaryBus.id.plat = dev;
return 0;
}
}
}
/* Then check for pci_device_is_boot_vga() */
for (i = 0; i < xf86_num_platform_devices; i++) {
struct xf86_platform_device *dev = &xf86_platform_devices[i];
if (!dev->pdev)
continue;
pci_device_probe(dev->pdev);
if (pci_device_is_boot_vga(dev->pdev)) {
primaryBus.type = BUS_PLATFORM;
primaryBus.id.plat = dev;
}
}
return 0;
}
void
xf86MergeOutputClassOptions(int entityIndex, void **options)
{
const EntityPtr entity = xf86Entities[entityIndex];
struct xf86_platform_device *dev = NULL;
XF86ConfOutputClassPtr cl;
XF86OptionPtr classopts;
int i = 0;
switch (entity->bus.type) {
case BUS_PLATFORM:
dev = entity->bus.id.plat;
break;
case BUS_PCI:
for (i = 0; i < xf86_num_platform_devices; i++) {
if (xf86_platform_devices[i].pdev) {
if (MATCH_PCI_DEVICES(xf86_platform_devices[i].pdev,
entity->bus.id.pci)) {
dev = &xf86_platform_devices[i];
break;
}
}
}
break;
default:
xf86Msg(X_DEBUG, "xf86MergeOutputClassOptions unsupported bus type %d\n",
entity->bus.type);
}
if (!dev)
return;
for (cl = xf86configptr->conf_outputclass_lst; cl; cl = cl->list.next) {
if (!OutputClassMatches(cl, dev) || !cl->option_lst)
continue;
xf86Msg(X_INFO, "Applying OutputClass \"%s\" options to %s\n",
cl->identifier, dev->attribs->path);
classopts = xf86optionListDup(cl->option_lst);
*options = xf86optionListMerge(*options, classopts);
}
}
static int
xf86ClaimPlatformSlot(struct xf86_platform_device * d, DriverPtr drvp,
int chipset, GDevPtr dev, Bool active)
{
EntityPtr p = NULL;
int num;
if (xf86_check_platform_slot(d)) {
num = xf86AllocateEntity();
p = xf86Entities[num];
p->driver = drvp;
p->chipset = chipset;
p->bus.type = BUS_PLATFORM;
p->bus.id.plat = d;
p->active = active;
p->inUse = FALSE;
if (dev)
xf86AddDevToEntity(num, dev);
platformSlotClaimed++;
return num;
}
else
return -1;
}
static int
xf86UnclaimPlatformSlot(struct xf86_platform_device *d, GDevPtr dev)
{
int i;
for (i = 0; i < xf86NumEntities; i++) {
const EntityPtr p = xf86Entities[i];
if ((p->bus.type == BUS_PLATFORM) && (p->bus.id.plat == d)) {
if (dev)
xf86RemoveDevFromEntity(i, dev);
platformSlotClaimed--;
p->bus.type = BUS_NONE;
return 0;
}
}
return 0;
}
#define END_OF_MATCHES(m) \
(((m).vendor_id == 0) && ((m).device_id == 0) && ((m).subvendor_id == 0))
static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp,
GDevPtr gdev, int flags, intptr_t match_data)
{
Bool foundScreen = FALSE;
int entity;
if (gdev && gdev->screen == 0 && !xf86_check_platform_slot(dev))
return FALSE;
entity = xf86ClaimPlatformSlot(dev, drvp, 0,
gdev, gdev ? gdev->active : 0);
if ((entity == -1) && gdev && (gdev->screen > 0)) {
unsigned nent;
for (nent = 0; nent < xf86NumEntities; nent++) {
EntityPtr pEnt = xf86Entities[nent];
if (pEnt->bus.type != BUS_PLATFORM)
continue;
if (pEnt->bus.id.plat == dev) {
entity = nent;
xf86AddDevToEntity(nent, gdev);
break;
}
}
}
if (entity != -1) {
if ((dev->flags & XF86_PDEV_SERVER_FD) && (!drvp->driverFunc ||
!drvp->driverFunc(NULL, SUPPORTS_SERVER_FDS, NULL))) {
systemd_logind_release_fd(dev->attribs->major, dev->attribs->minor, dev->attribs->fd);
dev->attribs->fd = -1;
dev->flags &= ~XF86_PDEV_SERVER_FD;
}
if (drvp->platformProbe(drvp, entity, flags, dev, match_data))
foundScreen = TRUE;
else
xf86UnclaimPlatformSlot(dev, gdev);
}
return foundScreen;
}
static Bool
probeSingleDevice(struct xf86_platform_device *dev, DriverPtr drvp, GDevPtr gdev, int flags)
{
int k;
Bool foundScreen = FALSE;
struct pci_device *pPci;
const struct pci_id_match *const devices = drvp->supported_devices;
if (dev->pdev && devices) {
int device_id = dev->pdev->device_id;
pPci = dev->pdev;
for (k = 0; !END_OF_MATCHES(devices[k]); k++) {
if (PCI_ID_COMPARE(devices[k].vendor_id, pPci->vendor_id)
&& PCI_ID_COMPARE(devices[k].device_id, device_id)
&& ((devices[k].device_class_mask & pPci->device_class)
== devices[k].device_class)) {
foundScreen = doPlatformProbe(dev, drvp, gdev, flags, devices[k].match_data);
if (foundScreen)
break;
}
}
}
else if (dev->pdev && !devices)
return FALSE;
else
foundScreen = doPlatformProbe(dev, drvp, gdev, flags, 0);
return foundScreen;
}
static Bool
isGPUDevice(GDevPtr gdev)
{
int i;
for (i = 0; i < gdev->myScreenSection->num_gpu_devices; i++) {
if (gdev == gdev->myScreenSection->gpu_devices[i])
return TRUE;
}
return FALSE;
}
int
xf86platformProbeDev(DriverPtr drvp)
{
Bool foundScreen = FALSE;
GDevPtr *devList;
const unsigned numDevs = xf86MatchDevice(drvp->driverName, &devList);
int i, j;
/* find the main device or any device specified in xorg.conf */
for (i = 0; i < numDevs; i++) {
const char *devpath;
/* skip inactive devices */
if (!devList[i]->active)
continue;
/* This is specific to modesetting. */
devpath = xf86FindOptionValue(devList[i]->options, "kmsdev");
for (j = 0; j < xf86_num_platform_devices; j++) {
if (devpath && *devpath) {
if (strcmp(xf86_platform_devices[j].attribs->path, devpath) == 0)
break;
} else if (devList[i]->busID && *devList[i]->busID) {
if (xf86PlatformDeviceCheckBusID(&xf86_platform_devices[j], devList[i]->busID))
break;
}
else {
/* for non-seat0 servers assume first device is the master */
if (ServerIsNotSeat0()) {
break;
} else {
/* Accept the device if the driver is simpledrm */
if (strcmp(xf86_platform_devices[j].attribs->driver, "simpledrm") == 0)
break;
}
if (xf86IsPrimaryPlatform(&xf86_platform_devices[j]))
break;
}
}
if (j == xf86_num_platform_devices)
continue;
foundScreen = probeSingleDevice(&xf86_platform_devices[j], drvp, devList[i],
isGPUDevice(devList[i]) ? PLATFORM_PROBE_GPU_SCREEN : 0);
}
free(devList);
return foundScreen;
}
int
xf86platformAddGPUDevices(DriverPtr drvp)
{
Bool foundScreen = FALSE;
GDevPtr *devList;
int j;
if (!drvp->platformProbe)
return FALSE;
xf86MatchDevice(drvp->driverName, &devList);
/* if autoaddgpu devices is enabled then go find any unclaimed platform
* devices and add them as GPU screens */
if (xf86Info.autoAddGPU) {
for (j = 0; j < xf86_num_platform_devices; j++) {
if (probeSingleDevice(&xf86_platform_devices[j], drvp,
devList ? devList[0] : NULL,
PLATFORM_PROBE_GPU_SCREEN))
foundScreen = TRUE;
}
}
free(devList);
return foundScreen;
}
int
xf86platformAddDevice(int index)
{
int i, old_screens, scr_index, scrnum;
DriverPtr drvp = NULL;
screenLayoutPtr layout;
static const char *hotplug_driver_name = "modesetting";
if (!xf86Info.autoAddGPU)
return -1;
/* force load the driver for now */
xf86LoadOneModule(hotplug_driver_name, NULL);
for (i = 0; i < xf86NumDrivers; i++) {
if (!xf86DriverList[i])
continue;
if (!strcmp(xf86DriverList[i]->driverName, hotplug_driver_name)) {
drvp = xf86DriverList[i];
break;
}
}
if (i == xf86NumDrivers)
return -1;
old_screens = xf86NumGPUScreens;
doPlatformProbe(&xf86_platform_devices[index], drvp, NULL,
PLATFORM_PROBE_GPU_SCREEN, 0);
if (old_screens == xf86NumGPUScreens)
return -1;
i = old_screens;
for (layout = xf86ConfigLayout.screens; layout->screen != NULL;
layout++) {
xf86GPUScreens[i]->confScreen = layout->screen;
break;
}
if (xf86GPUScreens[i]->PreInit &&
xf86GPUScreens[i]->PreInit(xf86GPUScreens[i], 0))
xf86GPUScreens[i]->configured = TRUE;
if (!xf86GPUScreens[i]->configured) {
ErrorF("hotplugged device %d didn't configure\n", i);
xf86DeleteScreen(xf86GPUScreens[i]);
return -1;
}
scr_index = AddGPUScreen(xf86GPUScreens[i]->ScreenInit, 0, NULL);
if (scr_index == -1) {
xf86DeleteScreen(xf86GPUScreens[i]);
xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
xf86NumGPUScreens = old_screens;
return -1;
}
dixSetPrivate(&xf86GPUScreens[i]->pScreen->devPrivates,
xf86ScreenKey, xf86GPUScreens[i]);
CreateScratchPixmapsForScreen(xf86GPUScreens[i]->pScreen);
if (xf86GPUScreens[i]->pScreen->CreateScreenResources &&
!(*xf86GPUScreens[i]->pScreen->CreateScreenResources) (xf86GPUScreens[i]->pScreen)) {
RemoveGPUScreen(xf86GPUScreens[i]->pScreen);
xf86DeleteScreen(xf86GPUScreens[i]);
xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
xf86NumGPUScreens = old_screens;
return -1;
}
/* attach unbound to the configured protocol screen (or 0) */
scrnum = xf86GPUScreens[i]->confScreen->screennum;
AttachUnboundGPU(xf86Screens[scrnum]->pScreen, xf86GPUScreens[i]->pScreen);
if (xf86Info.autoBindGPU)
RRProviderAutoConfigGpuScreen(xf86ScrnToScreen(xf86GPUScreens[i]),
xf86ScrnToScreen(xf86Screens[scrnum]));
RRResourcesChanged(xf86Screens[scrnum]->pScreen);
RRTellChanged(xf86Screens[scrnum]->pScreen);
return 0;
}
void
xf86platformRemoveDevice(int index)
{
EntityPtr entity;
int ent_num, i, j, scrnum;
Bool found;
for (ent_num = 0; ent_num < xf86NumEntities; ent_num++) {
entity = xf86Entities[ent_num];
if (entity->bus.type == BUS_PLATFORM &&
entity->bus.id.plat == &xf86_platform_devices[index])
break;
}
if (ent_num == xf86NumEntities)
goto out;
found = FALSE;
for (i = 0; i < xf86NumGPUScreens; i++) {
for (j = 0; j < xf86GPUScreens[i]->numEntities; j++)
if (xf86GPUScreens[i]->entityList[j] == ent_num) {
found = TRUE;
break;
}
if (found)
break;
}
if (!found) {
ErrorF("failed to find screen to remove\n");
goto out;
}
scrnum = xf86GPUScreens[i]->confScreen->screennum;
xf86GPUScreens[i]->pScreen->CloseScreen(xf86GPUScreens[i]->pScreen);
RemoveGPUScreen(xf86GPUScreens[i]->pScreen);
xf86DeleteScreen(xf86GPUScreens[i]);
xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
xf86_remove_platform_device(index);
RRResourcesChanged(xf86Screens[scrnum]->pScreen);
RRTellChanged(xf86Screens[scrnum]->pScreen);
out:
return;
}
/* called on return from VT switch to find any new devices */
void xf86platformVTProbe(void)
{
int i;
for (i = 0; i < xf86_num_platform_devices; i++) {
if (!(xf86_platform_devices[i].flags & XF86_PDEV_UNOWNED))
continue;
xf86_platform_devices[i].flags &= ~XF86_PDEV_UNOWNED;
xf86PlatformReprobeDevice(i, xf86_platform_devices[i].attribs);
}
}
void xf86platformPrimary(void)
{
/* use the first platform device as a fallback */
if (primaryBus.type == BUS_NONE) {
xf86Msg(X_INFO, "no primary bus or device found\n");
if (xf86_num_platform_devices > 0) {
primaryBus.id.plat = &xf86_platform_devices[0];
primaryBus.type = BUS_PLATFORM;
xf86Msg(X_NONE, "\tfalling back to %s\n", primaryBus.id.plat->attribs->syspath);
}
}
}
#endif

View file

@ -1,170 +0,0 @@
/*
* Copyright © 2012 Red Hat.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Author: Dave Airlie <airlied@redhat.com>
*/
#ifndef XF86_PLATFORM_BUS_H
#define XF86_PLATFORM_BUS_H
#include "hotplug.h"
#include "xf86MatchDrivers.h"
struct xf86_platform_device {
struct OdevAttributes *attribs;
/* for PCI devices */
struct pci_device *pdev;
int flags;
};
/* xf86_platform_device flags */
#define XF86_PDEV_UNOWNED 0x01
#define XF86_PDEV_SERVER_FD 0x02
#define XF86_PDEV_PAUSED 0x04
#ifdef XSERVER_PLATFORM_BUS
int xf86platformProbe(void);
int xf86platformProbeDev(DriverPtr drvp);
int xf86platformAddGPUDevices(DriverPtr drvp);
void xf86MergeOutputClassOptions(int entityIndex, void **options);
extern int xf86_num_platform_devices;
extern struct xf86_platform_device *xf86_platform_devices;
extern int
xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned);
extern int
xf86_remove_platform_device(int dev_index);
extern Bool
xf86_get_platform_device_unowned(int index);
extern int
xf86platformAddDevice(int index);
extern void
xf86platformRemoveDevice(int index);
static inline struct OdevAttributes *
xf86_platform_device_odev_attributes(struct xf86_platform_device *device)
{
return device->attribs;
}
static inline struct OdevAttributes *
xf86_platform_odev_attributes(int index)
{
struct xf86_platform_device *device = &xf86_platform_devices[index];
return device->attribs;
}
#ifndef _XORG_CONFIG_H_
/*
* Define the legacy API only for external builds
*/
/* path to kernel device node - Linux e.g. /dev/dri/card0 */
#define ODEV_ATTRIB_PATH 1
/* system device path - Linux e.g. /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 */
#define ODEV_ATTRIB_SYSPATH 2
/* DRI-style bus id */
#define ODEV_ATTRIB_BUSID 3
/* Server managed FD */
#define ODEV_ATTRIB_FD 4
/* Major number of the device node pointed to by ODEV_ATTRIB_PATH */
#define ODEV_ATTRIB_MAJOR 5
/* Minor number of the device node pointed to by ODEV_ATTRIB_PATH */
#define ODEV_ATTRIB_MINOR 6
/* kernel driver name */
#define ODEV_ATTRIB_DRIVER 7
/* Protect against a mismatch attribute type by generating a compiler
* error using a negative array size when an incorrect attribute is
* passed
*/
#define _ODEV_ATTRIB_IS_STRING(x) ((x) == ODEV_ATTRIB_PATH || \
(x) == ODEV_ATTRIB_SYSPATH || \
(x) == ODEV_ATTRIB_BUSID || \
(x) == ODEV_ATTRIB_DRIVER)
#define _ODEV_ATTRIB_STRING_CHECK(x) ((int (*)[_ODEV_ATTRIB_IS_STRING(x)-1]) 0)
static inline char *
_xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0])
{
switch (attrib) {
case ODEV_ATTRIB_PATH:
return xf86_platform_device_odev_attributes(device)->path;
case ODEV_ATTRIB_SYSPATH:
return xf86_platform_device_odev_attributes(device)->syspath;
case ODEV_ATTRIB_BUSID:
return xf86_platform_device_odev_attributes(device)->busid;
case ODEV_ATTRIB_DRIVER:
return xf86_platform_device_odev_attributes(device)->driver;
default:
assert(FALSE);
return NULL;
}
}
#define xf86_get_platform_device_attrib(device, attrib) _xf86_get_platform_device_attrib(device,attrib,_ODEV_ATTRIB_STRING_CHECK(attrib))
#define _ODEV_ATTRIB_IS_INT(x) ((x) == ODEV_ATTRIB_FD || (x) == ODEV_ATTRIB_MAJOR || (x) == ODEV_ATTRIB_MINOR)
#define _ODEV_ATTRIB_INT_DEFAULT(x) ((x) == ODEV_ATTRIB_FD ? -1 : 0)
#define _ODEV_ATTRIB_DEFAULT_CHECK(x,def) (_ODEV_ATTRIB_INT_DEFAULT(x) == (def))
#define _ODEV_ATTRIB_INT_CHECK(x,def) ((int (*)[_ODEV_ATTRIB_IS_INT(x)*_ODEV_ATTRIB_DEFAULT_CHECK(x,def)-1]) 0)
static inline int
_xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib, int (*fake)[0])
{
switch (attrib) {
case ODEV_ATTRIB_FD:
return xf86_platform_device_odev_attributes(device)->fd;
case ODEV_ATTRIB_MAJOR:
return xf86_platform_device_odev_attributes(device)->major;
case ODEV_ATTRIB_MINOR:
return xf86_platform_device_odev_attributes(device)->minor;
default:
assert(FALSE);
return 0;
}
}
#define xf86_get_platform_device_int_attrib(device, attrib, def) _xf86_get_platform_device_int_attrib(device,attrib,_ODEV_ATTRIB_INT_CHECK(attrib,def))
#endif
extern _X_EXPORT Bool
xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid);
extern _X_EXPORT void
xf86PlatformMatchDriver(XF86MatchedDrivers *);
extern void xf86platformVTProbe(void);
extern void xf86platformPrimary(void);
#else
static inline int xf86platformAddGPUDevices(DriverPtr drvp) { return FALSE; }
static inline void xf86MergeOutputClassOptions(int index, void **options) {}
#endif
#endif

View file

@ -1,757 +0,0 @@
/*
* SBUS bus-specific code.
*
* Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <unistd.h>
#include <X11/X.h>
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "xf86cmap.h"
#include "xf86Bus.h"
#include "xf86sbusBus.h"
#include "xf86Sbus.h"
Bool sbusSlotClaimed = FALSE;
static int xf86nSbusInfo;
static void
CheckSbusDevice(const char *device, int fbNum)
{
int fd, i;
struct fbgattr fbattr;
sbusDevicePtr psdp;
fd = open(device, O_RDONLY, 0);
if (fd < 0)
return;
memset(&fbattr, 0, sizeof(fbattr));
if (ioctl(fd, FBIOGATTR, &fbattr) < 0) {
if (ioctl(fd, FBIOGTYPE, &fbattr.fbtype) < 0) {
close(fd);
return;
}
}
close(fd);
for (i = 0; sbusDeviceTable[i].devId; i++)
if (sbusDeviceTable[i].fbType == fbattr.fbtype.fb_type)
break;
if (!sbusDeviceTable[i].devId)
return;
xf86SbusInfo =
xnfreallocarray(xf86SbusInfo, ++xf86nSbusInfo + 1, sizeof(psdp));
xf86SbusInfo[xf86nSbusInfo] = NULL;
xf86SbusInfo[xf86nSbusInfo - 1] = psdp = xnfcalloc(sizeof(sbusDevice), 1);
psdp->devId = sbusDeviceTable[i].devId;
psdp->fbNum = fbNum;
psdp->device = xnfstrdup(device);
psdp->width = fbattr.fbtype.fb_width;
psdp->height = fbattr.fbtype.fb_height;
psdp->fd = -1;
}
void
xf86SbusProbe(void)
{
int i, useProm = 0;
char fbDevName[32];
sbusDevicePtr psdp, *psdpp;
xf86SbusInfo = malloc(sizeof(psdp));
*xf86SbusInfo = NULL;
for (i = 0; i < 32; i++) {
snprintf(fbDevName, sizeof(fbDevName), "/dev/fb%d", i);
CheckSbusDevice(fbDevName, i);
}
if (sparcPromInit() >= 0) {
useProm = 1;
sparcPromAssignNodes();
}
for (psdpp = xf86SbusInfo; (psdp = *psdpp); psdpp++) {
for (i = 0; sbusDeviceTable[i].devId; i++)
if (sbusDeviceTable[i].devId == psdp->devId)
psdp->descr = sbusDeviceTable[i].descr;
/*
* If we can use PROM information and found the PROM node for this
* device, we can tell more about the card.
*/
if (useProm && psdp->node.node) {
char *prop, *promPath;
int len, chiprev, vmsize;
switch (psdp->devId) {
case SBUS_DEVICE_MGX:
prop = sparcPromGetProperty(&psdp->node, "fb_size", &len);
if (prop && len == 4 && *(int *) prop == 0x400000)
psdp->descr = "Quantum 3D MGXplus with 4M VRAM";
break;
case SBUS_DEVICE_CG6:
chiprev = 0;
vmsize = 0;
prop = sparcPromGetProperty(&psdp->node, "chiprev", &len);
if (prop && len == 4)
chiprev = *(int *) prop;
prop = sparcPromGetProperty(&psdp->node, "vmsize", &len);
if (prop && len == 4)
vmsize = *(int *) prop;
switch (chiprev) {
case 1:
case 2:
case 3:
case 4:
psdp->descr = "Sun Double width GX";
break;
case 5:
case 6:
case 7:
case 8:
case 9:
psdp->descr = "Sun Single width GX";
break;
case 11:
switch (vmsize) {
case 2:
psdp->descr = "Sun Turbo GX with 1M VSIMM";
break;
case 4:
psdp->descr = "Sun Turbo GX Plus";
break;
default:
psdp->descr = "Sun Turbo GX";
break;
}
}
break;
case SBUS_DEVICE_CG14:
prop = sparcPromGetProperty(&psdp->node, "reg", &len);
vmsize = 0;
if (prop && !(len % 12) && len > 0)
vmsize = *(int *) (prop + len - 4);
switch (vmsize) {
case 0x400000:
psdp->descr = "Sun SX with 4M VSIMM";
break;
case 0x800000:
psdp->descr = "Sun SX with 8M VSIMM";
break;
}
break;
case SBUS_DEVICE_LEO:
prop = sparcPromGetProperty(&psdp->node, "model", &len);
if (prop && len > 0 && !strstr(prop, "501-2503"))
psdp->descr = "Sun Turbo ZX";
break;
case SBUS_DEVICE_TCX:
if (sparcPromGetBool(&psdp->node, "tcx-8-bit"))
psdp->descr = "Sun TCX (8bit)";
else
psdp->descr = "Sun TCX (S24)";
break;
case SBUS_DEVICE_FFB:
prop = sparcPromGetProperty(&psdp->node, "name", &len);
chiprev = 0;
prop = sparcPromGetProperty(&psdp->node, "board_type", &len);
if (prop && len == 4)
chiprev = *(int *) prop;
if (strstr(prop, "afb")) {
if (chiprev == 3)
psdp->descr = "Sun|Elite3D-M6 Horizontal";
}
else {
switch (chiprev) {
case 0x08:
psdp->descr = "Sun FFB 67MHz Creator";
break;
case 0x0b:
psdp->descr = "Sun FFB 67MHz Creator 3D";
break;
case 0x1b:
psdp->descr = "Sun FFB 75MHz Creator 3D";
break;
case 0x20:
case 0x28:
psdp->descr = "Sun FFB2 Vertical Creator";
break;
case 0x23:
case 0x2b:
psdp->descr = "Sun FFB2 Vertical Creator 3D";
break;
case 0x30:
psdp->descr = "Sun FFB2+ Vertical Creator";
break;
case 0x33:
psdp->descr = "Sun FFB2+ Vertical Creator 3D";
break;
case 0x40:
case 0x48:
psdp->descr = "Sun FFB2 Horizontal Creator";
break;
case 0x43:
case 0x4b:
psdp->descr = "Sun FFB2 Horizontal Creator 3D";
break;
}
}
break;
}
xf86Msg(X_PROBED, "SBUS:(0x%08x) %s", psdp->node.node, psdp->descr);
promPath = sparcPromNode2Pathname(&psdp->node);
if (promPath) {
xf86ErrorF(" at %s", promPath);
free(promPath);
}
}
else
xf86Msg(X_PROBED, "SBUS: %s", psdp->descr);
xf86ErrorF("\n");
}
if (useProm)
sparcPromClose();
}
/*
* Parse a BUS ID string, and return the SBUS bus parameters if it was
* in the correct format for a SBUS bus id.
*/
Bool
xf86ParseSbusBusString(const char *busID, int *fbNum)
{
/*
* The format is assumed to be one of:
* "fbN", e.g. "fb1", which means the device corresponding to /dev/fbN
* "nameN", e.g. "cgsix0", which means Nth instance of card NAME
* "/prompath", e.g. "/sbus@0,10001000/cgsix@3,0" which is PROM pathname
* to the device.
*/
const char *id;
int i, len;
if (StringToBusType(busID, &id) != BUS_SBUS)
return FALSE;
if (*id != '/') {
if (!strncmp(id, "fb", 2)) {
if (!isdigit(id[2]))
return FALSE;
*fbNum = atoi(id + 2);
return TRUE;
}
else {
sbusDevicePtr *psdpp;
int devId;
for (i = 0, len = 0; sbusDeviceTable[i].devId; i++) {
len = strlen(sbusDeviceTable[i].promName);
if (!strncmp(sbusDeviceTable[i].promName, id, len)
&& isdigit(id[len]))
break;
}
devId = sbusDeviceTable[i].devId;
if (!devId)
return FALSE;
i = atoi(id + len);
for (psdpp = xf86SbusInfo; *psdpp; ++psdpp) {
if ((*psdpp)->devId != devId)
continue;
if (!i) {
*fbNum = (*psdpp)->fbNum;
return TRUE;
}
i--;
}
}
return FALSE;
}
if (sparcPromInit() >= 0) {
i = sparcPromPathname2Node(id);
sparcPromClose();
if (i) {
sbusDevicePtr *psdpp;
for (psdpp = xf86SbusInfo; *psdpp; ++psdpp) {
if ((*psdpp)->node.node == i) {
*fbNum = (*psdpp)->fbNum;
return TRUE;
}
}
}
}
return FALSE;
}
/*
* Compare a BUS ID string with a SBUS bus id. Return TRUE if they match.
*/
Bool
xf86CompareSbusBusString(const char *busID, int fbNum)
{
int iFbNum;
if (xf86ParseSbusBusString(busID, &iFbNum)) {
return fbNum == iFbNum;
}
else {
return FALSE;
}
}
/*
* Check if the slot requested is free. If it is already in use, return FALSE.
*/
Bool
xf86CheckSbusSlot(int fbNum)
{
int i;
EntityPtr p;
for (i = 0; i < xf86NumEntities; i++) {
p = xf86Entities[i];
/* Check if this SBUS slot is taken */
if (p->bus.type == BUS_SBUS && p->bus.id.sbus.fbNum == fbNum)
return FALSE;
}
return TRUE;
}
/*
* If the slot requested is already in use, return -1.
* Otherwise, claim the slot for the screen requesting it.
*/
int
xf86ClaimSbusSlot(sbusDevicePtr psdp, DriverPtr drvp, GDevPtr dev, Bool active)
{
EntityPtr p = NULL;
int num;
if (xf86CheckSbusSlot(psdp->fbNum)) {
num = xf86AllocateEntity();
p = xf86Entities[num];
p->driver = drvp;
p->chipset = -1;
p->bus.type = BUS_SBUS;
xf86AddDevToEntity(num, dev);
p->bus.id.sbus.fbNum = psdp->fbNum;
p->active = active;
p->inUse = FALSE;
sbusSlotClaimed = TRUE;
return num;
}
else
return -1;
}
int
xf86MatchSbusInstances(const char *driverName, int sbusDevId,
GDevPtr * devList, int numDevs, DriverPtr drvp,
int **foundEntities)
{
int i, j;
sbusDevicePtr psdp, *psdpp;
int numClaimedInstances = 0;
int allocatedInstances = 0;
int numFound = 0;
GDevPtr devBus = NULL;
GDevPtr dev = NULL;
int *retEntities = NULL;
int useProm = 0;
struct Inst {
sbusDevicePtr sbus;
GDevPtr dev;
Bool claimed; /* BusID matches with a device section */
} *instances = NULL;
*foundEntities = NULL;
for (psdpp = xf86SbusInfo, psdp = *psdpp; psdp; psdp = *++psdpp) {
if (psdp->devId != sbusDevId)
continue;
if (psdp->fd == -2)
continue;
++allocatedInstances;
instances = xnfreallocarray(instances,
allocatedInstances, sizeof(struct Inst));
instances[allocatedInstances - 1].sbus = psdp;
instances[allocatedInstances - 1].dev = NULL;
instances[allocatedInstances - 1].claimed = FALSE;
numFound++;
}
/*
* This may be debatable, but if no SBUS devices with a matching vendor
* type is found, return zero now. It is probably not desirable to
* allow the config file to override this.
*/
if (allocatedInstances <= 0) {
free(instances);
return 0;
}
if (sparcPromInit() >= 0)
useProm = 1;
if (xf86DoConfigure && xf86DoConfigurePass1) {
GDevPtr pGDev;
int actualcards = 0;
for (i = 0; i < allocatedInstances; i++) {
actualcards++;
pGDev = xf86AddBusDeviceToConfigure(drvp->driverName, BUS_SBUS,
instances[i].sbus, -1);
if (pGDev) {
/*
* XF86Match???Instances() treat chipID and chipRev as
* overrides, so clobber them here.
*/
pGDev->chipID = pGDev->chipRev = -1;
}
}
free(instances);
if (useProm)
sparcPromClose();
return actualcards;
}
DebugF("%s instances found: %d\n", driverName, allocatedInstances);
for (i = 0; i < allocatedInstances; i++) {
char *promPath = NULL;
psdp = instances[i].sbus;
devBus = NULL;
dev = NULL;
if (useProm && psdp->node.node)
promPath = sparcPromNode2Pathname(&psdp->node);
for (j = 0; j < numDevs; j++) {
if (devList[j]->busID && *devList[j]->busID) {
if (xf86CompareSbusBusString(devList[j]->busID, psdp->fbNum)) {
if (devBus)
xf86MsgVerb(X_WARNING, 0,
"%s: More than one matching Device section for "
"instance (BusID: %s) found: %s\n",
driverName, devList[j]->identifier,
devList[j]->busID);
else
devBus = devList[j];
}
}
else {
if (!dev && !devBus) {
if (promPath)
xf86Msg(X_PROBED,
"Assigning device section with no busID to SBUS:%s\n",
promPath);
else
xf86Msg(X_PROBED,
"Assigning device section with no busID to SBUS:fb%d\n",
psdp->fbNum);
dev = devList[j];
}
else
xf86MsgVerb(X_WARNING, 0,
"%s: More than one matching Device section "
"found: %s\n", driverName,
devList[j]->identifier);
}
}
if (devBus)
dev = devBus; /* busID preferred */
if (!dev && psdp->fd != -2) {
if (promPath) {
xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
"for instance (BusID SBUS:%s) found\n",
driverName, promPath);
}
else
xf86MsgVerb(X_WARNING, 0, "%s: No matching Device section "
"for instance (BusID SBUS:fb%d) found\n",
driverName, psdp->fbNum);
}
else if (dev) {
numClaimedInstances++;
instances[i].claimed = TRUE;
instances[i].dev = dev;
}
free(promPath);
}
DebugF("%s instances found: %d\n", driverName, numClaimedInstances);
/*
* Of the claimed instances, check that another driver hasn't already
* claimed its slot.
*/
numFound = 0;
for (i = 0; i < allocatedInstances && numClaimedInstances > 0; i++) {
if (!instances[i].claimed)
continue;
psdp = instances[i].sbus;
if (!xf86CheckSbusSlot(psdp->fbNum))
continue;
DebugF("%s: card at fb%d %08x is claimed by a Device section\n",
driverName, psdp->fbNum, psdp->node.node);
/* Allocate an entry in the lists to be returned */
numFound++;
retEntities = xnfreallocarray(retEntities, numFound, sizeof(int));
retEntities[numFound - 1]
= xf86ClaimSbusSlot(psdp, drvp, instances[i].dev,
instances[i].dev->active ? TRUE : FALSE);
}
free(instances);
if (numFound > 0) {
*foundEntities = retEntities;
}
if (useProm)
sparcPromClose();
return numFound;
}
/*
* xf86GetSbusInfoForEntity() -- Get the sbusDevicePtr of entity.
*/
sbusDevicePtr
xf86GetSbusInfoForEntity(int entityIndex)
{
sbusDevicePtr *psdpp;
EntityPtr p = xf86Entities[entityIndex];
if (entityIndex >= xf86NumEntities || p->bus.type != BUS_SBUS)
return NULL;
for (psdpp = xf86SbusInfo; *psdpp != NULL; psdpp++) {
if (p->bus.id.sbus.fbNum == (*psdpp)->fbNum)
return *psdpp;
}
return NULL;
}
int
xf86GetEntityForSbusInfo(sbusDevicePtr psdp)
{
int i;
for (i = 0; i < xf86NumEntities; i++) {
EntityPtr p = xf86Entities[i];
if (p->bus.type != BUS_SBUS)
continue;
if (p->bus.id.sbus.fbNum == psdp->fbNum)
return i;
}
return -1;
}
void
xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn, sbusDevicePtr psdp)
{
DisplayModePtr mode;
mode = xnfcalloc(sizeof(DisplayModeRec), 1);
mode->name = "current";
mode->next = mode;
mode->prev = mode;
mode->type = M_T_BUILTIN;
mode->Clock = 100000000;
mode->HDisplay = psdp->width;
mode->HSyncStart = psdp->width;
mode->HSyncEnd = psdp->width;
mode->HTotal = psdp->width;
mode->VDisplay = psdp->height;
mode->VSyncStart = psdp->height;
mode->VSyncEnd = psdp->height;
mode->VTotal = psdp->height;
mode->SynthClock = mode->Clock;
mode->CrtcHDisplay = mode->HDisplay;
mode->CrtcHSyncStart = mode->HSyncStart;
mode->CrtcHSyncEnd = mode->HSyncEnd;
mode->CrtcHTotal = mode->HTotal;
mode->CrtcVDisplay = mode->VDisplay;
mode->CrtcVSyncStart = mode->VSyncStart;
mode->CrtcVSyncEnd = mode->VSyncEnd;
mode->CrtcVTotal = mode->VTotal;
mode->CrtcHAdjusted = FALSE;
mode->CrtcVAdjusted = FALSE;
pScrn->modes = mode;
pScrn->virtualX = psdp->width;
pScrn->virtualY = psdp->height;
}
static DevPrivateKeyRec sbusPaletteKeyRec;
#define sbusPaletteKey (&sbusPaletteKeyRec)
typedef struct _sbusCmap {
sbusDevicePtr psdp;
CloseScreenProcPtr CloseScreen;
Bool origCmapValid;
unsigned char origRed[16];
unsigned char origGreen[16];
unsigned char origBlue[16];
} sbusCmapRec, *sbusCmapPtr;
#define SBUSCMAPPTR(pScreen) ((sbusCmapPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, sbusPaletteKey))
static void
xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
LOCO * colors, VisualPtr pVisual)
{
int i, index;
sbusCmapPtr cmap;
struct fbcmap fbcmap;
unsigned char *data;
cmap = SBUSCMAPPTR(pScrn->pScreen);
if (!cmap)
return;
fbcmap.count = 0;
fbcmap.index = indices[0];
fbcmap.red = data = xallocarray(numColors, 3);
if (!data)
return;
fbcmap.green = data + numColors;
fbcmap.blue = fbcmap.green + numColors;
for (i = 0; i < numColors; i++) {
index = indices[i];
if (fbcmap.count && index != fbcmap.index + fbcmap.count) {
ioctl(cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
fbcmap.count = 0;
fbcmap.index = index;
}
fbcmap.red[fbcmap.count] = colors[index].red;
fbcmap.green[fbcmap.count] = colors[index].green;
fbcmap.blue[fbcmap.count++] = colors[index].blue;
}
ioctl(cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
free(data);
}
static Bool
xf86SbusCmapCloseScreen(ScreenPtr pScreen)
{
sbusCmapPtr cmap;
struct fbcmap fbcmap;
cmap = SBUSCMAPPTR(pScreen);
if (cmap->origCmapValid) {
fbcmap.index = 0;
fbcmap.count = 16;
fbcmap.red = cmap->origRed;
fbcmap.green = cmap->origGreen;
fbcmap.blue = cmap->origBlue;
ioctl(cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
}
pScreen->CloseScreen = cmap->CloseScreen;
free(cmap);
return (*pScreen->CloseScreen) (pScreen);
}
Bool
xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp)
{
sbusCmapPtr cmap;
struct fbcmap fbcmap;
unsigned char data[2];
if (!dixRegisterPrivateKey(sbusPaletteKey, PRIVATE_SCREEN, 0))
FatalError("Cannot register sbus private key");
cmap = xnfcalloc(1, sizeof(sbusCmapRec));
dixSetPrivate(&pScreen->devPrivates, sbusPaletteKey, cmap);
cmap->psdp = psdp;
fbcmap.index = 0;
fbcmap.count = 16;
fbcmap.red = cmap->origRed;
fbcmap.green = cmap->origGreen;
fbcmap.blue = cmap->origBlue;
if (ioctl(psdp->fd, FBIOGETCMAP, &fbcmap) >= 0)
cmap->origCmapValid = TRUE;
fbcmap.index = 0;
fbcmap.count = 2;
fbcmap.red = data;
fbcmap.green = data;
fbcmap.blue = data;
if (pScreen->whitePixel == 0) {
data[0] = 255;
data[1] = 0;
}
else {
data[0] = 0;
data[1] = 255;
}
ioctl(psdp->fd, FBIOPUTCMAP, &fbcmap);
cmap->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xf86SbusCmapCloseScreen;
return xf86HandleColormaps(pScreen, 256, 8,
xf86SbusCmapLoadPalette, NULL, 0);
}
Bool
xf86SbusConfigure(void *busData, sbusDevicePtr sBus)
{
if (sBus && sBus->fbNum == ((sbusDevicePtr) busData)->fbNum)
return 0;
return 1;
}
void
xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus, GDevRec * GDev)
{
char *promPath = NULL;
sBus = (sbusDevicePtr) busData;
GDev->identifier = sBus->descr;
if (sparcPromInit() >= 0) {
promPath = sparcPromNode2Pathname(&sBus->node);
sparcPromClose();
}
if (promPath) {
XNFasprintf(&GDev->busID, "SBUS:%s", promPath);
free(promPath);
}
else {
XNFasprintf(&GDev->busID, "SBUS:fb%d", sBus->fbNum);
}
}

View file

@ -1,111 +0,0 @@
/*
* SBUS bus-specific declarations
*
* Copyright (C) 2000 Jakub Jelinek (jakub@redhat.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _XF86_SBUSBUS_H
#define _XF86_SBUSBUS_H
#include "xf86str.h"
#define SBUS_DEVICE_BW2 0x0001
#define SBUS_DEVICE_CG2 0x0002
#define SBUS_DEVICE_CG3 0x0003
#define SBUS_DEVICE_CG4 0x0004
#define SBUS_DEVICE_CG6 0x0005
#define SBUS_DEVICE_CG8 0x0006
#define SBUS_DEVICE_CG12 0x0007
#define SBUS_DEVICE_CG14 0x0008
#define SBUS_DEVICE_LEO 0x0009
#define SBUS_DEVICE_TCX 0x000a
#define SBUS_DEVICE_FFB 0x000b
#define SBUS_DEVICE_GT 0x000c
#define SBUS_DEVICE_MGX 0x000d
typedef struct sbus_prom_node {
int node;
/* Because of misdesigned openpromio */
int cookie[2];
} sbusPromNode, *sbusPromNodePtr;
typedef struct sbus_device {
int devId;
int fbNum;
int fd;
int width, height;
sbusPromNode node;
const char *descr;
const char *device;
} sbusDevice, *sbusDevicePtr;
struct sbus_devtable {
int devId;
int fbType;
const char *promName;
const char *driverName;
const char *descr;
};
extern _X_EXPORT void xf86SbusProbe(void);
extern _X_EXPORT sbusDevicePtr *xf86SbusInfo;
extern _X_EXPORT struct sbus_devtable sbusDeviceTable[];
extern _X_EXPORT int xf86MatchSbusInstances(const char *driverName,
int sbusDevId, GDevPtr * devList,
int numDevs, DriverPtr drvp,
int **foundEntities);
extern _X_EXPORT sbusDevicePtr xf86GetSbusInfoForEntity(int entityIndex);
extern _X_EXPORT int xf86GetEntityForSbusInfo(sbusDevicePtr psdp);
extern _X_EXPORT void xf86SbusUseBuiltinMode(ScrnInfoPtr pScrn,
sbusDevicePtr psdp);
extern _X_EXPORT void *xf86MapSbusMem(sbusDevicePtr psdp,
unsigned long offset,
unsigned long size);
extern _X_EXPORT void xf86UnmapSbusMem(sbusDevicePtr psdp, void *addr,
unsigned long size);
extern _X_EXPORT void xf86SbusHideOsHwCursor(sbusDevicePtr psdp);
extern _X_EXPORT void xf86SbusSetOsHwCursorCmap(sbusDevicePtr psdp, int bg,
int fg);
extern _X_EXPORT Bool xf86SbusHandleColormaps(ScreenPtr pScreen,
sbusDevicePtr psdp);
extern _X_EXPORT int promRootNode;
extern _X_EXPORT int promGetSibling(int node);
extern _X_EXPORT int promGetChild(int node);
extern _X_EXPORT char *promGetProperty(const char *prop, int *lenp);
extern _X_EXPORT int promGetBool(const char *prop);
extern _X_EXPORT int sparcPromInit(void);
extern _X_EXPORT void sparcPromClose(void);
extern _X_EXPORT char *sparcPromGetProperty(sbusPromNodePtr pnode,
const char *prop, int *lenp);
extern _X_EXPORT int sparcPromGetBool(sbusPromNodePtr pnode, const char *prop);
extern _X_EXPORT void sparcPromAssignNodes(void);
extern _X_EXPORT char *sparcPromNode2Pathname(sbusPromNodePtr pnode);
extern _X_EXPORT int sparcPromPathname2Node(const char *pathName);
extern _X_EXPORT char *sparcDriverName(void);
extern Bool xf86SbusConfigure(void *busData, sbusDevicePtr sBus);
extern void xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus,
GDevRec * GDev);
#endif /* _XF86_SBUSBUS_H */

View file

@ -1,775 +0,0 @@
/*
* Copyright (c) 1997-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/*
* This file contains definitions of the public XFree86 data structures/types.
* Any data structures that video drivers need to access should go here.
*/
#ifndef _XF86STR_H
#define _XF86STR_H
#include "misc.h"
#include "input.h"
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "colormapst.h"
#include "xf86Module.h"
#include "xf86Opt.h"
#include "displaymode.h"
/**
* Integer type that is of the size of the addressable memory (machine size).
* On most platforms \c uintptr_t will suffice. However, on some mixed
* 32-bit / 64-bit platforms, such as 32-bit binaries on 64-bit PowerPC, this
* must be 64-bits.
*/
#include <inttypes.h>
#if defined(__powerpc__)
typedef uint64_t memType;
#else
typedef uintptr_t memType;
#endif
/* Video mode flags */
typedef enum {
V_PHSYNC = 0x0001,
V_NHSYNC = 0x0002,
V_PVSYNC = 0x0004,
V_NVSYNC = 0x0008,
V_INTERLACE = 0x0010,
V_DBLSCAN = 0x0020,
V_CSYNC = 0x0040,
V_PCSYNC = 0x0080,
V_NCSYNC = 0x0100,
V_HSKEW = 0x0200, /* hskew provided */
V_BCAST = 0x0400,
V_PIXMUX = 0x1000,
V_DBLCLK = 0x2000,
V_CLKDIV2 = 0x4000
} ModeFlags;
typedef enum {
INTERLACE_HALVE_V = 0x0001 /* Halve V values for interlacing */
} CrtcAdjustFlags;
/* Flags passed to ChipValidMode() */
typedef enum {
MODECHECK_INITIAL = 0,
MODECHECK_FINAL = 1
} ModeCheckFlags;
/*
* The mode sets are, from best to worst: USERDEF, DRIVER, and DEFAULT/BUILTIN.
* Preferred will bubble a mode to the top within a set.
*/
#define M_T_BUILTIN 0x01 /* built-in mode */
#define M_T_CLOCK_C (0x02 | M_T_BUILTIN) /* built-in mode - configure clock */
#define M_T_CRTC_C (0x04 | M_T_BUILTIN) /* built-in mode - configure CRTC */
#define M_T_CLOCK_CRTC_C (M_T_CLOCK_C | M_T_CRTC_C)
/* built-in mode - configure CRTC and clock */
#define M_T_PREFERRED 0x08 /* preferred mode within a set */
#define M_T_DEFAULT 0x10 /* (VESA) default modes */
#define M_T_USERDEF 0x20 /* One of the modes from the config file */
#define M_T_DRIVER 0x40 /* Supplied by the driver (EDID, etc) */
#define M_T_USERPREF 0x80 /* mode preferred by the user config */
/* The monitor description */
#define MAX_HSYNC 8
#define MAX_VREFRESH 8
typedef struct {
float hi, lo;
} range;
typedef struct {
CARD32 red, green, blue;
} rgb;
typedef struct {
float red, green, blue;
} Gamma;
/* The permitted gamma range is 1 / GAMMA_MAX <= g <= GAMMA_MAX */
#define GAMMA_MAX 10.0
#define GAMMA_MIN (1.0 / GAMMA_MAX)
#define GAMMA_ZERO (GAMMA_MIN / 100.0)
typedef struct {
const char *id;
const char *vendor;
const char *model;
int nHsync;
range hsync[MAX_HSYNC];
int nVrefresh;
range vrefresh[MAX_VREFRESH];
DisplayModePtr Modes; /* Start of the monitor's mode list */
DisplayModePtr Last; /* End of the monitor's mode list */
Gamma gamma; /* Gamma of the monitor */
int widthmm;
int heightmm;
void *options;
void *DDC;
Bool reducedblanking; /* Allow CVT reduced blanking modes? */
int maxPixClock; /* in kHz, like mode->Clock */
} MonRec, *MonPtr;
/* the list of clock ranges */
typedef struct x_ClockRange {
struct x_ClockRange *next;
int minClock; /* (kHz) */
int maxClock; /* (kHz) */
int clockIndex; /* -1 for programmable clocks */
Bool interlaceAllowed;
Bool doubleScanAllowed;
int ClockMulFactor;
int ClockDivFactor;
int PrivFlags;
} ClockRange, *ClockRangePtr;
/*
* The driverFunc. xorgDriverFuncOp specifies the action driver should
* perform. If requested option is not supported function should return
* FALSE. pointer can be used to pass arguments to the function or
* to return data to the caller.
*/
typedef struct _ScrnInfoRec *ScrnInfoPtr;
/* do not change order */
typedef enum {
RR_GET_INFO,
RR_SET_CONFIG,
RR_GET_MODE_MM,
GET_REQUIRED_HW_INTERFACES = 10,
SUPPORTS_SERVER_FDS = 11,
} xorgDriverFuncOp;
typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, void *);
/* RR_GET_INFO, RR_SET_CONFIG */
typedef struct {
int rotation;
int rate;
int width;
int height;
} xorgRRConfig;
typedef union {
short RRRotations;
xorgRRConfig RRConfig;
} xorgRRRotation, *xorgRRRotationPtr;
/* RR_GET_MODE_MM */
typedef struct {
DisplayModePtr mode;
int virtX;
int virtY;
int mmWidth;
int mmHeight;
} xorgRRModeMM, *xorgRRModeMMPtr;
/* GET_REQUIRED_HW_INTERFACES */
#define HW_IO 1
#define HW_MMIO 2
#define HW_SKIP_CONSOLE 4
#define NEED_IO_ENABLED(x) (x & HW_IO)
typedef CARD32 xorgHWFlags;
/*
* The driver list struct. This contains the information required for each
* driver before a ScrnInfoRec has been allocated.
*/
struct _DriverRec;
struct _SymTabRec;
struct _PciChipsets;
struct pci_device;
struct xf86_platform_device;
typedef struct _DriverRec {
int driverVersion;
const char *driverName;
void (*Identify) (int flags);
Bool (*Probe) (struct _DriverRec * drv, int flags);
const OptionInfoRec *(*AvailableOptions) (int chipid, int bustype);
void *module;
int refCount;
xorgDriverFuncProc *driverFunc;
const struct pci_id_match *supported_devices;
Bool (*PciProbe) (struct _DriverRec * drv, int entity_num,
struct pci_device * dev, intptr_t match_data);
Bool (*platformProbe) (struct _DriverRec * drv, int entity_num, int flags,
struct xf86_platform_device * dev, intptr_t match_data);
} DriverRec, *DriverPtr;
/*
* platform probe flags
*/
#define PLATFORM_PROBE_GPU_SCREEN 1
/*
* AddDriver flags
*/
#define HaveDriverFuncs 1
/*
* These are the private bus types. New types can be added here. Types
* required for the public interface should be added to xf86str.h, with
* function prototypes added to xf86.h.
*/
/* Tolerate prior #include <linux/input.h> */
#if defined(__linux__)
#undef BUS_NONE
#undef BUS_PCI
#undef BUS_SBUS
#undef BUS_PLATFORM
#undef BUS_USB
#undef BUS_last
#endif
typedef enum {
BUS_NONE,
BUS_PCI,
BUS_SBUS,
BUS_PLATFORM,
BUS_USB,
BUS_last /* Keep last */
} BusType;
typedef struct {
int fbNum;
} SbusBusId;
typedef struct _bus {
BusType type;
union {
struct pci_device *pci;
SbusBusId sbus;
struct xf86_platform_device *plat;
} id;
} BusRec, *BusPtr;
typedef enum {
DAC_BPP8 = 0,
DAC_BPP16,
DAC_BPP24,
DAC_BPP32,
MAXDACSPEEDS
} DacSpeedIndex;
typedef struct {
const char *identifier;
const char *vendor;
const char *board;
const char *chipset;
const char *ramdac;
const char *driver;
struct _confscreenrec *myScreenSection;
Bool claimed;
int dacSpeeds[MAXDACSPEEDS];
int numclocks;
int clock[MAXCLOCKS];
const char *clockchip;
const char *busID;
Bool active;
Bool inUse;
int videoRam;
unsigned long MemBase; /* Frame buffer base address */
unsigned long IOBase;
int chipID;
int chipRev;
void *options;
int irq;
int screen; /* For multi-CRTC cards */
} GDevRec, *GDevPtr;
typedef struct {
int frameX0;
int frameY0;
int virtualX;
int virtualY;
int depth;
int fbbpp;
rgb weight;
rgb blackColour;
rgb whiteColour;
int defaultVisual;
const char **modes;
void *options;
} DispRec, *DispPtr;
typedef struct _confxvportrec {
const char *identifier;
void *options;
} confXvPortRec, *confXvPortPtr;
typedef struct _confxvadaptrec {
const char *identifier;
int numports;
confXvPortPtr ports;
void *options;
} confXvAdaptorRec, *confXvAdaptorPtr;
#define MAX_GPUDEVICES 4
typedef struct _confscreenrec {
const char *id;
int screennum;
int defaultdepth;
int defaultbpp;
int defaultfbbpp;
MonPtr monitor;
GDevPtr device;
int numdisplays;
DispPtr *displays;
int numxvadaptors;
confXvAdaptorPtr xvadaptors;
void *options;
int num_gpu_devices;
GDevPtr gpu_devices[MAX_GPUDEVICES];
} confScreenRec, *confScreenPtr;
typedef enum {
PosObsolete = -1,
PosAbsolute = 0,
PosRightOf,
PosLeftOf,
PosAbove,
PosBelow,
PosRelative
} PositionType;
typedef struct _screenlayoutrec {
confScreenPtr screen;
const char *topname;
confScreenPtr top;
const char *bottomname;
confScreenPtr bottom;
const char *leftname;
confScreenPtr left;
const char *rightname;
confScreenPtr right;
PositionType where;
int x;
int y;
const char *refname;
confScreenPtr refscreen;
} screenLayoutRec, *screenLayoutPtr;
typedef struct _InputInfoRec InputInfoRec;
typedef struct _serverlayoutrec {
const char *id;
screenLayoutPtr screens;
GDevPtr inactives;
InputInfoRec **inputs; /* NULL terminated */
void *options;
} serverLayoutRec, *serverLayoutPtr;
typedef struct _confdribufferrec {
int count;
int size;
enum {
XF86DRI_WC_HINT = 0x0001 /* Placeholder: not implemented */
} flags;
} confDRIBufferRec, *confDRIBufferPtr;
typedef struct _confdrirec {
int group;
int mode;
int bufs_count;
confDRIBufferRec *bufs;
} confDRIRec, *confDRIPtr;
#define NUM_RESERVED_INTS 4
#define NUM_RESERVED_POINTERS 4
#define NUM_RESERVED_FUNCS 4
/* let clients know they can use this */
#define XF86_SCRN_HAS_PREFER_CLONE 1
typedef void *(*funcPointer) (void);
/* Power management events: so far we only support APM */
typedef enum {
XF86_APM_UNKNOWN = -1,
XF86_APM_SYS_STANDBY,
XF86_APM_SYS_SUSPEND,
XF86_APM_CRITICAL_SUSPEND,
XF86_APM_USER_STANDBY,
XF86_APM_USER_SUSPEND,
XF86_APM_STANDBY_RESUME,
XF86_APM_NORMAL_RESUME,
XF86_APM_CRITICAL_RESUME,
XF86_APM_LOW_BATTERY,
XF86_APM_POWER_STATUS_CHANGE,
XF86_APM_UPDATE_TIME,
XF86_APM_CAPABILITY_CHANGED,
XF86_APM_STANDBY_FAILED,
XF86_APM_SUSPEND_FAILED
} pmEvent;
typedef enum {
PM_WAIT,
PM_CONTINUE,
PM_FAILED,
PM_NONE
} pmWait;
typedef struct _PciChipsets {
/**
* Key used to match this device with its name in an array of
* \c SymTabRec.
*/
int numChipset;
/**
* This value is quirky. Depending on the driver, it can take on one of
* three meanings. In drivers that have exactly one vendor ID (e.g.,
* radeon, mga, i810) the low 16-bits are the device ID.
*
* In drivers that can have multiple vendor IDs (e.g., the glint driver
* can have either 3dlabs' ID or TI's ID, the i740 driver can have either
* Intel's ID or Real3D's ID, etc.) the low 16-bits are the device ID and
* the high 16-bits are the vendor ID.
*
* In drivers that don't have a specific vendor (e.g., vga) contains the
* device ID for either the generic VGA or generic 8514 devices. This
* turns out to be the same as the subclass and programming interface
* value (e.g., the full 24-bit class for the VGA device is 0x030000 (or
* 0x000101) and for 8514 is 0x030001).
*/
int PCIid;
/* dummy place holders for drivers to build against old/new servers */
#define RES_UNDEFINED NULL
#define RES_EXCLUSIVE_VGA NULL
#define RES_SHARED_VGA NULL
void *dummy;
} PciChipsets;
/* Entity properties */
typedef void (*EntityProc) (int entityIndex, void *private);
typedef struct _entityInfo {
int index;
BusRec location;
int chipset;
Bool active;
GDevPtr device;
DriverPtr driver;
} EntityInfoRec, *EntityInfoPtr;
/* DGA */
typedef struct {
int num; /* A unique identifier for the mode (num > 0) */
DisplayModePtr mode;
int flags; /* DGA_CONCURRENT_ACCESS, etc... */
int imageWidth; /* linear accessible portion (pixels) */
int imageHeight;
int pixmapWidth; /* Xlib accessible portion (pixels) */
int pixmapHeight; /* both fields ignored if no concurrent access */
int bytesPerScanline;
int byteOrder; /* MSBFirst, LSBFirst */
int depth;
int bitsPerPixel;
unsigned long red_mask;
unsigned long green_mask;
unsigned long blue_mask;
short visualClass;
int viewportWidth;
int viewportHeight;
int xViewportStep; /* viewport position granularity */
int yViewportStep;
int maxViewportX; /* max viewport origin */
int maxViewportY;
int viewportFlags; /* types of page flipping possible */
int offset; /* offset into physical memory */
unsigned char *address; /* server's mapped framebuffer */
int reserved1;
int reserved2;
} DGAModeRec, *DGAModePtr;
typedef struct {
DGAModePtr mode;
PixmapPtr pPix;
} DGADeviceRec, *DGADevicePtr;
/*
* Flags for driver Probe() functions.
*/
#define PROBE_DEFAULT 0x00
#define PROBE_DETECT 0x01
#define PROBE_TRYHARD 0x02
/*
* Driver entry point types
*/
typedef Bool xf86ProbeProc(DriverPtr, int);
typedef Bool xf86PreInitProc(ScrnInfoPtr, int);
typedef Bool xf86ScreenInitProc(ScreenPtr, int, char **);
typedef Bool xf86SwitchModeProc(ScrnInfoPtr, DisplayModePtr);
typedef void xf86AdjustFrameProc(ScrnInfoPtr, int, int);
typedef Bool xf86EnterVTProc(ScrnInfoPtr);
typedef void xf86LeaveVTProc(ScrnInfoPtr);
typedef void xf86FreeScreenProc(ScrnInfoPtr);
typedef ModeStatus xf86ValidModeProc(ScrnInfoPtr, DisplayModePtr, Bool, int);
typedef void xf86EnableDisableFBAccessProc(ScrnInfoPtr, Bool);
typedef int xf86SetDGAModeProc(ScrnInfoPtr, int, DGADevicePtr);
typedef int xf86ChangeGammaProc(ScrnInfoPtr, Gamma);
typedef void xf86PointerMovedProc(ScrnInfoPtr, int, int);
typedef Bool xf86PMEventProc(ScrnInfoPtr, pmEvent, Bool);
typedef void xf86DPMSSetProc(ScrnInfoPtr, int, int);
typedef void xf86LoadPaletteProc(ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
typedef void xf86SetOverscanProc(ScrnInfoPtr, int);
typedef void xf86ModeSetProc(ScrnInfoPtr);
/*
* ScrnInfoRec
*
* There is one of these for each screen, and it holds all the screen-specific
* information. Note: No fields are to be dependent on compile-time defines.
*/
typedef struct _ScrnInfoRec {
int driverVersion;
const char *driverName; /* canonical name used in */
/* the config file */
ScreenPtr pScreen; /* Pointer to the ScreenRec */
int scrnIndex; /* Number of this screen */
Bool configured; /* Is this screen valid */
int origIndex; /* initial number assigned to
* this screen before
* finalising the number of
* available screens */
/* Display-wide screenInfo values needed by this screen */
int imageByteOrder;
int bitmapScanlineUnit;
int bitmapScanlinePad;
int bitmapBitOrder;
int numFormats;
PixmapFormatRec formats[MAXFORMATS];
PixmapFormatRec fbFormat;
int bitsPerPixel; /* fb bpp */
int depth; /* depth of default visual */
MessageType depthFrom; /* set from config? */
MessageType bitsPerPixelFrom; /* set from config? */
rgb weight; /* r/g/b weights */
rgb mask; /* rgb masks */
rgb offset; /* rgb offsets */
int rgbBits; /* Number of bits in r/g/b */
Gamma gamma; /* Gamma of the monitor */
int defaultVisual; /* default visual class */
int virtualX; /* Virtual width */
int virtualY; /* Virtual height */
int xInc; /* Horizontal timing increment */
int displayWidth; /* memory pitch */
int frameX0; /* viewport position */
int frameY0;
int frameX1;
int frameY1;
int zoomLocked; /* Disallow mode changes */
DisplayModePtr modePool; /* list of compatible modes */
DisplayModePtr modes; /* list of actual modes */
DisplayModePtr currentMode; /* current mode
* This was previously
* overloaded with the modes
* field, which is a pointer
* into a circular list */
confScreenPtr confScreen; /* Screen config info */
MonPtr monitor; /* Monitor information */
DispPtr display; /* Display information */
int *entityList; /* List of device entities */
int numEntities;
int widthmm; /* physical display dimensions
* in mm */
int heightmm;
int xDpi; /* width DPI */
int yDpi; /* height DPI */
const char *name; /* Name to prefix messages */
void *driverPrivate; /* Driver private area */
DevUnion *privates; /* Other privates can hook in
* here */
DriverPtr drv; /* xf86DriverList[] entry */
void *module; /* Pointer to module head */
int colorKey;
int overlayFlags;
/* Some of these may be moved out of here into the driver private area */
const char *chipset; /* chipset name */
const char *ramdac; /* ramdac name */
const char *clockchip; /* clock name */
Bool progClock; /* clock is programmable */
int numClocks; /* number of clocks */
int clock[MAXCLOCKS]; /* list of clock frequencies */
int videoRam; /* amount of video ram (kb) */
unsigned long memPhysBase; /* Physical address of FB */
unsigned long fbOffset; /* Offset of FB in the above */
void *options;
/* Allow screens to be enabled/disabled individually */
Bool vtSema;
/* hw cursor moves from input thread */
Bool silkenMouse;
/* Storage for clockRanges and adjustFlags for use with the VidMode ext */
ClockRangePtr clockRanges;
int adjustFlags;
/* initial rightof support disable */
int preferClone;
Bool is_gpu;
uint32_t capabilities;
int *entityInstanceList;
struct pci_device *vgaDev;
/*
* Driver entry points.
*
*/
xf86ProbeProc *Probe;
xf86PreInitProc *PreInit;
xf86ScreenInitProc *ScreenInit;
xf86SwitchModeProc *SwitchMode;
xf86AdjustFrameProc *AdjustFrame;
xf86EnterVTProc *EnterVT;
xf86LeaveVTProc *LeaveVT;
xf86FreeScreenProc *FreeScreen;
xf86ValidModeProc *ValidMode;
xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
xf86SetDGAModeProc *SetDGAMode;
xf86ChangeGammaProc *ChangeGamma;
xf86PointerMovedProc *PointerMoved;
xf86PMEventProc *PMEvent;
xf86DPMSSetProc *DPMSSet;
xf86LoadPaletteProc *LoadPalette;
xf86SetOverscanProc *SetOverscan;
xorgDriverFuncProc *DriverFunc;
xf86ModeSetProc *ModeSet;
int reservedInt[NUM_RESERVED_INTS];
void *reservedPtr[NUM_RESERVED_POINTERS];
funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
} ScrnInfoRec;
typedef struct {
Bool (*OpenFramebuffer) (ScrnInfoPtr pScrn,
char **name,
unsigned char **mem,
int *size, int *offset, int *extra);
void (*CloseFramebuffer) (ScrnInfoPtr pScrn);
Bool (*SetMode) (ScrnInfoPtr pScrn, DGAModePtr pMode);
void (*SetViewport) (ScrnInfoPtr pScrn, int x, int y, int flags);
int (*GetViewport) (ScrnInfoPtr pScrn);
void (*Sync) (ScrnInfoPtr);
void (*FillRect) (ScrnInfoPtr pScrn,
int x, int y, int w, int h, unsigned long color);
void (*BlitRect) (ScrnInfoPtr pScrn,
int srcx, int srcy, int w, int h, int dstx, int dsty);
void (*BlitTransRect) (ScrnInfoPtr pScrn,
int srcx, int srcy,
int w, int h,
int dstx, int dsty, unsigned long color);
} DGAFunctionRec, *DGAFunctionPtr;
typedef struct _SymTabRec {
int token; /* id of the token */
const char *name; /* token name */
} SymTabRec, *SymTabPtr;
/* flags for xf86LookupMode */
typedef enum {
LOOKUP_DEFAULT = 0, /* Use default mode lookup method */
LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */
LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */
LOOKUP_LIST_ORDER, /* Pick first useful mode in list */
LOOKUP_CLKDIV2 = 0x0100, /* Allow half clocks */
LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */
} LookupModeFlags;
#define NoDepth24Support 0x00
#define Support24bppFb 0x01 /* 24bpp framebuffer supported */
#define Support32bppFb 0x02 /* 32bpp framebuffer supported */
#define SupportConvert24to32 0x04 /* Can convert 24bpp pixmap to 32bpp */
#define SupportConvert32to24 0x08 /* Can convert 32bpp pixmap to 24bpp */
#define PreferConvert24to32 0x10 /* prefer 24bpp pixmap to 32bpp conv */
#define PreferConvert32to24 0x20 /* prefer 32bpp pixmap to 24bpp conv */
/* For DPMS */
typedef void (*DPMSSetProcPtr) (ScrnInfoPtr, int, int);
/* Input handler proc */
typedef void (*InputHandlerProc) (int fd, void *data);
/* These are used by xf86GetClocks */
#define CLK_REG_SAVE -1
#define CLK_REG_RESTORE -2
/*
* misc constants
*/
#define INTERLACE_REFRESH_WEIGHT 1.5
#define SYNC_TOLERANCE 0.01 /* 1 percent */
#define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */
#define OVERLAY_8_32_DUALFB 0x00000001
#define OVERLAY_8_24_DUALFB 0x00000002
#define OVERLAY_8_16_DUALFB 0x00000004
#define OVERLAY_8_32_PLANAR 0x00000008
/* Values of xf86Info.mouseFlags */
#define MF_CLEAR_DTR 1
#define MF_CLEAR_RTS 2
/* Action Events */
typedef enum {
ACTION_TERMINATE = 0, /* Terminate Server */
ACTION_NEXT_MODE = 10, /* Switch to next video mode */
ACTION_PREV_MODE,
ACTION_SWITCHSCREEN = 100, /* VT switch */
ACTION_SWITCHSCREEN_NEXT,
ACTION_SWITCHSCREEN_PREV,
} ActionEvent;
#endif /* _XF86STR_H */

File diff suppressed because it is too large Load diff

View file

@ -1,229 +0,0 @@
/*
* Copyright (c) 1998-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifndef _XF86XV_H_
#define _XF86XV_H_
#include "xvdix.h"
#include "xf86str.h"
#define VIDEO_OVERLAID_IMAGES 0x00000004
#define VIDEO_OVERLAID_STILLS 0x00000008
/*
* Usage of VIDEO_CLIP_TO_VIEWPORT is not recommended.
* It can make reput behaviour inconsistent.
*/
#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
typedef XvImageRec XF86ImageRec, *XF86ImagePtr;
typedef struct {
ScrnInfoPtr pScrn;
int id;
unsigned short width, height;
int *pitches; /* bytes */
int *offsets; /* in bytes from start of framebuffer */
DevUnion devPrivate;
} XF86SurfaceRec, *XF86SurfacePtr;
typedef int (*PutVideoFuncPtr) (ScrnInfoPtr pScrn,
short vid_x, short vid_y, short drw_x,
short drw_y, short vid_w, short vid_h,
short drw_w, short drw_h, RegionPtr clipBoxes,
void *data, DrawablePtr pDraw);
typedef int (*PutStillFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y,
short drw_x, short drw_y, short vid_w,
short vid_h, short drw_w, short drw_h,
RegionPtr clipBoxes, void *data,
DrawablePtr pDraw);
typedef int (*GetVideoFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y,
short drw_x, short drw_y, short vid_w,
short vid_h, short drw_w, short drw_h,
RegionPtr clipBoxes, void *data,
DrawablePtr pDraw);
typedef int (*GetStillFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y,
short drw_x, short drw_y, short vid_w,
short vid_h, short drw_w, short drw_h,
RegionPtr clipBoxes, void *data,
DrawablePtr pDraw);
typedef void (*StopVideoFuncPtr) (ScrnInfoPtr pScrn, void *data, Bool Exit);
typedef int (*SetPortAttributeFuncPtr) (ScrnInfoPtr pScrn, Atom attribute,
INT32 value, void *data);
typedef int (*GetPortAttributeFuncPtr) (ScrnInfoPtr pScrn, Atom attribute,
INT32 *value, void *data);
typedef void (*QueryBestSizeFuncPtr) (ScrnInfoPtr pScrn, Bool motion,
short vid_w, short vid_h, short drw_w,
short drw_h, unsigned int *p_w,
unsigned int *p_h, void *data);
typedef int (*PutImageFuncPtr) (ScrnInfoPtr pScrn, short src_x, short src_y,
short drw_x, short drw_y, short src_w,
short src_h, short drw_w, short drw_h,
int image, unsigned char *buf, short width,
short height, Bool Sync, RegionPtr clipBoxes,
void *data, DrawablePtr pDraw);
typedef int (*ReputImageFuncPtr) (ScrnInfoPtr pScrn, short src_x, short src_y,
short drw_x, short drw_y, short src_w,
short src_h, short drw_w, short drw_h,
RegionPtr clipBoxes, void *data,
DrawablePtr pDraw);
typedef int (*QueryImageAttributesFuncPtr) (ScrnInfoPtr pScrn, int image,
unsigned short *width,
unsigned short *height,
int *pitches, int *offsets);
typedef enum {
XV_OFF,
XV_PENDING,
XV_ON
} XvStatus;
/*** this is what the driver needs to fill out ***/
typedef struct {
int id;
const char *name;
unsigned short width, height;
XvRationalRec rate;
} XF86VideoEncodingRec, *XF86VideoEncodingPtr;
typedef struct {
char depth;
short class;
} XF86VideoFormatRec, *XF86VideoFormatPtr;
typedef XvAttributeRec XF86AttributeRec, *XF86AttributePtr;
typedef struct {
unsigned int type;
int flags;
const char *name;
int nEncodings;
XF86VideoEncodingPtr pEncodings;
int nFormats;
XF86VideoFormatPtr pFormats;
int nPorts;
DevUnion *pPortPrivates;
int nAttributes;
XF86AttributePtr pAttributes;
int nImages;
XF86ImagePtr pImages;
PutVideoFuncPtr PutVideo;
PutStillFuncPtr PutStill;
GetVideoFuncPtr GetVideo;
GetStillFuncPtr GetStill;
StopVideoFuncPtr StopVideo;
SetPortAttributeFuncPtr SetPortAttribute;
GetPortAttributeFuncPtr GetPortAttribute;
QueryBestSizeFuncPtr QueryBestSize;
PutImageFuncPtr PutImage;
ReputImageFuncPtr ReputImage; /* image/still */
QueryImageAttributesFuncPtr QueryImageAttributes;
} XF86VideoAdaptorRec, *XF86VideoAdaptorPtr;
typedef struct {
XF86ImagePtr image;
int flags;
int (*alloc_surface) (ScrnInfoPtr pScrn,
int id,
unsigned short width,
unsigned short height, XF86SurfacePtr surface);
int (*free_surface) (XF86SurfacePtr surface);
int (*display) (XF86SurfacePtr surface,
short vid_x, short vid_y,
short drw_x, short drw_y,
short vid_w, short vid_h,
short drw_w, short drw_h, RegionPtr clipBoxes);
int (*stop) (XF86SurfacePtr surface);
int (*getAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 *value);
int (*setAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 value);
int max_width;
int max_height;
int num_attributes;
XF86AttributePtr attributes;
} XF86OffscreenImageRec, *XF86OffscreenImagePtr;
extern _X_EXPORT Bool
xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * Adaptors, int num);
typedef int (*xf86XVInitGenericAdaptorPtr) (ScrnInfoPtr pScrn,
XF86VideoAdaptorPtr ** Adaptors);
extern _X_EXPORT int
xf86XVRegisterGenericAdaptorDriver(xf86XVInitGenericAdaptorPtr InitFunc);
extern _X_EXPORT int
xf86XVListGenericAdaptors(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr ** Adaptors);
extern _X_EXPORT Bool
xf86XVRegisterOffscreenImages(ScreenPtr pScreen,
XF86OffscreenImagePtr images, int num);
extern _X_EXPORT XF86OffscreenImagePtr
xf86XVQueryOffscreenImages(ScreenPtr pScreen, int *num);
extern _X_EXPORT XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr
pScrn);
extern _X_EXPORT void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr);
extern _X_EXPORT void
xf86XVFillKeyHelper(ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes);
extern _X_EXPORT void
xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes);
extern _X_EXPORT void
xf86XVFillKeyHelperPort(DrawablePtr pDraw, void *data, CARD32 key,
RegionPtr clipboxes, Bool fillEverything);
extern _X_EXPORT Bool
xf86XVClipVideoHelper(BoxPtr dst,
INT32 *xa,
INT32 *xb,
INT32 *ya,
INT32 *yb, RegionPtr reg, INT32 width, INT32 height);
extern _X_EXPORT void
xf86XVCopyYUV12ToPacked(const void *srcy,
const void *srcv,
const void *srcu,
void *dst,
int srcPitchy,
int srcPitchuv, int dstPitch, int h, int w);
extern _X_EXPORT void
xf86XVCopyPacked(const void *src,
void *dst, int srcPitch, int dstPitch, int h, int w);
#endif /* _XF86XV_H_ */

View file

@ -1,223 +0,0 @@
/*
* Copyright (c) 2001-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "misc.h"
#include "xf86.h"
#include "xf86_OSproc.h"
#include <X11/X.h>
#include <X11/Xproto.h>
#include "scrnintstr.h"
#include "resource.h"
#include "dixstruct.h"
#include "xf86xvpriv.h"
#include "xf86xvmc.h"
typedef struct {
CloseScreenProcPtr CloseScreen;
int num_adaptors;
XF86MCAdaptorPtr *adaptors;
XvMCAdaptorPtr dixinfo;
} xf86XvMCScreenRec, *xf86XvMCScreenPtr;
static DevPrivateKeyRec XF86XvMCScreenKeyRec;
#define XF86XvMCScreenKey (&XF86XvMCScreenKeyRec)
#define XF86XVMC_GET_PRIVATE(pScreen) (xf86XvMCScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, XF86XvMCScreenKey)
static int
xf86XvMCCreateContext(XvPortPtr pPort,
XvMCContextPtr pContext, int *num_priv, CARD32 **priv)
{
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
pContext->port_priv = (XvPortRecPrivatePtr) (pPort->devPriv.ptr);
return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateContext) (pScrn,
pContext,
num_priv,
priv);
}
static void
xf86XvMCDestroyContext(XvMCContextPtr pContext)
{
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num]->DestroyContext) (pScrn,
pContext);
}
static int
xf86XvMCCreateSurface(XvMCSurfacePtr pSurface, int *num_priv, CARD32 **priv)
{
XvMCContextPtr pContext = pSurface->context;
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSurface) (pScrn,
pSurface,
num_priv,
priv);
}
static void
xf86XvMCDestroySurface(XvMCSurfacePtr pSurface)
{
XvMCContextPtr pContext = pSurface->context;
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num]->DestroySurface) (pScrn,
pSurface);
}
static int
xf86XvMCCreateSubpicture(XvMCSubpicturePtr pSubpicture,
int *num_priv, CARD32 **priv)
{
XvMCContextPtr pContext = pSubpicture->context;
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
return (*pScreenPriv->adaptors[pContext->adapt_num]->
CreateSubpicture) (pScrn, pSubpicture, num_priv, priv);
}
static void
xf86XvMCDestroySubpicture(XvMCSubpicturePtr pSubpicture)
{
XvMCContextPtr pContext = pSubpicture->context;
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen);
ScrnInfoPtr pScrn = xf86ScreenToScrn(pContext->pScreen);
(*pScreenPriv->adaptors[pContext->adapt_num]->DestroySubpicture) (pScrn,
pSubpicture);
}
static Bool
xf86XvMCCloseScreen(ScreenPtr pScreen)
{
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
free(pScreenPriv->dixinfo);
free(pScreenPriv);
return (*pScreen->CloseScreen) (pScreen);
}
Bool
xf86XvMCScreenInit(ScreenPtr pScreen,
int num_adaptors, XF86MCAdaptorPtr * adaptors)
{
XvMCAdaptorPtr pAdapt;
xf86XvMCScreenPtr pScreenPriv;
XvScreenPtr pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
XF86XvScreenKey);
int i, j;
if (noXvExtension)
return FALSE;
if (!(pAdapt = xallocarray(num_adaptors, sizeof(XvMCAdaptorRec))))
return FALSE;
if (!dixRegisterPrivateKey(&XF86XvMCScreenKeyRec, PRIVATE_SCREEN, 0)) {
free(pAdapt);
return FALSE;
}
if (!(pScreenPriv = malloc(sizeof(xf86XvMCScreenRec)))) {
free(pAdapt);
return FALSE;
}
dixSetPrivate(&pScreen->devPrivates, XF86XvMCScreenKey, pScreenPriv);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xf86XvMCCloseScreen;
pScreenPriv->num_adaptors = num_adaptors;
pScreenPriv->adaptors = adaptors;
pScreenPriv->dixinfo = pAdapt;
for (i = 0; i < num_adaptors; i++) {
pAdapt[i].xv_adaptor = NULL;
for (j = 0; j < pxvs->nAdaptors; j++) {
if (!strcmp((*adaptors)->name, pxvs->pAdaptors[j].name)) {
pAdapt[i].xv_adaptor = &(pxvs->pAdaptors[j]);
break;
}
}
if (!pAdapt[i].xv_adaptor) {
/* no adaptor by that name */
pScreenPriv->dixinfo = FALSE;
free(pAdapt);
return FALSE;
}
pAdapt[i].num_surfaces = (*adaptors)->num_surfaces;
pAdapt[i].surfaces = (XvMCSurfaceInfoPtr *) ((*adaptors)->surfaces);
pAdapt[i].num_subpictures = (*adaptors)->num_subpictures;
pAdapt[i].subpictures = (XvImagePtr *) ((*adaptors)->subpictures);
pAdapt[i].CreateContext = xf86XvMCCreateContext;
pAdapt[i].DestroyContext = xf86XvMCDestroyContext;
pAdapt[i].CreateSurface = xf86XvMCCreateSurface;
pAdapt[i].DestroySurface = xf86XvMCDestroySurface;
pAdapt[i].CreateSubpicture = xf86XvMCCreateSubpicture;
pAdapt[i].DestroySubpicture = xf86XvMCDestroySubpicture;
adaptors++;
}
if (Success != XvMCScreenInit(pScreen, num_adaptors, pAdapt))
return FALSE;
return TRUE;
}
XF86MCAdaptorPtr
xf86XvMCCreateAdaptorRec(void)
{
return calloc(1, sizeof(XF86MCAdaptorRec));
}
void
xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor)
{
free(adaptor);
}

View file

@ -1,141 +0,0 @@
/*
* Copyright (c) 2001 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifndef _XF86XVMC_H
#define _XF86XVMC_H
#include "xvmcext.h"
#include "xf86xv.h"
typedef struct {
int num_xvimages;
int *xvimage_ids; /* reference the subpictures in the XF86MCAdaptorRec */
} XF86MCImageIDList;
typedef struct {
int surface_type_id; /* Driver generated. Must be unique on the port */
int chroma_format;
int color_description; /* no longer used */
unsigned short max_width;
unsigned short max_height;
unsigned short subpicture_max_width;
unsigned short subpicture_max_height;
int mc_type;
int flags;
XF86MCImageIDList *compatible_subpictures; /* can be null, if none */
} XF86MCSurfaceInfoRec, *XF86MCSurfaceInfoPtr;
/*
xf86XvMCCreateContextProc
DIX will fill everything out in the context except the driver_priv.
The port_priv holds the private data specified for the port when
Xv was initialized by the driver.
The driver may store whatever it wants in driver_priv and edit
the width, height and flags. If the driver wants to return something
to the client it can allocate space in priv and specify the number
of 32 bit words in num_priv. This must be dynamically allocated
space because DIX will free it after it passes it to the client.
*/
typedef int (*xf86XvMCCreateContextProcPtr) (ScrnInfoPtr pScrn,
XvMCContextPtr context,
int *num_priv, CARD32 **priv);
typedef void (*xf86XvMCDestroyContextProcPtr) (ScrnInfoPtr pScrn,
XvMCContextPtr context);
/*
xf86XvMCCreateSurfaceProc
DIX will fill everything out in the surface except the driver_priv.
The driver may store whatever it wants in driver_priv. The driver
may pass data back to the client in the same manner as the
xf86XvMCCreateContextProc.
*/
typedef int (*xf86XvMCCreateSurfaceProcPtr) (ScrnInfoPtr pScrn,
XvMCSurfacePtr surface,
int *num_priv, CARD32 **priv);
typedef void (*xf86XvMCDestroySurfaceProcPtr) (ScrnInfoPtr pScrn,
XvMCSurfacePtr surface);
/*
xf86XvMCCreateSubpictureProc
DIX will fill everything out in the subpicture except the driver_priv,
num_palette_entries, entry_bytes and component_order. The driver may
store whatever it wants in driver_priv and edit the width and height.
If it is a paletted subpicture the driver needs to fill out the
num_palette_entries, entry_bytes and component_order. These are
not communicated to the client until the time the surface is
created.
The driver may pass data back to the client in the same manner as the
xf86XvMCCreateContextProc.
*/
typedef int (*xf86XvMCCreateSubpictureProcPtr) (ScrnInfoPtr pScrn,
XvMCSubpicturePtr subpicture,
int *num_priv, CARD32 **priv);
typedef void (*xf86XvMCDestroySubpictureProcPtr) (ScrnInfoPtr pScrn,
XvMCSubpicturePtr subpicture);
typedef struct {
const char *name;
int num_surfaces;
XF86MCSurfaceInfoPtr *surfaces;
int num_subpictures;
XF86ImagePtr *subpictures;
xf86XvMCCreateContextProcPtr CreateContext;
xf86XvMCDestroyContextProcPtr DestroyContext;
xf86XvMCCreateSurfaceProcPtr CreateSurface;
xf86XvMCDestroySurfaceProcPtr DestroySurface;
xf86XvMCCreateSubpictureProcPtr CreateSubpicture;
xf86XvMCDestroySubpictureProcPtr DestroySubpicture;
} XF86MCAdaptorRec, *XF86MCAdaptorPtr;
/*
xf86XvMCScreenInit
Unlike Xv, the adaptor data is not copied from this structure.
This structure's data is used so it must stick around for the
life of the server. Note that it's an array of pointers not
an array of structures.
*/
extern _X_EXPORT Bool xf86XvMCScreenInit(ScreenPtr pScreen,
int num_adaptors,
XF86MCAdaptorPtr * adaptors);
extern _X_EXPORT XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec(void);
extern _X_EXPORT void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor);
#endif /* _XF86XVMC_H */

View file

@ -1,88 +0,0 @@
/*
* Copyright (c) 2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifndef _XF86XVPRIV_H_
#define _XF86XVPRIV_H_
#include "xf86xv.h"
#include "privates.h"
/*** These are DDX layer privates ***/
extern _X_EXPORT DevPrivateKey XF86XvScreenKey;
typedef struct {
DestroyWindowProcPtr DestroyWindow;
ClipNotifyProcPtr ClipNotify;
WindowExposuresProcPtr WindowExposures;
PostValidateTreeProcPtr PostValidateTree;
void (*AdjustFrame) (ScrnInfoPtr, int, int);
Bool (*EnterVT) (ScrnInfoPtr);
void (*LeaveVT) (ScrnInfoPtr);
xf86ModeSetProc *ModeSet;
CloseScreenProcPtr CloseScreen;
} XF86XVScreenRec, *XF86XVScreenPtr;
typedef struct {
int flags;
PutVideoFuncPtr PutVideo;
PutStillFuncPtr PutStill;
GetVideoFuncPtr GetVideo;
GetStillFuncPtr GetStill;
StopVideoFuncPtr StopVideo;
SetPortAttributeFuncPtr SetPortAttribute;
GetPortAttributeFuncPtr GetPortAttribute;
QueryBestSizeFuncPtr QueryBestSize;
PutImageFuncPtr PutImage;
ReputImageFuncPtr ReputImage;
QueryImageAttributesFuncPtr QueryImageAttributes;
} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr;
typedef struct {
ScrnInfoPtr pScrn;
DrawablePtr pDraw;
unsigned char type;
unsigned int subWindowMode;
RegionPtr clientClip;
RegionPtr ckeyFilled;
RegionPtr pCompositeClip;
Bool FreeCompositeClip;
XvAdaptorRecPrivatePtr AdaptorRec;
XvStatus isOn;
Bool clipChanged;
int vid_x, vid_y, vid_w, vid_h;
int drw_x, drw_y, drw_w, drw_h;
DevUnion DevPriv;
} XvPortRecPrivate, *XvPortRecPrivatePtr;
typedef struct _XF86XVWindowRec {
XvPortRecPrivatePtr PortRec;
struct _XF86XVWindowRec *next;
} XF86XVWindowRec, *XF86XVWindowPtr;
#endif /* _XF86XVPRIV_H_ */

View file

@ -1,168 +0,0 @@
/*
* Copyright (c) 1997 Metro Link Incorporated
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Except as contained in this notice, the name of the Metro Link shall not be
* used in advertising or otherwise to promote the sale, use or other dealings
* in this Software without prior written authorization from Metro Link.
*
*/
/*
X Input Serial Buffer routines for use in any XInput driver that accesses
a serial device.
*/
/*****************************************************************************
* Standard Headers
****************************************************************************/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <misc.h>
#include <xf86.h>
#include <xf86_OSproc.h>
#include <xf86_OSlib.h>
#include <xf86Xinput.h>
#include "xisb.h"
/*****************************************************************************
* Local Headers
****************************************************************************/
/*****************************************************************************
* Variables without includable headers
****************************************************************************/
/*****************************************************************************
* Local Variables
****************************************************************************/
/*****************************************************************************
* Function Definitions
****************************************************************************/
XISBuffer *
XisbNew(int fd, ssize_t size)
{
XISBuffer *b;
b = malloc(sizeof(XISBuffer));
if (!b)
return NULL;
b->buf = malloc((sizeof(unsigned char) * size));
if (!b->buf) {
free(b);
return NULL;
}
b->fd = fd;
b->trace = 0;
b->block_duration = 0;
b->current = 1; /* force it to be past the end to trigger initial read */
b->end = 0;
b->buffer_size = size;
return b;
}
void
XisbFree(XISBuffer * b)
{
free(b->buf);
free(b);
}
int
XisbRead(XISBuffer * b)
{
int ret;
if (b->current >= b->end) {
if (b->block_duration >= 0) {
if (xf86WaitForInput(b->fd, b->block_duration) < 1)
return -1;
}
else {
/*
* automatically clear it so if XisbRead is called in a loop
* the next call will make sure there is data with select and
* thus prevent a blocking read
*/
b->block_duration = 0;
}
ret = xf86ReadSerial(b->fd, b->buf, b->buffer_size);
switch (ret) {
case 0:
return -1; /* timeout */
case -1:
return -2; /* error */
default:
b->end = ret;
b->current = 0;
break;
}
}
if (b->trace)
ErrorF("read 0x%02x (%c)\n", b->buf[b->current],
isprint(b->buf[b->current]) ? b->buf[b->current] : '.');
return b->buf[b->current++];
}
/* the only purpose of this function is to provide output tracing */
ssize_t
XisbWrite(XISBuffer * b, unsigned char *msg, ssize_t len)
{
if (b->trace) {
int i = 0;
for (i = 0; i < len; i++)
ErrorF("\t\twrote 0x%02x (%c)\n", msg[i], msg[i]);
}
return (xf86WriteSerial(b->fd, msg, len));
}
/* turn tracing of this buffer on (1) or off (0) */
void
XisbTrace(XISBuffer * b, int trace)
{
b->trace = trace;
}
/*
* specify a block_duration of -1 when you know the buffer's fd is ready to
* read. After a read, it is automatically set to 0 so that the next read
* will use check to select for data and prevent a block.
* It is the caller's responsibility to set the block_duration to -1 if it
* knows that there is data to read (because the main select loop triggered
* the read) and wants to avoid the unnecessary overhead of the select call
*
* a zero or positive block duration will cause the select to block for the
* give duration in usecs.
*/
void
XisbBlockDuration(XISBuffer * b, int block_duration)
{
b->block_duration = block_duration;
}

View file

@ -1,65 +0,0 @@
/*
* Copyright (c) 1997 Metro Link Incorporated
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Except as contained in this notice, the name of the Metro Link shall not be
* used in advertising or otherwise to promote the sale, use or other dealings
* in this Software without prior written authorization from Metro Link.
*
*/
#ifndef _xisb_H_
#define _xisb_H_
#include <unistd.h>
/******************************************************************************
* Definitions
* structs, typedefs, #defines, enums
*****************************************************************************/
typedef struct _XISBuffer {
int fd;
int trace;
int block_duration;
ssize_t current; /* bytes read */
ssize_t end;
ssize_t buffer_size;
unsigned char *buf;
} XISBuffer;
/******************************************************************************
* Declarations
* variables: use xisb_LOC in front
* of globals.
* put locals in the .c file.
*****************************************************************************/
extern _X_EXPORT XISBuffer *XisbNew(int fd, ssize_t size);
extern _X_EXPORT void XisbFree(XISBuffer * b);
extern _X_EXPORT int XisbRead(XISBuffer * b);
extern _X_EXPORT ssize_t XisbWrite(XISBuffer * b, unsigned char *msg,
ssize_t len);
extern _X_EXPORT void XisbTrace(XISBuffer * b, int trace);
extern _X_EXPORT void XisbBlockDuration(XISBuffer * b, int block_duration);
/*
* DO NOT PUT ANYTHING AFTER THIS ENDIF
*/
#endif

View file

@ -1,22 +0,0 @@
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include "os.h"
#include "servermd.h"
#include "pixmapstr.h"
#include "windowstr.h"
#include "propertyst.h"
#include "gcstruct.h"
#include "loaderProcs.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xorgVersion.h"
CARD32
xorgGetVersion(void)
{
return XORG_VERSION_CURRENT;
}

View file

@ -1,49 +0,0 @@
/*
* Copyright (c) 2004, X.Org Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifndef XORG_VERSION_H
#define XORG_VERSION_H
#ifndef XORG_VERSION_CURRENT
#error
#endif
#define XORG_VERSION_NUMERIC(major,minor,patch,snap,dummy) \
(((major) * 10000000) + ((minor) * 100000) + ((patch) * 1000) + snap)
#define XORG_GET_MAJOR_VERSION(vers) ((vers) / 10000000)
#define XORG_GET_MINOR_VERSION(vers) (((vers) % 10000000) / 100000)
#define XORG_GET_PATCH_VERSION(vers) (((vers) % 100000) / 1000)
#define XORG_GET_SNAP_VERSION(vers) ((vers) % 1000)
#define XORG_VERSION_MAJOR XORG_GET_MAJOR_VERSION(XORG_VERSION_CURRENT)
#define XORG_VERSION_MINOR XORG_GET_MINOR_VERSION(XORG_VERSION_CURRENT)
#define XORG_VERSION_PATCH XORG_GET_PATCH_VERSION(XORG_VERSION_CURRENT)
#define XORG_VERSION_SNAP XORG_GET_SNAP_VERSION(XORG_VERSION_CURRENT)
#endif

View file

@ -1,97 +0,0 @@
DDC.HOWTO
This file describes how to add DDC support to a chipset driver.
1) DDC INITIALIZATION
When implementing DDC in the driver one has the choice between
DDC1 and DDC2.
DDC1 data is continuously transmitted by a DDC1 capable display
device. The data is send serially over a data line; the Vsync
signal serves as clock. Only one EDID 1.x data block can be
transmitted using DDC1. Since transmission of an EDID1 block
using a regular Vsync frequency would take up several seconds
the driver can increase the Vsync frequency to up to 25 kHz as
soon as it detects DDC1 activity on the data line.
DDC2 data is transmitted using the I2C protocol. This requires
an additional clock line. DDC2 is capable of transmitting EDID1
and EDID2 block as well as a VDIF block on display devices that
support these.
Display devices switch into the DDC2 mode as soon as they detect
activity on the DDC clock line. Once the are in DDC2 mode they
stop transmitting DDC1 signals until the next power cycle.
Some graphics chipset configurations which are not capable of
DDC2 might still be able to read DDC1 data. Where available
DDC2 it is preferable.
All relevant prototypes and defines are in xf86DDC.h.
DDC2 additionally requires I2C support. The I2C prototypes
are in xf86i2c.h.
DDC1 Support:
The driver has to provide a read function which waits for the
end of the next Vsync signal and reads in and returns the status
of the DDC line:
unsigned int XXX_ddc1Read(ScrnInfoPtr pScrn)
Additionally a function is required to increase the Vsync
frequency to max. 25 kHz.
void XXX_ddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed)
If the speed argument is DDC_FAST the function should increase
the Vsync frequency on DDC_SLOW it should restore the original
value. For convenience a generic ddc1SetSpeed() function is provided
in the vga module for VGA-like chipsets.
void vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, sf86ddcSpeed speed).
To read out the DDC1 data the driver should call
xf86MonPtr xf86DoEDID_DDC1(int scrnIndex,
void (*DDC1SetSpeed)(ScrnInfoPtr, xf86ddcSpeed),
unsigned int (*DDC1Read)(ScrnInfoPtr))
in PreInit(). DDC1SetSpeed is a pointer to the SetSpeed()
function, DDC1Read has to point to the DDC1 read function.
The function will return a pointer to the xf86Monitor structure
which contains all information retrieved by DDC.
NULL will be returned on failure.
DDC2 Support
To read out DDC2 information I2C has to be initialized first.
(See documentation for the i2c module).
The function
xf86MonPtr xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus)
is provided to read out and process DDC2 data. A pointer
to the I2CBusRec of the appropriate I2C Bus has to be passed
as the second argument.
The function will return a pointer to the xf86Monitor structure
which contains all information retrieved by DDC.
NULL will be returned on failure.
Printing monitor parameters
To print out the information contained in the xf86Monitor
structure the function
xf86MonPtr xf86PrintEDID(xf86MonPtr monitor)
is provided.
Further processing of the xf86Monitor structure is not yet
implemented. However, it is planned to use the information
about video modes, gamma values etc.
Therefore it is strongly recommended to read out DDC data
before any video mode processing is done.
$XFree86: xc/programs/Xserver/hw/xfree86/ddc/DDC.HOWTO,v 1.2 1998/12/06 13:30:39 dawes Exp $

View file

@ -1,470 +0,0 @@
/* xf86DDC.c
*
* Copyright 1998,1999 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
*/
/*
* A note on terminology. DDC1 is the original dumb serial protocol, and
* can only do up to 128 bytes of EDID. DDC2 is I2C-encapsulated and
* introduces extension blocks. EDID is the old display identification
* block, DisplayID is the new one.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "misc.h"
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86DDC.h"
#include <string.h>
#define RETRIES 4
typedef enum {
DDCOPT_NODDC1,
DDCOPT_NODDC2,
DDCOPT_NODDC
} DDCOpts;
static const OptionInfoRec DDCOptions[] = {
{DDCOPT_NODDC1, "NoDDC1", OPTV_BOOLEAN, {0}, FALSE},
{DDCOPT_NODDC2, "NoDDC2", OPTV_BOOLEAN, {0}, FALSE},
{DDCOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE},
{-1, NULL, OPTV_NONE, {0}, FALSE},
};
/* DDC1 */
static int
find_start(unsigned int *ptr)
{
unsigned int comp[9], test[9];
int i, j;
for (i = 0; i < 9; i++) {
comp[i] = *(ptr++);
test[i] = 1;
}
for (i = 0; i < 127; i++) {
for (j = 0; j < 9; j++) {
test[j] = test[j] & !(comp[j] ^ *(ptr++));
}
}
for (i = 0; i < 9; i++)
if (test[i])
return i + 1;
return -1;
}
static unsigned char *
find_header(unsigned char *block)
{
unsigned char *ptr, *head_ptr, *end;
unsigned char header[] = { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 };
ptr = block;
end = block + EDID1_LEN;
while (ptr < end) {
int i;
head_ptr = ptr;
for (i = 0; i < 8; i++) {
if (header[i] != *(head_ptr++))
break;
if (head_ptr == end)
head_ptr = block;
}
if (i == 8)
break;
ptr++;
}
if (ptr == end)
return NULL;
return ptr;
}
static unsigned char *
resort(unsigned char *s_block)
{
unsigned char *d_new, *d_ptr, *d_end, *s_ptr, *s_end;
unsigned char tmp;
s_ptr = find_header(s_block);
if (!s_ptr)
return NULL;
s_end = s_block + EDID1_LEN;
d_new = malloc(EDID1_LEN);
if (!d_new)
return NULL;
d_end = d_new + EDID1_LEN;
for (d_ptr = d_new; d_ptr < d_end; d_ptr++) {
tmp = *(s_ptr++);
*d_ptr = tmp;
if (s_ptr == s_end)
s_ptr = s_block;
}
free(s_block);
return d_new;
}
static int
DDC_checksum(const unsigned char *block, int len)
{
int i, result = 0;
int not_null = 0;
for (i = 0; i < len; i++) {
not_null |= block[i];
result += block[i];
}
#ifdef DEBUG
if (result & 0xFF)
ErrorF("DDC checksum not correct\n");
if (!not_null)
ErrorF("DDC read all Null\n");
#endif
/* catch the trivial case where all bytes are 0 */
if (!not_null)
return 1;
return result & 0xFF;
}
static unsigned char *
GetEDID_DDC1(unsigned int *s_ptr)
{
unsigned char *d_block, *d_pos;
unsigned int *s_pos, *s_end;
int s_start;
int i, j;
s_start = find_start(s_ptr);
if (s_start == -1)
return NULL;
s_end = s_ptr + NUM;
s_pos = s_ptr + s_start;
d_block = calloc(1, EDID1_LEN);
if (!d_block)
return NULL;
d_pos = d_block;
for (i = 0; i < EDID1_LEN; i++) {
for (j = 0; j < 8; j++) {
*d_pos <<= 1;
if (*s_pos) {
*d_pos |= 0x01;
}
s_pos++;
if (s_pos == s_end)
s_pos = s_ptr;
};
s_pos++;
if (s_pos == s_end)
s_pos = s_ptr;
d_pos++;
}
free(s_ptr);
if (d_block && DDC_checksum(d_block, EDID1_LEN)) {
free(d_block);
return NULL;
}
return (resort(d_block));
}
/* fetch entire EDID record; DDC bit needs to be masked */
static unsigned int *
FetchEDID_DDC1(register ScrnInfoPtr pScrn,
register unsigned int (*read_DDC) (ScrnInfoPtr))
{
int count = NUM;
unsigned int *ptr, *xp;
ptr = xp = malloc(sizeof(int) * NUM);
if (!ptr)
return NULL;
do {
/* wait for next retrace */
*xp = read_DDC(pScrn);
xp++;
} while (--count);
return ptr;
}
/* test if DDC1 return 0 if not */
static Bool
TestDDC1(ScrnInfoPtr pScrn, unsigned int (*read_DDC) (ScrnInfoPtr))
{
int old, count;
old = read_DDC(pScrn);
count = HEADER * BITS_PER_BYTE;
do {
/* wait for next retrace */
if (old != read_DDC(pScrn))
break;
} while (count--);
return count;
}
/*
* read EDID record , pass it to callback function to interpret.
* callback function will store it for further use by calling
* function; it will also decide if we need to reread it
*/
static unsigned char *
EDIDRead_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDCSpeed,
unsigned int (*read_DDC) (ScrnInfoPtr))
{
unsigned char *EDID_block = NULL;
int count = RETRIES;
if (!read_DDC) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"chipset doesn't support DDC1\n");
return NULL;
};
if (TestDDC1(pScrn, read_DDC) == -1) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "No DDC signal\n");
return NULL;
};
if (DDCSpeed)
DDCSpeed(pScrn, DDC_FAST);
do {
EDID_block = GetEDID_DDC1(FetchEDID_DDC1(pScrn, read_DDC));
count--;
} while (!EDID_block && count);
if (DDCSpeed)
DDCSpeed(pScrn, DDC_SLOW);
return EDID_block;
}
/**
* Attempts to probe the monitor for EDID information, if NoDDC and NoDDC1 are
* unset. EDID information blocks are interpreted and the results returned in
* an xf86MonPtr.
*
* This function does not affect the list of modes used by drivers -- it is up
* to the driver to decide policy on what to do with EDID information.
*
* @return pointer to a new xf86MonPtr containing the EDID information.
* @return NULL if no monitor attached or failure to interpret the EDID.
*/
xf86MonPtr
xf86DoEDID_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDC1SetSpeed,
unsigned int (*DDC1Read) (ScrnInfoPtr))
{
unsigned char *EDID_block = NULL;
xf86MonPtr tmp = NULL;
/* Default DDC and DDC1 to enabled. */
Bool noddc = FALSE, noddc1 = FALSE;
OptionInfoPtr options;
options = xnfalloc(sizeof(DDCOptions));
(void) memcpy(options, DDCOptions, sizeof(DDCOptions));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
xf86GetOptValBool(options, DDCOPT_NODDC1, &noddc1);
free(options);
if (noddc || noddc1)
return NULL;
OsBlockSignals();
EDID_block = EDIDRead_DDC1(pScrn, DDC1SetSpeed, DDC1Read);
OsReleaseSignals();
if (EDID_block) {
tmp = xf86InterpretEDID(pScrn->scrnIndex, EDID_block);
}
#ifdef DEBUG
else
ErrorF("No EDID block returned\n");
if (!tmp)
ErrorF("Cannot interpret EDID block\n");
#endif
return tmp;
}
/* DDC2 */
static I2CDevPtr
DDC2MakeDevice(I2CBusPtr pBus, int address, const char *name)
{
I2CDevPtr dev = NULL;
if (!(dev = xf86I2CFindDev(pBus, address))) {
dev = xf86CreateI2CDevRec();
dev->DevName = name;
dev->SlaveAddr = address;
dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */
dev->StartTimeout = 550;
dev->BitTimeout = 40;
dev->AcknTimeout = 40;
dev->pI2CBus = pBus;
if (!xf86I2CDevInit(dev)) {
xf86DrvMsg(pBus->scrnIndex, X_PROBED, "No DDC2 device\n");
return NULL;
}
}
return dev;
}
static I2CDevPtr
DDC2Init(I2CBusPtr pBus)
{
I2CDevPtr dev = NULL;
/*
* Slow down the bus so that older monitors don't
* miss things.
*/
pBus->RiseFallTime = 20;
dev = DDC2MakeDevice(pBus, 0x00A0, "ddc2");
if (xf86I2CProbeAddress(pBus, 0x0060))
DDC2MakeDevice(pBus, 0x0060, "E-EDID segment register");
return dev;
}
/* Mmmm, smell the hacks */
static void
EEDIDStop(I2CDevPtr d)
{
}
/* block is the EDID block number. a segment is two blocks. */
static Bool
DDC2Read(I2CDevPtr dev, int block, unsigned char *R_Buffer)
{
unsigned char W_Buffer[1];
int i, segment;
I2CDevPtr seg;
void (*stop) (I2CDevPtr);
for (i = 0; i < RETRIES; i++) {
/* Stop bits reset the segment pointer to 0, so be careful here. */
segment = block >> 1;
if (segment) {
Bool b;
if (!(seg = xf86I2CFindDev(dev->pI2CBus, 0x0060)))
return FALSE;
W_Buffer[0] = segment;
stop = dev->pI2CBus->I2CStop;
dev->pI2CBus->I2CStop = EEDIDStop;
b = xf86I2CWriteRead(seg, W_Buffer, 1, NULL, 0);
dev->pI2CBus->I2CStop = stop;
if (!b) {
dev->pI2CBus->I2CStop(dev);
continue;
}
}
W_Buffer[0] = (block & 0x01) * EDID1_LEN;
if (xf86I2CWriteRead(dev, W_Buffer, 1, R_Buffer, EDID1_LEN)) {
if (!DDC_checksum(R_Buffer, EDID1_LEN))
return TRUE;
}
}
return FALSE;
}
/**
* Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are
* unset. EDID information blocks are interpreted and the results returned in
* an xf86MonPtr. Unlike xf86DoEDID_DDC[12](), this function will return
* the complete EDID data, including all extension blocks, if the 'complete'
* parameter is TRUE;
*
* This function does not affect the list of modes used by drivers -- it is up
* to the driver to decide policy on what to do with EDID information.
*
* @return pointer to a new xf86MonPtr containing the EDID information.
* @return NULL if no monitor attached or failure to interpret the EDID.
*/
xf86MonPtr
xf86DoEEDID(ScrnInfoPtr pScrn, I2CBusPtr pBus, Bool complete)
{
unsigned char *EDID_block = NULL;
xf86MonPtr tmp = NULL;
I2CDevPtr dev = NULL;
/* Default DDC and DDC2 to enabled. */
Bool noddc = FALSE, noddc2 = FALSE;
OptionInfoPtr options;
options = malloc(sizeof(DDCOptions));
if (!options)
return NULL;
memcpy(options, DDCOptions, sizeof(DDCOptions));
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2);
free(options);
if (noddc || noddc2)
return NULL;
if (!(dev = DDC2Init(pBus)))
return NULL;
EDID_block = calloc(1, EDID1_LEN);
if (!EDID_block)
return NULL;
if (DDC2Read(dev, 0, EDID_block)) {
int i, n = EDID_block[0x7e];
if (complete && n) {
EDID_block = reallocarray(EDID_block, 1 + n, EDID1_LEN);
for (i = 0; i < n; i++)
DDC2Read(dev, i + 1, EDID_block + (EDID1_LEN * (1 + i)));
}
tmp = xf86InterpretEEDID(pScrn->scrnIndex, EDID_block);
}
if (tmp && complete)
tmp->flags |= MONITOR_EDID_COMPLETE_RAWDATA;
return tmp;
}
/**
* Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are
* unset. EDID information blocks are interpreted and the results returned in
* an xf86MonPtr.
*
* This function does not affect the list of modes used by drivers -- it is up
* to the driver to decide policy on what to do with EDID information.
*
* @return pointer to a new xf86MonPtr containing the EDID information.
* @return NULL if no monitor attached or failure to interpret the EDID.
*/
xf86MonPtr
xf86DoEDID_DDC2(ScrnInfoPtr pScrn, I2CBusPtr pBus)
{
return xf86DoEEDID(pScrn, pBus, FALSE);
}

View file

@ -1,83 +0,0 @@
/*
* Copyright 2006 Luc Verhaegen.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sub license,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf86.h"
#include "xf86DDC.h"
#include "xf86Priv.h"
#include <X11/Xatom.h>
#include "property.h"
#include "propertyst.h"
#include <string.h>
#define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA"
static int
edidSize(const xf86MonPtr DDC)
{
int ret = 128;
if (DDC->flags & EDID_COMPLETE_RAWDATA)
ret += DDC->no_sections * 128;
return ret;
}
static void
setRootWindowEDID(ScreenPtr pScreen, xf86MonPtr DDC)
{
Atom atom = MakeAtom(EDID1_ATOM_NAME, strlen(EDID1_ATOM_NAME), TRUE);
dixChangeWindowProperty(serverClient, pScreen->root, atom, XA_INTEGER,
8, PropModeReplace, edidSize(DDC), DDC->rawData,
FALSE);
}
static void
addEDIDProp(CallbackListPtr *pcbl, void *scrn, void *screen)
{
ScreenPtr pScreen = screen;
ScrnInfoPtr pScrn = scrn;
if (xf86ScreenToScrn(pScreen) == pScrn)
setRootWindowEDID(pScreen, pScrn->monitor->DDC);
}
Bool
xf86SetDDCproperties(ScrnInfoPtr pScrn, xf86MonPtr DDC)
{
if (!pScrn || !pScrn->monitor || !DDC)
return FALSE;
xf86EdidMonitorSet(pScrn->scrnIndex, pScrn->monitor, DDC);
if (xf86Initialising)
AddCallback(&RootWindowFinalizeCallback, addEDIDProp, pScrn);
else
setRootWindowEDID(pScrn->pScreen, DDC);
return TRUE;
}

View file

@ -1,671 +0,0 @@
/*
* edid.h: defines to parse an EDID block
*
* This file contains all information to interpret a standard EDIC block
* transmitted by a display device via DDC (Display Data Channel). So far
* there is no information to deal with optional EDID blocks.
* DDC is a Trademark of VESA (Video Electronics Standard Association).
*
* Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
*/
#ifndef _EDID_H_
#define _EDID_H_
#include <X11/Xmd.h>
#ifndef _X_EXPORT
#include <X11/Xfuncproto.h>
#endif
/* read complete EDID record */
#define EDID1_LEN 128
#define BITS_PER_BYTE 9
#define NUM BITS_PER_BYTE*EDID1_LEN
#define HEADER 6
#define STD_TIMINGS 8
#define DET_TIMINGS 4
#ifdef _PARSE_EDID_
/* header: 0x00 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00 */
#define HEADER_SECTION 0
#define HEADER_LENGTH 8
/* vendor section */
#define VENDOR_SECTION (HEADER_SECTION + HEADER_LENGTH)
#define V_MANUFACTURER 0
#define V_PROD_ID (V_MANUFACTURER + 2)
#define V_SERIAL (V_PROD_ID + 2)
#define V_WEEK (V_SERIAL + 4)
#define V_YEAR (V_WEEK + 1)
#define VENDOR_LENGTH (V_YEAR + 1)
/* EDID version */
#define VERSION_SECTION (VENDOR_SECTION + VENDOR_LENGTH)
#define V_VERSION 0
#define V_REVISION (V_VERSION + 1)
#define VERSION_LENGTH (V_REVISION + 1)
/* display information */
#define DISPLAY_SECTION (VERSION_SECTION + VERSION_LENGTH)
#define D_INPUT 0
#define D_HSIZE (D_INPUT + 1)
#define D_VSIZE (D_HSIZE + 1)
#define D_GAMMA (D_VSIZE + 1)
#define FEAT_S (D_GAMMA + 1)
#define D_RG_LOW (FEAT_S + 1)
#define D_BW_LOW (D_RG_LOW + 1)
#define D_REDX (D_BW_LOW + 1)
#define D_REDY (D_REDX + 1)
#define D_GREENX (D_REDY + 1)
#define D_GREENY (D_GREENX + 1)
#define D_BLUEX (D_GREENY + 1)
#define D_BLUEY (D_BLUEX + 1)
#define D_WHITEX (D_BLUEY + 1)
#define D_WHITEY (D_WHITEX + 1)
#define DISPLAY_LENGTH (D_WHITEY + 1)
/* supported VESA and other standard timings */
#define ESTABLISHED_TIMING_SECTION (DISPLAY_SECTION + DISPLAY_LENGTH)
#define E_T1 0
#define E_T2 (E_T1 + 1)
#define E_TMANU (E_T2 + 1)
#define E_TIMING_LENGTH (E_TMANU + 1)
/* non predefined standard timings supported by display */
#define STD_TIMING_SECTION (ESTABLISHED_TIMING_SECTION + E_TIMING_LENGTH)
#define STD_TIMING_INFO_LEN 2
#define STD_TIMING_INFO_NUM STD_TIMINGS
#define STD_TIMING_LENGTH (STD_TIMING_INFO_LEN * STD_TIMING_INFO_NUM)
/* detailed timing info of non standard timings */
#define DET_TIMING_SECTION (STD_TIMING_SECTION + STD_TIMING_LENGTH)
#define DET_TIMING_INFO_LEN 18
#define MONITOR_DESC_LEN DET_TIMING_INFO_LEN
#define DET_TIMING_INFO_NUM DET_TIMINGS
#define DET_TIMING_LENGTH (DET_TIMING_INFO_LEN * DET_TIMING_INFO_NUM)
/* number of EDID sections to follow */
#define NO_EDID (DET_TIMING_SECTION + DET_TIMING_LENGTH)
/* one byte checksum */
#define CHECKSUM (NO_EDID + 1)
#if (CHECKSUM != (EDID1_LEN - 1))
#error "EDID1 length != 128!"
#endif
#define SECTION(x,y) (Uchar *)(x + y)
#define GET_ARRAY(y) ((Uchar *)(c + y))
#define GET(y) *(Uchar *)(c + y)
/* extract information from vendor section */
#define _PROD_ID(x) x[0] + (x[1] << 8);
#define PROD_ID _PROD_ID(GET_ARRAY(V_PROD_ID))
#define _SERIAL_NO(x) x[0] + (x[1] << 8) + (x[2] << 16) + (x[3] << 24)
#define SERIAL_NO _SERIAL_NO(GET_ARRAY(V_SERIAL))
#define _YEAR(x) (x & 0xFF) + 1990
#define YEAR _YEAR(GET(V_YEAR))
#define WEEK GET(V_WEEK) & 0xFF
#define _L1(x) ((x[0] & 0x7C) >> 2) + '@'
#define _L2(x) ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@'
#define _L3(x) (x[1] & 0x1F) + '@';
#define L1 _L1(GET_ARRAY(V_MANUFACTURER))
#define L2 _L2(GET_ARRAY(V_MANUFACTURER))
#define L3 _L3(GET_ARRAY(V_MANUFACTURER))
/* extract information from version section */
#define VERSION GET(V_VERSION)
#define REVISION GET(V_REVISION)
/* extract information from display section */
#define _INPUT_TYPE(x) ((x & 0x80) >> 7)
#define INPUT_TYPE _INPUT_TYPE(GET(D_INPUT))
#define _INPUT_VOLTAGE(x) ((x & 0x60) >> 5)
#define INPUT_VOLTAGE _INPUT_VOLTAGE(GET(D_INPUT))
#define _SETUP(x) ((x & 0x10) >> 4)
#define SETUP _SETUP(GET(D_INPUT))
#define _SYNC(x) (x & 0x0F)
#define SYNC _SYNC(GET(D_INPUT))
#define _DFP(x) (x & 0x01)
#define DFP _DFP(GET(D_INPUT))
#define _BPC(x) ((x & 0x70) >> 4)
#define BPC _BPC(GET(D_INPUT))
#define _DIGITAL_INTERFACE(x) (x & 0x0F)
#define DIGITAL_INTERFACE _DIGITAL_INTERFACE(GET(D_INPUT))
#define _GAMMA(x) (x == 0xff ? 0.0 : ((x + 100.0)/100.0))
#define GAMMA _GAMMA(GET(D_GAMMA))
#define HSIZE_MAX GET(D_HSIZE)
#define VSIZE_MAX GET(D_VSIZE)
#define _DPMS(x) ((x & 0xE0) >> 5)
#define DPMS _DPMS(GET(FEAT_S))
#define _DISPLAY_TYPE(x) ((x & 0x18) >> 3)
#define DISPLAY_TYPE _DISPLAY_TYPE(GET(FEAT_S))
#define _MSC(x) (x & 0x7)
#define MSC _MSC(GET(FEAT_S))
/* color characteristics */
#define CC_L(x,y) ((x & (0x03 << y)) >> y)
#define CC_H(x) (x << 2)
#define I_CC(x,y,z) CC_H(y) | CC_L(x,z)
#define F_CC(x) ((x)/1024.0)
#define REDX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDX)),6))
#define REDY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_REDY)),4))
#define GREENX F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENX)),2))
#define GREENY F_CC(I_CC((GET(D_RG_LOW)),(GET(D_GREENY)),0))
#define BLUEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEX)),6))
#define BLUEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_BLUEY)),4))
#define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2))
#define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0))
/* extract information from standard timing section */
#define T1 GET(E_T1)
#define T2 GET(E_T2)
#define T_MANU GET(E_TMANU)
/* extract information from established timing section */
#define _VALID_TIMING(x) !(((x[0] == 0x01) && (x[1] == 0x01)) \
|| ((x[0] == 0x00) && (x[1] == 0x00)) \
|| ((x[0] == 0x20) && (x[1] == 0x20)) )
#define VALID_TIMING _VALID_TIMING(c)
#define _HSIZE1(x) ((x[0] + 31) * 8)
#define HSIZE1 _HSIZE1(c)
#define RATIO(x) ((x[1] & 0xC0) >> 6)
#define RATIO1_1 0
/* EDID Ver. 1.3 redefined this */
#define RATIO16_10 RATIO1_1
#define RATIO4_3 1
#define RATIO5_4 2
#define RATIO16_9 3
#define _VSIZE1(x,y,r) switch(RATIO(x)){ \
case RATIO1_1: y = ((v->version > 1 || v->revision > 2) \
? (_HSIZE1(x) * 10) / 16 : _HSIZE1(x)); break; \
case RATIO4_3: y = _HSIZE1(x) * 3 / 4; break; \
case RATIO5_4: y = _HSIZE1(x) * 4 / 5; break; \
case RATIO16_9: y = _HSIZE1(x) * 9 / 16; break; \
}
#define VSIZE1(x) _VSIZE1(c,x,v)
#define _REFRESH_R(x) (x[1] & 0x3F) + 60
#define REFRESH_R _REFRESH_R(c)
#define _ID_LOW(x) x[0]
#define ID_LOW _ID_LOW(c)
#define _ID_HIGH(x) (x[1] << 8)
#define ID_HIGH _ID_HIGH(c)
#define STD_TIMING_ID (ID_LOW | ID_HIGH)
#define _NEXT_STD_TIMING(x) (x = (x + STD_TIMING_INFO_LEN))
#define NEXT_STD_TIMING _NEXT_STD_TIMING(c)
/* EDID Ver. >= 1.2 */
/**
* Returns true if the pointer is the start of a monitor descriptor block
* instead of a detailed timing descriptor.
*
* Checking the reserved pad fields for zeroes fails on some monitors with
* broken empty ASCII strings. Only the first two bytes are reliable.
*/
#define _IS_MONITOR_DESC(x) (x[0] == 0 && x[1] == 0)
#define IS_MONITOR_DESC _IS_MONITOR_DESC(c)
#define _PIXEL_CLOCK(x) (x[0] + (x[1] << 8)) * 10000
#define PIXEL_CLOCK _PIXEL_CLOCK(c)
#define _H_ACTIVE(x) (x[2] + ((x[4] & 0xF0) << 4))
#define H_ACTIVE _H_ACTIVE(c)
#define _H_BLANK(x) (x[3] + ((x[4] & 0x0F) << 8))
#define H_BLANK _H_BLANK(c)
#define _V_ACTIVE(x) (x[5] + ((x[7] & 0xF0) << 4))
#define V_ACTIVE _V_ACTIVE(c)
#define _V_BLANK(x) (x[6] + ((x[7] & 0x0F) << 8))
#define V_BLANK _V_BLANK(c)
#define _H_SYNC_OFF(x) (x[8] + ((x[11] & 0xC0) << 2))
#define H_SYNC_OFF _H_SYNC_OFF(c)
#define _H_SYNC_WIDTH(x) (x[9] + ((x[11] & 0x30) << 4))
#define H_SYNC_WIDTH _H_SYNC_WIDTH(c)
#define _V_SYNC_OFF(x) ((x[10] >> 4) + ((x[11] & 0x0C) << 2))
#define V_SYNC_OFF _V_SYNC_OFF(c)
#define _V_SYNC_WIDTH(x) ((x[10] & 0x0F) + ((x[11] & 0x03) << 4))
#define V_SYNC_WIDTH _V_SYNC_WIDTH(c)
#define _H_SIZE(x) (x[12] + ((x[14] & 0xF0) << 4))
#define H_SIZE _H_SIZE(c)
#define _V_SIZE(x) (x[13] + ((x[14] & 0x0F) << 8))
#define V_SIZE _V_SIZE(c)
#define _H_BORDER(x) (x[15])
#define H_BORDER _H_BORDER(c)
#define _V_BORDER(x) (x[16])
#define V_BORDER _V_BORDER(c)
#define _INTERLACED(x) ((x[17] & 0x80) >> 7)
#define INTERLACED _INTERLACED(c)
#define _STEREO(x) ((x[17] & 0x60) >> 5)
#define STEREO _STEREO(c)
#define _STEREO1(x) (x[17] & 0x1)
#define STEREO1 _STEREO(c)
#define _SYNC_T(x) ((x[17] & 0x18) >> 3)
#define SYNC_T _SYNC_T(c)
#define _MISC(x) ((x[17] & 0x06) >> 1)
#define MISC _MISC(c)
#define _MONITOR_DESC_TYPE(x) x[3]
#define MONITOR_DESC_TYPE _MONITOR_DESC_TYPE(c)
#define SERIAL_NUMBER 0xFF
#define ASCII_STR 0xFE
#define MONITOR_RANGES 0xFD
#define _MIN_V_OFFSET(x) ((!!(x[4] & 0x01)) * 255)
#define _MAX_V_OFFSET(x) ((!!(x[4] & 0x02)) * 255)
#define _MIN_H_OFFSET(x) ((!!(x[4] & 0x04)) * 255)
#define _MAX_H_OFFSET(x) ((!!(x[4] & 0x08)) * 255)
#define _MIN_V(x) x[5]
#define MIN_V (_MIN_V(c) + _MIN_V_OFFSET(c))
#define _MAX_V(x) x[6]
#define MAX_V (_MAX_V(c) + _MAX_V_OFFSET(c))
#define _MIN_H(x) x[7]
#define MIN_H (_MIN_H(c) + _MIN_H_OFFSET(c))
#define _MAX_H(x) x[8]
#define MAX_H (_MAX_H(c) + _MAX_H_OFFSET(c))
#define _MAX_CLOCK(x) x[9]
#define MAX_CLOCK _MAX_CLOCK(c)
#define _DEFAULT_GTF(x) (x[10] == 0x00)
#define DEFAULT_GTF _DEFAULT_GTF(c)
#define _RANGE_LIMITS_ONLY(x) (x[10] == 0x01)
#define RANGE_LIMITS_ONLY _RANGE_LIMITS_ONLY(c)
#define _HAVE_2ND_GTF(x) (x[10] == 0x02)
#define HAVE_2ND_GTF _HAVE_2ND_GTF(c)
#define _F_2ND_GTF(x) (x[12] * 2)
#define F_2ND_GTF _F_2ND_GTF(c)
#define _C_2ND_GTF(x) (x[13] / 2)
#define C_2ND_GTF _C_2ND_GTF(c)
#define _M_2ND_GTF(x) (x[14] + (x[15] << 8))
#define M_2ND_GTF _M_2ND_GTF(c)
#define _K_2ND_GTF(x) (x[16])
#define K_2ND_GTF _K_2ND_GTF(c)
#define _J_2ND_GTF(x) (x[17] / 2)
#define J_2ND_GTF _J_2ND_GTF(c)
#define _HAVE_CVT(x) (x[10] == 0x04)
#define HAVE_CVT _HAVE_CVT(c)
#define _MAX_CLOCK_KHZ(x) (x[12] >> 2)
#define MAX_CLOCK_KHZ (MAX_CLOCK * 10000) - (_MAX_CLOCK_KHZ(c) * 250)
#define _MAXWIDTH(x) ((x[13] == 0 ? 0 : x[13] + ((x[12] & 0x03) << 8)) * 8)
#define MAXWIDTH _MAXWIDTH(c)
#define _SUPPORTED_ASPECT(x) x[14]
#define SUPPORTED_ASPECT _SUPPORTED_ASPECT(c)
#define SUPPORTED_ASPECT_4_3 0x80
#define SUPPORTED_ASPECT_16_9 0x40
#define SUPPORTED_ASPECT_16_10 0x20
#define SUPPORTED_ASPECT_5_4 0x10
#define SUPPORTED_ASPECT_15_9 0x08
#define _PREFERRED_ASPECT(x) ((x[15] & 0xe0) >> 5)
#define PREFERRED_ASPECT _PREFERRED_ASPECT(c)
#define PREFERRED_ASPECT_4_3 0
#define PREFERRED_ASPECT_16_9 1
#define PREFERRED_ASPECT_16_10 2
#define PREFERRED_ASPECT_5_4 3
#define PREFERRED_ASPECT_15_9 4
#define _SUPPORTED_BLANKING(x) ((x[15] & 0x18) >> 3)
#define SUPPORTED_BLANKING _SUPPORTED_BLANKING(c)
#define CVT_STANDARD 0x01
#define CVT_REDUCED 0x02
#define _SUPPORTED_SCALING(x) ((x[16] & 0xf0) >> 4)
#define SUPPORTED_SCALING _SUPPORTED_SCALING(c)
#define SCALING_HSHRINK 0x08
#define SCALING_HSTRETCH 0x04
#define SCALING_VSHRINK 0x02
#define SCALING_VSTRETCH 0x01
#define _PREFERRED_REFRESH(x) x[17]
#define PREFERRED_REFRESH _PREFERRED_REFRESH(c)
#define MONITOR_NAME 0xFC
#define ADD_COLOR_POINT 0xFB
#define WHITEX F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEX)),2))
#define WHITEY F_CC(I_CC((GET(D_BW_LOW)),(GET(D_WHITEY)),0))
#define _WHITEX_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 1)),2))
#define _WHITEY_ADD(x,y) F_CC(I_CC(((*(x + y))),(*(x + y + 2)),0))
#define _WHITE_INDEX1(x) x[5]
#define WHITE_INDEX1 _WHITE_INDEX1(c)
#define _WHITE_INDEX2(x) x[10]
#define WHITE_INDEX2 _WHITE_INDEX2(c)
#define WHITEX1 _WHITEX_ADD(c,6)
#define WHITEY1 _WHITEY_ADD(c,6)
#define WHITEX2 _WHITEX_ADD(c,12)
#define WHITEY2 _WHITEY_ADD(c,12)
#define _WHITE_GAMMA1(x) _GAMMA(x[9])
#define WHITE_GAMMA1 _WHITE_GAMMA1(c)
#define _WHITE_GAMMA2(x) _GAMMA(x[14])
#define WHITE_GAMMA2 _WHITE_GAMMA2(c)
#define ADD_STD_TIMINGS 0xFA
#define COLOR_MANAGEMENT_DATA 0xF9
#define CVT_3BYTE_DATA 0xF8
#define ADD_EST_TIMINGS 0xF7
#define ADD_DUMMY 0x10
#define _NEXT_DT_MD_SECTION(x) (x = (x + DET_TIMING_INFO_LEN))
#define NEXT_DT_MD_SECTION _NEXT_DT_MD_SECTION(c)
#endif /* _PARSE_EDID_ */
/* input type */
#define DIGITAL(x) x
/* DFP */
#define DFP1(x) x
/* input voltage level */
#define V070 0 /* 0.700V/0.300V */
#define V071 1 /* 0.714V/0.286V */
#define V100 2 /* 1.000V/0.400V */
#define V007 3 /* 0.700V/0.000V */
/* Signal level setup */
#define SIG_SETUP(x) (x)
/* sync characteristics */
#define SEP_SYNC(x) (x & 0x08)
#define COMP_SYNC(x) (x & 0x04)
#define SYNC_O_GREEN(x) (x & 0x02)
#define SYNC_SERR(x) (x & 0x01)
/* DPMS features */
#define DPMS_STANDBY(x) (x & 0x04)
#define DPMS_SUSPEND(x) (x & 0x02)
#define DPMS_OFF(x) (x & 0x01)
/* display type, analog */
#define DISP_MONO 0
#define DISP_RGB 1
#define DISP_MULTCOLOR 2
/* display color encodings, digital */
#define DISP_YCRCB444 0x01
#define DISP_YCRCB422 0x02
/* Msc stuff EDID Ver > 1.1 */
#define STD_COLOR_SPACE(x) (x & 0x4)
#define PREFERRED_TIMING_MODE(x) (x & 0x2)
#define GFT_SUPPORTED(x) (x & 0x1)
#define GTF_SUPPORTED(x) (x & 0x1)
#define CVT_SUPPORTED(x) (x & 0x1)
/* detailed timing misc */
#define IS_INTERLACED(x) (x)
#define IS_STEREO(x) (x)
#define IS_RIGHT_STEREO(x) (x & 0x01)
#define IS_LEFT_STEREO(x) (x & 0x02)
#define IS_4WAY_STEREO(x) (x & 0x03)
#define IS_RIGHT_ON_SYNC(x) IS_RIGHT_STEREO(x)
#define IS_LEFT_ON_SYNC(x) IS_LEFT_STEREO(x)
typedef unsigned int Uint;
typedef unsigned char Uchar;
struct vendor {
char name[4];
int prod_id;
Uint serial;
int week;
int year;
};
struct edid_version {
int version;
int revision;
};
struct disp_features {
unsigned int input_type:1;
unsigned int input_voltage:2;
unsigned int input_setup:1;
unsigned int input_sync:5;
unsigned int input_dfp:1;
unsigned int input_bpc:3;
unsigned int input_interface:4;
/* 15 bit hole */
int hsize;
int vsize;
float gamma;
unsigned int dpms:3;
unsigned int display_type:2;
unsigned int msc:3;
float redx;
float redy;
float greenx;
float greeny;
float bluex;
float bluey;
float whitex;
float whitey;
};
struct established_timings {
Uchar t1;
Uchar t2;
Uchar t_manu;
};
struct std_timings {
int hsize;
int vsize;
int refresh;
CARD16 id;
};
struct detailed_timings {
int clock;
int h_active;
int h_blanking;
int v_active;
int v_blanking;
int h_sync_off;
int h_sync_width;
int v_sync_off;
int v_sync_width;
int h_size;
int v_size;
int h_border;
int v_border;
unsigned int interlaced:1;
unsigned int stereo:2;
unsigned int sync:2;
unsigned int misc:2;
unsigned int stereo_1:1;
};
#define DT 0
#define DS_SERIAL 0xFF
#define DS_ASCII_STR 0xFE
#define DS_NAME 0xFC
#define DS_RANGES 0xFD
#define DS_WHITE_P 0xFB
#define DS_STD_TIMINGS 0xFA
#define DS_CMD 0xF9
#define DS_CVT 0xF8
#define DS_EST_III 0xF7
#define DS_DUMMY 0x10
#define DS_UNKOWN 0x100 /* type is an int */
#define DS_VENDOR 0x101
#define DS_VENDOR_MAX 0x110
/*
* Display range limit Descriptor of EDID version1, reversion 4
*/
typedef enum {
DR_DEFAULT_GTF,
DR_LIMITS_ONLY,
DR_SECONDARY_GTF,
DR_CVT_SUPPORTED = 4,
} DR_timing_flags;
struct monitor_ranges {
int min_v;
int max_v;
int min_h;
int max_h;
int max_clock; /* in mhz */
int gtf_2nd_f;
int gtf_2nd_c;
int gtf_2nd_m;
int gtf_2nd_k;
int gtf_2nd_j;
int max_clock_khz;
int maxwidth; /* in pixels */
char supported_aspect;
char preferred_aspect;
char supported_blanking;
char supported_scaling;
int preferred_refresh; /* in hz */
DR_timing_flags display_range_timing_flags;
};
struct whitePoints {
int index;
float white_x;
float white_y;
float white_gamma;
};
struct cvt_timings {
int width;
int height;
int rate;
int rates;
};
/*
* Be careful when adding new sections; this structure can't grow, it's
* embedded in the middle of xf86Monitor which is ABI. Sizes below are
* in bytes, for ILP32 systems. If all else fails just copy the section
* literally like serial and friends.
*/
struct detailed_monitor_section {
int type;
union {
struct detailed_timings d_timings; /* 56 */
Uchar serial[13];
Uchar ascii_data[13];
Uchar name[13];
struct monitor_ranges ranges; /* 60 */
struct std_timings std_t[5]; /* 80 */
struct whitePoints wp[2]; /* 32 */
/* color management data */
struct cvt_timings cvt[4]; /* 64 */
Uchar est_iii[6]; /* 6 */
} section; /* max: 80 */
};
/* flags */
#define MONITOR_EDID_COMPLETE_RAWDATA 0x01
/* old, don't use */
#define EDID_COMPLETE_RAWDATA 0x01
/*
* For DisplayID devices, only the scrnIndex, flags, and rawData fields
* are meaningful. For EDID, they all are.
*/
typedef struct {
int scrnIndex;
struct vendor vendor;
struct edid_version ver;
struct disp_features features;
struct established_timings timings1;
struct std_timings timings2[8];
struct detailed_monitor_section det_mon[4];
unsigned long flags;
int no_sections;
Uchar *rawData;
} xf86Monitor, *xf86MonPtr;
extern _X_EXPORT xf86MonPtr ConfiguredMonitor;
#define EXT_TAG 0
#define EXT_REV 1
#define CEA_EXT 0x02
#define VTB_EXT 0x10
#define DI_EXT 0x40
#define LS_EXT 0x50
#define MI_EXT 0x60
#define CEA_EXT_MIN_DATA_OFFSET 4
#define CEA_EXT_MAX_DATA_OFFSET 127
#define CEA_EXT_DET_TIMING_NUM 6
#define IEEE_ID_HDMI 0x000C03
#define CEA_AUDIO_BLK 1
#define CEA_VIDEO_BLK 2
#define CEA_VENDOR_BLK 3
#define CEA_SPEAKER_ALLOC_BLK 4
#define CEA_VESA_DTC_BLK 5
#define VENDOR_SUPPORT_AI(x) ((x) >> 7)
#define VENDOR_SUPPORT_DC_48bit(x) ( ( (x) >> 6) & 0x01)
#define VENDOR_SUPPORT_DC_36bit(x) ( ( (x) >> 5) & 0x01)
#define VENDOR_SUPPORT_DC_30bit(x) ( ( (x) >> 4) & 0x01)
#define VENDOR_SUPPORT_DC_Y444(x) ( ( (x) >> 3) & 0x01)
#define VENDOR_LATENCY_PRESENT(x) ( (x) >> 7)
#define VENDOR_LATENCY_PRESENT_I(x) ( ( (x) >> 6) & 0x01)
#define HDMI_MAX_TMDS_UNIT (5000)
struct cea_video_block {
Uchar video_code;
};
struct cea_audio_block_descriptor {
Uchar audio_code[3];
};
struct cea_audio_block {
struct cea_audio_block_descriptor descriptor[10];
};
struct cea_vendor_block_hdmi {
Uchar portB:4;
Uchar portA:4;
Uchar portD:4;
Uchar portC:4;
Uchar support_flags;
Uchar max_tmds_clock;
Uchar latency_present;
Uchar video_latency;
Uchar audio_latency;
Uchar interlaced_video_latency;
Uchar interlaced_audio_latency;
};
struct cea_vendor_block {
unsigned char ieee_id[3];
union {
struct cea_vendor_block_hdmi hdmi;
/* any other vendor blocks we know about */
};
};
struct cea_speaker_block {
Uchar FLR:1;
Uchar LFE:1;
Uchar FC:1;
Uchar RLR:1;
Uchar RC:1;
Uchar FLRC:1;
Uchar RLRC:1;
Uchar FLRW:1;
Uchar FLRH:1;
Uchar TC:1;
Uchar FCH:1;
Uchar Resv:5;
Uchar ResvByte;
};
struct cea_data_block {
Uchar len:5;
Uchar tag:3;
union {
struct cea_video_block video;
struct cea_audio_block audio;
struct cea_vendor_block vendor;
struct cea_speaker_block speaker;
} u;
};
struct cea_ext_body {
Uchar tag;
Uchar rev;
Uchar dt_offset;
Uchar flags;
struct cea_data_block data_collection;
};
#endif /* _EDID_H_ */

View file

@ -1,788 +0,0 @@
/*
* Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
* Copyright 2007 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* interpret_edid.c: interpret a primary EDID block
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "misc.h"
#include "xf86.h"
#include "xf86_OSproc.h"
#define _PARSE_EDID_
#include "xf86DDC.h"
#include <string.h>
static void get_vendor_section(Uchar *, struct vendor *);
static void get_version_section(Uchar *, struct edid_version *);
static void get_display_section(Uchar *, struct disp_features *,
struct edid_version *);
static void get_established_timing_section(Uchar *,
struct established_timings *);
static void get_std_timing_section(Uchar *, struct std_timings *,
struct edid_version *);
static void fetch_detailed_block(Uchar * c, struct edid_version *ver,
struct detailed_monitor_section *det_mon);
static void get_dt_md_section(Uchar *, struct edid_version *,
struct detailed_monitor_section *det_mon);
static void copy_string(Uchar *, Uchar *);
static void get_dst_timing_section(Uchar *, struct std_timings *,
struct edid_version *);
static void get_monitor_ranges(Uchar *, struct monitor_ranges *);
static void get_whitepoint_section(Uchar *, struct whitePoints *);
static void get_detailed_timing_section(Uchar *, struct detailed_timings *);
static Bool validate_version(int scrnIndex, struct edid_version *);
static void
find_ranges_section(struct detailed_monitor_section *det, void *ranges)
{
if (det->type == DS_RANGES && det->section.ranges.max_clock)
*(struct monitor_ranges **) ranges = &det->section.ranges;
}
static void
find_max_detailed_clock(struct detailed_monitor_section *det, void *ret)
{
if (det->type == DT) {
*(int *) ret = max(*((int *) ret), det->section.d_timings.clock);
}
}
static void
handle_edid_quirks(xf86MonPtr m)
{
struct monitor_ranges *ranges = NULL;
/*
* max_clock is only encoded in EDID in tens of MHz, so occasionally we
* find a monitor claiming a max of 160 with a mode requiring 162, or
* similar. Strictly we should refuse to round up too far, but let's
* see how well this works.
*/
/* Try to find Monitor Range and max clock, then re-set range value */
xf86ForEachDetailedBlock(m, find_ranges_section, &ranges);
if (ranges && ranges->max_clock) {
int clock = 0;
xf86ForEachDetailedBlock(m, find_max_detailed_clock, &clock);
if (clock && (ranges->max_clock * 1e6 < clock)) {
xf86Msg(X_WARNING, "EDID timing clock %.2f exceeds claimed max "
"%dMHz, fixing\n", clock / 1.0e6, ranges->max_clock);
ranges->max_clock = (clock + 999999) / 1e6;
}
}
}
struct det_hv_parameter {
int real_hsize;
int real_vsize;
float target_aspect;
};
static void
handle_detailed_hvsize(struct detailed_monitor_section *det_mon, void *data)
{
struct det_hv_parameter *p = (struct det_hv_parameter *) data;
float timing_aspect;
if (det_mon->type == DT) {
struct detailed_timings *timing;
timing = &det_mon->section.d_timings;
if (!timing->v_size)
return;
timing_aspect = (float) timing->h_size / timing->v_size;
if (fabs(1 - (timing_aspect / p->target_aspect)) < 0.05) {
p->real_hsize = max(p->real_hsize, timing->h_size);
p->real_vsize = max(p->real_vsize, timing->v_size);
}
}
}
static void
encode_aspect_ratio(xf86MonPtr m)
{
/*
* some monitors encode the aspect ratio instead of the physical size.
* try to find the largest detailed timing that matches that aspect
* ratio and use that to fill in the feature section.
*/
if ((m->features.hsize == 16 && m->features.vsize == 9) ||
(m->features.hsize == 16 && m->features.vsize == 10) ||
(m->features.hsize == 4 && m->features.vsize == 3) ||
(m->features.hsize == 5 && m->features.vsize == 4)) {
struct det_hv_parameter p;
p.real_hsize = 0;
p.real_vsize = 0;
p.target_aspect = (float) m->features.hsize / m->features.vsize;
xf86ForEachDetailedBlock(m, handle_detailed_hvsize, &p);
if (!p.real_hsize || !p.real_vsize) {
m->features.hsize = m->features.vsize = 0;
}
else if ((m->features.hsize * 10 == p.real_hsize) &&
(m->features.vsize * 10 == p.real_vsize)) {
/* exact match is just unlikely, should do a better check though */
m->features.hsize = m->features.vsize = 0;
}
else {
/* convert mm to cm */
m->features.hsize = (p.real_hsize + 5) / 10;
m->features.vsize = (p.real_vsize + 5) / 10;
}
xf86Msg(X_INFO, "Quirked EDID physical size to %dx%d cm\n",
m->features.hsize, m->features.vsize);
}
}
xf86MonPtr
xf86InterpretEDID(int scrnIndex, Uchar * block)
{
xf86MonPtr m;
if (!block)
return NULL;
if (!(m = xnfcalloc(sizeof(xf86Monitor), 1)))
return NULL;
m->scrnIndex = scrnIndex;
m->rawData = block;
get_vendor_section(SECTION(VENDOR_SECTION, block), &m->vendor);
get_version_section(SECTION(VERSION_SECTION, block), &m->ver);
if (!validate_version(scrnIndex, &m->ver))
goto error;
get_display_section(SECTION(DISPLAY_SECTION, block), &m->features, &m->ver);
get_established_timing_section(SECTION(ESTABLISHED_TIMING_SECTION, block),
&m->timings1);
get_std_timing_section(SECTION(STD_TIMING_SECTION, block), m->timings2,
&m->ver);
get_dt_md_section(SECTION(DET_TIMING_SECTION, block), &m->ver, m->det_mon);
m->no_sections = (int) *(char *) SECTION(NO_EDID, block);
handle_edid_quirks(m);
encode_aspect_ratio(m);
return m;
error:
free(m);
return NULL;
}
static int
get_cea_detail_timing(Uchar * blk, xf86MonPtr mon,
struct detailed_monitor_section *det_mon)
{
int dt_num;
int dt_offset = ((struct cea_ext_body *) blk)->dt_offset;
dt_num = 0;
if (dt_offset < CEA_EXT_MIN_DATA_OFFSET)
return dt_num;
for (; dt_offset < (CEA_EXT_MAX_DATA_OFFSET - DET_TIMING_INFO_LEN) &&
dt_num < CEA_EXT_DET_TIMING_NUM; _NEXT_DT_MD_SECTION(dt_offset)) {
fetch_detailed_block(blk + dt_offset, &mon->ver, det_mon + dt_num);
dt_num = dt_num + 1;
}
return dt_num;
}
static void
handle_cea_detail_block(Uchar * ext, xf86MonPtr mon,
handle_detailed_fn fn, void *data)
{
int i;
struct detailed_monitor_section det_mon[CEA_EXT_DET_TIMING_NUM];
int det_mon_num;
det_mon_num = get_cea_detail_timing(ext, mon, det_mon);
for (i = 0; i < det_mon_num; i++)
fn(det_mon + i, data);
}
void
xf86ForEachDetailedBlock(xf86MonPtr mon, handle_detailed_fn fn, void *data)
{
int i;
Uchar *ext;
if (mon == NULL)
return;
for (i = 0; i < DET_TIMINGS; i++)
fn(mon->det_mon + i, data);
for (i = 0; i < mon->no_sections; i++) {
ext = mon->rawData + EDID1_LEN * (i + 1);
switch (ext[EXT_TAG]) {
case CEA_EXT:
handle_cea_detail_block(ext, mon, fn, data);
break;
case VTB_EXT:
case DI_EXT:
case LS_EXT:
case MI_EXT:
break;
}
}
}
static struct cea_data_block *
extract_cea_data_block(Uchar * ext, int data_type)
{
struct cea_ext_body *cea;
struct cea_data_block *data_collection;
struct cea_data_block *data_end;
cea = (struct cea_ext_body *) ext;
if (cea->dt_offset <= CEA_EXT_MIN_DATA_OFFSET)
return NULL;
data_collection = &cea->data_collection;
data_end = (struct cea_data_block *) (cea->dt_offset + ext);
for (; data_collection < data_end;) {
if (data_type == data_collection->tag) {
return data_collection;
}
data_collection = (void *) ((unsigned char *) data_collection +
data_collection->len + 1);
}
return NULL;
}
static void
handle_cea_video_block(Uchar * ext, handle_video_fn fn, void *data)
{
struct cea_video_block *video;
struct cea_video_block *video_end;
struct cea_data_block *data_collection;
data_collection = extract_cea_data_block(ext, CEA_VIDEO_BLK);
if (data_collection == NULL)
return;
video = &data_collection->u.video;
video_end = (struct cea_video_block *)
((Uchar *) video + data_collection->len);
for (; video < video_end; video = video + 1) {
fn(video, data);
}
}
void
xf86ForEachVideoBlock(xf86MonPtr mon, handle_video_fn fn, void *data)
{
int i;
Uchar *ext;
if (mon == NULL)
return;
for (i = 0; i < mon->no_sections; i++) {
ext = mon->rawData + EDID1_LEN * (i + 1);
switch (ext[EXT_TAG]) {
case CEA_EXT:
handle_cea_video_block(ext, fn, data);
break;
case VTB_EXT:
case DI_EXT:
case LS_EXT:
case MI_EXT:
break;
}
}
}
static Bool
cea_db_offsets(Uchar *cea, int *start, int *end)
{
/* Data block offset in CEA extension block */
*start = CEA_EXT_MIN_DATA_OFFSET;
*end = cea[2];
if (*end == 0)
*end = CEA_EXT_MAX_DATA_OFFSET;
if (*end < CEA_EXT_MIN_DATA_OFFSET || *end > CEA_EXT_MAX_DATA_OFFSET)
return FALSE;
return TRUE;
}
static int
cea_db_len(Uchar *db)
{
return db[0] & 0x1f;
}
static int
cea_db_tag(Uchar *db)
{
return db[0] >> 5;
}
typedef void (*handle_cea_db_fn) (Uchar *, void *);
static void
cea_for_each_db(xf86MonPtr mon, handle_cea_db_fn fn, void *data)
{
int i;
if (!mon)
return;
if (!(mon->flags & EDID_COMPLETE_RAWDATA))
return;
if (!mon->no_sections)
return;
if (!mon->rawData)
return;
for (i = 0; i < mon->no_sections; i++) {
int start, end, offset;
Uchar *ext;
ext = mon->rawData + EDID1_LEN * (i + 1);
if (ext[EXT_TAG] != CEA_EXT)
continue;
if (!cea_db_offsets(ext, &start, &end))
continue;
for (offset = start;
offset < end && offset + cea_db_len(&ext[offset]) < end;
offset += cea_db_len(&ext[offset]) + 1)
fn(&ext[offset], data);
}
}
struct find_hdmi_block_data {
struct cea_data_block *hdmi;
};
static void find_hdmi_block(Uchar *db, void *data)
{
struct find_hdmi_block_data *result = data;
int oui;
if (cea_db_tag(db) != CEA_VENDOR_BLK)
return;
if (cea_db_len(db) < 5)
return;
oui = (db[3] << 16) | (db[2] << 8) | db[1];
if (oui == IEEE_ID_HDMI)
result->hdmi = (struct cea_data_block *)db;
}
struct cea_data_block *xf86MonitorFindHDMIBlock(xf86MonPtr mon)
{
struct find_hdmi_block_data result = { NULL };
cea_for_each_db(mon, find_hdmi_block, &result);
return result.hdmi;
}
xf86MonPtr
xf86InterpretEEDID(int scrnIndex, Uchar * block)
{
xf86MonPtr m;
m = xf86InterpretEDID(scrnIndex, block);
if (!m)
return NULL;
/* extension parse */
return m;
}
static void
get_vendor_section(Uchar * c, struct vendor *r)
{
r->name[0] = L1;
r->name[1] = L2;
r->name[2] = L3;
r->name[3] = '\0';
r->prod_id = PROD_ID;
r->serial = SERIAL_NO;
r->week = WEEK;
r->year = YEAR;
}
static void
get_version_section(Uchar * c, struct edid_version *r)
{
r->version = VERSION;
r->revision = REVISION;
}
static void
get_display_section(Uchar * c, struct disp_features *r, struct edid_version *v)
{
r->input_type = INPUT_TYPE;
if (!DIGITAL(r->input_type)) {
r->input_voltage = INPUT_VOLTAGE;
r->input_setup = SETUP;
r->input_sync = SYNC;
}
else if (v->revision == 2 || v->revision == 3) {
r->input_dfp = DFP;
}
else if (v->revision >= 4) {
r->input_bpc = BPC;
r->input_interface = DIGITAL_INTERFACE;
}
r->hsize = HSIZE_MAX;
r->vsize = VSIZE_MAX;
r->gamma = GAMMA;
r->dpms = DPMS;
r->display_type = DISPLAY_TYPE;
r->msc = MSC;
r->redx = REDX;
r->redy = REDY;
r->greenx = GREENX;
r->greeny = GREENY;
r->bluex = BLUEX;
r->bluey = BLUEY;
r->whitex = WHITEX;
r->whitey = WHITEY;
}
static void
get_established_timing_section(Uchar * c, struct established_timings *r)
{
r->t1 = T1;
r->t2 = T2;
r->t_manu = T_MANU;
}
static void
get_cvt_timing_section(Uchar * c, struct cvt_timings *r)
{
int i;
for (i = 0; i < 4; i++) {
if (c[0] && c[1] && c[2]) {
r[i].height = (c[0] + ((c[1] & 0xF0) << 8) + 1) * 2;
switch (c[1] & 0xc0) {
case 0x00:
r[i].width = r[i].height * 4 / 3;
break;
case 0x40:
r[i].width = r[i].height * 16 / 9;
break;
case 0x80:
r[i].width = r[i].height * 16 / 10;
break;
case 0xc0:
r[i].width = r[i].height * 15 / 9;
break;
}
switch (c[2] & 0x60) {
case 0x00:
r[i].rate = 50;
break;
case 0x20:
r[i].rate = 60;
break;
case 0x40:
r[i].rate = 75;
break;
case 0x60:
r[i].rate = 85;
break;
}
r[i].rates = c[2] & 0x1f;
}
else {
return;
}
c += 3;
}
}
static void
get_std_timing_section(Uchar * c, struct std_timings *r, struct edid_version *v)
{
int i;
for (i = 0; i < STD_TIMINGS; i++) {
if (VALID_TIMING) {
r[i].hsize = HSIZE1;
VSIZE1(r[i].vsize);
r[i].refresh = REFRESH_R;
r[i].id = STD_TIMING_ID;
}
else {
r[i].hsize = r[i].vsize = r[i].refresh = r[i].id = 0;
}
NEXT_STD_TIMING;
}
}
static const unsigned char empty_block[18];
static void
fetch_detailed_block(Uchar * c, struct edid_version *ver,
struct detailed_monitor_section *det_mon)
{
if (ver->version == 1 && ver->revision >= 1 && IS_MONITOR_DESC) {
switch (MONITOR_DESC_TYPE) {
case SERIAL_NUMBER:
det_mon->type = DS_SERIAL;
copy_string(c, det_mon->section.serial);
break;
case ASCII_STR:
det_mon->type = DS_ASCII_STR;
copy_string(c, det_mon->section.ascii_data);
break;
case MONITOR_RANGES:
det_mon->type = DS_RANGES;
get_monitor_ranges(c, &det_mon->section.ranges);
break;
case MONITOR_NAME:
det_mon->type = DS_NAME;
copy_string(c, det_mon->section.name);
break;
case ADD_COLOR_POINT:
det_mon->type = DS_WHITE_P;
get_whitepoint_section(c, det_mon->section.wp);
break;
case ADD_STD_TIMINGS:
det_mon->type = DS_STD_TIMINGS;
get_dst_timing_section(c, det_mon->section.std_t, ver);
break;
case COLOR_MANAGEMENT_DATA:
det_mon->type = DS_CMD;
break;
case CVT_3BYTE_DATA:
det_mon->type = DS_CVT;
get_cvt_timing_section(c, det_mon->section.cvt);
break;
case ADD_EST_TIMINGS:
det_mon->type = DS_EST_III;
memcpy(det_mon->section.est_iii, c + 6, 6);
break;
case ADD_DUMMY:
det_mon->type = DS_DUMMY;
break;
default:
det_mon->type = DS_UNKOWN;
break;
}
if (c[3] <= 0x0F && memcmp(c, empty_block, sizeof(empty_block))) {
det_mon->type = DS_VENDOR + c[3];
}
}
else {
det_mon->type = DT;
get_detailed_timing_section(c, &det_mon->section.d_timings);
}
}
static void
get_dt_md_section(Uchar * c, struct edid_version *ver,
struct detailed_monitor_section *det_mon)
{
int i;
for (i = 0; i < DET_TIMINGS; i++) {
fetch_detailed_block(c, ver, det_mon + i);
NEXT_DT_MD_SECTION;
}
}
static void
copy_string(Uchar * c, Uchar * s)
{
int i;
c = c + 5;
for (i = 0; (i < 13 && *c != 0x0A); i++)
*(s++) = *(c++);
*s = 0;
while (i-- && (*--s == 0x20))
*s = 0;
}
static void
get_dst_timing_section(Uchar * c, struct std_timings *t, struct edid_version *v)
{
int j;
c = c + 5;
for (j = 0; j < 5; j++) {
t[j].hsize = HSIZE1;
VSIZE1(t[j].vsize);
t[j].refresh = REFRESH_R;
t[j].id = STD_TIMING_ID;
NEXT_STD_TIMING;
}
}
static void
get_monitor_ranges(Uchar * c, struct monitor_ranges *r)
{
r->min_v = MIN_V;
r->max_v = MAX_V;
r->min_h = MIN_H;
r->max_h = MAX_H;
r->max_clock = 0;
if (MAX_CLOCK != 0xff) /* is specified? */
r->max_clock = MAX_CLOCK * 10 + 5;
r->display_range_timing_flags = c[10];
if (HAVE_2ND_GTF) {
r->gtf_2nd_f = F_2ND_GTF;
r->gtf_2nd_c = C_2ND_GTF;
r->gtf_2nd_m = M_2ND_GTF;
r->gtf_2nd_k = K_2ND_GTF;
r->gtf_2nd_j = J_2ND_GTF;
}
else {
r->gtf_2nd_f = 0;
}
if (HAVE_CVT) {
r->max_clock_khz = MAX_CLOCK_KHZ;
r->max_clock = r->max_clock_khz / 1000;
r->maxwidth = MAXWIDTH;
r->supported_aspect = SUPPORTED_ASPECT;
r->preferred_aspect = PREFERRED_ASPECT;
r->supported_blanking = SUPPORTED_BLANKING;
r->supported_scaling = SUPPORTED_SCALING;
r->preferred_refresh = PREFERRED_REFRESH;
}
else {
r->max_clock_khz = 0;
}
}
static void
get_whitepoint_section(Uchar * c, struct whitePoints *wp)
{
wp[0].white_x = WHITEX1;
wp[0].white_y = WHITEY1;
wp[1].white_x = WHITEX2;
wp[1].white_y = WHITEY2;
wp[0].index = WHITE_INDEX1;
wp[1].index = WHITE_INDEX2;
wp[0].white_gamma = WHITE_GAMMA1;
wp[1].white_gamma = WHITE_GAMMA2;
}
static void
get_detailed_timing_section(Uchar * c, struct detailed_timings *r)
{
r->clock = PIXEL_CLOCK;
r->h_active = H_ACTIVE;
r->h_blanking = H_BLANK;
r->v_active = V_ACTIVE;
r->v_blanking = V_BLANK;
r->h_sync_off = H_SYNC_OFF;
r->h_sync_width = H_SYNC_WIDTH;
r->v_sync_off = V_SYNC_OFF;
r->v_sync_width = V_SYNC_WIDTH;
r->h_size = H_SIZE;
r->v_size = V_SIZE;
r->h_border = H_BORDER;
r->v_border = V_BORDER;
r->interlaced = INTERLACED;
r->stereo = STEREO;
r->stereo_1 = STEREO1;
r->sync = SYNC_T;
r->misc = MISC;
}
#define MAX_EDID_MINOR 4
static Bool
validate_version(int scrnIndex, struct edid_version *r)
{
if (r->version != 1) {
xf86DrvMsg(scrnIndex, X_ERROR, "Unknown EDID version %d\n", r->version);
return FALSE;
}
if (r->revision > MAX_EDID_MINOR)
xf86DrvMsg(scrnIndex, X_WARNING,
"Assuming version 1.%d is compatible with 1.%d\n",
r->revision, MAX_EDID_MINOR);
return TRUE;
}
Bool
gtf_supported(xf86MonPtr mon)
{
int i;
if (!mon)
return FALSE;
if ((mon->ver.version == 1) && (mon->ver.revision < 4)) {
if (mon->features.msc & 0x1)
return TRUE;
} else {
for (i = 0; i < DET_TIMINGS; i++) {
struct detailed_monitor_section *det_timing_des = &(mon->det_mon[i]);
if (det_timing_des && (det_timing_des->type == DS_RANGES) && (mon->features.msc & 0x1) &&
(det_timing_des->section.ranges.display_range_timing_flags == DR_DEFAULT_GTF
|| det_timing_des->section.ranges.display_range_timing_flags == DR_SECONDARY_GTF))
return TRUE;
}
}
return FALSE;
}
/*
* Returns true if HDMI, false if definitely not or unknown.
*/
Bool
xf86MonitorIsHDMI(xf86MonPtr mon)
{
return xf86MonitorFindHDMIBlock(mon) != NULL;
}

View file

@ -1,15 +0,0 @@
srcs_xorg_ddc = [
'ddc.c',
'interpret_edid.c',
'print_edid.c',
'ddcProperty.c',
]
xorg_ddc = static_library('xorg_ddc',
srcs_xorg_ddc,
include_directories: [inc, xorg_inc],
dependencies: common_dep,
c_args: xorg_c_args,
)
install_data(['edid.h', 'xf86DDC.h'], install_dir: xorgsdkdir)

View file

@ -1,562 +0,0 @@
/*
* Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
* Copyright 2007 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* print_edid.c: print out all information retrieved from display device
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
/* XXX kinda gross */
#define _PARSE_EDID_
#include "misc.h"
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86DDC.h"
#include "edid.h"
#define EDID_WIDTH 16
static void
print_vendor(int scrnIndex, struct vendor *c)
{
xf86DrvMsg(scrnIndex, X_INFO, "Manufacturer: %s Model: %x Serial#: %u\n",
(char *) &c->name, c->prod_id, c->serial);
xf86DrvMsg(scrnIndex, X_INFO, "Year: %u Week: %u\n", c->year, c->week);
}
static void
print_version(int scrnIndex, struct edid_version *c)
{
xf86DrvMsg(scrnIndex, X_INFO, "EDID Version: %u.%u\n", c->version,
c->revision);
}
static const char *digital_interfaces[] = {
"undefined",
"DVI",
"HDMI-a",
"HDMI-b",
"MDDI",
"DisplayPort",
"unknown"
};
static void
print_input_features(int scrnIndex, struct disp_features *c,
struct edid_version *v)
{
if (DIGITAL(c->input_type)) {
xf86DrvMsg(scrnIndex, X_INFO, "Digital Display Input\n");
if (v->revision == 2 || v->revision == 3) {
if (DFP1(c->input_dfp))
xf86DrvMsg(scrnIndex, X_INFO, "DFP 1.x compatible TMDS\n");
}
else if (v->revision >= 4) {
int interface = c->input_interface;
int bpc = c->input_bpc;
if (interface > 6)
interface = 6; /* unknown */
if (bpc == 0 || bpc == 7)
xf86DrvMsg(scrnIndex, X_INFO, "Undefined color depth\n");
else
xf86DrvMsg(scrnIndex, X_INFO, "%d bits per channel\n",
bpc * 2 + 4);
xf86DrvMsg(scrnIndex, X_INFO, "Digital interface is %s\n",
digital_interfaces[interface]);
}
}
else {
xf86DrvMsg(scrnIndex, X_INFO, "Analog Display Input, ");
xf86ErrorF("Input Voltage Level: ");
switch (c->input_voltage) {
case V070:
xf86ErrorF("0.700/0.300 V\n");
break;
case V071:
xf86ErrorF("0.714/0.286 V\n");
break;
case V100:
xf86ErrorF("1.000/0.400 V\n");
break;
case V007:
xf86ErrorF("0.700/0.700 V\n");
break;
default:
xf86ErrorF("undefined\n");
}
if (SIG_SETUP(c->input_setup))
xf86DrvMsg(scrnIndex, X_INFO, "Signal levels configurable\n");
xf86DrvMsg(scrnIndex, X_INFO, "Sync:");
if (SEP_SYNC(c->input_sync))
xf86ErrorF(" Separate");
if (COMP_SYNC(c->input_sync))
xf86ErrorF(" Composite");
if (SYNC_O_GREEN(c->input_sync))
xf86ErrorF(" SyncOnGreen");
if (SYNC_SERR(c->input_sync))
xf86ErrorF("Serration on. "
"V.Sync Pulse req. if CompSync or SyncOnGreen\n");
else
xf86ErrorF("\n");
}
}
static void
print_dpms_features(int scrnIndex, struct disp_features *c,
struct edid_version *v)
{
if (c->dpms) {
xf86DrvMsg(scrnIndex, X_INFO, "DPMS capabilities:");
if (DPMS_STANDBY(c->dpms))
xf86ErrorF(" StandBy");
if (DPMS_SUSPEND(c->dpms))
xf86ErrorF(" Suspend");
if (DPMS_OFF(c->dpms))
xf86ErrorF(" Off");
}
else
xf86DrvMsg(scrnIndex, X_INFO, "No DPMS capabilities specified");
if (!c->input_type) { /* analog */
switch (c->display_type) {
case DISP_MONO:
xf86ErrorF("; Monochrome/GrayScale Display\n");
break;
case DISP_RGB:
xf86ErrorF("; RGB/Color Display\n");
break;
case DISP_MULTCOLOR:
xf86ErrorF("; Non RGB Multicolor Display\n");
break;
default:
xf86ErrorF("\n");
break;
}
}
else {
int enc = c->display_type;
xf86ErrorF("\n");
xf86DrvMsg(scrnIndex, X_INFO, "Supported color encodings: "
"RGB 4:4:4 %s%s\n",
enc & DISP_YCRCB444 ? "YCrCb 4:4:4 " : "",
enc & DISP_YCRCB422 ? "YCrCb 4:2:2" : "");
}
if (STD_COLOR_SPACE(c->msc))
xf86DrvMsg(scrnIndex, X_INFO,
"Default color space is primary color space\n");
if (PREFERRED_TIMING_MODE(c->msc) || v->revision >= 4) {
xf86DrvMsg(scrnIndex, X_INFO,
"First detailed timing is preferred mode\n");
if (v->revision >= 4)
xf86DrvMsg(scrnIndex, X_INFO,
"Preferred mode is native pixel format and refresh rate\n");
}
else if (v->revision == 3) {
xf86DrvMsg(scrnIndex, X_INFO,
"First detailed timing not preferred "
"mode in violation of standard!\n");
}
if (v->revision >= 4) {
if (GFT_SUPPORTED(c->msc)) {
xf86DrvMsg(scrnIndex, X_INFO, "Display is continuous-frequency\n");
}
}
else {
if (GFT_SUPPORTED(c->msc))
xf86DrvMsg(scrnIndex, X_INFO, "GTF timings supported\n");
}
}
static void
print_whitepoint(int scrnIndex, struct disp_features *disp)
{
xf86DrvMsg(scrnIndex, X_INFO, "redX: %.3f redY: %.3f ",
disp->redx, disp->redy);
xf86ErrorF("greenX: %.3f greenY: %.3f\n", disp->greenx, disp->greeny);
xf86DrvMsg(scrnIndex, X_INFO, "blueX: %.3f blueY: %.3f ",
disp->bluex, disp->bluey);
xf86ErrorF("whiteX: %.3f whiteY: %.3f\n", disp->whitex, disp->whitey);
}
static void
print_display(int scrnIndex, struct disp_features *disp, struct edid_version *v)
{
print_input_features(scrnIndex, disp, v);
if (disp->hsize && disp->vsize) {
xf86DrvMsg(scrnIndex, X_INFO, "Max Image Size [cm]: ");
xf86ErrorF("horiz.: %i ", disp->hsize);
xf86ErrorF("vert.: %i\n", disp->vsize);
}
else if (v->revision >= 4 && (disp->hsize || disp->vsize)) {
if (disp->hsize)
xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (landscape)\n",
(disp->hsize + 99) / 100.0);
if (disp->vsize)
xf86DrvMsg(scrnIndex, X_INFO, "Aspect ratio: %.2f (portrait)\n",
100.0 / (float) (disp->vsize + 99));
}
else {
xf86DrvMsg(scrnIndex, X_INFO, "Indeterminate output size\n");
}
if (!disp->gamma && v->revision >= 1.4)
xf86DrvMsg(scrnIndex, X_INFO, "Gamma defined in extension block\n");
else
xf86DrvMsg(scrnIndex, X_INFO, "Gamma: %.2f\n", disp->gamma);
print_dpms_features(scrnIndex, disp, v);
print_whitepoint(scrnIndex, disp);
}
static void
print_established_timings(int scrnIndex, struct established_timings *t)
{
unsigned char c;
if (t->t1 || t->t2 || t->t_manu)
xf86DrvMsg(scrnIndex, X_INFO, "Supported established timings:\n");
c = t->t1;
if (c & 0x80)
xf86DrvMsg(scrnIndex, X_INFO, "720x400@70Hz\n");
if (c & 0x40)
xf86DrvMsg(scrnIndex, X_INFO, "720x400@88Hz\n");
if (c & 0x20)
xf86DrvMsg(scrnIndex, X_INFO, "640x480@60Hz\n");
if (c & 0x10)
xf86DrvMsg(scrnIndex, X_INFO, "640x480@67Hz\n");
if (c & 0x08)
xf86DrvMsg(scrnIndex, X_INFO, "640x480@72Hz\n");
if (c & 0x04)
xf86DrvMsg(scrnIndex, X_INFO, "640x480@75Hz\n");
if (c & 0x02)
xf86DrvMsg(scrnIndex, X_INFO, "800x600@56Hz\n");
if (c & 0x01)
xf86DrvMsg(scrnIndex, X_INFO, "800x600@60Hz\n");
c = t->t2;
if (c & 0x80)
xf86DrvMsg(scrnIndex, X_INFO, "800x600@72Hz\n");
if (c & 0x40)
xf86DrvMsg(scrnIndex, X_INFO, "800x600@75Hz\n");
if (c & 0x20)
xf86DrvMsg(scrnIndex, X_INFO, "832x624@75Hz\n");
if (c & 0x10)
xf86DrvMsg(scrnIndex, X_INFO, "1024x768@87Hz (interlaced)\n");
if (c & 0x08)
xf86DrvMsg(scrnIndex, X_INFO, "1024x768@60Hz\n");
if (c & 0x04)
xf86DrvMsg(scrnIndex, X_INFO, "1024x768@70Hz\n");
if (c & 0x02)
xf86DrvMsg(scrnIndex, X_INFO, "1024x768@75Hz\n");
if (c & 0x01)
xf86DrvMsg(scrnIndex, X_INFO, "1280x1024@75Hz\n");
c = t->t_manu;
if (c & 0x80)
xf86DrvMsg(scrnIndex, X_INFO, "1152x864@75Hz\n");
xf86DrvMsg(scrnIndex, X_INFO, "Manufacturer's mask: %X\n", c & 0x7F);
}
static void
print_std_timings(int scrnIndex, struct std_timings *t)
{
int i;
char done = 0;
for (i = 0; i < STD_TIMINGS; i++) {
if (t[i].hsize > 256) { /* sanity check */
if (!done) {
xf86DrvMsg(scrnIndex, X_INFO, "Supported standard timings:\n");
done = 1;
}
xf86DrvMsg(scrnIndex, X_INFO,
"#%i: hsize: %i vsize %i refresh: %i vid: %i\n",
i, t[i].hsize, t[i].vsize, t[i].refresh, t[i].id);
}
}
}
static void
print_cvt_timings(int si, struct cvt_timings *t)
{
int i;
for (i = 0; i < 4; i++) {
if (t[i].height) {
xf86DrvMsg(si, X_INFO, "%dx%d @ %s%s%s%s%s Hz\n",
t[i].width, t[i].height,
t[i].rates & 0x10 ? "50," : "",
t[i].rates & 0x08 ? "60," : "",
t[i].rates & 0x04 ? "75," : "",
t[i].rates & 0x02 ? "85," : "",
t[i].rates & 0x01 ? "60RB" : "");
}
else
break;
}
}
static void
print_detailed_timings(int scrnIndex, struct detailed_timings *t)
{
if (t->clock > 15000000) { /* sanity check */
xf86DrvMsg(scrnIndex, X_INFO, "Supported detailed timing:\n");
xf86DrvMsg(scrnIndex, X_INFO, "clock: %.1f MHz ",
t->clock / 1000000.0);
xf86ErrorF("Image Size: %i x %i mm\n", t->h_size, t->v_size);
xf86DrvMsg(scrnIndex, X_INFO,
"h_active: %i h_sync: %i h_sync_end %i h_blank_end %i ",
t->h_active, t->h_sync_off + t->h_active,
t->h_sync_off + t->h_sync_width + t->h_active,
t->h_active + t->h_blanking);
xf86ErrorF("h_border: %i\n", t->h_border);
xf86DrvMsg(scrnIndex, X_INFO,
"v_active: %i v_sync: %i v_sync_end %i v_blanking: %i ",
t->v_active, t->v_sync_off + t->v_active,
t->v_sync_off + t->v_sync_width + t->v_active,
t->v_active + t->v_blanking);
xf86ErrorF("v_border: %i\n", t->v_border);
if (IS_STEREO(t->stereo)) {
xf86DrvMsg(scrnIndex, X_INFO, "Stereo: ");
if (IS_RIGHT_STEREO(t->stereo)) {
if (!t->stereo_1)
xf86ErrorF("right channel on sync\n");
else
xf86ErrorF("left channel on sync\n");
}
else if (IS_LEFT_STEREO(t->stereo)) {
if (!t->stereo_1)
xf86ErrorF("right channel on even line\n");
else
xf86ErrorF("left channel on evel line\n");
}
if (IS_4WAY_STEREO(t->stereo)) {
if (!t->stereo_1)
xf86ErrorF("4-way interleaved\n");
else
xf86ErrorF("side-by-side interleaved");
}
}
}
}
/* This function handle all detailed patchs,
* including EDID and EDID-extension
*/
struct det_print_parameter {
xf86MonPtr m;
int index;
ddc_quirk_t quirks;
};
static void
handle_detailed_print(struct detailed_monitor_section *det_mon, void *data)
{
int j, scrnIndex;
struct det_print_parameter *p;
p = (struct det_print_parameter *) data;
scrnIndex = p->m->scrnIndex;
xf86DetTimingApplyQuirks(det_mon, p->quirks,
p->m->features.hsize, p->m->features.vsize);
switch (det_mon->type) {
case DT:
print_detailed_timings(scrnIndex, &det_mon->section.d_timings);
break;
case DS_SERIAL:
xf86DrvMsg(scrnIndex, X_INFO, "Serial No: %s\n",
det_mon->section.serial);
break;
case DS_ASCII_STR:
xf86DrvMsg(scrnIndex, X_INFO, " %s\n", det_mon->section.ascii_data);
break;
case DS_NAME:
xf86DrvMsg(scrnIndex, X_INFO, "Monitor name: %s\n",
det_mon->section.name);
break;
case DS_RANGES:
{
struct monitor_ranges *r = &det_mon->section.ranges;
xf86DrvMsg(scrnIndex, X_INFO,
"Ranges: V min: %i V max: %i Hz, H min: %i H max: %i kHz,",
r->min_v, r->max_v, r->min_h, r->max_h);
if (r->max_clock_khz != 0) {
xf86ErrorF(" PixClock max %i kHz\n", r->max_clock_khz);
if (r->maxwidth)
xf86DrvMsg(scrnIndex, X_INFO, "Maximum pixel width: %d\n",
r->maxwidth);
xf86DrvMsg(scrnIndex, X_INFO, "Supported aspect ratios:");
if (r->supported_aspect & SUPPORTED_ASPECT_4_3)
xf86ErrorF(" 4:3%s",
r->preferred_aspect ==
PREFERRED_ASPECT_4_3 ? "*" : "");
if (r->supported_aspect & SUPPORTED_ASPECT_16_9)
xf86ErrorF(" 16:9%s",
r->preferred_aspect ==
PREFERRED_ASPECT_16_9 ? "*" : "");
if (r->supported_aspect & SUPPORTED_ASPECT_16_10)
xf86ErrorF(" 16:10%s",
r->preferred_aspect ==
PREFERRED_ASPECT_16_10 ? "*" : "");
if (r->supported_aspect & SUPPORTED_ASPECT_5_4)
xf86ErrorF(" 5:4%s",
r->preferred_aspect ==
PREFERRED_ASPECT_5_4 ? "*" : "");
if (r->supported_aspect & SUPPORTED_ASPECT_15_9)
xf86ErrorF(" 15:9%s",
r->preferred_aspect ==
PREFERRED_ASPECT_15_9 ? "*" : "");
xf86ErrorF("\n");
xf86DrvMsg(scrnIndex, X_INFO, "Supported blankings:");
if (r->supported_blanking & CVT_STANDARD)
xf86ErrorF(" standard");
if (r->supported_blanking & CVT_REDUCED)
xf86ErrorF(" reduced");
xf86ErrorF("\n");
xf86DrvMsg(scrnIndex, X_INFO, "Supported scalings:");
if (r->supported_scaling & SCALING_HSHRINK)
xf86ErrorF(" hshrink");
if (r->supported_scaling & SCALING_HSTRETCH)
xf86ErrorF(" hstretch");
if (r->supported_scaling & SCALING_VSHRINK)
xf86ErrorF(" vshrink");
if (r->supported_scaling & SCALING_VSTRETCH)
xf86ErrorF(" vstretch");
xf86ErrorF("\n");
if (r->preferred_refresh)
xf86DrvMsg(scrnIndex, X_INFO, "Preferred refresh rate: %d\n",
r->preferred_refresh);
else
xf86DrvMsg(scrnIndex, X_INFO, "Buggy monitor, no preferred "
"refresh rate given\n");
}
else if (r->max_clock != 0) {
xf86ErrorF(" PixClock max %i MHz\n", r->max_clock);
}
else {
xf86ErrorF("\n");
}
if (r->gtf_2nd_f > 0)
xf86DrvMsg(scrnIndex, X_INFO, " 2nd GTF parameters: f: %i kHz "
"c: %i m: %i k %i j %i\n", r->gtf_2nd_f,
r->gtf_2nd_c, r->gtf_2nd_m, r->gtf_2nd_k, r->gtf_2nd_j);
break;
}
case DS_STD_TIMINGS:
for (j = 0; j < 5; j++)
xf86DrvMsg(scrnIndex, X_INFO,
"#%i: hsize: %i vsize %i refresh: %i "
"vid: %i\n", p->index, det_mon->section.std_t[j].hsize,
det_mon->section.std_t[j].vsize,
det_mon->section.std_t[j].refresh,
det_mon->section.std_t[j].id);
break;
case DS_WHITE_P:
for (j = 0; j < 2; j++)
if (det_mon->section.wp[j].index != 0)
xf86DrvMsg(scrnIndex, X_INFO,
"White point %i: whiteX: %f, whiteY: %f; gamma: %f\n",
det_mon->section.wp[j].index,
det_mon->section.wp[j].white_x,
det_mon->section.wp[j].white_y,
det_mon->section.wp[j].white_gamma);
break;
case DS_CMD:
xf86DrvMsg(scrnIndex, X_INFO, "Color management data: (not decoded)\n");
break;
case DS_CVT:
xf86DrvMsg(scrnIndex, X_INFO, "CVT 3-byte-code modes:\n");
print_cvt_timings(scrnIndex, det_mon->section.cvt);
break;
case DS_EST_III:
xf86DrvMsg(scrnIndex, X_INFO,
"Established timings III: (not decoded)\n");
break;
case DS_DUMMY:
default:
break;
}
if (det_mon->type >= DS_VENDOR && det_mon->type <= DS_VENDOR_MAX) {
xf86DrvMsg(scrnIndex, X_INFO,
"Unknown vendor-specific block %hx\n",
det_mon->type - DS_VENDOR);
}
p->index = p->index + 1;
}
static void
print_number_sections(int scrnIndex, int num)
{
if (num)
xf86DrvMsg(scrnIndex, X_INFO, "Number of EDID sections to follow: %i\n",
num);
}
xf86MonPtr
xf86PrintEDID(xf86MonPtr m)
{
CARD16 i, j, n;
char buf[EDID_WIDTH * 2 + 1];
struct det_print_parameter p;
if (!m)
return NULL;
print_vendor(m->scrnIndex, &m->vendor);
print_version(m->scrnIndex, &m->ver);
print_display(m->scrnIndex, &m->features, &m->ver);
print_established_timings(m->scrnIndex, &m->timings1);
print_std_timings(m->scrnIndex, m->timings2);
p.m = m;
p.index = 0;
p.quirks = xf86DDCDetectQuirks(m->scrnIndex, m, FALSE);
xf86ForEachDetailedBlock(m, handle_detailed_print, &p);
print_number_sections(m->scrnIndex, m->no_sections);
/* extension block section stuff */
xf86DrvMsg(m->scrnIndex, X_INFO, "EDID (in hex):\n");
n = 128;
if (m->flags & EDID_COMPLETE_RAWDATA)
n += m->no_sections * 128;
for (i = 0; i < n; i += j) {
for (j = 0; j < EDID_WIDTH; ++j) {
sprintf(&buf[j * 2], "%02x", m->rawData[i + j]);
}
xf86DrvMsg(m->scrnIndex, X_INFO, "\t%s\n", buf);
}
return m;
}

View file

@ -1,101 +0,0 @@
/* xf86DDC.h
*
* This file contains all information to interpret a standard EDIC block
* transmitted by a display device via DDC (Display Data Channel). So far
* there is no information to deal with optional EDID blocks.
* DDC is a Trademark of VESA (Video Electronics Standard Association).
*
* Copyright 1998 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
*/
#ifndef XF86_DDC_H
#define XF86_DDC_H
#include "edid.h"
#include "xf86i2c.h"
#include "xf86str.h"
/* speed up / slow down */
typedef enum {
DDC_SLOW,
DDC_FAST
} xf86ddcSpeed;
typedef void (*DDC1SetSpeedProc) (ScrnInfoPtr, xf86ddcSpeed);
extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC1(ScrnInfoPtr pScrn,
DDC1SetSpeedProc DDC1SetSpeed,
unsigned
int (*DDC1Read) (ScrnInfoPtr)
);
extern _X_EXPORT xf86MonPtr xf86DoEDID_DDC2(ScrnInfoPtr pScrn, I2CBusPtr pBus);
extern _X_EXPORT xf86MonPtr xf86DoEEDID(ScrnInfoPtr pScrn, I2CBusPtr pBus, Bool);
extern _X_EXPORT xf86MonPtr xf86PrintEDID(xf86MonPtr monPtr);
extern _X_EXPORT xf86MonPtr xf86InterpretEDID(int screenIndex, Uchar * block);
extern _X_EXPORT xf86MonPtr xf86InterpretEEDID(int screenIndex, Uchar * block);
extern _X_EXPORT void
xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC);
extern _X_EXPORT Bool xf86SetDDCproperties(ScrnInfoPtr pScreen, xf86MonPtr DDC);
extern _X_EXPORT Bool
xf86MonitorIsHDMI(xf86MonPtr mon);
extern _X_EXPORT Bool
gtf_supported(xf86MonPtr mon);
extern _X_EXPORT DisplayModePtr
FindDMTMode(int hsize, int vsize, int refresh, Bool rb);
extern _X_EXPORT const DisplayModeRec DMTModes[];
/*
* Quirks to work around broken EDID data from various monitors.
*/
typedef enum {
DDC_QUIRK_NONE = 0,
/* First detailed mode is bogus, prefer largest mode at 60hz */
DDC_QUIRK_PREFER_LARGE_60 = 1 << 0,
/* 135MHz clock is too high, drop a bit */
DDC_QUIRK_135_CLOCK_TOO_HIGH = 1 << 1,
/* Prefer the largest mode at 75 Hz */
DDC_QUIRK_PREFER_LARGE_75 = 1 << 2,
/* Convert detailed timing's horizontal from units of cm to mm */
DDC_QUIRK_DETAILED_H_IN_CM = 1 << 3,
/* Convert detailed timing's vertical from units of cm to mm */
DDC_QUIRK_DETAILED_V_IN_CM = 1 << 4,
/* Detailed timing descriptors have bogus size values, so just take the
* maximum size and use that.
*/
DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE = 1 << 5,
/* Monitor forgot to set the first detailed is preferred bit. */
DDC_QUIRK_FIRST_DETAILED_PREFERRED = 1 << 6,
/* use +hsync +vsync for detailed mode */
DDC_QUIRK_DETAILED_SYNC_PP = 1 << 7,
/* Force single-link DVI bandwidth limit */
DDC_QUIRK_DVI_SINGLE_LINK = 1 << 8,
} ddc_quirk_t;
typedef void (*handle_detailed_fn) (struct detailed_monitor_section *, void *);
void xf86ForEachDetailedBlock(xf86MonPtr mon, handle_detailed_fn, void *data);
ddc_quirk_t xf86DDCDetectQuirks(int scrnIndex, xf86MonPtr DDC, Bool verbose);
void xf86DetTimingApplyQuirks(struct detailed_monitor_section *det_mon,
ddc_quirk_t quirks, int hsize, int vsize);
typedef void (*handle_video_fn) (struct cea_video_block *, void *);
void xf86ForEachVideoBlock(xf86MonPtr, handle_video_fn, void *);
struct cea_data_block *xf86MonitorFindHDMIBlock(xf86MonPtr mon);
#endif

View file

@ -1,52 +0,0 @@
/*
* Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the XFree86 Project shall
* not be used in advertising or otherwise to promote the sale, use or other
* dealings in this Software without prior written authorization from the
* XFree86 Project.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf86Module.h"
#include "fb.h"
static XF86ModuleVersionInfo VersRec = {
#ifdef FB_ACCESS_WRAPPER
"wfb",
#else
"fb",
#endif
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
XORG_VERSION_CURRENT,
1, 0, 0,
ABI_CLASS_ANSIC, /* Only need the ansic layer */
ABI_ANSIC_VERSION,
MOD_CLASS_NONE,
{0, 0, 0, 0} /* signature, to be patched into the file by a tool */
};
_X_EXPORT XF86ModuleData FBPREFIX(ModuleData) = {
&VersRec, NULL, NULL};

View file

@ -1,85 +0,0 @@
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Kevin E. Martin <kevin@precisioninsight.com>
*
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf86Module.h"
#include "xf86Priv.h"
#include "xf86.h"
#include "colormap.h"
#include "micmap.h"
#include "globals.h"
#include "glxserver.h"
#include "extinit.h"
#include "glx_extinit.h"
static MODULESETUPPROTO(glxSetup);
static XF86ModuleVersionInfo VersRec = {
"glx",
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
XORG_VERSION_CURRENT,
1, 0, 0,
ABI_CLASS_EXTENSION,
ABI_EXTENSION_VERSION,
MOD_CLASS_NONE,
{0, 0, 0, 0}
};
_X_EXPORT XF86ModuleData glxModuleData = { &VersRec, glxSetup, NULL };
static void *
glxSetup(void *module, void *opts, int *errmaj, int *errmin)
{
static Bool setupDone = FALSE;
__GLXprovider *provider;
if (setupDone) {
if (errmaj)
*errmaj = LDR_ONCEONLY;
return NULL;
}
setupDone = TRUE;
provider = LoaderSymbol("__glXDRI2Provider");
if (provider)
GlxPushProvider(provider);
xorgGlxCreateVendor();
return module;
}

View file

@ -1,43 +0,0 @@
shared_module(
'wfb',
'fbmodule.c',
include_directories: [inc, xorg_inc],
c_args: [ xorg_c_args, wfb_args ],
dependencies: common_dep,
link_whole: libxserver_wfb,
link_with: e,
install: true,
install_dir: module_dir,
)
shared_module(
'shadow',
'shmodule.c',
include_directories: [inc, xorg_inc],
c_args: xorg_c_args,
dependencies: common_dep,
link_whole: libxserver_miext_shadow,
link_with: e,
install: true,
install_dir: module_dir,
)
if build_glx
shared_module(
'glx',
[ 'glxmodule.c', srcs_glxdri2 ],
include_directories: [ inc, xorg_inc, glx_inc ],
c_args: [ xorg_c_args, glx_align64 ],
dependencies: [ common_dep, dl_dep, dri_dep ],
link_whole: libxserver_glx,
link_with: e,
install: true,
install_dir: join_paths(module_dir, 'extensions')
)
endif

View file

@ -1,53 +0,0 @@
/*
* Copyright © 2000 Keith Packard
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "xf86Module.h"
#include <X11/X.h>
#include "scrnintstr.h"
#include "windowstr.h"
#include <X11/fonts/font.h>
#include "dixfontstr.h"
#include <X11/fonts/fontstruct.h>
#include "mi.h"
#include "regionstr.h"
#include "globals.h"
#include "gcstruct.h"
#include "shadow.h"
static XF86ModuleVersionInfo VersRec = {
"shadow",
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
XORG_VERSION_CURRENT,
1, 1, 0,
ABI_CLASS_ANSIC, /* Only need the ansic layer */
ABI_ANSIC_VERSION,
MOD_CLASS_NONE,
{0, 0, 0, 0} /* signature, to be patched into the file by a tool */
};
_X_EXPORT XF86ModuleData shadowModuleData = { &VersRec, NULL, NULL };

View file

@ -1,4 +0,0 @@
ddxDesign.html
ddxDesign.pdf
ddxDesign.ps
ddxDesign.txt

View file

@ -1,473 +0,0 @@
Multi-monitor Mode Setting APIs
Keith Packard, <keithp@keithp.com
6 March 2007
1. Introduction
This document describes a set of mode setting APIs added in X server version
1.3 that support multiple monitors per card. These interfaces expose the
underlying hardware CRTC and output concepts to the xf86 DDX layer so that
the implementation of initial server setup and mode changes through
extensions can be shared across drivers. In addition, these new interfaces
support a new configuration mechanism as well which allows each monitor to
be customized separately providing a consistent cross-driver configuration
mechanism that supports the full range of output features.
All of the code implementing this interface can be found in hw/xfree86/modes
in the X server sources.
2. Overview
This document describes both the driver API and the configuration data
placed in xorg.conf; these are entirely separate as the driver has no
interaction with the configuration information at all. Much of the structure
here is cloned from the RandR extension version 1.2 additions which deal
with the same kinds of information.
2.1 API overview
The mode setting API is expressed through two new driver-visible objects,
the 'CRTC' (xf86CrtcRec) and the 'Output' (xf86OutputRec). A CRTC refers to
hardware within the video system that can scan a subset of the framebuffer
and generate a video signal. An Output receives that signal and transmits it
to a monitor, projector or other device.
The xf86CrtcRec and xf86OutputRec contain a small amount of state data
related to the object along with a pointer to a set of functions provided by
the driver that manipulate the object in fairly simple ways.
To emulate older behaviour, one of the outputs is picked as the 'compat'
output; this output changes over time as outputs are detected and used, the
goal is to always have one 'special' output which is used for operations
which need a single defined monitor (like XFree86-VidModeExtension mode
setting, RandR 1.1 mode setting, DDC property setting, etc.).
2.1.1 Output overview
As outputs are connected to monitors, they hold a list of modes supported by
the monitor. If the monitor and output support DDC, then the list of modes
generally comes from the EDID data in the monitor. Otherwise, the server
uses the standard VESA modes, pruned by monitor timing. If the configuration
file doesn't contain monitor timing data, the server uses default timing
information which supports 640x480, 800x600 and 1024x768 all with a 60Hz
refresh rate.
As hardware often limits possible configuration combinations, each output
knows the set of CRTCs that it can be connected to as well as the set of
other outputs which can be simultaneously connected to a CRTC.
2.1.2 CRTC overview
CRTCs serve only to stream frame buffer data to outputs using a mode line.
Ideally, they would not be presented to the user at all, and in fact the
configuration file doesn't expose them. The RandR 1.2 protocol does, but the
hope there is that client-side applications will hide them carefully away.
Each crtc has an associated cursor, along with the current configuration.
All of the data needed to determine valid configurations is contained within
the Outputs.
2.2 Configuration overview
As outputs drive monitors, the "Monitor" section has been repurposed to
define their configuration. This provides for a bit more syntax than
the large list of driver-specific options that were used in the past for
similar configuration.
However, the existing "Monitor" section referenced by the active "Screen"
section no longer has any use at all; some sensible meaning for this
parameter is needed now that a Screen can have multiple Monitors.
3. Public Functions
3.1 PreInit functions
These functions should be used during the driver PreInit phase, they are
arranged in the order they should be invoked.
void
xf86CrtcConfigInit (ScrnInfoPtr scrn
const xf86CrtcConfigFuncsRec *funcs)
This function allocates and initializes structures needed to track CRTC and
Output state.
void
xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
int minWidth, int minHeight,
int maxWidth, int maxHeight)
This sets the range of screen sizes supported by the driver.
xf86CrtcPtr
xf86CrtcCreate (ScrnInfoPtr scrn,
const xf86CrtcFuncsRec *funcs)
Create one CRTC object. See the discussion below for a description of the
contents of the xf86CrtcFuncsRec. Note that this is done in PreInit, so it
should not be re-invoked at each server generation. Create one of these for
each CRTC present in the hardware.
xf86OutputPtr
xf86OutputCreate (ScrnInfoPtr scrn,
const xf86OutputFuncsRec *funcs,
const char *name)
Create one Output object. See the discussion below for a description of the
contents of the xf86OutputFuncsRec. This is also called from PreInit and
need not be re-invoked at each ScreenInit time. An Output should be created
for every Output present in the hardware, not just for outputs which have
detected monitors.
Bool
xf86OutputRename (xf86OutputPtr output, const char *name)
If necessary, the name of an output can be changed after it is created using
this function.
Bool
xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
Using the resources provided, and the configuration specified by the user,
this function computes an initial configuration for the server. It tries to
enable as much hardware as possible using some fairly simple heuristics.
The 'canGrow' parameter indicates that the frame buffer does not have a fixed
size. When the frame buffer has a fixed size, the configuration selects a
'reasonablely large' frame buffer so that common reconfiguration options are
possible. For resizable frame buffers, the frame buffer is set to the smallest
size that encloses the desired configuration.
3.2 ScreenInit functions
These functions should be used during the driver ScreenInit phase.
Bool
xf86DiDGAInit (ScreenPtr screen, unsigned long dga_address)
This function provides driver-independent accelerated DGA support for some
of the DGA operations; using this, the driver can avoid needing to implement
any of the rest of DGA.
Bool
xf86SaveScreen(ScreenPtr pScreen, int mode)
Stick this in pScreen->SaveScreen and the core X screen saver will be
implemented by disabling outputs and crtcs using their dpms functions.
void
xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
Pass this function to xf86DPMSInit and all DPMS mode switching will be
managed by using the dpms functions provided by the Outputs and CRTCs.
Bool
xf86CrtcScreenInit (ScreenPtr screen)
This function completes the screen initialization process for the crtc and
output objects. Call it near the end of the ScreenInit function, after the
frame buffer and acceleration layers have been added.
3.3 EnterVT functions
Functions used during EnterVT, or whenever the current configuration needs
to be applied to the hardware.
Bool
xf86SetDesiredModes (ScrnInfoPtr scrn)
xf86InitialConfiguration selects the desired configuration at PreInit time;
when the server finally hits ScreenInit, xf86SetDesiredModes is used by the
driver to take that configuration and apply it to the hardware. In addition,
successful mode selection at other times updates the configuration that will
be used by this function, so LeaveVT/EnterVT pairs can simply invoke this
and return to the previous configuration.
3.4 SwitchMode functions
Functions called from the pScrn->SwitchMode hook, which is used by the
XFree86-VidModeExtension and the keypad mode switch commands.
Bool
xf86SetSingleMode (ScrnInfoPtr scrn,
DisplayModePtr desired,
Rotation rotation)
This function applies the specified mode to all active outputs. Which is to
say, it picks reasonable modes for all active outputs, attempting to get the
screen to the specified size while not breaking anything that is currently
working.
3.7 get_modes functions
Functions called during output->get_modes to help build lists of modes
xf86MonPtr
xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
This returns the EDID data structure for the 'output' using the I2C bus
'pDDCBus'. This has no effect on 'output' itself.
void
xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
Once the EDID data has been fetched, this call applies the EDID data to the
output object, setting the physical size and also various properties, like
the DDC root window property (when output is the 'compat' output), and the
RandR 1.2 EDID output properties.
DisplayModePtr
xf86OutputGetEDIDModes (xf86OutputPtr output)
Given an EDID data structure, this function computes a list of suitable
modes. This function also applies a sequence of 'quirks' during this process
so that the returned modes may not actually match the mode data present in
the EDID data.
3.6 Other functions
These remaining functions in the API can be used by the driver as needed.
Bool
xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
int x, int y)
Applies a mode to a CRTC. All of the outputs which are currently using the
specified CRTC are included in the mode setting process. 'x' and 'y' are the
offset within the frame buffer that the crtc is placed at. No checking is
done in this function to ensure that the mode is usable by the active
outputs.
void
xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
This discards the mode lists for all outputs, re-detects monitor presence
and then acquires new mode lists for all monitors which are not disconnected.
Monitor configuration data is used to modify the mode lists returned by the
outputs. 'maxX' and 'maxY' limit the maximum size modes that will be
returned.
void
xf86SetScrnInfoModes (ScrnInfoPtr pScrn)
This copies the 'compat' output mode list into the pScrn modes list which is
used by the XFree86-VidModeExtension and the keypad mode switching
operations. The current 'desired' mode for the CRTC associated with the
'compat' output is placed first in this list to indicate the current mode.
Usually, the driver won't need to call this function as
xf86InitialConfiguration will do so automatically, as well as any RandR
functions which reprobe for modes. However, if the driver reprobes for modes
at other times using xf86ProbeOutputModes, this function needs to be called.
Bool
xf86DiDGAReInit (ScreenPtr pScreen)
This is similar to xf86SetScrnInfoModes, but it applies the 'compat' output
mode list to the set of modes advertised by the DGA extension; it needs to
be called whenever xf86ProbeOutputModes is invoked.
void
xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
After any sequence of calls using xf86CrtcSetMode, this function cleans up
any leftover Output and CRTC objects by disabling them, saving power. It is
safe to call this whenever the server is running as it only disables objects
which are not currently in use.
4. CRTC operations
4.1 CRTC functions
These functions provide an abstract interface for the CRTC object; most
manipulation of the CRTC object is done through these functions.
void
crtc->funcs->dpms (xf86CrtcPtr crtc, int mode)
Where 'mode' is one of DPMSModeOff, DPMSModeSuspend, DPMSModeStandby or
DPMSModeOn. This requests that the crtc go to the specified power state.
When changing power states, the output dpms functions are invoked before the
crtc dpms functions.
void
crtc->funcs->save (xf86CrtcPtr crtc)
void
crtc->funcs->restore (xf86CrtcPtr crtc)
Preserve/restore any register contents related to the CRTC. These are
strictly a convenience for the driver writer; if the existing driver has
fully operation save/restore functions, you need not place any additional
code here. In particular, the server itself never uses this function.
Bool
crtc->funcs->lock (xf86CrtcPtr crtc)
void
crtc->funcs->unlock (xf86CrtcPtr crtc)
These functions are invoked around mode setting operations; the intent is
that DRI locking be done here to prevent DRI applications from manipulating
the hardware while the server is busy changing the output configuration. If
the lock function returns FALSE, the unlock function will not be invoked.
Bool
crtc->funcs->mode_fixup (xf86CrtcPtr crtc,
DisplayModePtr mode,
DisplayModePtr adjusted_mode)
This call gives the CRTC a chance to see what mode will be set and to
comment on the mode by changing 'adjusted_mode' as needed. This function
shall not modify the state of the crtc hardware at all. If the CRTC cannot
accept this mode, this function may return FALSE.
void
crtc->funcs->prepare (xf86CrtcPtr crtc)
This call is made just before the mode is set to make the hardware ready for
the operation. A usual function to perform here is to disable the crtc so
that mode setting can occur with clocks turned off and outputs deactivated.
void
crtc->funcs->mode_set (xf86CrtcPtr crtc,
DisplayModePtr mode,
DisplayModePtr adjusted_mode)
This function applies the specified mode (possibly adjusted by the CRTC
and/or Outputs).
void
crtc->funcs->commit (xf86CrtcPtr crtc)
Once the mode has been applied to the CRTC and Outputs, this function is
invoked to let the hardware turn things back on.
void
crtc->funcs->gamma_set (xf86CrtcPtr crtc, CARD16 *red,
CARD16 *green, CARD16 *blue, int size)
This function adjusts the gamma ramps for the specified crtc.
void *
crtc->funcs->shadow_allocate (xf86CrtcPtr crtc, int width, int height)
This function allocates frame buffer space for a shadow frame buffer. When
allocated, the crtc must scan from the shadow instead of the main frame
buffer. This is used for rotation. The address returned is passed to the
shadow_create function. This function should return NULL on failure.
PixmapPtr
crtc->funcs->shadow_create (xf86CrtcPtr crtc, void *data,
int width, int height)
This function creates a pixmap object that will be used as a shadow of the
main frame buffer for CRTCs which are rotated or reflected. 'data' is the
value returned by shadow_allocate.
void
crtc->funcs->shadow_destroy (xf86CrtcPtr crtc, PixmapPtr pPixmap,
void *data)
Destroys any associated shadow objects. If pPixmap is NULL, then a pixmap
was not created, but 'data' may still be non-NULL indicating that the shadow
had been allocated.
void
crtc->funcs->destroy (xf86CrtcPtr crtc)
When a CRTC is destroyed (which only happens in error cases), this function
can clean up any driver-specific data.
4.2 CRTC fields
The CRTC object is not opaque; there are several fields of interest to the
driver writer.
struct _xf86Crtc {
/**
* Associated ScrnInfo
*/
ScrnInfoPtr scrn;
/**
* Active state of this CRTC
*
* Set when this CRTC is driving one or more outputs
*/
Bool enabled;
/** Track whether cursor is within CRTC range */
Bool cursorInRange;
/** Track state of cursor associated with this CRTC */
Bool cursorShown;
/**
* Active mode
*
* This reflects the mode as set in the CRTC currently
* It will be cleared when the VT is not active or
* during server startup
*/
DisplayModeRec mode;
Rotation rotation;
PixmapPtr rotatedPixmap;
void *rotatedData;
/**
* Position on screen
*
* Locates this CRTC within the frame buffer
*/
int x, y;
/**
* Desired mode
*
* This is set to the requested mode, independent of
* whether the VT is active. In particular, it receives
* the startup configured mode and saves the active mode
* on VT switch.
*/
DisplayModeRec desiredMode;
Rotation desiredRotation;
int desiredX, desiredY;
/** crtc-specific functions */
const xf86CrtcFuncsRec *funcs;
/**
* Driver private
*
* Holds driver-private information
*/
void *driver_private;
#ifdef RANDR_12_INTERFACE
/**
* RandR crtc
*
* When RandR 1.2 is available, this
* points at the associated crtc object
*/
RRCrtcPtr randr_crtc;
#else
void *randr_crtc;
#endif
};
5. Output functions.
6. Configuration
Because the configuration file syntax is fixed,
this was done by creating new "Driver" section options that hook specific
outputs to specific "Monitor" sections in the file. The option:
section of the form:
Option "monitor-VGA" "My VGA Monitor"
connects the VGA output of this driver to the "Monitor" section with
Identifier "My VGA Monitor". All of the usual monitor options can now be
placed in that "Monitor" section and will be applied to the VGA output
configuration.

View file

@ -1,407 +0,0 @@
This is the XFree86 driver/module registry. To avoid name space clashes and
to maintain some consistency between drivers the important name spaces are
maintained here.
1. Module Names.
Each module is required to have a unique name. Registered names are:
GLcore
acecad
afb
apm
ark
ati
atimisc
bitmap
bt8xx
calcomp
cfb
cfb16
cfb24
cfb32
chips
cirrus
citron
cyrix
dbe
ddc
digitaledge
dmc
dri
drm
dynapro
elo2300
elographics
extmod
fb
fbdev
fbdevhw
fi12x6
freetype
glide
glint
glx
hyperpen
i128
i2c
i740
i810
imstt
int10
joystick
keyboard
layer
magellan
magictouch
mfb
mga
microtouch
mouse
msp34xx
mutouch
neomagic
newport
nv
pcidata
penmount
pex5
r128
radeon
rac
ramdac
record
rendition
s3
s3virge
savage
shadow
shadowfb
siliconmotion
sis
spaceorb
speedo
summa
sunbw2
suncg14
suncg3
suncg6
sunffb
sunleo
suntcx
tdfx
tga
trident
tseng
type1
v4l
vbe
vesa
vga
vgahw
vmware
void
wacom
xaa
xf1bpp
xf24_32bpp
xf4bpp
xf8_16bpp
xf8_32bpp
xf8_32wid
xie
xtrap
xtt
2. External Module Object Symbols.
Each module is required to use a unique prefix or prefixes for all of
its externally visible symbols. They should be unique without regard to
case. Registered prefixes are:
ati
bt8xx
cfb
chips
fi12x6
glide
glint
mfb
mga
msp34xx
neo
permedia
tseng
vga
vgahw
vmware
xaa
xf1bpp
xf4bpp
3. Chipset Names.
Each video driver is required to use a unique set of chipset names. Case,
white space and underscore characters are ignored when comparing chipset
names. All names listed here are in lower case with all white space and
underscores removed. Registered chipset names are:
ati
ativga
ct64200
ct64300
ct65520
ct65525
ct65530
ct65535
ct65540
ct65545
ct65546
ct65548
ct65550
ct65554
ct65555
ct68554
ct69000
et4000
et4000w32
et4000w32i
et4000w32p
et6000
et6100
generic
ibmvga
ibm8514
mach32
mach64
mach8
mga2064w
mga1064sg
mga2164w
mga2164wagp
neo2070
neo2090
neo2093
neo2097
neo2160
neo2200
tipm2
vgawonder
voodoo
4. Option Names.
Option names and their usage should be consistent between drivers.
Case, white space and underscore characters are ignored when comparing
option names. The prefix "no" may be added or removed from boolean
option names. All names listed here are in their preferred user-visible
form. Some registered option names are:
Types are: B = boolean, O = set/unset (no value), I = integer, S = string,
A = optional string, F = floating point number Q = frequency
Scopes are: F = global flags, V = video driver, C = common (per screen),
I = input drivers, X = XAA, Xv = Xv extension, M = misc.
Names currently in use:
Name Type Scope Description
----------------------------------------------------------------------------
AllowMouseOpenFail B F ignore mouse dev open failure
AllowNonLocalModInDev B F allow non-local mod of input devs
AllowNonLocalXvidtune B F allow non-local VidMode connections
BlankTime I F Screen saver timeout (min)
DisableModInDev B F disallow changing input devs
DisableVidModeExtension B F disable VidMode extension
DontVTSwitch B F disable Ctrl-Alt-Fn
DontZap B F disable Ctrl-Alt-BS sequence
DontZoom B F disable Ctrl-Alt-+/-
OffTime I F Time before DPMS off mode active (min)
PciProbe1 O F use PCI probe algorithm 1
PciProbe2 O F use PCI probe algorithm 2
PciForceConfig1 O F force PCI config type 1
PciForceConfig2 O F force PCI config type 2
Pixmap I F depth 24 pixmap size (24 or 32)
StandbyTime I F Time before DPMS standby active (min)
SuspendTime I F Time before DPMS suspend mode active (min)
BackingStore B C Enable backing store
DDC B C Enable/disable DDC
DDC1 B C Enable/disable DDC1
DDC2 B C Enable/disable DDC2
DPMS O C Enable DPMS
BaudRate I I Serial port baud rate
ButtonNumber I I Button number (for touch screen?)
ButtonThreshold I I ??
ClearDTR O I Clear serial port DTR
ClearRTS O I Clear serial port RTS
DataBits I I Serial port data bits
DemandLoad O I ??
Device S I Device file name
DeviceName S I Input device name
FlowControl S I Serial flow control ("xon", "none")
Floating B I Device initialised as floating
HistorySize I I ??
MaxX I I Maximum X coordinate
MaxY I I Maximum Y coordinate
MinX I I Minimum X coordinate
MinY I I Minimum Y coordinate
Parity S I Serial port parity ("odd", "even", "none")
ReportDelay I I ??
ReportingMode S I may be "raw" or "scaled"
ScreenNumber I I Screen number (for touch screen)
SendCoreEvents B I Send core events
StopBits I I Serial port stop bits
SwapXY B I Swap the X and Y axes
UntouchDelay I I ??
Vmin I I Tty VMIN
Vtime I I Tty VTIME
18BitBus B V ??
8Plus16 B V Enable depth 8 + depth 16 with overlay
8Plus24 B V Enable depth 8 + depth 24 with overlay
BlockWrite B V Enable/disable block write
ColorKey I V Set the color key for overlay modes
CompositeSync B V Composite sync
CRTDisplay B V Force display on CRT, not LCD
CRTScreen B V Display on CRT, not LCD (Obsolete)
EarlyRasPrecharge O V Early RAS pre-charge
FastDRAM O V Fast DRAM
FifoAggressive O V Aggressive FIFO setting
FifoConservative O V Conservative FIFO setting
FifoModerate O V Moderate FIFO setting
FireGL3000 B V Card is Diamond FireGL3000
FixPanelSize B V ??
FPClock8 Q V Flat panel clock for 8bpp fb (MHz)
FPClock16 Q V Flat panel clock for 16bpp fb (MHz)
FPClock24 Q V Flat panel clock for 24bpp fb (MHz)
FPClock32 Q V Flat panel clock for 32bpp fb (MHz)
FPMVRAM O V Fast page mode VRAM
FramebufferWC B V Enable/disable WC for the framebuffer
GlideDevice I V Selects which Voodoo board to use
HiBitHigh O V High clock bit default to set
HiBitLow O V High clock bit default to cleared
HWClocks B V Enable/disable HW clocks
HWCursor B V Enable/disable HW cursor
LateRasPrecharge O V Late RAS pre-charge
Legend O V Card is Legend ET4000
LCDCenter B V Enable/disable centering for LCD displays
Linear B V Enable/disable linear framebuffer
MCLK Q V Specify the current MCLK value (MHz)
MedDRAM B V Medium speed DRAM
MemCfg1 I V ??
MemCfg2 I V ??
MGASDRAM B V Mga card has SDRAM
MMIO B V Enable/disable memory mapped I/O
MMIOCache B V Enable/Disable MMIO cache
MuxThreshold I V Multiplexing threshold (kHz)
NoAccel B V Disable/enable acceleration
NoClockChip B V ??
NoStretch B V Disable/enable stretching for LCD displays
OnAtExit B V Leave video signal on when exiting server
OverclockMem B V Enable memory overclocking
Overlay A V Enable multi-depth/overlay. An optional
string "M,N" may be specified, where
M, N are the depths.
PanelDisplay B V Force display on LCD
PciBurst B V Enable/disable PCI burst mode
PciRetry B V Enable/disable PCI retries
ProbeClocks B V Force probe for non-programmable clocks
ReferenceClock Q V Clock generator reference frequency
RGBbits I V Number of significant bits per rgb
Rotate S V Rotate the virtual display (CW or CCW)
SetLCDClk Q V Set LCD clock (MHz)
SetMclk Q V Set Memory Clock (MHz)
ShadowFB B V Enable shadow framebuffer layer
ShowCache B V Enable viewing of offscreen memory
ShowOverscan O V Set the overscan area to a visible colour
SlowDRAM O V Slow DRAM
SlowEDODRAM O V Slow EDO DRAM
STN B V STN screen type (??)
SWCursor B V Enable/disable SW cursor
SuspendHack B V ??
SyncOnGreen B V Enable/disable sync on green
TurboQueue B V Enable/disable turbo queue
UseFBDev B V Use the fbdev driver interface
UseModeLine B V Use Modeline (??)
W32Interleave B V ??
Buffers I Xv Number of buffers
Device S Xv Device file name
Expose B Xv Disable occlusion clipping (see DESIGN)
FramesPerSec I Xv Max. refresh frequency
XAA options. All are of type "O" and scope "X", and are self-explanatory
XaaNoColor8x8PatternFillRect
XaaNoColor8x8PatternFillTrap
XaaNoCPUToScreenColorExpandFill
XaaNoDashedBresenhamLine
XaaNoDashedTwoPointLine
XaaNoScreenToScreenCopy
XaaNoImageReadRect
XaaNoImageWriteRect
XaaNoMono8x8PatternFillRect
XaaNoMono8x8PatternFillTrap
XaaNoOffscreenPixmaps
XaaNoPixmapCache
XaaNoScanlineCPUToScreenColorExpandFill
XaaNoScanlineImageWriteRect
XaaNoScreenToScreenColorExpandFill
XaaNoSolidBresenhamLine
XaaNoSolidFillRect
XaaNoSolidFillTrap
XaaNoSolidHorVertLine
XaaNoSolidTwoPointLine
Names used in previous versions:
16Clocks
8Clocks
ClkDiv2
EDO VRAM
ExternDisp
ExtFramBuf
FastVRAM
FavorBitBlt
InternDisp
NoBitBlt
NoFontCache
NoImageBlt
NoMemAccess
NoPciDisconnect
NoPixmapCache
NoProgramClocks
NoSplitXfer
OverrideBIOS
OverrideValidateMode
ProgLcdModeRegs
ProgLcdModeStretch
SlowDRAMrefresh
SlowVRAM
SwapHiBit
5. Ramdac Names.
Ramdac names should be consistent between drivers. Case, white space
and underscore characters are ignored when comparing ramdac names. All
names listed here are in lower case with all white space and underscores
removed.
6. Clock Chip Names.
Clock chip names should be consistent between drivers. Case, white
space and underscore characters are ignored when comparing clock chip
names. All names listed here are in lower case with all white space
and underscores removed.
$XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.18 2002/04/06 18:31:09 tsi Exp $

File diff suppressed because it is too large Load diff

View file

@ -1,89 +0,0 @@
Adding EXA support to your X.Org video driver
---------------------------------------------
EXA (for EXcellent Architecture or Ex-kaa aXeleration Architecture or
whatever) aims to extend the life of the venerable XFree86 video drivers by
introducing a new set of acceleration hooks that efficiently accelerate the X
Render extension, including solid fills, blits within screen memory and to and
from system memory, and Porter-Duff compositing and transform operations.
Configuration
-------------
Some drivers implement a per-instance useEXA flag to track whether EXA is
active or not.
Setting the flag can be done in the driver's Options parsing routine.
Loading EXA
------------
EXA drivers in the XFree86 DDX should use the loadable module loader to load
the EXA core. Careful versioning allows the EXA API to be extended without
breaking the ABI for older versions of drivers. Example code for loading EXA:
static const char *exaSymbols[] = {
"exaDriverAlloc",
"exaDriverInit",
"exaDriverFini",
"exaOffscreenAlloc",
"exaOffscreenFree",
"exaGetPixmapOffset",
"exaGetPixmapPitch",
"exaGetPixmapSize",
"exaMarkSync",
"exaWaitSync",
NULL
};
if (info->useEXA) {
info->exaReq.majorversion = 2;
info->exaReq.minorversion = 0;
if (!LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL,
&info->exaReq, &errmaj, &errmin)) {
LoaderErrorMsg(NULL, "exa", errmaj, errmin);
return FALSE;
}
xf86LoaderReqSymLists(exaSymbols, NULL);
}
EXA is then initialized using exaDriverAlloc and exaDriverInit. See doxygen
documentation for getting started there.
Further documentation
------------
The EXA driver interface and public API is documented using doxygen in
xserver/xorg/exa/. To build the documentation, run:
doxygen -g
doxygen Doxyfile
The resulting documentation will appear an html/index.html under the current
directory.
EXA initialization
------------------
Your driver's AccelInit routine must initialize an ExaDriverRec structure if
EXA support is enabled, with appropriate error handling (i.e. NoAccel and
NoXvideo should be set to true if EXA fails to initialize for whatever
reason).
The AccelInit routine also needs to make sure that there's enough offscreen
memory for certain operations to function, like Xvideo, which should advertise
a maximum size no larger than can be dealt with given the amount of offscreen
memory available.
EXA and Xv
----------
Video support becomes easier with EXA since AllocateFBMemory can use
exaOffscreenAlloc directly, freeing a previous area if necessary and
allocating a new one. Likewise, FreeFBMemory can call exaOffscreenFree.
EXA teardown
------------
At screen close time, EXA drivers should call exaDriverFini with their screen
pointer, free their EXADriver structure, and do any other necessary teardown.
EXA misc.
---------
In many drivers, DGA support will need to be changed to be aware of the new
EXA support.
Send updates and corrections to Jesse Barnes <jbarnes@virtuousgeek.org> or
just check them in if you have permission.

View file

@ -1,35 +0,0 @@
if build_docs_devel
basename = 'ddxDesign'
input_xml = basename + '.xml'
custom_target(
basename + '.html',
output: basename + '.html',
input: [input_xml],
command: [xmlto] + docs_xmlto_search_flags + [
'-x', join_paths(doc_stylesheet_srcdir, 'xorg-xhtml.xsl'),
'-o', meson.current_build_dir(),
'xhtml-nochunks', '@INPUT0@'],
build_by_default: true,
install: false,
)
if build_docs_pdf
foreach format : ['ps', 'pdf']
output_fn = basename + '.' + format
custom_target(
output_fn,
output: output_fn,
input: [input_xml],
command: [xmlto] + docs_xmlto_search_flags + [
'-x', join_paths(doc_stylesheet_srcdir, 'xorg-fo.xsl'),
'--stringparam', 'img.src.path=' + meson.current_build_dir(),
'-o', meson.current_build_dir(),
'--with-fop', format, '@INPUT0@'],
build_by_default: true,
install: false,
)
endforeach
endif
endif

File diff suppressed because it is too large Load diff

View file

@ -1,342 +0,0 @@
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Jens Owen <jens@tungstengraphics.com>
*
*/
/* Prototypes for DRI functions */
#ifndef _DRI_H_
#include <pciaccess.h>
#include "scrnintstr.h"
#include "xf86dri.h"
typedef int DRISyncType;
#define DRI_NO_SYNC 0
#define DRI_2D_SYNC 1
#define DRI_3D_SYNC 2
typedef int DRIContextType;
typedef struct _DRIContextPrivRec DRIContextPrivRec, *DRIContextPrivPtr;
typedef enum _DRIContextFlags {
DRI_CONTEXT_2DONLY = 0x01,
DRI_CONTEXT_PRESERVED = 0x02,
DRI_CONTEXT_RESERVED = 0x04 /* DRI Only -- no kernel equivalent */
} DRIContextFlags;
#define DRI_NO_CONTEXT 0
#define DRI_2D_CONTEXT 1
#define DRI_3D_CONTEXT 2
typedef int DRISwapMethod;
#define DRI_HIDE_X_CONTEXT 0
#define DRI_SERVER_SWAP 1
#define DRI_KERNEL_SWAP 2
typedef int DRIWindowRequests;
#define DRI_NO_WINDOWS 0
#define DRI_3D_WINDOWS_ONLY 1
#define DRI_ALL_WINDOWS 2
typedef void (*ClipNotifyPtr) (WindowPtr, int, int);
typedef void (*AdjustFramePtr) (ScrnInfoPtr pScrn, int x, int y);
/*
* These functions can be wrapped by the DRI. Each of these have
* generic default funcs (initialized in DRICreateInfoRec) and can be
* overridden by the driver in its [driver]DRIScreenInit function.
*/
typedef struct {
ScreenWakeupHandlerProcPtr WakeupHandler;
ScreenBlockHandlerProcPtr BlockHandler;
WindowExposuresProcPtr WindowExposures;
CopyWindowProcPtr CopyWindow;
ClipNotifyProcPtr ClipNotify;
AdjustFramePtr AdjustFrame;
} DRIWrappedFuncsRec, *DRIWrappedFuncsPtr;
/*
* Prior to Xorg 6.8.99.8, the DRIInfoRec structure was implicitly versioned
* by the XF86DRI_*_VERSION defines in xf86dristr.h. These numbers were also
* being used to version the XFree86-DRI protocol. Bugs #3066 and #3163
* showed that this was inadequate. The DRIInfoRec structure is now versioned
* by the DRIINFO_*_VERSION defines in this file. - ajax, 2005-05-18.
*
* Revision history:
* 4.1.0 and earlier: DRIQueryVersion returns XF86DRI_*_VERSION.
* 4.2.0: DRIQueryVersion begins returning DRIINFO_*_VERSION.
* 5.0.0: frameBufferPhysicalAddress changed from CARD32 to pointer.
*/
#define DRIINFO_MAJOR_VERSION 5
#define DRIINFO_MINOR_VERSION 4
#define DRIINFO_PATCH_VERSION 0
typedef unsigned long long (*DRITexOffsetStartProcPtr) (PixmapPtr pPix);
typedef void (*DRITexOffsetFinishProcPtr) (PixmapPtr pPix);
typedef struct {
/* driver call back functions
*
* New fields should be added at the end for backwards compatibility.
* Bump the DRIINFO patch number to indicate bugfixes.
* Bump the DRIINFO minor number to indicate new fields.
* Bump the DRIINFO major number to indicate binary-incompatible changes.
*/
Bool (*CreateContext) (ScreenPtr pScreen,
VisualPtr visual,
drm_context_t hHWContext,
void *pVisualConfigPriv, DRIContextType context);
void (*DestroyContext) (ScreenPtr pScreen,
drm_context_t hHWContext, DRIContextType context);
void (*SwapContext) (ScreenPtr pScreen,
DRISyncType syncType,
DRIContextType readContextType,
void *readContextStore,
DRIContextType writeContextType,
void *writeContextStore);
void (*InitBuffers) (WindowPtr pWin, RegionPtr prgn, CARD32 indx);
void (*MoveBuffers) (WindowPtr pWin,
DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 indx);
void (*TransitionTo3d) (ScreenPtr pScreen);
void (*TransitionTo2d) (ScreenPtr pScreen);
void (*SetDrawableIndex) (WindowPtr pWin, CARD32 indx);
Bool (*OpenFullScreen) (ScreenPtr pScreen);
Bool (*CloseFullScreen) (ScreenPtr pScreen);
/* wrapped functions */
DRIWrappedFuncsRec wrap;
/* device info */
char *drmDriverName;
char *clientDriverName;
char *busIdString;
int ddxDriverMajorVersion;
int ddxDriverMinorVersion;
int ddxDriverPatchVersion;
void *frameBufferPhysicalAddress;
long frameBufferSize;
long frameBufferStride;
long SAREASize;
int maxDrawableTableEntry;
int ddxDrawableTableEntry;
long contextSize;
DRISwapMethod driverSwapMethod;
DRIWindowRequests bufferRequests;
int devPrivateSize;
void *devPrivate;
Bool createDummyCtx;
Bool createDummyCtxPriv;
/* New with DRI version 4.1.0 */
void (*TransitionSingleToMulti3D) (ScreenPtr pScreen);
void (*TransitionMultiToSingle3D) (ScreenPtr pScreen);
/* New with DRI version 5.1.0 */
void (*ClipNotify) (ScreenPtr pScreen, WindowPtr *ppWin, int num);
/* New with DRI version 5.2.0 */
Bool allocSarea;
Bool keepFDOpen;
/* New with DRI version 5.3.0 */
DRITexOffsetStartProcPtr texOffsetStart;
DRITexOffsetFinishProcPtr texOffsetFinish;
/* New with DRI version 5.4.0 */
int dontMapFrameBuffer;
drm_handle_t hFrameBuffer; /* Handle to framebuffer, either
* mapped by DDX driver or DRI */
} DRIInfoRec, *DRIInfoPtr;
extern _X_EXPORT Bool DRIOpenDRMMaster(ScrnInfoPtr pScrn,
unsigned long sAreaSize,
const char *busID,
const char *drmDriverName);
extern _X_EXPORT Bool DRIScreenInit(ScreenPtr pScreen,
DRIInfoPtr pDRIInfo, int *pDRMFD);
extern _X_EXPORT void DRICloseScreen(ScreenPtr pScreen);
extern Bool DRIExtensionInit(void);
extern _X_EXPORT void DRIReset(void);
extern _X_EXPORT Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen,
Bool *isCapable);
extern _X_EXPORT Bool DRIOpenConnection(ScreenPtr pScreen,
drm_handle_t * hSAREA,
char **busIdString);
extern _X_EXPORT Bool DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic);
extern _X_EXPORT Bool DRICloseConnection(ScreenPtr pScreen);
extern _X_EXPORT Bool DRIGetClientDriverName(ScreenPtr pScreen,
int *ddxDriverMajorVersion,
int *ddxDriverMinorVersion,
int *ddxDriverPatchVersion,
char **clientDriverName);
extern _X_EXPORT Bool DRICreateContext(ScreenPtr pScreen,
VisualPtr visual,
XID context, drm_context_t * pHWContext);
extern _X_EXPORT Bool DRIDestroyContext(ScreenPtr pScreen, XID context);
extern _X_EXPORT Bool DRIContextPrivDelete(void *pResource, XID id);
extern _X_EXPORT Bool DRICreateDrawable(ScreenPtr pScreen,
ClientPtr client,
DrawablePtr pDrawable,
drm_drawable_t * hHWDrawable);
extern _X_EXPORT Bool DRIDestroyDrawable(ScreenPtr pScreen,
ClientPtr client,
DrawablePtr pDrawable);
extern _X_EXPORT Bool DRIDrawablePrivDelete(void *pResource, XID id);
extern _X_EXPORT Bool DRIGetDrawableInfo(ScreenPtr pScreen,
DrawablePtr pDrawable,
unsigned int *indx,
unsigned int *stamp,
int *X,
int *Y,
int *W,
int *H,
int *numClipRects,
drm_clip_rect_t ** pClipRects,
int *backX,
int *backY,
int *numBackClipRects,
drm_clip_rect_t ** pBackClipRects);
extern _X_EXPORT Bool DRIGetDeviceInfo(ScreenPtr pScreen,
drm_handle_t * hFrameBuffer,
int *fbOrigin,
int *fbSize,
int *fbStride,
int *devPrivateSize, void **pDevPrivate);
extern _X_EXPORT DRIInfoPtr DRICreateInfoRec(void);
extern _X_EXPORT void DRIDestroyInfoRec(DRIInfoPtr DRIInfo);
extern _X_EXPORT Bool DRIFinishScreenInit(ScreenPtr pScreen);
extern _X_EXPORT void DRIWakeupHandler(void *wakeupData, int result);
extern _X_EXPORT void DRIBlockHandler(void *blockData, void *timeout);
extern _X_EXPORT void DRIDoWakeupHandler(ScreenPtr pScreen, int result);
extern _X_EXPORT void DRIDoBlockHandler(ScreenPtr pScreen, void *timeout);
extern _X_EXPORT void DRISwapContext(int drmFD, void *oldctx, void *newctx);
extern _X_EXPORT void *DRIGetContextStore(DRIContextPrivPtr context);
extern _X_EXPORT void DRIWindowExposures(WindowPtr pWin, RegionPtr prgn);
extern _X_EXPORT Bool DRIDestroyWindow(WindowPtr pWin);
extern _X_EXPORT void DRICopyWindow(WindowPtr pWin,
DDXPointRec ptOldOrg, RegionPtr prgnSrc);
extern _X_EXPORT void DRIClipNotify(WindowPtr pWin, int dx, int dy);
extern _X_EXPORT CARD32 DRIGetDrawableIndex(WindowPtr pWin);
extern _X_EXPORT void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg);
extern _X_EXPORT void DRILock(ScreenPtr pScreen, int flags);
extern _X_EXPORT void DRIUnlock(ScreenPtr pScreen);
extern _X_EXPORT DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen);
extern _X_EXPORT void *DRIGetSAREAPrivate(ScreenPtr pScreen);
extern _X_EXPORT unsigned int DRIGetDrawableStamp(ScreenPtr pScreen,
CARD32 drawable_index);
extern _X_EXPORT DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen,
drm_context_t *
pHWContext,
DRIContextFlags flags);
extern _X_EXPORT DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr
pScreen,
drm_context_t
hHWContext,
DRIContextFlags
flags);
extern _X_EXPORT Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv);
extern _X_EXPORT drm_context_t DRIGetContext(ScreenPtr pScreen);
extern _X_EXPORT void DRIQueryVersion(int *majorVersion,
int *minorVersion, int *patchVersion);
extern _X_EXPORT void DRIAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
extern _X_EXPORT void DRIMoveBuffersHelper(ScreenPtr pScreen,
int dx,
int dy,
int *xdir, int *ydir, RegionPtr reg);
extern _X_EXPORT int DRIMasterFD(ScrnInfoPtr pScrn);
extern _X_EXPORT void *DRIMasterSareaPointer(ScrnInfoPtr pScrn);
extern _X_EXPORT drm_handle_t DRIMasterSareaHandle(ScrnInfoPtr pScrn);
extern _X_EXPORT void DRIGetTexOffsetFuncs(ScreenPtr pScreen,
DRITexOffsetStartProcPtr *
texOffsetStartFunc,
DRITexOffsetFinishProcPtr *
texOffsetFinishFunc);
#define _DRI_H_
#endif

View file

@ -1,124 +0,0 @@
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sub license, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Jens Owen <jens@tungstengraphics.com>
*
*/
#ifndef DRI_STRUCT_H
#define DRI_STRUCT_H
#include "xf86drm.h"
#include "xf86Crtc.h"
#define DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin) ((DRIDrawablePrivPtr) \
dixLookupPrivate(&(pWin)->devPrivates, DRIWindowPrivKey))
#define DRI_DRAWABLE_PRIV_FROM_PIXMAP(pPix) ((DRIDrawablePrivPtr) \
dixLookupPrivate(&(pPix)->devPrivates, DRIWindowPrivKey))
typedef struct _DRIDrawablePrivRec {
drm_drawable_t hwDrawable;
int drawableIndex;
ScreenPtr pScreen;
int refCount;
int nrects;
} DRIDrawablePrivRec, *DRIDrawablePrivPtr;
struct _DRIContextPrivRec {
drm_context_t hwContext;
ScreenPtr pScreen;
Bool valid3D;
DRIContextFlags flags;
void **pContextStore;
};
#define DRI_SCREEN_PRIV(pScreen) ((DRIScreenPrivPtr) \
(dixPrivateKeyRegistered(DRIScreenPrivKey) ? \
dixLookupPrivate(&(pScreen)->devPrivates, DRIScreenPrivKey) : NULL))
#define DRI_SCREEN_PRIV_FROM_INDEX(screenIndex) ((DRIScreenPrivPtr) \
dixLookupPrivate(&screenInfo.screens[screenIndex]->devPrivates, \
DRIScreenPrivKey))
#define DRI_ENT_PRIV(pScrn) \
((DRIEntPrivIndex < 0) ? \
NULL: \
((DRIEntPrivPtr)(xf86GetEntityPrivate((pScrn)->entityList[0], \
DRIEntPrivIndex)->ptr)))
typedef struct _DRIScreenPrivRec {
Bool directRenderingSupport;
int drmFD; /* File descriptor for /dev/video/? */
drm_handle_t hSAREA; /* Handle to SAREA, for mapping */
XF86DRISAREAPtr pSAREA; /* Mapped pointer to SAREA */
drm_context_t myContext; /* DDX Driver's context */
DRIContextPrivPtr myContextPriv; /* Pointer to server's private area */
DRIContextPrivPtr lastPartial3DContext; /* last one partially saved */
void **hiddenContextStore; /* hidden X context */
void **partial3DContextStore; /* parital 3D context */
DRIInfoPtr pDriverInfo;
int nrWindows;
int nrWindowsVisible;
int nrWalked;
drm_clip_rect_t private_buffer_rect; /* management of private buffers */
DrawablePtr fullscreen; /* pointer to fullscreen drawable */
drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */
DRIWrappedFuncsRec wrap;
DestroyWindowProcPtr DestroyWindow;
DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES];
DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */
Bool createDummyCtx;
Bool createDummyCtxPriv;
Bool grabbedDRILock;
Bool drmSIGIOHandlerInstalled;
Bool wrapped;
Bool windowsTouched;
int lockRefCount;
drm_handle_t hLSAREA; /* Handle to SAREA containing lock, for mapping */
XF86DRILSAREAPtr pLSAREA; /* Mapped pointer to SAREA containing lock */
int *pLockRefCount;
int *pLockingContext;
xf86_crtc_notify_proc_ptr xf86_crtc_notify;
} DRIScreenPrivRec, *DRIScreenPrivPtr;
typedef struct _DRIEntPrivRec {
int drmFD;
Bool drmOpened;
Bool sAreaGrabbed;
drm_handle_t hLSAREA;
XF86DRILSAREAPtr pLSAREA;
unsigned long sAreaSize;
int lockRefCount;
int lockingContext;
ScreenPtr resOwner;
Bool keepFDOpen;
int refCount;
} DRIEntPrivRec, *DRIEntPrivPtr;
#endif /* DRI_STRUCT_H */

View file

@ -1,23 +0,0 @@
srcs_xorg_dri = [
'dri.c',
'xf86dri.c',
]
xorg_dri = static_library('xorg_dri',
srcs_xorg_dri,
include_directories: [inc, xorg_inc],
dependencies: [
common_dep,
libdrm_dep,
],
c_args: xorg_c_args,
)
install_data(
[
'dri.h',
'sarea.h',
'dristruct.h',
],
install_dir: xorgsdkdir,
)

View file

@ -1,96 +0,0 @@
/**
* \file sarea.h
* SAREA definitions.
*
* \author Kevin E. Martin <kevin@precisioninsight.com>
* \author Jens Owen <jens@tungstengraphics.com>
* \author Rickard E. (Rik) Faith <faith@valinux.com>
*/
/*
* Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2000 VA Linux Systems, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _SAREA_H_
#define _SAREA_H_
#include "xf86drm.h"
/* SAREA area needs to be at least a page */
#if defined(__alpha__)
#define SAREA_MAX 0x2000
#elif defined(__ia64__)
#define SAREA_MAX 0x10000 /* 64kB */
#else
/* Intel 830M driver needs at least 8k SAREA */
#define SAREA_MAX 0x2000
#endif
#define SAREA_MAX_DRAWABLES 256
#define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000
/**
* SAREA per drawable information.
*
* \sa _XF86DRISAREA.
*/
typedef struct _XF86DRISAREADrawable {
unsigned int stamp;
unsigned int flags;
} XF86DRISAREADrawableRec, *XF86DRISAREADrawablePtr;
/**
* SAREA frame information.
*
* \sa _XF86DRISAREA.
*/
typedef struct _XF86DRISAREAFrame {
unsigned int x;
unsigned int y;
unsigned int width;
unsigned int height;
unsigned int fullscreen;
} XF86DRISAREAFrameRec, *XF86DRISAREAFramePtr;
/**
* SAREA definition.
*/
typedef struct _XF86DRISAREA {
/** first thing is always the DRM locking structure */
drmLock lock;
/** \todo Use readers/writer lock for drawable_lock */
drmLock drawable_lock;
XF86DRISAREADrawableRec drawableTable[SAREA_MAX_DRAWABLES];
XF86DRISAREAFrameRec frame;
drm_context_t dummy_context;
} XF86DRISAREARec, *XF86DRISAREAPtr;
typedef struct _XF86DRILSAREA {
drmLock lock;
drmLock otherLocks[31];
} XF86DRILSAREARec, *XF86DRILSAREAPtr;
#endif

Some files were not shown because too many files have changed in this diff Show more