[PATCH] drm/i915: Don't test plane stride with !INTEL_DISPLAY_ENABLED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If INTEL_DISPLAY_ENABLED is false, then the modesetting resources were
never initialized.  Userspace may still call DRM_IOCTL_MODE_CREATE_DUMB
which will eventually lead i915_gem_dumb_create() to try to dereference
a non-existent pipe A primary plane while figuring out a proper pitch.

We could force dumb buffer creation to fail in cases where display isn't
enabled (since there isn't really a definition of a "suitable for
scanout" buffer in that case), but it's easier (and probably less
invasive to IGT tests) to just drop the attempt to align to plane max
stride in cases where the display isn't enabled.

Cc: Lucas De Marchi <lucas.demarchi@xxxxxxxxx>
Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
Signed-off-by: Matt Roper <matthew.d.roper@xxxxxxxxx>
---
 drivers/gpu/drm/i915/i915_gem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 143a8952b736..f022a17328b0 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -229,7 +229,8 @@ i915_gem_dumb_create(struct drm_file *file,
 	args->pitch = ALIGN(args->width * cpp, 64);
 
 	/* align stride to page size so that we can remap */
-	if (args->pitch > intel_plane_fb_max_stride(to_i915(dev), format,
+	if (INTEL_DISPLAY_ENABLED(to_i915(dev)) &&
+	    args->pitch > intel_plane_fb_max_stride(to_i915(dev), format,
 						    DRM_FORMAT_MOD_LINEAR))
 		args->pitch = ALIGN(args->pitch, 4096);
 
-- 
2.21.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux