Skip to content
This repository

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

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 misc
Octocat-spinner-32 openbsd
Octocat-spinner-32 src
Octocat-spinner-32 xsrc
Octocat-spinner-32 BRANCHES
Octocat-spinner-32 CAVEATS
Octocat-spinner-32 README
Octocat-spinner-32 autobuild.sh
README
+------------------------------------------------------------------------------+
|             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.

Notes:

- This port targets NetBSD -current's native X.org.  It is incompatible with
  NetBSD 6 or pkgsrc's X.org.

- There is no KMS support in this port.  OpenBSD -current now has KMS support,
  but this was not the case when the port was developed.  So, in short, the port
  is based on OpenBSD -current sources from 2013-03-18 12:36 UTC.

- Taylor Campbell is currently porting Linux's DRM+GEM+KMS to NetBSD.  His first
  goal is to support Intel integrated GPUs.  See his post:

  http://mail-index.netbsd.org/tech-x11/2013/02/06/msg001229.html


*****      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.

The port is based on NetBSD -current sources.  Upstream changes are merged in as
needed (typically when a user reports a build failure).  The date of the latest
update can be found in the commit history of the netbsd-current branch:

http://github.com/gsutre/netbsd-drmgem/commits/netbsd-current

A priori, the port is only compatible with NetBSD -current of the same date.  In
reality, compatibility often remains for months.


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.

A typical use case for this script is the following.  First, upgrade the system
to NetBSD -current with sources dated from <time stamp>.  Daily binary snapshots
from http://releng.netbsd.org/ may be used for this.  Then, run autobuild.sh as
instructed above, with the same <time stamp>.


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:

http://www.netbsd.org/docs/guide/en/chap-fetch.html

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.
Something went wrong with that request. Please try again.