1X11::Protocol::Ext::XFrUesee8r6_CDoGnAt(r3i)buted Perl DXo1c1u:m:ePnrtoattoicoonl::Ext::XFree86_DGA(3)
2
3
4
6 X11::Protocol::Ext::XFree86_DGA - direct video memory access
7
9 use X11::Protocol;
10 my $X = X11::Protocol->new;
11 $X->init_extension('XFree86-DGA')
12 or print "XFree86-DGA extension not available";
13
15 The XFree86-DGA extension provides direct access to the video RAM of
16 the server display. A client program running on the same machine can
17 use this to read or write directly instead of going through the X
18 protocol.
19
20 Accessing video memory will require some system-dependent trickery.
21 Under the Linux kernel for example video RAM is part of the /dev/mem
22 physical address space and can be brought into program address space
23 with an "mmap()" or accessed with "sysread()" and "syswrite()". This
24 normally requires root permissions.
25
26 The requests offered here are only XFree86-DGA version 1.0 as yet and
27 they don't say anything about the pixel layout etc in the memory --
28 that has to be divined separately. (Version 2.0 has more for that.)
29
31 The following requests are made available with an "init_extension()",
32 as per "EXTENSIONS" in X11::Protocol.
33
34 my $ext_available = $X->init_extension('XFree86-DGA');
35
36 XFree86-DGA 1.0
37 "($server_major, $server_minor) = $X->XF86DGAQueryVersion()"
38 Return the DGA protocol version implemented by the server.
39
40 "$flags = $X->XF86DGAQueryDirectVideo ($screen_num)"
41 Get flags describing direct video access on $screen_num (integer 0
42 upwards). The only flag bit is
43
44 0x0001 direct video available
45
46 It's possible to have the extension available but no direct video
47 on a particular screen, or even on no screens at all. When no
48 direct video the requests below give protocol error
49 "XF86DGANoDirectVideoMode".
50
51 "($address, $width, $bank_size_bytes, $ram_size_kbytes) =
52 $X->XF86DGAGetVideoLL ($screen_num)"
53 Return the location and size of the video memory for $screen_num
54 (integer 0 upwards).
55
56 $address is a raw physical 32-bit address as an integer. $width is
57 in pixels.
58
59 $bank_size_bytes is the size in bytes accessible at a given time.
60 $ram_size_kbytes is the total memory in 1024 byte blocks. If
61 "$ram_size_kbytes*1024" is bigger than $bank_size_bytes then
62 "$X->XF86DGASetVidPage()" below must be used to switch among the
63 banks to access all the RAM.
64
65 "$X->XF86DGADirectVideo ($screen_num, $flags)"
66 Enable or disable direct video access on $screen_num (integer 0
67 upwards). $flags is bits
68
69 0x0002 enable direct video graphics
70 0x0004 enable mouse pointer reporting as relative
71 0x0008 enable direct keyboard event reporting
72
73 When direct video graphics is enabled (bit 0x0002) the server gives
74 up control to the client program.
75
76 If the graphics card doesn't have a direct video mode then an
77 "XF86DGANoDirectVideoMode" error results, or if the screen is not
78 active (eg. switched away to a different virtual terminal) then
79 "XF86DGAScreenNotActive".
80
81 "($width, $height) = $X->XF86DGAGetViewPortSize ($screen_num)"
82 Get the size of the viewport on $screen_num (integer 0 upwards).
83 This is the part of the video memory actually visible on the
84 monitor. The memory might be bigger than the monitor.
85
86 "$X->XF86DGASetViewPort ($screen_num, $x, $y)"
87 Set the coordinates of the top-left corner of the visible part of
88 the video memory on $screen_num (integer 0 upwards).
89
90 This can be used when the video memory is bigger than the monitor
91 to pan around that bigger area. It can also be used for some
92 double-buffering to display one part of memory while drawing to
93 another.
94
95 "$vidpage = $X->XF86DGAGetVidPage ($screen_num)"
96 "$X->XF86DGASetVidPage ($screen_num, $vidpage)"
97 Get or set the video page (bank) on $screen_num (integer 0
98 upwards). $vidpage is an integer 0 upwards.
99
100 This is used to access all the RAM when when the bank size is less
101 than the total memory size (per "XF86DGAGetVideoLL()" above).
102
103 "$vidpage = $X->XF86DGAInstallColormap ($screen_num, $colormap)"
104 Set the colormap on $screen_num to $colormap (integer XID).
105
106 This can only be used while direct video is enabled (per
107 "XF86DGADirectVideo()" above) or an error "XF86DGAScreenNotActive"
108 or "XF86DGADirectNotActivated" results.
109
110 "$bool = $X->XF86DGAViewPortChanged ($screen_num, $num_pages)"
111 Check whether a previous "XF86DGASetViewPort()" on $screen_num
112 (integer 0 upwards) has completed, meaning a vertical retrace has
113 occurred since that viewport location was set.
114
115 This is used for double-buffering (or N-multi-buffering) to check a
116 viewport change has become visible. $num_pages should be 2 for
117 double-buffering and can be higher for multi-buffering.
118
120 X11::Protocol
121
122 /usr/share/doc/xserver-xfree86/README.DGA.gz
123
125 <http://user42.tuxfamily.org/x11-protocol-other/index.html>
126
128 Copyright 2011, 2012, 2013, 2014, 2017 Kevin Ryde
129
130 X11-Protocol-Other is free software; you can redistribute it and/or
131 modify it under the terms of the GNU General Public License as
132 published by the Free Software Foundation; either version 3, or (at
133 your option) any later version.
134
135 X11-Protocol-Other is distributed in the hope that it will be useful,
136 but WITHOUT ANY WARRANTY; without even the implied warranty of
137 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
138 General Public License for more details.
139
140 You should have received a copy of the GNU General Public License along
141 with X11-Protocol-Other. If not, see <http://www.gnu.org/licenses/>.
142
143
144
145perl v5.32.1 2021-01-27X11::Protocol::Ext::XFree86_DGA(3)