amdgpu_do_pageflip() indexed the flipdata->fb array indexing over config->num_crtc, but the flip completion routines, e.g., drmmode_flip_handler(), index that array via the crtc hw id from drmmode_get_crtc_id(crtc).
This is mismatched and causes indexing into the wrong array slot at flip completion -> Server crash.
Always use drmmode_get_crtc_id(crtc) for indexing into the array to fix this.
Tested on a dual-X-Screen setup with one video output assigned to each X-Screen, page-flipping an OpenGL app on either of both X-Screens. This used to crash when flipping on X-Screen 1, now it doesn't anymore.
Fixes: 9b6782c8 "Store FB for each CRTC in drmmode_flipdata_rec" (Ported from radeon commit 0058fd2ebf4c900b12f129984e98886a7ac84b2f) Reviewed-by: Michel Dänzer firstname.lastname@example.org Signed-off-by: Mario Kleiner email@example.com