On Fri, Jan 06, 2023 at 09:30:56PM +0100, Daniel Vetter wrote: > On Fri, Jan 06, 2023 at 11:33:06AM -0800, Brian Norris wrote: > > On Fri, Jan 06, 2023 at 07:17:53PM +0100, Daniel Vetter wrote: > > > - check that drivers which use self_refresh are not using > > > drm_atomic_helper_wait_for_vblanks(), because that would defeat the > > > point > > > > I'm a bit lost on this one. drm_atomic_helper_wait_for_vblanks() is part > > of the common drm_atomic_helper_commit_tail*() helpers, and so it's > > naturally used in many cases (including Rockchip/PSR). And how does it > > defeat the point? > > Yeah, but that's for backwards compat reasons, the much better function is > drm_atomic_helper_wait_for_flip_done(). And if you go into self refresh > that's really the better one. My knowledge is certainly going to diminish once you talk about backwards compat for drivers I'm very unfamiliar with. Are you suggesting I can change the default drm_atomic_helper_commit_tail{,_rpm}() to use drm_atomic_helper_wait_for_flip_done()? (Or, just when self_refresh_active==true?) I can try to read through drivers for compatibility, but I may be prone to breaking things. Otherwise, I'd be copy/paste/modifying the generic commit helpers. > > > - have a drm_crtc_vblank_off/on which take the crtc state, so they can > > > look at the self-refresh state > > > > And I suppose you mean this helper variant would kick off the next step > > (fake vblank timer)? > > Yeah, I figured that's the better way to implement this since it would be > driver agnostic. But rockchip is still the only driver using the > self-refresh helpers, so I guess it doesn't really matter. I've run into enough gotchas with these helpers that I feel like it might be difficult to ever get a second driver using this. Or at least, we'd have to learn what requirements they have when we get there. (Well, maybe you know better, but I certainly don't.) I'm tempted to just go with what's the simplest for Rockchip now, and look at some generic timer fallbacks later if the need arises. > > Also, I still haven't found that fake timer machinery, but maybe I just > > don't know what I'm looking for. > > I ... didn't find it either. I'm honestly not sure whether this works for > intel, or whether we do something silly like disable self-refresh when a > vblank interrupt is pending :-/ Nice to know I'm not the only one, I suppose :) > I think new proposal from me is to just respin this patch here with our > discussion all summarized (it's good to record this stuff for the next > person that comes around), and the WARN_ON adjusted so it also checks that > vblank interrupts keep working (per the ret value at least, it's not a > real functional check). And call that good enough. Sounds good. I'll try to summarize without immortalizing too much of my ignorance ;) And thanks for your thoughts. > Also maybe look into switching from wait_for_vblanks to > wait_for_flip_done, it's the right thing to do (see kerneldoc, it should > explain things a bit). I've read some, and will probably reread a few more times. And I left one question above. Brian