Wednesday, January 09, 2008

DMA and Ubuntu

One of my readers is having a bit of a hard time with DVD playback, after reading my article:
Playing Encrypted DVD's in Ubuntu 7.10, he has been unable to get dvd's to playback smoothly.

One really common solution to slow, jerky, and unreliable playback is turning on DMA.
DMA stands for: Direct Memory Access. DMA allows a piece of hardware to talk directly with the RAM, reading and/or writing independent of the CPU (Central Processing Unit). In other words the hardware can use the system memory, bypassing the CPU, allowing the device to read and write much faster.

By default Ubuntu has DMA turned off (set to 0), this can be changed in the /etc/hdparm.conf file, like so:

  1. First make a backup of your hdpram file:# sudo cp /etc/hdparm.conf /etc/hdparm.conf.bak
  2. Now edit the file using your favourite text editor, I'm using gedit, however you can use the editor of you choice just change the following command to suit your needs: # sudo gedit /etc/hdparm.conf
  3. Once the file is open you will need to add the following at the end of the file:/dev/cdrom {
    dma = on
  4. Once you restart your computer you should have DMA turned on.

I have been reading about a number of problems with turning DMA on. Here are a couple of solutions if DMA still doesn't work after trying the instructions above:
First try re-editing the hdpram.conf file to read /dev/dvd instead of /dev/cdrom, then restart the computer.
If you are getting the error:
`HDIO set dma failed: operation not permitted'
You may need to edit your /etc/modules.conf file, for more information please see this forum thread: #post93238.
Personally none of my systems have these issues so I can't test this solution.

I hope this proves useful to someone, have fun.


Unknown said...

Just wanted to say nice blog and site! Good info too! I got here by looking up how to install MT4 on Ubuntu, and while you don't necessarily answer that, the site content certainly caught my eye anyway. Good work and all that good karma! :)

Anonymous said...

hi, Kris, tried, but no way with the dvd....
above goes the output for vlc if interests you....

thanks anyway!

caqui@aquitemcaqui:~$ vlc
VLC media player 0.8.6c Janus
libdvdnav: Using dvdnav version 0.1.10 from
libdvdread: Using libdvdcss version 1.2.5 for DVD access
libdvdnav: DVD Title: THE_RECRUIT
libdvdnav: DVD Serial Number: 2ec3a175
libdvdnav: DVD Title (Alternative):
libdvdnav: Unable to find map file '/home/caqui/.dvdnav/'
libdvdnav: DVD disk reports itself with Region mask 0x00f60000. Regions: 1 4

libdvdread: Attempting to retrieve all CSS keys
libdvdread: This can take a _long_ time, please be patient

libdvdread: Get key for /VIDEO_TS/VIDEO_TS.VOB at 0x0000012a
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_01_0.VOB at 0x000007c9
libdvdread: Error cracking CSS key for /VIDEO_TS/VTS_01_0.VOB (0x000007c9)
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_01_1.VOB at 0x0002f97b
libdvdread: Elapsed time 3
libdvdread: Get key for /VIDEO_TS/VTS_02_1.VOB at 0x003128d5
libdvdread: Error cracking CSS key for /VIDEO_TS/VTS_02_1.VOB (0x003128d5)!!
libdvdread: Elapsed time 0
libdvdread: Get key for /VIDEO_TS/VTS_03_1.VOB at 0x00330b54
libdvdread: Error cracking CSS key for /VIDEO_TS/VTS_03_1.VOB (0x00330b54)!!
libdvdread: Elapsed time 0
libdvdread: Found 3 VTS's
libdvdread: Elapsed time 3
libdvdnav: ifoRead_TITLE_VOBU_ADMAP vtsi failed - CRASHING
vlc: vm.c:218: ifoOpenNewVTSI: Afirmação `0' falhou.
Cancelado (core dumped)

Kris said...

Thank you lonervamp for your kind comments.
I love hearing from my readers, especially when they have such lovely things to say! ;-)
Cheers Kris

Kris said...

Gee caqui, I'm not sure what to try next. I thought that DMA would work.
According to my research there are some computers on which dvd playback just doesn't work, it looks as though yours may be one of these.

Unfortunately there doesn't seem to be a simple solution.
I'm really sorry, I will continue to look, and should I come across a solution I'll be sure to email you.
Thank you for your patience, take care!
Cheers Kris

Anonymous said...

thank you again, kris! I think the problem must be my computer too....i forgot to tell you that is a aspire 5100 laptop. I think ubuntu is not the best shot to this machine. A friend of mine runs everything just well on his desktop!

do you have any idea how to install flash 9 in amd 64? i tried the tip at ubuntu foruns but it just didn't work...

you are been very helpfull!

see you

Kris said...

Hiya Caqui,
I'm sorry to hear this about your laptop. Laptops are certainly very fickle when it comes to what works and what doesn't.
My laptop is an old one, and yet I still find that most things don't work, and others kinda work but with very heavy work arounds.
This is not good enough I know, yet I do understand the problems open source have.

Unfortunately I don't have any 64bit machines. So I wouldn't even know where to begin.
The Ubuntu Guide site does have a howto on this here:
Flash 9 on 64 bits system (x86_64).
Let me know how you go with it.
I hope it helps.
Take care Kris

Anonymous said...

i luckly found a tutorial about the flash at

it is simple and works perfectly (you just have to understand portuguese...hehe)


Anonymous said...

Mackenzie said...

Turn off Compiz. when you do "hdparm -i /dev/cdrom" or whatever device it is and it shows dma enabled but it's still kitchy, turn off Compiz. I read somewhere that someone got it to work fine after turning off fglrx, so I turned off Compiz as I was trying to make MythTV work right, and it did the trick.

Anonymous said...

good post, this is something I always have to do manually after an install (and sometimes I forget to do it!) Nice to see the *bsd banners as well! Would love to visit Tasmania one day...