# radeon hd 4250 3d acceleration, dri, drm and all that?



## cL0N31 (Oct 15, 2011)

i've got this 880g chipset with the radeon hd 4250 video onboard... flash animations, games and stuff like that lag... can someone point me on how to? thanks

```
Section "ServerLayout"
	Identifier     "X.org Configured"
	Screen      0  "Screen0" 0 0
	InputDevice    "Mouse0" "CorePointer"
	InputDevice    "Keyboard0" "CoreKeyboard"
	Option		"DontZap"		"0"
	Option		"AllowEmptyInput"	"0"
	Option		"AutoAddDevices"	"0"
EndSection

Section "Files"
	ModulePath   "/usr/local/lib/xorg/modules"
	FontPath     "/usr/local/lib/X11/fonts/misc/"
	FontPath     "/usr/local/lib/X11/fonts/TTF/"
	FontPath     "/usr/local/lib/X11/fonts/OTF"
	FontPath     "/usr/local/lib/X11/fonts/Type1/"
	FontPath     "/usr/local/lib/X11/fonts/100dpi/"
	FontPath     "/usr/local/lib/X11/fonts/75dpi/"
EndSection

Section "Module"
	Load  "extmod"
	Load  "record"
	Load  "dbe"
	Load  "glx"
	Load  "dri"
	Load  "dri2"
EndSection

Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "kbd"
	Option		"XkbOptions"		"terminate:ctrl_alt_bksp,grp:ctrl_shift_toggle"
	Option		"XkbLayout"		"us,ru"
EndSection

Section "InputDevice"
	Identifier  "Mouse0"
	Driver      "mouse"
	Option	    "Protocol" "auto"
	Option	    "Device" "/dev/sysmouse"
	Option	    "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
	#DisplaySize	  340   270	# mm
	Identifier   "Monitor0"
	VendorName   "NEC"
	ModelName    "LCD72VX"
	HorizSync    31.0 - 81.0
	VertRefresh  56.0 - 75.0
	Option	    "DPMS"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
        ### [arg]: arg optional
        #Option     "NoAccel"            	# [<bool>]
        #Option     "SWcursor"           	# [<bool>]
        #Option     "Dac6Bit"            	# [<bool>]
        #Option     "Dac8Bit"            	# [<bool>]
        #Option     "BusType"            	# [<str>]
        #Option     "CPPIOMode"          	# [<bool>]
        #Option     "CPusecTimeout"      	# <i>
        #Option     "AGPMode"            	# <i>
        #Option     "AGPFastWrite"       	# [<bool>]
        #Option     "AGPSize"            	# <i>
        #Option     "GARTSize"           	# <i>
        #Option     "RingSize"           	# <i>
        #Option     "BufferSize"         	# <i>
        #Option     "EnableDepthMoves"   	# [<bool>]
        #Option     "EnablePageFlip"     	# [<bool>]
        #Option     "NoBackBuffer"       	# [<bool>]
        #Option     "DMAForXv"           	# [<bool>]
        #Option     "FBTexPercent"       	# <i>
        #Option     "DepthBits"          	# <i>
        #Option     "PCIAPERSize"        	# <i>
        #Option     "AccelDFS"           	# [<bool>]
        #Option     "IgnoreEDID"         	# [<bool>]
        #Option     "CustomEDID"         	# [<str>]
        #Option     "DisplayPriority"    	# [<str>]
        #Option     "PanelSize"          	# [<str>]
        #Option     "ForceMinDotClock"   	# <freq>
        #Option     "ColorTiling"        	# [<bool>]
        #Option     "VideoKey"           	# <i>
        #Option     "RageTheatreCrystal" 	# <i>
        #Option     "RageTheatreTunerPort" 	# <i>
        #Option     "RageTheatreCompositePort" 	# <i>
        #Option     "RageTheatreSVideoPort" 	# <i>
        #Option     "TunerType"          	# <i>
        #Option     "RageTheatreMicrocPath" 	# <str>
        #Option     "RageTheatreMicrocType" 	# <str>
        #Option     "ScalerWidth"        	# <i>
        #Option     "RenderAccel"        	# [<bool>]
        #Option     "SubPixelOrder"      	# [<str>]
        #Option     "ClockGating"        	# [<bool>]
        #Option     "VGAAccess"          	# [<bool>]
        #Option     "ReverseDDC"         	# [<bool>]
        #Option     "LVDSProbePLL"       	# [<bool>]
        #Option     "AccelMethod"        	# <str>
        #Option     "DRI"                	# [<bool>]
        #Option     "ConnectorTable"     	# <str>
        #Option     "DefaultConnectorTable" 	# [<bool>]
        #Option     "DefaultTMDSPLL"     	# [<bool>]
        #Option     "TVDACLoadDetect"    	# [<bool>]
        #Option     "ForceTVOut"         	# [<bool>]
        #Option     "TVStandard"         	# <str>
        #Option     "IgnoreLidStatus"    	# [<bool>]
        #Option     "DefaultTVDACAdj"    	# [<bool>]
        #Option     "Int10"              	# [<bool>]
        #Option     "EXAVSync"           	# [<bool>]
        #Option     "ATOMTVOut"          	# [<bool>]
        #Option     "R4xxATOM"           	# [<bool>]
        #Option     "ForceLowPowerMode"  	# [<bool>]
        #Option     "DynamicPM"          	# [<bool>]
        #Option     "NewPLL"             	# [<bool>]
        #Option     "ZaphodHeads"        	# <str>
	Identifier  "Card0"
	Driver      "radeon"
	VendorName  "ATI Technologies Inc"
	BoardName   "RS880 [Radeon HD 4250]"
	BusID       "PCI:1:5:0"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	SubSection "Display"
		Viewport   0 0
		Depth     1
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     4
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     8
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     15
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     16
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection
```


