This page describes how changes can be ported between xf86-video-amdgpu and xf86-video-ati, preserving the original changes as much as possible. This is important because it makes it easy to compare the Git histories of the two drivers.

The examples below are for porting a change from amdgpu to radeon. When porting in the opposite direction, the steps have to be adapted accordingly.

Adding the other driver's repository as a remote

git remote add amdgpu git://anongit.freedesktop.org/xorg/driver/xf86-video-amdgpu

Looking at the changes available in the other driver's repository

gitk ..amdgpu/master &

Trying to cherry pick a change to be ported

git cherry-pick -x <commit>

At the very least, this should create a commit with the original log and other metadata of the original commit preserved. It may also manage to actually apply some parts of the original change to the code, though it'll usually need to be fixed up manually, e.g. to convert identifiers between amdgpu/radeon.

Get rid of files which only exist in the other driver's repository:

git rm src/amdgpu_*

Porting the rest of the changes

Create a temporary patch file for the original change:

git show <commit> >/tmp/<commit>.diff

Remove any hunks which were already applied by git cherry-pick. The following scripts may be helpful for converting at least some of the remaining hunks:

https://people.freedesktop.org/~daenzer/convert-patch-amdgpu-radeon-untabify.sh

https://people.freedesktop.org/~daenzer/convert-patch-amdgpu-radeon.sh

https://people.freedesktop.org/~daenzer/convert-patch-radeon-amdgpu-tabify.sh

https://people.freedesktop.org/~daenzer/convert-patch-radeon-amdgpu.sh

For example:

convert-patch-amdgpu-radeon.sh </tmp/<commit>.diff | patch -p1 --dry-run

(remove --dry-run to actually apply the converted changes)

For hunks which don't apply directly after conversion by a script, one can compare the patch file and the code it should apply to side by side. There are two possible strategies from there:

  • Tweak the patch file until it can be applied after conversion by a script
  • Apply the changes to the code manually

Choose the better strategy on a hunk by hunk basis.

Amending the commit log

Once all hunks have been ported and the resulting code compiles without warnings and works,

git add <any files with conflicts from git cherry-pick>
git commit --amend

In order to link the ported change to the original one, the commit log should be amended with something like:

(Ported from amdgpu commit <commit>)
Signed-off-by: <name and e-mail of person who ported the change>