FreeBSD Foundation's New Project: Implement GEM/KMS/DRI for Intel Graphics

Status
Not open for further replies.
Hey all,

Couple of questions here. I'm trying to get this working on an Intel HD4000 chip. Has anyone tried/gotten it working on one of these?

Also, is all.14.9-stable-9.patch the latest patch? It applies cleanly with the exception of the _mem reject (which I deleted). However when I rebuild and kldload the module nothing shows up in dmesg and Xorg dies with:

Code:
# X

X.Org X Server 1.10.6
Release Date: 2012-02-10
X Protocol Version 11, Revision 0
Build Operating System: FreeBSD 9.0-STABLE amd64 
Current Operating System: FreeBSD jeffu-htpc 9.0-STABLE FreeBSD 9.0-STABLE #0: Fri Jun  1 22:30:59 EDT 2012
     root@jeffu-htpc:/usr/obj/usr/src/sys/GENERIC amd64
Build Date: 01 June 2012  11:59:09PM
 
Current version of pixman: 0.24.2
	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Sat Jun  2 04:04:52 2012
(==) Using default built-in configuration (30 lines)
(EE) Failed to load module "fbdev" (module does not exist, 0)
(EE) intel(0): [drm] Failed to open DRM device for pci:0000:00:02.0: File exists
(EE) intel(0): Failed to become DRM master.
DRM_IOCTL_I915_GEM_APERTURE failed: Bad file descriptor
Assuming 131072kB available aperture size.
May lead to reduced performance or incorrect rendering.
get chip id failed: -1 [9]
param: 4, val: 0
Assertion failed: (0), function drm_intel_bufmgr_gem_init, file intel_bufmgr_gem.c, line 2332.
zsh: abort (core dumped)  X

I'm working on starting over from scratch, documenting every step I take to see if I went wrong somewhere. Will post that once it's done either successfully or not.
 
my path to KMS

I am still in the process of testing, but I haven't encountered any obvious errors and my CPU usage and heat development are at normal levels. The CPU I'm using is an Intel i7-2640M with HD 3000 in a ThinkPad X220 (mentioning this because some others in this thread have the same machine). What I did to get KMS working is basically an updated version of Toto's guide, where I take into account that KMS is now part of CURRENT.

  • step0, step1 and step2 are identical.
  • step3 stays the same, except RELENG_9 is replaced with:

    cvsup0.txt
    Code:
    *default host=cvsup.FreeBSD.org
    *default prefix=/usr
    *default base=/var/db
    *default release=cvs tag=.
    *default delete use-rel-suffix compress
    
    src-all

    This gives us HEAD in /usr/src/.
  • step4 and step5 are no longer necessary since the code used in the patch has been merged.
  • step6, step7 and step8 follow as before.
  • step9 skip
  • step10 this also stays the same.
After I went through with this process all I needed to do was load i915kms:
kldload i915kms

Don't be surprised if your screen goes black once it loads. With a bit of luck you will now be able to startx

At the moment it isn't possible to return to the console and will have to start X blindly or by using a login manager (I have been pointed to slim and it does the job).

Good luck and enjoy!
 
jeffutter said:
Hey all,

Couple of questions here. I'm trying to get this working on an Intel HD4000 chip. Has anyone tried/gotten it working on one of these?

Also, is all.14.9-stable-9.patch the latest patch? It applies cleanly with the exception of the _mem reject (which I deleted). However when I rebuild and kldload the module nothing shows up in dmesg and Xorg dies with: ...

I'm working on starting over from scratch, documenting every step I take to see if I went wrong somewhere. Will post that once it's done either successfully or not.

The i915_mem.c file must be modified before applying the patch, like the i915_suspend.c file, i.e. rewritten from
Code:
__FBSDID("$FreeBSD: stable/9/sys/dev/drm/i915_mem.c 182080 2008-08-23 20:59:12Z rnoland $");
to
Code:
__FBSDID("$FreeBSD$");
somewhere at the top of the file.

The newest patch is 15.1 IIRC, though since kib committed the patches to upstream it's no longer refered. On his wiki page kib wrote what steps you need to take if you want to pull the driver into a RELENG source tree.
 
