Hands-on Projects for the Linux Graphics Subsystem

PCI Experimens (part III)

The memory region required for the video driver appears as we saw in
section 4.2.4 by entering the following
command:

sudo cat /proc/791/maps

where 791 was the process id of the X Server (X or Xorg), at the time the command was issued.
The process id is returned by the 'ps' or 'pgrep' Unix commands.
The next image illustrates part of the output of the previous command:

address perms offset dev inode pathname
. . .
where "address" is the address space in the process that it occupies,
"perms" is a set of permissions:
r = read
w = write
x = execute
s = shared
p = private (copy on write)
"offset" is the offset into the file/whatever, "dev" is the device
(major:minor), and "inode" is the inode on that device. 0 indicates
that no inode is associated with the memory region, as the case would
be with BSS (uninitialized data).
Under Linux 2.0 there is no field giving pathname.

Notice that the first part, the address is the only one that varies each time the system boot up,
for instance at another time the proc output was the following:

The virtual address space, that maps the device memory, can be placed in a different memory
location each time the X Server starts up, however the total size of this address space
remains the same. This virtual memory region is placed the first time at b378a000-b575a000
and the same time at b36eb000-b56bb000, which means that its size is about 32MB. This is certainly
less than the 128 MB we would expect for a system with 128 MB video memory, however the mystery
to this gets solved, if we have a look at the BIOS configuration, during the BIOS setup,
which for the system we run the experiment, reveals a restricted size for video memory
down to 32 MB.

At both cases we see that the device memory is placed at the processor memory
location 0xe8000000. We verify this and also the size of this memory region, 128 MB, with
lspci. From the Linux command line we enter lspci, with the vvv argument
in order to find 'maximum verbose' info about the PCI address 00:02.0:

sudo lspci -vvv -s 00:02.0

The command output is displayed in the following image:

As we see this memory space appears as 'Region 0', starting at e8000000, with a size of 128 MB.