On 03.07.2015 17:16, Grigori Goronzy wrote:
On 2015-07-03 05:30, Michel Dänzer wrote:
On resume, the cursor BO is currently pinned again by radeon_cursor_reset -> radeon_set_cursor. However, radeon_cursor_reset is also called when changing the video mode, in which case it causes the cursor BO pin count to increase by 1 for each CRTC using it. Presumably, the mouse cursor would end up broken again on suspend/resume after that for you.
Indeed. It seems to be problematic overall that radeon_cursor_reset does unconditionally increment the pin count. As soon as a mode is switched with cursor enabled, the cursor BO will stay pinned forever.
Exactly, so we can't ignore that for this fix.
We need a solution which pins the BO again on resume but doesn't increase the pin count during a mode change. I'm not sure right now what the best way is to achieve that, I'll think about it more later.
How about this:
Never let radeon_set_cursor mess with the pin count, do that in radeon_crtc_cursor_set2 only, and make sure that the reference^Wpin count is updated accordingly (i.e. exactly one pin per crtc). Then add some explicit cursor resume code that traverses the crtc list and re-pins as needed. Maybe that that nice, but should work.
Sounds good. I probably won't get around to playing with this before next week, feel free to give it a try in the meantime.