----------



## adamk (Oct 15, 2011)

What's the output of [cmd=]glxinfo | grep -i render[/cmd]
?

EDIT:  And please show us your /var/log/Xorg.0.log file too.

Adam


----------



## wblock@ (Oct 16, 2011)

cL0N31 said:
			
		

> i've got this 880g chipset with the radeon hd 4250 video onboard... flash animations, games and stuff like that lag...



"Lag" as in "doesn't do things until I move the mouse?"



> ```
> Section "ServerLayout"
> Identifier     "X.org Configured"
> Screen      0  "Screen0" 0 0
> ...



AllowEmptyInput, FreeBSD, and Xorg Input

Short version: delete that line with the strike-through.  It's actively bad.  It causes input lag.

Using "Off" instead of "0" is more readable.

Adding a DRI section shouldn't hurt:

```
Section "DRI"
        Group 0
        Mode  0660
EndSection
```

Put your /var/log/Xorg.0.log on pastebin.com and post the link here.


----------



## cL0N31 (Oct 16, 2011)

3d xscreensavers lag and hedgewars lag unbelievably, doesn't matter if i move mouse or not

http://pastebin.com/cHymdY45

with


```
Section "ServerLayout"
	Identifier     "X.org Configured"
	Screen      0  "Screen0" 0 0
	InputDevice    "Mouse0" "CorePointer"
	InputDevice    "Keyboard0" "CoreKeyboard"
	Option		"DontZap"		"0"
	Option		"AutoAddDevices"	"0"
EndSection

Section "Files"
	ModulePath   "/usr/local/lib/xorg/modules"
	FontPath     "/usr/local/lib/X11/fonts/misc/"
	FontPath     "/usr/local/lib/X11/fonts/TTF/"
	FontPath     "/usr/local/lib/X11/fonts/OTF"
	FontPath     "/usr/local/lib/X11/fonts/Type1/"
	FontPath     "/usr/local/lib/X11/fonts/100dpi/"
	FontPath     "/usr/local/lib/X11/fonts/75dpi/"
EndSection

Section "Module"
	Load  "extmod"
	Load  "record"
	Load  "dbe"
	Load  "glx"
	Load  "dri"
	Load  "dri2"
EndSection

Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "kbd"
	Option		"XkbOptions"		"terminate:ctrl_alt_bksp,grp:ctrl_shift_toggle"
	Option		"XkbLayout"		"us,ru"
EndSection

