static u32 i8xx_fbc_ctl(struct intel_fbc *fbc)
{
- const struct intel_fbc_reg_params *params = &fbc->params;
+ const struct intel_fbc_state *params = &fbc->params;
struct drm_i915_private *i915 = fbc->i915;
unsigned int cfb_stride;
u32 fbc_ctl;
static u32 i965_fbc_ctl2(struct intel_fbc *fbc)
{
- const struct intel_fbc_reg_params *params = &fbc->params;
+ const struct intel_fbc_state *params = &fbc->params;
u32 fbc_ctl2;
fbc_ctl2 = FBC_CTL_FENCE_DBL | FBC_CTL_IDLE_IMM |
- FBC_CTL_PLANE(params->crtc.i9xx_plane);
+ FBC_CTL_PLANE(params->i9xx_plane);
if (params->fence_id >= 0)
fbc_ctl2 |= FBC_CTL_CPU_FENCE_EN;
static void i8xx_fbc_activate(struct intel_fbc *fbc)
{
- const struct intel_fbc_reg_params *params = &fbc->params;
+ const struct intel_fbc_state *params = &fbc->params;
struct drm_i915_private *i915 = fbc->i915;
int i;
static void i8xx_fbc_nuke(struct intel_fbc *fbc)
{
- struct intel_fbc_reg_params *params = &fbc->params;
- enum i9xx_plane_id i9xx_plane = params->crtc.i9xx_plane;
+ struct intel_fbc_state *params = &fbc->params;
+ enum i9xx_plane_id i9xx_plane = params->i9xx_plane;
struct drm_i915_private *dev_priv = fbc->i915;
spin_lock_irq(&dev_priv->uncore.lock);
static void i965_fbc_nuke(struct intel_fbc *fbc)
{
- struct intel_fbc_reg_params *params = &fbc->params;
- enum i9xx_plane_id i9xx_plane = params->crtc.i9xx_plane;
+ struct intel_fbc_state *params = &fbc->params;
+ enum i9xx_plane_id i9xx_plane = params->i9xx_plane;
struct drm_i915_private *dev_priv = fbc->i915;
spin_lock_irq(&dev_priv->uncore.lock);
static u32 g4x_dpfc_ctl(struct intel_fbc *fbc)
{
- const struct intel_fbc_reg_params *params = &fbc->params;
+ const struct intel_fbc_state *params = &fbc->params;
struct drm_i915_private *i915 = fbc->i915;
u32 dpfc_ctl;
dpfc_ctl = g4x_dpfc_ctl_limit(fbc) |
- DPFC_CTL_PLANE_G4X(params->crtc.i9xx_plane);
+ DPFC_CTL_PLANE_G4X(params->i9xx_plane);
if (IS_G4X(i915))
dpfc_ctl |= DPFC_CTL_SR_EN;
static void g4x_fbc_activate(struct intel_fbc *fbc)
{
- const struct intel_fbc_reg_params *params = &fbc->params;
+ const struct intel_fbc_state *params = &fbc->params;
struct drm_i915_private *i915 = fbc->i915;
intel_de_write(i915, DPFC_FENCE_YOFF,
static void ilk_fbc_activate(struct intel_fbc *fbc)
{
- struct intel_fbc_reg_params *params = &fbc->params;
+ struct intel_fbc_state *params = &fbc->params;
struct drm_i915_private *i915 = fbc->i915;
intel_de_write(i915, ILK_DPFC_FENCE_YOFF,
static void snb_fbc_program_fence(struct intel_fbc *fbc)
{
- const struct intel_fbc_reg_params *params = &fbc->params;
+ const struct intel_fbc_state *params = &fbc->params;
struct drm_i915_private *i915 = fbc->i915;
u32 ctl = 0;
static void glk_fbc_program_cfb_stride(struct intel_fbc *fbc)
{
- const struct intel_fbc_reg_params *params = &fbc->params;
+ const struct intel_fbc_state *params = &fbc->params;
struct drm_i915_private *i915 = fbc->i915;
u32 val = 0;
static void skl_fbc_program_cfb_stride(struct intel_fbc *fbc)
{
- const struct intel_fbc_reg_params *params = &fbc->params;
+ const struct intel_fbc_state *params = &fbc->params;
struct drm_i915_private *i915 = fbc->i915;
u32 val = 0;
static u32 ivb_dpfc_ctl(struct intel_fbc *fbc)
{
- const struct intel_fbc_reg_params *params = &fbc->params;
+ const struct intel_fbc_state *params = &fbc->params;
struct drm_i915_private *i915 = fbc->i915;
u32 dpfc_ctl;
dpfc_ctl = g4x_dpfc_ctl_limit(fbc);
if (IS_IVYBRIDGE(i915))
- dpfc_ctl |= DPFC_CTL_PLANE_IVB(params->crtc.i9xx_plane);
+ dpfc_ctl |= DPFC_CTL_PLANE_IVB(params->i9xx_plane);
if (params->fence_id >= 0)
dpfc_ctl |= DPFC_CTL_FENCE_EN_IVB;
const struct intel_plane_state *plane_state =
intel_atomic_get_new_plane_state(state, plane);
struct intel_fbc *fbc = plane->fbc;
- struct intel_fbc_state_cache *cache = &fbc->state_cache;
+ struct intel_fbc_state *cache = &fbc->state_cache;
cache->no_fbc_reason = plane_state->no_fbc_reason;
if (cache->no_fbc_reason)
return;
+ cache->i9xx_plane = plane->i9xx_plane;
+
/* FBC1 compression interval: arbitrary choice of 1 second */
cache->interval = drm_mode_vrefresh(&crtc_state->hw.adjusted_mode);
{
struct drm_i915_private *i915 = to_i915(crtc->base.dev);
struct intel_fbc *fbc = &i915->fbc;
- struct intel_fbc_state_cache *cache = &fbc->state_cache;
+ struct intel_fbc_state *cache = &fbc->state_cache;
if (!intel_fbc_can_enable(fbc))
return false;
static void intel_fbc_get_reg_params(struct intel_fbc *fbc,
struct intel_crtc *crtc)
{
- const struct intel_fbc_state_cache *cache = &fbc->state_cache;
- struct intel_fbc_reg_params *params = &fbc->params;
+ const struct intel_fbc_state *cache = &fbc->state_cache;
+ struct intel_fbc_state *params = &fbc->params;
/* Since all our fields are integer types, use memset here so the
* comparison function can rely on memcmp because the padding will be
* zero. */
- memset(params, 0, sizeof(*params));
-
- params->fence_id = cache->fence_id;
- params->fence_y_offset = cache->fence_y_offset;
-
- params->interval = cache->interval;
- params->crtc.i9xx_plane = to_intel_plane(crtc->base.primary)->i9xx_plane;
-
- params->cfb_stride = cache->cfb_stride;
- params->cfb_size = cache->cfb_size;
- params->override_cfb_stride = cache->override_cfb_stride;
+ *params = *cache;
}
static bool intel_fbc_can_flip_nuke(struct intel_atomic_state *state,
intel_atomic_get_new_plane_state(state, plane);
const struct drm_framebuffer *old_fb = old_plane_state->hw.fb;
const struct drm_framebuffer *new_fb = new_plane_state->hw.fb;
- const struct intel_fbc_state_cache *cache = &fbc->state_cache;
- const struct intel_fbc_reg_params *params = &fbc->params;
+ const struct intel_fbc_state *cache = &fbc->state_cache;
+ const struct intel_fbc_state *params = &fbc->params;
if (drm_atomic_crtc_needs_modeset(&new_crtc_state->uapi))
return false;
const struct intel_plane_state *plane_state =
intel_atomic_get_new_plane_state(state, plane);
struct intel_fbc *fbc = plane->fbc;
- struct intel_fbc_state_cache *cache;
+ struct intel_fbc_state *cache;
int min_limit;
if (!fbc || !plane_state)
#define I915_COLOR_UNEVICTABLE (-1) /* a non-vma sharing the address space */
+struct intel_fbc_state {
+ const char *no_fbc_reason;
+ enum i9xx_plane_id i9xx_plane;
+ unsigned int cfb_stride;
+ unsigned int cfb_size;
+ unsigned int fence_y_offset;
+ u16 override_cfb_stride;
+ u16 interval;
+ s8 fence_id;
+};
+
struct intel_fbc {
struct drm_i915_private *i915;
const struct intel_fbc_funcs *funcs;
* appropriate locking, so we cache information here in order to avoid
* these problems.
*/
- struct intel_fbc_state_cache {
- const char *no_fbc_reason;
-
- unsigned int cfb_stride;
- unsigned int cfb_size;
- unsigned int fence_y_offset;
- u16 override_cfb_stride;
- u16 interval;
- s8 fence_id;
- } state_cache;
+ struct intel_fbc_state state_cache;
/*
* This structure contains everything that's relevant to program the
* something different in the struct. The genx_fbc_activate functions
* are supposed to read from it in order to program the registers.
*/
- struct intel_fbc_reg_params {
- struct {
- enum i9xx_plane_id i9xx_plane;
- } crtc;
-
- unsigned int cfb_stride;
- unsigned int cfb_size;
- unsigned int fence_y_offset;
- u16 override_cfb_stride;
- u16 interval;
- s8 fence_id;
- } params;
-
+ struct intel_fbc_state params;
const char *no_fbc_reason;
};