6

I am trying to get my way around on graphics driver development, in this case for modifications on a DRM kernel module, called gma500_gfx.

Every time when I have made a change to this driver, I start a script which compiles and replaces the previous kernel module (by a cp command), and restarts the Linux distro (Lubuntu).

I am unable to reload this graphics driver module without restarting Linux (yet). The commands modprobe and rmmod always give me a 'module in use' error.

modprobe gma500_gfx -r
modprobe: FATAL: Module gma500_gfx is in use.

When I look at the dependencies I get the following list.

gma500_gfx            185579  2 
drm_kms_helper         48716  1 gma500_gfx
drm                   298219  3 drm_kms_helper,gma500_gfx
video                  19370  2 acer_wmi,gma500_gfx
i2c_algo_bit           13413  1 gma500_gfx

I am also unable to unload any of these dependencies, which give the same error. Other things that I have tried before the modprobe, but which are unsuccesful:

  • Go to a single user environment by "init 1"
  • Shutdown lightdm by "/etc/init.d/lightdm stop" (which reduces the refcount by 1 to 1)

Does anybody know a faster way to reload the graphics driver module than restarting the Linux distribution?

Arthur Borsboom
  • 331
  • 1
  • 2
  • 7

1 Answers1

2

After a lot of research, I have found the two references that keep the module from unloading and how to reload the module. The two things holding a lock are:

  1. LightDM, a lightweight X display manager
  2. The generic framebuffer framework

To remove the locks respectively:

  1. sudo /etc/init.d/lightdm stop
  2. echo 0 > /sys/class/vtconsole/vtcon1/bind

However, the second option unbinds the framebuffer framework from the gma500_gfx driver, which stops the screen output. So, it is better to combine nr. 2 with a script to unbind, unload the module, reset the screen and load the module again. AFAIK, I have to run this from a console.

#!/bin/bash
echo 0 > /sys/class/vtconsole/vtcon1/bind
modprobe -r gma500_gfx
modprobe gma500_gfx
/etc/init.d/lightdm start

Preferably I would like to have 1 restart-script, which I can run directly from LightDM, which reloads the driver and restores the session. I have not been able to do this yet, however that is a different topic than the question above. Any suggestions for doing that, would make me happy. :)

Avinash Raj
  • 80,446
Arthur Borsboom
  • 331
  • 1
  • 2
  • 7