Section "InputDevice"
	Identifier  "Mouse0"
	Driver      "mouse"
	Option	    "Protocol" "auto"
	Option	    "Device" "/dev/sysmouse"
	Option	    "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
	#DisplaySize	  340   270	# mm
	Identifier   "Monitor0"
	VendorName   "NEC"
	ModelName    "LCD72VX"
	HorizSync    31.0 - 81.0
	VertRefresh  56.0 - 75.0
	Option	    "DPMS"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
        ### [arg]: arg optional
        #Option     "NoAccel"            	# [<bool>]
        #Option     "SWcursor"           	# [<bool>]
        #Option     "Dac6Bit"            	# [<bool>]
        #Option     "Dac8Bit"            	# [<bool>]
        #Option     "BusType"            	# [<str>]
        #Option     "CPPIOMode"          	# [<bool>]
        #Option     "CPusecTimeout"      	# <i>
        #Option     "AGPMode"            	# <i>
        #Option     "AGPFastWrite"       	# [<bool>]
        #Option     "AGPSize"            	# <i>
        #Option     "GARTSize"           	# <i>
        #Option     "RingSize"           	# <i>
        #Option     "BufferSize"         	# <i>
        #Option     "EnableDepthMoves"   	# [<bool>]
        #Option     "EnablePageFlip"     	# [<bool>]
        #Option     "NoBackBuffer"       	# [<bool>]
        #Option     "DMAForXv"           	# [<bool>]
        #Option     "FBTexPercent"       	# <i>
        #Option     "DepthBits"          	# <i>
        #Option     "PCIAPERSize"        	# <i>
        #Option     "AccelDFS"           	# [<bool>]
        #Option     "IgnoreEDID"         	# [<bool>]
        #Option     "CustomEDID"         	# [<str>]
        #Option     "DisplayPriority"    	# [<str>]
        #Option     "PanelSize"          	# [<str>]
        #Option     "ForceMinDotClock"   	# <freq>
        #Option     "ColorTiling"        	# [<bool>]
        #Option     "VideoKey"           	# <i>
        #Option     "RageTheatreCrystal" 	# <i>
        #Option     "RageTheatreTunerPort" 	# <i>
        #Option     "RageTheatreCompositePort" 	# <i>
        #Option     "RageTheatreSVideoPort" 	# <i>
        #Option     "TunerType"          	# <i>
        #Option     "RageTheatreMicrocPath" 	# <str>
        #Option     "RageTheatreMicrocType" 	# <str>
        #Option     "ScalerWidth"        	# <i>
        #Option     "RenderAccel"        	# [<bool>]
        #Option     "SubPixelOrder"      	# [<str>]
        #Option     "ClockGating"        	# [<bool>]
        #Option     "VGAAccess"          	# [<bool>]
        #Option     "ReverseDDC"         	# [<bool>]
        #Option     "LVDSProbePLL"       	# [<bool>]
        #Option     "AccelMethod"        	# <str>
        #Option     "DRI"                	# [<bool>]
        #Option     "ConnectorTable"     	# <str>
        #Option     "DefaultConnectorTable" 	# [<bool>]
        #Option     "DefaultTMDSPLL"     	# [<bool>]
        #Option     "TVDACLoadDetect"    	# [<bool>]
        #Option     "ForceTVOut"         	# [<bool>]
        #Option     "TVStandard"         	# <str>
        #Option     "IgnoreLidStatus"    	# [<bool>]
        #Option     "DefaultTVDACAdj"    	# [<bool>]
        #Option     "Int10"              	# [<bool>]
        #Option     "EXAVSync"           	# [<bool>]
        #Option     "ATOMTVOut"          	# [<bool>]
        #Option     "R4xxATOM"           	# [<bool>]
        #Option     "ForceLowPowerMode"  	# [<bool>]
        #Option     "DynamicPM"          	# [<bool>]
        #Option     "NewPLL"             	# [<bool>]
        #Option     "ZaphodHeads"        	# <str>
	Identifier  "Card0"
	Driver      "radeon"
	VendorName  "ATI Technologies Inc"
	BoardName   "RS880 [Radeon HD 4250]"
	BusID       "PCI:1:5:0"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	SubSection "Display"
		Viewport   0 0
		Depth     1
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     4
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     8
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     15
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     16
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection

Section "DRI"
	Group	0
	Mode	0660
