This patch has been rebased onto amd-staging-4.9. It would be useful to have this patch outside the drm-next-4.12-wip branch as it would unblock submission of the corresponding libdrm and mesa patches. Splitting this off as it is my understanding that drm-next-4.12-wip may take a while to land on drm-next due to some KIQ regressions.