After an update of xf86-video-intel-2.7.1_4 from 7th June, my Xorg refuses to work anymore (Xorg with KMS worked fine on my 9-STABLE until then). Today, I changed from RELENG9 to HEAD, (I took the steps of finn, described in this thread).

Unfortunately, graphics/libdrm won't build:

Code:
modetest.c:58:19: error: cairo.h: No such file or directory
modetest.c: In function 'make_pwetty':
modetest.c:394: error: 'cairo_surface_t' undeclared (first use in this function)
modetest.c:394: error: (Each undeclared identifier is reported only once
modetest.c:394: error: for each function it appears in.)
modetest.c:394: error: 'surface' undeclared (first use in this function)
modetest.c:395: error: 'cairo_t' undeclared (first use in this function)
modetest.c:395: error: 'cr' undeclared (first use in this function)
modetest.c:399: error: 'CAIRO_FORMAT_ARGB32' undeclared (first use in this function)
modetest.c:405: error: 'CAIRO_LINE_CAP_SQUARE' undeclared (first use in this function)
*** [modetest.o] Error code 1
1 error
*** [all-recursive] Error code 1
1 error
*** [all-recursive] Error code 1
1 error
*** [all] Error code 2
1 error
*** [do-build] Error code 1

Stop in /usr/ports/graphics/libdrm.
*** [build] Error code 1

Stop in /usr/ports/graphics/libdrm.

===>>> make failed for graphics/libdrm
===>>> Aborting update

Any suggestions?
 
Either was cairo not (properly) installed, or the include paths wasn't extended. What's the compiler invocation that caused that error at your system?
 
I'm using 9.0-STABLE with the 14.9 patch and have recently upgraded the Intel driver (from ports), but only later read that it's for -CURRENT. Of course, it doesn't work. I've downgraded the port to the previous version and tried to compile it, but it doesn't even patch correctly.

Code:
===>  Applying FreeBSD patches for xf86-video-intel-2.17.0
2 out of 2 hunks failed--saving rejects to uxa/uxa-priv.h.rej
=> Patch patch-uxa_uxa-priv.h failed to apply cleanly.
*** Error code 1

Stop in /usr/ports/x11-drivers/xf86-video-intel.
 
xibo said:
Either was cairo not (properly) installed, or the include paths wasn't extended. What's the compiler invocation that caused that error at your system?

I reinstalled graphics/cairo but this didn't help.

That's what I get while compiling:
Code:
libdrm 2.4.31 will be compiled with:

  libkms         yes
  Intel API      yes
  vmwgfx API     no
  Radeon API     yes
  Nouveau API    yes

===>  Building for libdrm-2.4.31_1
/usr/bin/make  all-recursive
Making all in .
  CC     libdrm_la-xf86drmHash.lo
  CC     libdrm_la-xf86drm.lo
  CC     libdrm_la-xf86drmRandom.lo
  CC     libdrm_la-xf86drmSL.lo
  CC     libdrm_la-xf86drmMode.lo
  CCLD   libdrm.la
Making all in libkms
  CC     linux.lo
  CC     intel.lo
  CC     dumb.lo
  CC     api.lo
  CC     nouveau.lo
  CC     radeon.lo
  CCLD   libkms.la
Making all in intel
  CC     intel_bufmgr.lo
  CC     intel_bufmgr_fake.lo
  CC     intel_bufmgr_gem.lo
  CC     intel_decode.lo
intel_decode.c: In function 'decode_3d_primitive':
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:2418: warning: cannot optimize loop, the loop counter may overflow
  CC     mm.lo
  CC     test_decode.o
test_decode.c: In function 'compare_batch':
test_decode.c:91: warning: unused variable 'size'
intel_decode.c: In function 'decode_2d_br01':
intel_decode.c:299: warning: 'format' may be used uninitialized in this function
intel_decode.c: In function 'drm_intel_decode':
intel_decode.c:3105: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:3105: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:3105: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:3105: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:3105: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:3105: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:3105: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:3105: warning: cannot optimize loop, the loop counter may overflow
intel_decode.c:3105: warning: cannot optimize loop, the loop counter may overflow
  CCLD   libdrm_intel.la
  CCLD   test_decode
