* need to consider all the running CRTCs in the DRM device to assign
* a FIFO, not just the one in the state.
*
- * - To fix the above, we can't use drm_atomic_get_crtc_state on all
- * enabled CRTCs to pull their CRTC state into the global state, since
- * a page flip would start considering their vblank to complete. Since
- * we don't have a guarantee that they are actually active, that
- * vblank might never happen, and shouldn't even be considered if we
- * want to do a page flip on a single CRTC. That can be tested by
- * doing a modetest -v first on HDMI1 and then on HDMI0.
- *
* - Since we need the pixelvalve to be disabled and enabled back when
* the FIFO is changed, we should keep the FIFO assigned for as long
* as the CRTC is enabled, only considering it free again once that
struct drm_atomic_state *state)
{
unsigned long unassigned_channels = GENMASK(NUM_CHANNELS - 1, 0);
+ struct vc4_dev *vc4 = to_vc4_dev(state->dev);
struct drm_crtc_state *old_crtc_state, *new_crtc_state;
- struct drm_crtc_state *crtc_state;
struct drm_crtc *crtc;
unsigned int i;
* the same CRTCs, instead of evaluating only the CRTC being
* modified.
*/
- for_each_new_or_current_crtc_state(state, crtc, crtc_state) {
- struct vc4_crtc_state *vc4_crtc_state;
- if (!crtc_state->enable)
+ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+ struct drm_crtc_state *crtc_state;
+ if (!crtc->state->enable)
continue;
- vc4_crtc_state = to_vc4_crtc_state(crtc_state);
- unassigned_channels &= ~BIT(vc4_crtc_state->assigned_channel);
+ crtc_state = drm_atomic_get_crtc_state(state, crtc);
+ if (IS_ERR(crtc_state))
+ return PTR_ERR(crtc_state);
}
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
if (!new_crtc_state->enable)
continue;
- if (new_vc4_crtc_state->assigned_channel != VC4_HVS_CHANNEL_DISABLED)
+ if (new_vc4_crtc_state->assigned_channel != VC4_HVS_CHANNEL_DISABLED) {
+ unassigned_channels &= ~BIT(new_vc4_crtc_state->assigned_channel);
continue;
+ }
/*
* The problem we have to solve here is that we have