drm/i915/fbc: Introduce intel_fbc_add_plane()
In order to better encapsulate the FBC implementation introduce a small helper to do the plane<->FBC instance association. We'll also try to structure the plane init code such that introducing multiple FBC instances will be easier down the line. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20211124113652.22090-13-ville.syrjala@linux.intel.com Reviewed-by: Mika Kahola <mika.kahola@intel.com>
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "intel_de.h"
|
||||
#include "intel_display_types.h"
|
||||
#include "intel_fb.h"
|
||||
#include "intel_fbc.h"
|
||||
#include "intel_sprite.h"
|
||||
#include "i9xx_plane.h"
|
||||
|
||||
@@ -120,6 +121,15 @@ static bool i9xx_plane_has_fbc(struct drm_i915_private *dev_priv,
|
||||
return i9xx_plane == PLANE_A;
|
||||
}
|
||||
|
||||
static struct intel_fbc *i9xx_plane_fbc(struct drm_i915_private *dev_priv,
|
||||
enum i9xx_plane_id i9xx_plane)
|
||||
{
|
||||
if (i9xx_plane_has_fbc(dev_priv, i9xx_plane))
|
||||
return &dev_priv->fbc;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool i9xx_plane_has_windowing(struct intel_plane *plane)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
|
||||
@@ -807,10 +817,7 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
|
||||
plane->id = PLANE_PRIMARY;
|
||||
plane->frontbuffer_bit = INTEL_FRONTBUFFER(pipe, plane->id);
|
||||
|
||||
if (i9xx_plane_has_fbc(dev_priv, plane->i9xx_plane))
|
||||
plane->fbc = &dev_priv->fbc;
|
||||
if (plane->fbc)
|
||||
plane->fbc->possible_framebuffer_bits |= plane->frontbuffer_bit;
|
||||
intel_fbc_add_plane(i9xx_plane_fbc(dev_priv, plane->i9xx_plane), plane);
|
||||
|
||||
if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
|
||||
formats = vlv_primary_formats;
|
||||
|
||||
@@ -1612,6 +1612,15 @@ static bool need_fbc_vtd_wa(struct drm_i915_private *i915)
|
||||
return false;
|
||||
}
|
||||
|
||||
void intel_fbc_add_plane(struct intel_fbc *fbc, struct intel_plane *plane)
|
||||
{
|
||||
if (!fbc)
|
||||
return;
|
||||
|
||||
plane->fbc = fbc;
|
||||
fbc->possible_framebuffer_bits |= plane->frontbuffer_bit;
|
||||
}
|
||||
|
||||
/**
|
||||
* intel_fbc_init - Initialize FBC
|
||||
* @i915: the i915 device
|
||||
|
||||
@@ -15,6 +15,7 @@ struct intel_atomic_state;
|
||||
struct intel_crtc;
|
||||
struct intel_crtc_state;
|
||||
struct intel_fbc;
|
||||
struct intel_plane;
|
||||
struct intel_plane_state;
|
||||
|
||||
int intel_fbc_atomic_check(struct intel_atomic_state *state);
|
||||
@@ -33,6 +34,7 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv,
|
||||
enum fb_op_origin origin);
|
||||
void intel_fbc_flush(struct drm_i915_private *dev_priv,
|
||||
unsigned int frontbuffer_bits, enum fb_op_origin origin);
|
||||
void intel_fbc_add_plane(struct intel_fbc *fbc, struct intel_plane *plane);
|
||||
void intel_fbc_handle_fifo_underrun_irq(struct drm_i915_private *i915);
|
||||
void intel_fbc_reset_underrun(struct drm_i915_private *i915);
|
||||
void intel_fbc_debugfs_register(struct drm_i915_private *i915);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "intel_de.h"
|
||||
#include "intel_display_types.h"
|
||||
#include "intel_fb.h"
|
||||
#include "intel_fbc.h"
|
||||
#include "intel_pm.h"
|
||||
#include "intel_psr.h"
|
||||
#include "intel_sprite.h"
|
||||
@@ -1828,6 +1829,15 @@ static bool skl_plane_has_fbc(struct drm_i915_private *dev_priv,
|
||||
return pipe == PIPE_A && plane_id == PLANE_PRIMARY;
|
||||
}
|
||||
|
||||
static struct intel_fbc *skl_plane_fbc(struct drm_i915_private *dev_priv,
|
||||
enum pipe pipe, enum plane_id plane_id)
|
||||
{
|
||||
if (skl_plane_has_fbc(dev_priv, pipe, plane_id))
|
||||
return &dev_priv->fbc;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static bool skl_plane_has_planar(struct drm_i915_private *dev_priv,
|
||||
enum pipe pipe, enum plane_id plane_id)
|
||||
{
|
||||
@@ -2114,10 +2124,7 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
|
||||
plane->id = plane_id;
|
||||
plane->frontbuffer_bit = INTEL_FRONTBUFFER(pipe, plane_id);
|
||||
|
||||
if (skl_plane_has_fbc(dev_priv, pipe, plane_id))
|
||||
plane->fbc = &dev_priv->fbc;
|
||||
if (plane->fbc)
|
||||
plane->fbc->possible_framebuffer_bits |= plane->frontbuffer_bit;
|
||||
intel_fbc_add_plane(skl_plane_fbc(dev_priv, pipe, plane_id), plane);
|
||||
|
||||
if (DISPLAY_VER(dev_priv) >= 11) {
|
||||
plane->min_width = icl_plane_min_width;
|
||||
|
||||
Reference in New Issue
Block a user