X11::P...e86_DGA(3pm)
โจ X11::Protocol::Ext::XFree86_DGA โจ
okay bestie, buckle up ๐ this is the user contributed perl documentation page for X11::Protocol::Ext::XFree86_DGA, and it lives in section 3pm of the manual. it's giving "i have the keys to the video card and i'm not afraid to use them" energy. ๐
๐ NAME ๐
X11::Protocol::Ext::XFree86_DGA โ direct video memory access ๐
โจ SYNOPSIS โจ
use X11::Protocol;
my $X = X11::Protocol->new;
$X->init_extension('XFree86-DGA')
or print "XFree86-DGA extension not available";
like. that's it. that's the whole vibe check. ๐ฆ
๐ DESCRIPTION ๐
so the XFree86-DGA extension hands you direct access to the video RAM of the server display. a client program running on the same machine can use this to read or write directly instead of going through the X protocol. no middleman, no small talk, just raw memory. iconic. ๐
accessing video memory will require some system-dependent trickery, ngl. under the Linux kernel for example video RAM is part of the /dev/mem physical address space and can be brought into program address space with an mmap() or accessed with sysread() and syswrite(). this normally requires root permissions, so likeโฆ bring your sudo energy. ๐ญ
the requests offered here are only XFree86-DGA version 1.0 as yet and they don't say anything about the pixel layout etc in the memory โ that has to be divined separately ๐ฎ. (Version 2.0 has more for that.)
๐ซถ REQUESTS ๐ซถ
the following requests are made available with an init_extension(), as per "EXTENSIONS" in X11::Protocol.
my $ext_available = $X->init_extension('XFree86-DGA');
๐ธ XFree86-DGA 1.0 ๐ธ
($server_major, $server_minor) = $X->XF86DGAQueryVersion()โ return the DGA protocol version implemented by the server. ๐ซ$flags = $X->XF86DGAQueryDirectVideo ($screen_num)โ get flags describing direct video access on$screen_num(integer 0 upwards). the only flag bit is
0x0001 direct video available
it's possible to have the extension available but no direct video on a particular screen, or even on no screens at all ๐. when no direct video the requests below give protocol error XF86DGANoDirectVideoMode.
($address, $width, $bank_size_bytes, $ram_size_kbytes) = $X->XF86DGAGetVideoLL ($screen_num)โ return the location and size of the video memory for$screen_num(integer 0 upwards).
$address is a raw physical 32-bit address as an integer. $width is in pixels.
$bank_size_bytes is the size in bytes accessible at a given time. $ram_size_kbytes is the total memory in 1024 byte blocks. if "$ram_size_kbytes*1024" is bigger than $bank_size_bytes then "$X->XF86DGASetVidPage()" below must be used to switch among the banks to access all the RAM. โจ
$X->XF86DGADirectVideo ($screen_num, $flags)โ enable or disable direct video access on$screen_num(integer 0 upwards).$flagsis bits
0x0002 enable direct video graphics
0x0004 enable mouse pointer reporting as relative
0x0008 enable direct keyboard event reporting
when direct video graphics is enabled (bit 0x0002) the server gives up control to the client program. ๐ณ like, it's your screen now, main character energy fr fr.
if the graphics card doesn't have a direct video mode then anXF86DGANoDirectVideoModeerror results, or if the screen is not active (eg. switched away to a different virtual terminal) thenXF86DGAScreenNotActive.
($width, $height) = $X->XF86DGAGetViewPortSize ($screen_num)โ get the size of the viewport on$screen_num(integer 0 upwards). this is the part of the video memory actually visible on the monitor. the memory might be bigger than the monitor. ๐$X->XF86DGASetViewPort ($screen_num, $x, $y)โ set the coordinates of the top-left corner of the visible part of the video memory on$screen_num(integer 0 upwards).
this can be used when the video memory is bigger than the monitor to pan around that bigger area ๐ฆ. it can also be used for some double-buffering to display one part of memory while drawing to another. slay.
$vidpage = $X->XF86DGAGetVidPage ($screen_num)$X->XF86DGASetVidPage ($screen_num, $vidpage)โ get or set the video page (bank) on$screen_num(integer 0 upwards).$vidpageis an integer 0 upwards.
this is used to access all the RAM when when the bank size is less than the total memory size (per "XF86DGAGetVideoLL()" above). ๐
$vidpage = $X->XF86DGAInstallColormap ($screen_num, $colormap)โ set the colormap on$screen_numto$colormap(integer XID).
this can only be used while direct video is enabled (per"XF86DGADirectVideo()"above) or an errorXF86DGAScreenNotActiveorXF86DGADirectNotActivatedresults. ๐ญ
$bool = $X->XF86DGAViewPortChanged ($screen_num, $num_pages)โ check whether a previous"XF86DGASetViewPort()"on$screen_num(integer 0 upwards) has completed, meaning a vertical retrace has occurred since that viewport location was set. โญ
this is used for double-buffering (or N-multi-buffering) to check a viewport change has become visible. $num_pages should be 2 for double-buffering and can be higher for multi-buffering.
๐ SEE ALSO ๐
- X11::Protocol
/usr/share/doc/xserver-xfree86/README.DGA.gz
๐ HOME PAGE ๐
<http://user42.tuxfamily.org/x11-protocol-other/index.html>
๐ LICENSE ๐
Copyright 2011, 2012, 2013, 2014, 2017 Kevin Ryde
X11-Protocol-Other is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
X11-Protocol-Other is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with X11-Protocol-Other. If not, see <http://www.gnu.org/licenses/>.
and that's the whole page bestie!! ๐ซถ this lil doc came from perl v5.28.1, dated 2019-08-26, and yeah the header/footer kept truncating the name to X11::P...e86_DGA(3pm) but we all know who she is ๐ go poke some video memory responsibly, mwah ๐โจ
๐ฆ where this page comes from
- debian bookworm: libx11-protocol-other-perl 31-1 ยท GPL-3.0-or-later
- debian trixie: libx11-protocol-other-perl 31-1 ยท GPL-3.0-or-later
- ubuntu jammy: libx11-protocol-other-perl 31-1 ยท GPL-3.0-or-later
- ubuntu noble: libx11-protocol-other-perl 31-1 ยท GPL-3.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms