Issue with Xorg memory leak with Radeon fglrx proprietary drivers

I decided to try the open source drivers for my Radeon HD 7770, because I had an issue with Xorg memory leak that seems related with the AMD Catalyst proprietary drivers.

You can read about the memory leak bug in the following links:

https://bugs.launchpad.net/ubuntu/+source/fglrx-installer/+bug/1314787

https://bugs.launchpad.net/ubuntu/+source/fglrx-installer/+bug/1354350

So, in case this helps someone, here are the steps in Debian 8 to revert to the open source drivers and configure dual monitors:

Reverting to the open source drivers

First, if you have installed the proprietary drivers fglrx, you can revert to the open source drivers as follows:

Revert to open source graphics drivers

sudo apt-get purge "fglrx.*"  #  remove proprietary drivers
sudo rm /etc/X11/xorg.conf    #  remove old Xserver config

## Reinstall open source drivers

sudo apt-get install --reinstall xserver-xorg-core \
libgl1-mesa-glx:i386 libgl1-mesa-dri:i386 \
libgl1-mesa-glx:amd64 libgl1-mesa-dri:amd64

sudo dpkg-reconfigure xserver-xorg   # reconfig Xserver

sudo reboot

Radeon HD 7700 with open source radeon drivers, install the correct firmware in Debian 8

Debian Wiki AtiHowTo says to install firmware-linux-nonfree, but that did not work well for me.

instead of firmware-linux-nonfree I installed firmware-amd-graphics

apt-get install firmware-amd-graphics   libgl1-mesa-dri   xserver-xorg-video-ati

firmware-amd-graphics is not compatible with firmware-linux-nonfree, so apt-get will uninstall firmware-linux-nonfree before installing firmware-amd-graphics

reboot and then

dmesg should display the firmware/microcode used by the radeon DRM driver:

dmesg | grep radeon
[    2.790368] [drm] radeon kernel modesetting enabled.
[    2.795679] radeon 0000:01:00.0: VRAM: 1024M 0x0000000000000000 - 0x000000003FFFFFFF (1024M used)
[    2.795681] radeon 0000:01:00.0: GTT: 1024M 0x0000000040000000 - 0x000000007FFFFFFF
[    2.795738] [drm] radeon: 1024M of VRAM memory ready
[    2.795739] [drm] radeon: 1024M of GTT memory ready.
[    2.800032] radeon 0000:01:00.0: firmware: direct-loading firmware radeon/VERDE_pfp.bin
[    2.808456] radeon 0000:01:00.0: firmware: direct-loading firmware radeon/VERDE_me.bin
[    2.816542] radeon 0000:01:00.0: firmware: direct-loading firmware radeon/VERDE_ce.bin
[    2.824501] radeon 0000:01:00.0: firmware: direct-loading firmware radeon/VERDE_rlc.bin
[    2.827818] radeon 0000:01:00.0: firmware: direct-loading firmware radeon/VERDE_mc2.bin
...

and the output of xrandr should display the 2 monitors:

xrandr -q

Screen 0: minimum 320 x 200, current 3840 x 1080, maximum 16384 x 16384
DisplayPort-0 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 510mm x 287mm
   1920x1080     60.00*+  50.00    59.94
   1680x1050     59.88
   1600x900      59.98
   1280x1024     75.02    60.02
   1440x900      59.90
   1280x800      59.91
   1152x864      75.00
   1280x720      60.00    50.00    59.94
   1024x768      75.08    70.07    60.00
   832x624       74.55
   800x600       72.19    75.00    60.32    56.25
   720x576       50.00
   720x480       60.00    59.94
   640x480       75.00    72.81    66.67    60.00    59.94
   720x400       70.08
DVI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 510mm x 290mm
   1920x1080     60.00*+
   1680x1050     59.88
   1400x1050     59.95
   1600x900      59.98
   1280x1024     75.02    60.02
   1440x900      59.90
   1280x800      59.91
   1152x864      75.00
   1280x720      59.97
   1024x768      75.08    60.00
   832x624       74.55
   800x600       75.00    60.32    56.25
   640x480       75.00    60.00
   720x400       70.08
DVI-1 disconnected (normal left inverted right x axis y axis)

Configuring the Dual monitors

Depending on your desktop environment, it is possible that X still displays the same content mirrored in both monitors (instead of expanding the desktop)

Desktops like gnome and kde have their own tools to configure the dual monitors desktop.

If you are using a minimal desktop like awesome window manager , and you need a simple application to configure the dual monitors, you can try arandr that is a gui interface to xrandr.

arandr will allow you to use a gui to select the position of the monitors, and it will generate a bash script invoking xrandr with the correct parameters that we can use anytime.

apt-get install  arandr

Here is a sample bash script that is produced by arandr to configure the dual monitors on my PC:

#!/bin/sh

# script to configure dual monitors with xrandr
# it starts 1 monitor at pos 0x0,  and 2nd monitor at pos 1920x0

xrandr --output DisplayPort-0 --off --output DVI-1 --off \
--output DVI-0 --mode 1920x1080 --pos 0x0 --rotate normal \
--output HDMI-0 --mode 1920x1080 --pos 1920x0 --rotate normal