EndSection
```


----------



## cL0N31 (Oct 16, 2011)

```
$ glxinfo | grep -i render
direct rendering: Yes
OpenGL renderer string: Software Rasterizer
```


----------



## wblock@ (Oct 16, 2011)

And here's why:

```
drmOpenDevice: Open failed
[drm] failed to load kernel module "radeon"
```

But what caused that?  Please check that this matches:

```
% pkg_info -Ix dri-
dri-7.6.1,2         OpenGL hardware acceleration drivers for the DRI
```

Running pkg_libchk(1) from sysutils/bsdadminscripts would show library problems.


----------



## adamk (Oct 16, 2011)

Since the kernel module is part of the base system, and not any part of ports, I'd think that the version of the dri port the OP has installed doesn't actually play any role.  The port only includes the Mesa drivers.

Instead, I'd guess that this is due to PCI ID 9715 not being listed in /usr/src/sys/dev/drm/drm_pciids.h.

I wonder if the fix is as simple as adding an entry for it and recompiling the DRM drivers (or the entire kernel)?

EDIT:  Alright, so it's in /usr/src/sys/dev/drm/drm_pciids.h in -CURRENT.  I wonder if it's in 8.2...


----------



## wblock@ (Oct 16, 2011)

Maybe time for an import from upstream, but their wiki is remarkably poor.  I tried and failed to locate the latest version of the drm_pciids.txt file to see if it was already in there.


----------



## cL0N31 (Oct 16, 2011)

i have dri-7.4.4,2

wow... ok, i guess i could try editing the file manually and recompiling the drivers

here's the default 8.2's file as i have it http://pastebin.com/8cN10QCs


----------



## adamk (Oct 16, 2011)

Well I can confirm that 0x9715 is in /usr/src/sys/dev/drm/drm_pciids.h on -CURRENT and isn't in /usr/src/sys/dev/drm/drm_pciids.h on 8.2.  I do not know about -STABLE.

Importing from upstream isn't going to do any good in this specific case since the PCI ID has already been added to -CURRENT.  And importing from upstream might do more harm than good if PCI IDs get added that only work with KMS.  Also, in this case, upstream is the Linux kernel, since that's where all DRM development is done these days.

To the OP:  You can try simply adding your PCI ID to the aforementioned file.  Should be rather simple.

Also, since you are using an older version of the DRI port, make sure you have WITHOUT_NOUVEAU set to yes in /etc/make.conf and then rebuild the DRI and libdrm ports.


----------



## cL0N31 (Oct 16, 2011)

how come i have an older version? check this out: http://www.freshports.org/graphics/dri/

can you please post a line to the drm_pciids.h for me?


----------



## adamk (Oct 16, 2011)

You have an older version of the DRI port because you didn't define 
	
	



```
WITHOUT_NOUVEAU=yes
```
 in your /etc/make.conf file (and please note that it is WITHOUT_NOUVEAU, not WITH_NOUVEAU like I originally said above).  dri 7.6.1 should be the default, frankly, and not require some special option in /etc/make.conf.  I asked about that on one of the mailing lists a while back and though I don't remember the explanation I was given, I vaguely recall it being a non-answer.

This is the line from drm_pciids.h on -CURRENT:


```
{0x1002, 0x9715, CHIP_RS880|RADEON_NEW_MEMMAP|RADEON_IS_IGP, "ATI Radeon HD 4250"},
```

EDIT:  Not sure if it matters, but on -CURRENT it goes after the entry for 0x9714, not surprisingly.


----------



## cL0N31 (Oct 16, 2011)

i added the line to make.conf and added the line to drm_pciids.h accordingly, rebooted, updated dri to dri-7.6.1,2 ... rebooted, it still the same, OpenGL renderer string: Software Rasterizer and hedgewars lags as before... here's my log now http://pastebin.com/DMfbqrkA


----------



## wblock@ (Oct 16, 2011)

It's in 8-STABLE, which might have other necessary improvements.  See the Handbook or Upgrading FreeBSD To -STABLE.

After that, you can get the later version of the libraries by adding

```
WITHOUT_NOUVEAU=yes
```
to /etc/make.conf.


----------



## wblock@ (Oct 16, 2011)

cL0N31 said:
			
		

> i added the line to make.conf and added the line to drm_pciids.h accordingly, rebooted,



At minimum, you'd have to rebuild the library (make, make install).


----------



## adamk (Oct 16, 2011)

It's not just a library, but also the radeon kernel module that has to be rebuilt.

Adam


----------



## cL0N31 (Oct 16, 2011)

Ok, what library do I need to rebuild? To rebuild the kernel module, I assume I need to rebuild the radeon driver, right?


----------



## adamk (Oct 16, 2011)

To rebuild the kernel module, you need to run [cmd=""]make[/cmd] in /usr/src/sys/modules/drm/radeon followed by [cmd=""]make install[/cmd]

The other parts you need to rebuild are ports...  graphics/dri and graphics/libdrm.  You only need to rebuild them if you have not already done so since adding 
	
	



```
WITHOUT_NOUVEAU=yes
```
 to /etc/make.conf

Adam


----------



## cL0N31 (Oct 18, 2011)

i've rebuilt the radeon module, now i get this

```
$ glxinfo |grep render
unknown chip id 0x9715, can't guess.
direct rendering: Yes
OpenGL renderer string: Software Rasterizer
```


----------



## adamk (Oct 18, 2011)

Did you rebuild graphics/dri after setting WITHOUT_NOUVEAU?  I wonder if that PCI ID is too new for mesa 7.6 now...

Let's make sure the DRM driver attached properly.  What's the output of [cmd=""]dmesg | grep drm[/cmd]?  Can you show us you new Xorg log file?


----------



## cL0N31 (Oct 18, 2011)

i went to update everything with portmaster after i added WITHOUT_NOUVEAU=yes ... it resulted in building and installing the newer dri...

Xorg.0.log http://pastebin.com/BnuTf5XL


```
$ dmesg | grep drm
drm0: <ATI Radeon HD 4250> on vgapci0
info: [drm] MSI enabled 1 message(s)
vgapci0: child drm0 requested pci_enable_busmaster
info: [drm] Initialized radeon 1.31.0 20080613
info: [drm] Setting GART location based on new memory map
info: [drm] Loading RS780/RS880 Microcode
info: [drm] Resetting GPU
info: [drm] writeback test succeeded in 1 usecs
drm0: [ITHREAD]
info: [drm] Resetting GPU
info: [drm] Setting GART location based on new memory map
info: [drm] Loading RS780/RS880 Microcode
info: [drm] Resetting GPU
info: [drm] writeback test succeeded in 1 usecs
drm0: [ITHREAD]
info: [drm] Resetting GPU
info: [drm] Setting GART location based on new memory map
info: [drm] Loading RS780/RS880 Microcode
info: [drm] Resetting GPU
info: [drm] writeback test succeeded in 1 usecs
drm0: [ITHREAD]
```


----------



## phoenix (Oct 18, 2011)

With a Radeon HD chipset, wouldn't you want to use the x11-drivers/xf86-video-radeonhd port and change the driver name in xorg.conf to "*radeonhd*" instead of "*radeon*"?


----------



## adamk (Oct 18, 2011)

No.  The radeonhd driver is no longer developed and completely unsupported.  The only thing radeonhd supports on FreeBSD, that is unsupported by the radeon driver, is HDMI audio (which requires KMS with radeon).


----------



## cL0N31 (Oct 18, 2011)

hedgewars still lag mad... why would it lag at this point, it doesn't use mesagl


----------



## phoenix (Oct 18, 2011)

adamk said:
			
		

> No.  The radeonhd driver is no longer developed and completely unsupported.  The only thing radeonhd supports on FreeBSD, that is unsupported by the radeon driver, is HDMI audio (which requires KMS with radeon).



Ah.  Did not know that.  Thanks for the info.


----------



## cL0N31 (Oct 23, 2011)

i guess this is why:

http://www.freebsd.org/cgi/query-pr.cgi?pr=149041



> While Xv works now, 3D acceleration does not, unfortunately.
> But I think this is a different issue; I guess the chip is
> not yet supported by the GL code (but I'm not an expert in
> this area).


----------



## adamk (Oct 23, 2011)

That would explain slow 3D, but not slow 2D.  I believe there is a separate ports tree that has newer Xorg/Mesa components that might give you accelerated 3D, but I don't know much about it.  The freebsd-x11 mailing list archives probably mentions it.

Adam


----------



## felippico (Oct 31, 2011)

Have you compiled and installed the kernel after adding the line to drm_pciids.h? I have the same card and 2/3d is working, this is my xorg.conf: http://pastebin.com/0QhVHWvh

Fabrizio


----------



## ring_zero (Nov 11, 2011)

Everyone, I just wanted to say thank you to all of you for starting this thread and posting the great advice here.  I have spent the last 78 hours on two different machines trying to get this to work, and thanks to the advice in this thread, I have finally gotten it to work correctly.

Once again,

Thank you all.


----------



## wblock@ (Nov 11, 2011)

ring_zero said:
			
		

> Everyone, I just wanted to say thank you to all of you for starting this thread and posting the great advice here.  I have spent the last 78 hours on two different machines trying to get this to work, and thanks to the advice in this thread, I have finally gotten it to work correctly.



Excellent!  If you could post a summary of what was needed, it might help the next person with the same problem.  Thanks!


----------



## ring_zero (Nov 18, 2011)

*Summary*

To sum it up:

Edit /etc/make.conf and add the line 
	
	



```
WITHOUT_NOUVEAU=YES
```

Build the module: `# cd /usr/src/sys/modules/drm/radeon && make && make install`
Load the module (*): `# kldload radeon`
Install the port: `# cd /usr/ports/graphics/dri && make && make install`
Check that GLX is enabled: `$ glxinfo | grep OpenGL`  Check that "Software Rasterizer" is no longer present in the Rendering string.  Instead you should have something like this: ATI Radeon HD 4250

* I had to build and load the module first in order to get mesa to build.  It would not do so otherwise.

I did not run into the pciid issue.


----------

