Porting DRM/GEM from OpenBSD to NetBSD (Intel only)
Pull request Compare This branch is 92 commits behind gsutre:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


|             Porting DRM/GEM from OpenBSD to NetBSD (Intel only)              |

The X.org intel driver included in NetBSD -current does not support the recent
integrated GPUs found in Core i3/i5/i7 platforms.  However, OpenBSD 4.8 supports
them (kudos to OpenBSD developers!).  This support involves three components of
the system:

1. Kernel DRM driver (with GEM support)
2. Userland DRM library
3. X.org video driver

This project ports these three components from OpenBSD to NetBSD.  Support for
(embedded) display port has been, in addition, ported directly from Linux.  The
port focusses on Intel GPUs and removes support for other graphics hardware.

Note: This port is for NetBSD's native X.org.  It's not compatible with pkgsrc's
      X.org.                    ^^^^^^

*****      Use at your own risk        ******        Work in progress      *****

There are several ways to build and install this port.  The safest option is to
(cross-)build a new release from scratch.  But this may take time, so, instead,
one may choose to use the automated build script that is provided with the port.
Last, it is possible to manually build the required components.  Let us present
in detail these three alternatives.

Automated build script

Download the script autobuild.sh, create a directory with enough free space for
the build (750 MiB), and then run the script from this directory:

$ /path/to/autobuild.sh -mv <time stamp>

This builds a new kernel as well as intel-specific X.org modules and libraries.

WARNING: this script modifies the local X11R7 installation!

The <time stamp> specifies the date of NetBSD -current sources.  You may use any
date compatible with the CVS date format.  But, obviously, it is safer to choose
a date that is close to the sources of the running NetBSD system.

Manual build

1. Patch NetBSD source tree (/usr/src and /usr/xsrc)

$ git clone https://github.com/gsutre/netbsd-drmgem.git

Replace files in /usr/src and /usr/xsrc by the ones provided in the src and xsrc
sub-directories of this project.  This can be achieved for instance as follows:

(WARNING: this overwrites your local source tree.)

$ cd netbsd-drmgem
$ cp -av src xsrc /usr

Alternatively, for /usr/src, you can generate a patch to apply to your source
tree with the following command, run from within the cloned git repository:

$ git diff remotes/origin/netbsd-current remotes/origin/master -- src

However, the generated patch only concerns /usr/src.  It is still necessary to
overwrite /usr/xsrc with files in the xsrc sub-directory of this project.

2. Build and install new kernel

See for instance http://www.netbsd.org/docs/guide/en/part-compile.html.

3. Build and install OpenBSD Xenocara's libdrm and Xorg intel driver

Refer to the above link for details.  In most cases, the following should work:

$ export USETOOLS=no

$ cd /usr/src/external/mit/xorg/lib/libdrm
$ su root -c "make includes"
$ make
$ su root -c "make install"

$ cd /usr/src/external/mit/xorg/lib/libdrm_intel
$ su root -c "make includes"
$ make
$ su root -c "make install"

$ cd /usr/src/external/mit/xorg/server/drivers/xf86-video-intel
$ make
$ su root -c "make install"

However, this only builds the X.org intel(4) driver as well as its dependencies.
See the autobuild.sh script to build Mesa DRI modules and XvMC libraries.

Full (cross-)build

Fetch a clean NetBSD -current source tree, as explained here:


Next, do step 1 of the Manual build section to patch the source tree, and, then,
perform a full (cross-)build of the patched release using the build.sh script.
For instance:

$ ./build.sh -U -m amd64 -x release

Install the release as usual.