Making all in nouveau
  CC     nouveau_device.lo
  CC     nouveau_channel.lo
  CC     nouveau_pushbuf.lo
  CC     nouveau_grobj.lo
  CC     nouveau_notifier.lo
  CC     nouveau_bo.lo
  CC     nouveau_resource.lo
  CC     nouveau_reloc.lo
  CCLD   libdrm_nouveau.la
Making all in radeon
  CC     radeon_bo_gem.lo
  CC     radeon_cs_gem.lo
radeon_cs_gem.c:334: warning: 'cs_gem_dump_bof' defined but not used
  CC     radeon_cs_space.lo
  CC     radeon_bo.lo
  CC     radeon_cs.lo
  CC     radeon_surface.lo
  CC     bof.lo
bof.c: In function 'bof_object_get':
bof.c:68: warning: cannot optimize loop, the loop counter may overflow
bof.c:68: warning: cannot optimize loop, the loop counter may overflow
bof.c:68: warning: cannot optimize loop, the loop counter may overflow
bof.c:68: warning: cannot optimize loop, the loop counter may overflow
bof.c:68: warning: cannot optimize loop, the loop counter may overflow
  CCLD   libdrm_radeon.la
Making all in tests
Making all in modeprint
  CC     modeprint.o
  CCLD   modeprint
Making all in kmstest
  CC     main.o
  CCLD   kmstest
Making all in modetest
  CC     modetest.o
modetest.c:58:19: error: cairo.h: No such file or directory
modetest.c: In function 'make_pwetty':
modetest.c:394: error: 'cairo_surface_t' undeclared (first use in this function)
modetest.c:394: error: (Each undeclared identifier is reported only once
modetest.c:394: error: for each function it appears in.)
modetest.c:394: error: 'surface' undeclared (first use in this function)
modetest.c:395: error: 'cairo_t' undeclared (first use in this function)
modetest.c:395: error: 'cr' undeclared (first use in this function)
modetest.c:399: error: 'CAIRO_FORMAT_ARGB32' undeclared (first use in this function)
modetest.c:405: error: 'CAIRO_LINE_CAP_SQUARE' undeclared (first use in this function)
*** [modetest.o] Error code 1
1 error
*** [all-recursive] Error code 1
1 error
*** [all-recursive] Error code 1
1 error
*** [all] Error code 2
1 error
*** [do-build] Error code 1

Stop in /usr/ports/graphics/libdrm.
*** [build] Error code 1

Stop in /usr/ports/graphics/libdrm.

Edit: Very strange: I tried it again and again and suddenly it worked. I could compile and 10.0-CURRENT runs fine now.
 
These changes (neither on 9-STABLE or 10) support my IvyBridge video chip. This is an Intel HD 4000 from an i5 i5-3570K. What can I do to get the pciids added?

Code:
% pciconf -lvv
vgapci1@pci0:0:2:0:     class=0x038000 card=0x01621849 chip=0x01628086 rev=0x09 hdr=0x00
    vendor     = 'Intel Corporation'
    class      = display
 
xibo said:
It just got into RELENG_9 two minutes ago.

I just went from 9.0-RELEASE to STABLE. This is all I had to do (as root) to get things working beautifully.

Code:
echo "WITH_NEW_XORG=true" >> /etc/make.conf
portmaster x11/xorg
X -configure
# move the generated configuration file to /usr/local/etc/
 
It works great! With Mobile Intel GM45 Express Chipset.

jrm said:
I just went from 9.0-RELEASE to STABLE. This is all I had to do (as root) to get things working beautifully.

Code:
echo "WITH_NEW_XORG=true" >> /etc/make.conf
portmaster x11/xorg
X -configure
# move the generated configuration file to /usr/local/etc/

In addition I had to reinstall some x11-drivers/xf86-video-XXXXXX based on the EE messages I got from running configure. Then a reboot, and it works great!
 
