Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>,
	intel-gfx@lists.freedesktop.org,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: Re: [PATCH] drm/i915: Don't test plane stride with !INTEL_DISPLAY_ENABLED
Date: Fri, 8 Nov 2019 15:50:39 +0200	[thread overview]
Message-ID: <20191108135039.GI1208@intel.com> (raw)
In-Reply-To: <20191107203722.8814-1-matthew.d.roper@intel.com>

On Thu, Nov 07, 2019 at 12:37:22PM -0800, Matt Roper wrote:
> 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.

I just pushed my earlier patch which does it the other way around.
But yeah, we should perhaps just reject the entire thing.

> 
> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>  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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>,
	intel-gfx@lists.freedesktop.org,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Don't test plane stride with !INTEL_DISPLAY_ENABLED
Date: Fri, 8 Nov 2019 15:50:39 +0200	[thread overview]
Message-ID: <20191108135039.GI1208@intel.com> (raw)
Message-ID: <20191108135039.z4hAMOAJeyhMdwQG7fOsrL-OKOLFhLAL1bM6micOceI@z> (raw)
In-Reply-To: <20191107203722.8814-1-matthew.d.roper@intel.com>

On Thu, Nov 07, 2019 at 12:37:22PM -0800, Matt Roper wrote:
> 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.

I just pushed my earlier patch which does it the other way around.
But yeah, we should perhaps just reject the entire thing.

> 
> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>  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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-11-08 13:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07 20:37 [PATCH] drm/i915: Don't test plane stride with !INTEL_DISPLAY_ENABLED Matt Roper
2019-11-07 20:37 ` [Intel-gfx] " Matt Roper
2019-11-07 23:19 ` ✓ Fi.CI.BAT: success for " Patchwork
2019-11-07 23:19   ` [Intel-gfx] " Patchwork
2019-11-08 13:50 ` Ville Syrjälä [this message]
2019-11-08 13:50   ` [Intel-gfx] [PATCH] " Ville Syrjälä
2019-11-09  8:01 ` ✗ Fi.CI.IGT: failure for " Patchwork
2019-11-09  8:01   ` [Intel-gfx] " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191108135039.GI1208@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.d.roper@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox