Message ID | 20240705145254.3355-5-ville.syrjala@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/{i915, xe}: FBC cleanups + tweak fbdev stolen usage | expand |
On Fri, Jul 05, 2024 at 05:52:38PM +0300, Ville Syrjala wrote: > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > Extract intel_fbc_max_plane_size() from intel_fbc_plane_size_valid(). > We'll have another use for this soon in determining how much stolen > memory we'd like to keep reserved for FBC. > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> > --- > drivers/gpu/drm/i915/display/intel_fbc.c | 29 +++++++++++++++--------- > 1 file changed, 18 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c > index 8f3b8f2cbf7b..08a431cfbbb3 100644 > --- a/drivers/gpu/drm/i915/display/intel_fbc.c > +++ b/drivers/gpu/drm/i915/display/intel_fbc.c > @@ -1110,25 +1110,32 @@ static bool intel_fbc_hw_tracking_covers_screen(const struct intel_plane_state * > return effective_w <= max_w && effective_h <= max_h; > } > > -static bool intel_fbc_plane_size_valid(const struct intel_plane_state *plane_state) > +static void intel_fbc_max_plane_size(struct intel_display *display, > + unsigned int *w, unsigned int *h) > { > - struct intel_display *display = to_intel_display(plane_state->uapi.plane->dev); > struct drm_i915_private *i915 = to_i915(display->drm); > - unsigned int w, h, max_w, max_h; > > if (DISPLAY_VER(display) >= 10) { > - max_w = 5120; > - max_h = 4096; > + *w = 5120; > + *h = 4096; > } else if (DISPLAY_VER(display) >= 8 || IS_HASWELL(i915)) { > - max_w = 4096; > - max_h = 4096; > + *w = 4096; > + *h = 4096; > } else if (IS_G4X(i915) || DISPLAY_VER(display) >= 5) { > - max_w = 4096; > - max_h = 2048; > + *w = 4096; > + *h = 2048; > } else { > - max_w = 2048; > - max_h = 1536; > + *w = 2048; > + *h = 1536; > } > +} > + > +static bool intel_fbc_plane_size_valid(const struct intel_plane_state *plane_state) > +{ > + struct intel_display *display = to_intel_display(plane_state->uapi.plane->dev); > + unsigned int w, h, max_w, max_h; > + > + intel_fbc_max_plane_size(display, &max_w, &max_h); > > w = drm_rect_width(&plane_state->uapi.src) >> 16; > h = drm_rect_height(&plane_state->uapi.src) >> 16; > -- > 2.44.2 >
diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index 8f3b8f2cbf7b..08a431cfbbb3 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -1110,25 +1110,32 @@ static bool intel_fbc_hw_tracking_covers_screen(const struct intel_plane_state * return effective_w <= max_w && effective_h <= max_h; } -static bool intel_fbc_plane_size_valid(const struct intel_plane_state *plane_state) +static void intel_fbc_max_plane_size(struct intel_display *display, + unsigned int *w, unsigned int *h) { - struct intel_display *display = to_intel_display(plane_state->uapi.plane->dev); struct drm_i915_private *i915 = to_i915(display->drm); - unsigned int w, h, max_w, max_h; if (DISPLAY_VER(display) >= 10) { - max_w = 5120; - max_h = 4096; + *w = 5120; + *h = 4096; } else if (DISPLAY_VER(display) >= 8 || IS_HASWELL(i915)) { - max_w = 4096; - max_h = 4096; + *w = 4096; + *h = 4096; } else if (IS_G4X(i915) || DISPLAY_VER(display) >= 5) { - max_w = 4096; - max_h = 2048; + *w = 4096; + *h = 2048; } else { - max_w = 2048; - max_h = 1536; + *w = 2048; + *h = 1536; } +} + +static bool intel_fbc_plane_size_valid(const struct intel_plane_state *plane_state) +{ + struct intel_display *display = to_intel_display(plane_state->uapi.plane->dev); + unsigned int w, h, max_w, max_h; + + intel_fbc_max_plane_size(display, &max_w, &max_h); w = drm_rect_width(&plane_state->uapi.src) >> 16; h = drm_rect_height(&plane_state->uapi.src) >> 16;