Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: Use crtc->state in intel_fbdev_init_bios

fbdev init shouldn't race with userspace since it's called from
intel_modeset_init, so it's safe to dereference crtc->state and
assume nothing changed yet.

At least not more harmful than crtc->config.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181004094604.2646-11-maarten.lankhorst@linux.intel.com

+4 -4
+4 -4
drivers/gpu/drm/i915/intel_fbdev.c
··· 593 593 * pipe. Note we need to use the selected fb's pitch and bpp 594 594 * rather than the current pipe's, since they differ. 595 595 */ 596 - cur_size = intel_crtc->config->base.adjusted_mode.crtc_hdisplay; 596 + cur_size = crtc->state->adjusted_mode.crtc_hdisplay; 597 597 cur_size = cur_size * fb->base.format->cpp[0]; 598 598 if (fb->base.pitches[0] < cur_size) { 599 599 DRM_DEBUG_KMS("fb not wide enough for plane %c (%d vs %d)\n", ··· 603 603 break; 604 604 } 605 605 606 - cur_size = intel_crtc->config->base.adjusted_mode.crtc_vdisplay; 606 + cur_size = crtc->state->adjusted_mode.crtc_vdisplay; 607 607 cur_size = intel_fb_align_height(&fb->base, 0, cur_size); 608 608 cur_size *= fb->base.pitches[0]; 609 609 DRM_DEBUG_KMS("pipe %c area: %dx%d, bpp: %d, size: %d\n", 610 610 pipe_name(intel_crtc->pipe), 611 - intel_crtc->config->base.adjusted_mode.crtc_hdisplay, 612 - intel_crtc->config->base.adjusted_mode.crtc_vdisplay, 611 + crtc->state->adjusted_mode.crtc_hdisplay, 612 + crtc->state->adjusted_mode.crtc_vdisplay, 613 613 fb->base.format->cpp[0] * 8, 614 614 cur_size); 615 615