Failed on RELENG_9

The procedure failed on FreeBSD 9 with a Mobile Intel(R) 965 Express Chipset. This coupled with laptop overheating with this release really left a bitter taste.

Until 10.x I'll stick with 8.2

Wanted to tinker with Clang, alas.
 
Okay, got it working with FreeBSD 10.

Switching to console doesn't work. That's ok.

But...I don't even get back the console when I quit my Window Manager. I'm using jwm.

Any hints?
 
SR_Ind said:
Okay, got it working with FreeBSD 10.

Switching to console doesn't work. That's ok.

But...I don't even get back the console when I quit my Window Manager. I'm using jwm.

Any hints?

It doesn't work at the moment. Once you load i915kms and drm2, you cannot go back to tty. Unloading is not supported yet.
 
That's because switching code is not implemented yet and kernel module is still unloadable. Only reboot seems to help to get text console back.
 
Guys, one little question: when you say "it works" you say that your card is correctly initialized or you say that your card really works for everyday use? The discussion is only about functionallity? The stability doesn't matter?

Did you tried to run neverball game? Does it runs for 5 minutes or more? I asqued this because in my case, even with the latest kernel sources, if I run neverball or I use firefox to browse some complex HTML pages (e.g. with .swf embedded) the system hangs up after a while.

I'm a little bit confused: you say that you have a STABLE system with kms?

Neverball still hangs up the system in about 30s.

Note: I hate neverball, ok? I'm not a fan of this game, I just test the patch with it.
 
STABLE means RELENG_9, not stable release. 2D acceleration works pretty well here, X11 didn't crash at all recently. However, when trying to shut down the system it crashes before flushing the disks quite often, leaving me worried about data consistency...
 
xibo said:
STABLE means RELENG_9, not stable release. 2D acceleration works pretty well here, X11 didn't crash at all recently. However, when trying to shut down the system it crashes before flushing the disks quite often, leaving me worried about data consistency...

In my previous post, I used STABLE as an antonym of UNSTABLE, not as a FreeBSD STABLE release branch (sorry for writing "stable" with capital letters and generate confusion - I don't know wtf is wrong with me these days).

So, is there anyone here who has a healthy X11 + KMS + 3D system that doesn't crashe after, let's say, one hour of normal use (or 30 seconds of neverball use)?
 
Mine is running for some 4.5 hours and I've building ports in a rxvt terminal and also running MPlayer with the gl2 driver to test some 1080p HD videos. CPU temperature showing to be 63 degrees.

Shutdown and reboots only possible from rxvt terminal.
 
BlackSteel said:
That's because switching code is not implemented yet and kernel module is still unloadable. Only reboot seems to help to get text console back.

The console is there but you just cannot see it. But you can start X again or reboot.

phpwolf said:
Guys, one little question: when you say "it works" you say that your card is correctly initialized or you say that your card really works for everyday use? The discussion is only about functionallity? The stability doesn't matter?

Did you tried to run neverball game? Does it runs for 5 minutes or more? I asked this because in my case, even with the latest kernel sources, if I run neverball or I use firefox to browse some complex HTML pages (e.g. with .swf embedded) the system hangs up after a while.

I'm a little bit confused: you say that you have a STABLE system with kms?

Neverball still hangs up the system in about 30s.

Note: I hate neverball, ok No crashes after X minutes.? I'm not a fan of this game, I just test the patch with it.

X never crashes and games/neverball runs smooth. Perhaps it is because I did only compile with WITH_NEW_XORG and did not add WITH_KMS.

My system/config: dual-core 1.3GHz; AMD64; STABLE-9 (r237099); Mobile Intel GM45 Express Chipset; x11-wm/awesome WM.
 
phpwolf said:
So, is there anyone here who has a healthy X11 + KMS + 3D system that doesn't crashe after, let's say, one hour of normal use (or 30 seconds of neverball use)?

I don't know the 3D part. My Acer 1810TZ with G45 works healthy in FreeBSD 9-STABLE + KMS + NEW_XORG. I use this laptop average 5 hours per day.
 
Status
Not open for further replies.
Back
Top