Commit f90a85e7 authored by Maarten Lankhorst's avatar Maarten Lankhorst

drm/i915: Perform automated conversions for plane uapi/hw split, base -> uapi.

Split up plane_state->base to uapi. This is done using the following patch,
ran after the previous commit that splits out any hw references:

@@
struct intel_plane_state *T;
identifier x;
@@
-T->base.x
+T->uapi.x

@@
struct intel_plane_state *T;
@@
-T->base
+T->uapi
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191031112610.27608-10-maarten.lankhorst@linux.intel.com
parent 7b3cb17a
...@@ -286,7 +286,7 @@ static void intel_atomic_setup_scaler(struct intel_crtc_scaler_state *scaler_sta ...@@ -286,7 +286,7 @@ static void intel_atomic_setup_scaler(struct intel_crtc_scaler_state *scaler_sta
if (plane_state && plane_state->hw.fb && if (plane_state && plane_state->hw.fb &&
plane_state->hw.fb->format->is_yuv && plane_state->hw.fb->format->is_yuv &&
plane_state->hw.fb->format->num_planes > 1) { plane_state->hw.fb->format->num_planes > 1) {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
if (IS_GEN(dev_priv, 9) && if (IS_GEN(dev_priv, 9) &&
!IS_GEMINILAKE(dev_priv)) { !IS_GEMINILAKE(dev_priv)) {
mode = SKL_PS_SCALER_MODE_NV12; mode = SKL_PS_SCALER_MODE_NV12;
......
...@@ -56,7 +56,7 @@ struct intel_plane *intel_plane_alloc(void) ...@@ -56,7 +56,7 @@ struct intel_plane *intel_plane_alloc(void)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
__drm_atomic_helper_plane_reset(&plane->base, &plane_state->base); __drm_atomic_helper_plane_reset(&plane->base, &plane_state->uapi);
plane_state->scaler_id = -1; plane_state->scaler_id = -1;
return plane; return plane;
...@@ -88,12 +88,12 @@ intel_plane_duplicate_state(struct drm_plane *plane) ...@@ -88,12 +88,12 @@ intel_plane_duplicate_state(struct drm_plane *plane)
if (!intel_state) if (!intel_state)
return NULL; return NULL;
__drm_atomic_helper_plane_duplicate_state(plane, &intel_state->base); __drm_atomic_helper_plane_duplicate_state(plane, &intel_state->uapi);
intel_state->vma = NULL; intel_state->vma = NULL;
intel_state->flags = 0; intel_state->flags = 0;
return &intel_state->base; return &intel_state->uapi;
} }
/** /**
...@@ -111,7 +111,7 @@ intel_plane_destroy_state(struct drm_plane *plane, ...@@ -111,7 +111,7 @@ intel_plane_destroy_state(struct drm_plane *plane,
struct intel_plane_state *plane_state = to_intel_plane_state(state); struct intel_plane_state *plane_state = to_intel_plane_state(state);
WARN_ON(plane_state->vma); WARN_ON(plane_state->vma);
__drm_atomic_helper_plane_destroy_state(&plane_state->base); __drm_atomic_helper_plane_destroy_state(&plane_state->uapi);
kfree(plane_state); kfree(plane_state);
} }
...@@ -121,7 +121,7 @@ unsigned int intel_plane_data_rate(const struct intel_crtc_state *crtc_state, ...@@ -121,7 +121,7 @@ unsigned int intel_plane_data_rate(const struct intel_crtc_state *crtc_state,
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
unsigned int cpp; unsigned int cpp;
if (!plane_state->base.visible) if (!plane_state->uapi.visible)
return 0; return 0;
cpp = fb->format->cpp[0]; cpp = fb->format->cpp[0];
...@@ -147,7 +147,7 @@ bool intel_plane_calc_min_cdclk(struct intel_atomic_state *state, ...@@ -147,7 +147,7 @@ bool intel_plane_calc_min_cdclk(struct intel_atomic_state *state,
struct intel_crtc *crtc = to_intel_crtc(plane_state->hw.crtc); struct intel_crtc *crtc = to_intel_crtc(plane_state->hw.crtc);
struct intel_crtc_state *crtc_state; struct intel_crtc_state *crtc_state;
if (!plane_state->base.visible || !plane->min_cdclk) if (!plane_state->uapi.visible || !plane->min_cdclk)
return false; return false;
crtc_state = intel_atomic_get_new_crtc_state(state, crtc); crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
...@@ -181,7 +181,7 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_ ...@@ -181,7 +181,7 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
const struct intel_plane_state *old_plane_state, const struct intel_plane_state *old_plane_state,
struct intel_plane_state *new_plane_state) struct intel_plane_state *new_plane_state)
{ {
struct intel_plane *plane = to_intel_plane(new_plane_state->base.plane); struct intel_plane *plane = to_intel_plane(new_plane_state->uapi.plane);
const struct drm_framebuffer *fb = new_plane_state->hw.fb; const struct drm_framebuffer *fb = new_plane_state->hw.fb;
int ret; int ret;
...@@ -190,7 +190,7 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_ ...@@ -190,7 +190,7 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
new_crtc_state->c8_planes &= ~BIT(plane->id); new_crtc_state->c8_planes &= ~BIT(plane->id);
new_crtc_state->data_rate[plane->id] = 0; new_crtc_state->data_rate[plane->id] = 0;
new_crtc_state->min_cdclk[plane->id] = 0; new_crtc_state->min_cdclk[plane->id] = 0;
new_plane_state->base.visible = false; new_plane_state->uapi.visible = false;
if (!new_plane_state->hw.crtc && !old_plane_state->hw.crtc) if (!new_plane_state->hw.crtc && !old_plane_state->hw.crtc)
return 0; return 0;
...@@ -200,18 +200,18 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_ ...@@ -200,18 +200,18 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
return ret; return ret;
/* FIXME pre-g4x don't work like this */ /* FIXME pre-g4x don't work like this */
if (new_plane_state->base.visible) if (new_plane_state->uapi.visible)
new_crtc_state->active_planes |= BIT(plane->id); new_crtc_state->active_planes |= BIT(plane->id);
if (new_plane_state->base.visible && if (new_plane_state->uapi.visible &&
drm_format_info_is_yuv_semiplanar(fb->format)) drm_format_info_is_yuv_semiplanar(fb->format))
new_crtc_state->nv12_planes |= BIT(plane->id); new_crtc_state->nv12_planes |= BIT(plane->id);
if (new_plane_state->base.visible && if (new_plane_state->uapi.visible &&
fb->format->format == DRM_FORMAT_C8) fb->format->format == DRM_FORMAT_C8)
new_crtc_state->c8_planes |= BIT(plane->id); new_crtc_state->c8_planes |= BIT(plane->id);
if (new_plane_state->base.visible || old_plane_state->base.visible) if (new_plane_state->uapi.visible || old_plane_state->uapi.visible)
new_crtc_state->update_planes |= BIT(plane->id); new_crtc_state->update_planes |= BIT(plane->id);
new_crtc_state->data_rate[plane->id] = new_crtc_state->data_rate[plane->id] =
...@@ -246,7 +246,7 @@ int intel_plane_atomic_check(struct intel_atomic_state *state, ...@@ -246,7 +246,7 @@ int intel_plane_atomic_check(struct intel_atomic_state *state,
const struct intel_crtc_state *old_crtc_state; const struct intel_crtc_state *old_crtc_state;
struct intel_crtc_state *new_crtc_state; struct intel_crtc_state *new_crtc_state;
new_plane_state->base.visible = false; new_plane_state->uapi.visible = false;
if (!crtc) if (!crtc)
return 0; return 0;
...@@ -355,7 +355,7 @@ void skl_update_planes_on_crtc(struct intel_atomic_state *state, ...@@ -355,7 +355,7 @@ void skl_update_planes_on_crtc(struct intel_atomic_state *state,
struct intel_plane_state *new_plane_state = struct intel_plane_state *new_plane_state =
intel_atomic_get_new_plane_state(state, plane); intel_atomic_get_new_plane_state(state, plane);
if (new_plane_state->base.visible) { if (new_plane_state->uapi.visible) {
intel_update_plane(plane, new_crtc_state, new_plane_state); intel_update_plane(plane, new_crtc_state, new_plane_state);
} else if (new_plane_state->planar_slave) { } else if (new_plane_state->planar_slave) {
struct intel_plane *master = struct intel_plane *master =
...@@ -395,7 +395,7 @@ void i9xx_update_planes_on_crtc(struct intel_atomic_state *state, ...@@ -395,7 +395,7 @@ void i9xx_update_planes_on_crtc(struct intel_atomic_state *state,
!(update_mask & BIT(plane->id))) !(update_mask & BIT(plane->id)))
continue; continue;
if (new_plane_state->base.visible) if (new_plane_state->uapi.visible)
intel_update_plane(plane, new_crtc_state, new_plane_state); intel_update_plane(plane, new_crtc_state, new_plane_state);
else else
intel_disable_plane(plane, new_crtc_state); intel_disable_plane(plane, new_crtc_state);
......
...@@ -2082,7 +2082,7 @@ static unsigned int intel_surf_alignment(const struct drm_framebuffer *fb, ...@@ -2082,7 +2082,7 @@ static unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,
static bool intel_plane_uses_fence(const struct intel_plane_state *plane_state) static bool intel_plane_uses_fence(const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
return INTEL_GEN(dev_priv) < 4 || return INTEL_GEN(dev_priv) < 4 ||
...@@ -2391,7 +2391,7 @@ static u32 intel_plane_compute_aligned_offset(int *x, int *y, ...@@ -2391,7 +2391,7 @@ static u32 intel_plane_compute_aligned_offset(int *x, int *y,
const struct intel_plane_state *state, const struct intel_plane_state *state,
int color_plane) int color_plane)
{ {
struct intel_plane *intel_plane = to_intel_plane(state->base.plane); struct intel_plane *intel_plane = to_intel_plane(state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(intel_plane->base.dev); struct drm_i915_private *dev_priv = to_i915(intel_plane->base.dev);
const struct drm_framebuffer *fb = state->hw.fb; const struct drm_framebuffer *fb = state->hw.fb;
unsigned int rotation = state->hw.rotation; unsigned int rotation = state->hw.rotation;
...@@ -2579,7 +2579,7 @@ intel_fb_stride_alignment(const struct drm_framebuffer *fb, int color_plane) ...@@ -2579,7 +2579,7 @@ intel_fb_stride_alignment(const struct drm_framebuffer *fb, int color_plane)
bool intel_plane_can_remap(const struct intel_plane_state *plane_state) bool intel_plane_can_remap(const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
int i; int i;
...@@ -2619,7 +2619,7 @@ bool intel_plane_can_remap(const struct intel_plane_state *plane_state) ...@@ -2619,7 +2619,7 @@ bool intel_plane_can_remap(const struct intel_plane_state *plane_state)
static bool intel_plane_needs_remap(const struct intel_plane_state *plane_state) static bool intel_plane_needs_remap(const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
unsigned int rotation = plane_state->hw.rotation; unsigned int rotation = plane_state->hw.rotation;
u32 stride, max_stride; u32 stride, max_stride;
...@@ -2628,7 +2628,7 @@ static bool intel_plane_needs_remap(const struct intel_plane_state *plane_state) ...@@ -2628,7 +2628,7 @@ static bool intel_plane_needs_remap(const struct intel_plane_state *plane_state)
* No remapping for invisible planes since we don't have * No remapping for invisible planes since we don't have
* an actual source viewport to remap. * an actual source viewport to remap.
*/ */
if (!plane_state->base.visible) if (!plane_state->uapi.visible)
return false; return false;
if (!intel_plane_can_remap(plane_state)) if (!intel_plane_can_remap(plane_state))
...@@ -2811,7 +2811,7 @@ static void ...@@ -2811,7 +2811,7 @@ static void
intel_plane_remap_gtt(struct intel_plane_state *plane_state) intel_plane_remap_gtt(struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
to_i915(plane_state->base.plane->dev); to_i915(plane_state->uapi.plane->dev);
struct drm_framebuffer *fb = plane_state->hw.fb; struct drm_framebuffer *fb = plane_state->hw.fb;
struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb); struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
struct intel_rotation_info *info = &plane_state->view.rotated; struct intel_rotation_info *info = &plane_state->view.rotated;
...@@ -2826,20 +2826,20 @@ intel_plane_remap_gtt(struct intel_plane_state *plane_state) ...@@ -2826,20 +2826,20 @@ intel_plane_remap_gtt(struct intel_plane_state *plane_state)
plane_state->view.type = drm_rotation_90_or_270(rotation) ? plane_state->view.type = drm_rotation_90_or_270(rotation) ?
I915_GGTT_VIEW_ROTATED : I915_GGTT_VIEW_REMAPPED; I915_GGTT_VIEW_ROTATED : I915_GGTT_VIEW_REMAPPED;
src_x = plane_state->base.src.x1 >> 16; src_x = plane_state->uapi.src.x1 >> 16;
src_y = plane_state->base.src.y1 >> 16; src_y = plane_state->uapi.src.y1 >> 16;
src_w = drm_rect_width(&plane_state->base.src) >> 16; src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
src_h = drm_rect_height(&plane_state->base.src) >> 16; src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
WARN_ON(is_ccs_modifier(fb->modifier)); WARN_ON(is_ccs_modifier(fb->modifier));
/* Make src coordinates relative to the viewport */ /* Make src coordinates relative to the viewport */
drm_rect_translate(&plane_state->base.src, drm_rect_translate(&plane_state->uapi.src,
-(src_x << 16), -(src_y << 16)); -(src_x << 16), -(src_y << 16));
/* Rotate src coordinates to match rotated GTT view */ /* Rotate src coordinates to match rotated GTT view */
if (drm_rotation_90_or_270(rotation)) if (drm_rotation_90_or_270(rotation))
drm_rect_rotate(&plane_state->base.src, drm_rect_rotate(&plane_state->uapi.src,
src_w << 16, src_h << 16, src_w << 16, src_h << 16,
DRM_MODE_ROTATE_270); DRM_MODE_ROTATE_270);
...@@ -2959,7 +2959,7 @@ intel_plane_compute_gtt(struct intel_plane_state *plane_state) ...@@ -2959,7 +2959,7 @@ intel_plane_compute_gtt(struct intel_plane_state *plane_state)
/* Rotate src coordinates to match rotated GTT view */ /* Rotate src coordinates to match rotated GTT view */
if (drm_rotation_90_or_270(rotation)) if (drm_rotation_90_or_270(rotation))
drm_rect_rotate(&plane_state->base.src, drm_rect_rotate(&plane_state->uapi.src,
fb->base.width << 16, fb->base.height << 16, fb->base.width << 16, fb->base.height << 16,
DRM_MODE_ROTATE_270); DRM_MODE_ROTATE_270);
...@@ -3127,9 +3127,9 @@ intel_set_plane_visible(struct intel_crtc_state *crtc_state, ...@@ -3127,9 +3127,9 @@ intel_set_plane_visible(struct intel_crtc_state *crtc_state,
struct intel_plane_state *plane_state, struct intel_plane_state *plane_state,
bool visible) bool visible)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
plane_state->base.visible = visible; plane_state->uapi.visible = visible;
if (visible) if (visible)
crtc_state->uapi.plane_mask |= drm_plane_mask(&plane->base); crtc_state->uapi.plane_mask |= drm_plane_mask(&plane->base);
...@@ -3275,8 +3275,8 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, ...@@ -3275,8 +3275,8 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
plane_state->crtc_w = fb->width; plane_state->crtc_w = fb->width;
plane_state->crtc_h = fb->height; plane_state->crtc_h = fb->height;
intel_state->base.src = drm_plane_state_src(plane_state); intel_state->uapi.src = drm_plane_state_src(plane_state);
intel_state->base.dst = drm_plane_state_dest(plane_state); intel_state->uapi.dst = drm_plane_state_dest(plane_state);
if (plane_config->tiling) if (plane_config->tiling)
dev_priv->preserve_bios_swizzle = true; dev_priv->preserve_bios_swizzle = true;
...@@ -3411,13 +3411,13 @@ static bool skl_check_main_ccs_coordinates(struct intel_plane_state *plane_state ...@@ -3411,13 +3411,13 @@ static bool skl_check_main_ccs_coordinates(struct intel_plane_state *plane_state
static int skl_check_main_surface(struct intel_plane_state *plane_state) static int skl_check_main_surface(struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = to_i915(plane_state->base.plane->dev); struct drm_i915_private *dev_priv = to_i915(plane_state->uapi.plane->dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
unsigned int rotation = plane_state->hw.rotation; unsigned int rotation = plane_state->hw.rotation;
int x = plane_state->base.src.x1 >> 16; int x = plane_state->uapi.src.x1 >> 16;
int y = plane_state->base.src.y1 >> 16; int y = plane_state->uapi.src.y1 >> 16;
int w = drm_rect_width(&plane_state->base.src) >> 16; int w = drm_rect_width(&plane_state->uapi.src) >> 16;
int h = drm_rect_height(&plane_state->base.src) >> 16; int h = drm_rect_height(&plane_state->uapi.src) >> 16;
int max_width; int max_width;
int max_height; int max_height;
u32 alignment, offset, aux_offset = plane_state->color_plane[1].offset; u32 alignment, offset, aux_offset = plane_state->color_plane[1].offset;
...@@ -3500,7 +3500,7 @@ static int skl_check_main_surface(struct intel_plane_state *plane_state) ...@@ -3500,7 +3500,7 @@ static int skl_check_main_surface(struct intel_plane_state *plane_state)
* Put the final coordinates back so that the src * Put the final coordinates back so that the src
* coordinate checks will see the right values. * coordinate checks will see the right values.
*/ */
drm_rect_translate_to(&plane_state->base.src, drm_rect_translate_to(&plane_state->uapi.src,
x << 16, y << 16); x << 16, y << 16);
return 0; return 0;
...@@ -3512,10 +3512,10 @@ static int skl_check_nv12_aux_surface(struct intel_plane_state *plane_state) ...@@ -3512,10 +3512,10 @@ static int skl_check_nv12_aux_surface(struct intel_plane_state *plane_state)
unsigned int rotation = plane_state->hw.rotation; unsigned int rotation = plane_state->hw.rotation;
int max_width = skl_max_plane_width(fb, 1, rotation); int max_width = skl_max_plane_width(fb, 1, rotation);
int max_height = 4096; int max_height = 4096;
int x = plane_state->base.src.x1 >> 17; int x = plane_state->uapi.src.x1 >> 17;
int y = plane_state->base.src.y1 >> 17; int y = plane_state->uapi.src.y1 >> 17;
int w = drm_rect_width(&plane_state->base.src) >> 17; int w = drm_rect_width(&plane_state->uapi.src) >> 17;
int h = drm_rect_height(&plane_state->base.src) >> 17; int h = drm_rect_height(&plane_state->uapi.src) >> 17;
u32 offset; u32 offset;
intel_add_fb_offsets(&x, &y, plane_state, 1); intel_add_fb_offsets(&x, &y, plane_state, 1);
...@@ -3538,8 +3538,8 @@ static int skl_check_nv12_aux_surface(struct intel_plane_state *plane_state) ...@@ -3538,8 +3538,8 @@ static int skl_check_nv12_aux_surface(struct intel_plane_state *plane_state)
static int skl_check_ccs_aux_surface(struct intel_plane_state *plane_state) static int skl_check_ccs_aux_surface(struct intel_plane_state *plane_state)
{ {
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
int src_x = plane_state->base.src.x1 >> 16; int src_x = plane_state->uapi.src.x1 >> 16;
int src_y = plane_state->base.src.y1 >> 16; int src_y = plane_state->uapi.src.y1 >> 16;
int hsub = fb->format->hsub; int hsub = fb->format->hsub;
int vsub = fb->format->vsub; int vsub = fb->format->vsub;
int x = src_x / hsub; int x = src_x / hsub;
...@@ -3565,7 +3565,7 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state) ...@@ -3565,7 +3565,7 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)
if (ret) if (ret)
return ret; return ret;
if (!plane_state->base.visible) if (!plane_state->uapi.visible)
return 0; return 0;
/* /*
...@@ -3689,7 +3689,7 @@ static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state, ...@@ -3689,7 +3689,7 @@ static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
to_i915(plane_state->base.plane->dev); to_i915(plane_state->uapi.plane->dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
unsigned int rotation = plane_state->hw.rotation; unsigned int rotation = plane_state->hw.rotation;
u32 dspcntr; u32 dspcntr;
...@@ -3746,7 +3746,7 @@ static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state, ...@@ -3746,7 +3746,7 @@ static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state,
int i9xx_check_plane_surface(struct intel_plane_state *plane_state) int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
to_i915(plane_state->base.plane->dev); to_i915(plane_state->uapi.plane->dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
int src_x, src_y, src_w; int src_x, src_y, src_w;
u32 offset; u32 offset;
...@@ -3756,12 +3756,12 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state) ...@@ -3756,12 +3756,12 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
if (ret) if (ret)
return ret; return ret;
if (!plane_state->base.visible) if (!plane_state->uapi.visible)
return 0; return 0;
src_w = drm_rect_width(&plane_state->base.src) >> 16; src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
src_x = plane_state->base.src.x1 >> 16; src_x = plane_state->uapi.src.x1 >> 16;
src_y = plane_state->base.src.y1 >> 16; src_y = plane_state->uapi.src.y1 >> 16;
/* Undocumented hardware limit on i965/g4x/vlv/chv */ /* Undocumented hardware limit on i965/g4x/vlv/chv */
if (HAS_GMCH(dev_priv) && fb->format->cpp[0] == 8 && src_w > 2048) if (HAS_GMCH(dev_priv) && fb->format->cpp[0] == 8 && src_w > 2048)
...@@ -3779,14 +3779,14 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state) ...@@ -3779,14 +3779,14 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
* Put the final coordinates back so that the src * Put the final coordinates back so that the src
* coordinate checks will see the right values. * coordinate checks will see the right values.
*/ */
drm_rect_translate_to(&plane_state->base.src, drm_rect_translate_to(&plane_state->uapi.src,
src_x << 16, src_y << 16); src_x << 16, src_y << 16);
/* HSW/BDW do this automagically in hardware */ /* HSW/BDW do this automagically in hardware */
if (!IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv)) { if (!IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv)) {
unsigned int rotation = plane_state->hw.rotation; unsigned int rotation = plane_state->hw.rotation;
int src_w = drm_rect_width(&plane_state->base.src) >> 16; int src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
int src_h = drm_rect_height(&plane_state->base.src) >> 16; int src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
if (rotation & DRM_MODE_ROTATE_180) { if (rotation & DRM_MODE_ROTATE_180) {
src_x += src_w - 1; src_x += src_w - 1;
...@@ -3823,14 +3823,14 @@ static int ...@@ -3823,14 +3823,14 @@ static int
i9xx_plane_check(struct intel_crtc_state *crtc_state, i9xx_plane_check(struct intel_crtc_state *crtc_state,
struct intel_plane_state *plane_state) struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
int ret; int ret;
ret = chv_plane_check_rotation(plane_state); ret = chv_plane_check_rotation(plane_state);
if (ret) if (ret)
return ret; return ret;
ret = drm_atomic_helper_check_plane_state(&plane_state->base, ret = drm_atomic_helper_check_plane_state(&plane_state->uapi,
&crtc_state->uapi, &crtc_state->uapi,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
...@@ -3843,7 +3843,7 @@ i9xx_plane_check(struct intel_crtc_state *crtc_state, ...@@ -3843,7 +3843,7 @@ i9xx_plane_check(struct intel_crtc_state *crtc_state,
if (ret) if (ret)
return ret; return ret;
if (!plane_state->base.visible) if (!plane_state->uapi.visible)
return 0; return 0;
ret = intel_plane_check_src_coordinates(plane_state); ret = intel_plane_check_src_coordinates(plane_state);
...@@ -3864,10 +3864,10 @@ static void i9xx_update_plane(struct intel_plane *plane, ...@@ -3864,10 +3864,10 @@ static void i9xx_update_plane(struct intel_plane *plane,
u32 linear_offset; u32 linear_offset;
int x = plane_state->color_plane[0].x; int x = plane_state->color_plane[0].x;
int y = plane_state->color_plane[0].y; int y = plane_state->color_plane[0].y;
int crtc_x = plane_state->base.dst.x1; int crtc_x = plane_state->uapi.dst.x1;
int crtc_y = plane_state->base.dst.y1; int crtc_y = plane_state->uapi.dst.y1;
int crtc_w = drm_rect_width(&plane_state->base.dst); int crtc_w = drm_rect_width(&plane_state->uapi.dst);
int crtc_h = drm_rect_height(&plane_state->base.dst); int crtc_h = drm_rect_height(&plane_state->uapi.dst);
unsigned long irqflags; unsigned long irqflags;
u32 dspaddr_offset; u32 dspaddr_offset;
u32 dspcntr; u32 dspcntr;
...@@ -4221,7 +4221,7 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state, ...@@ -4221,7 +4221,7 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
to_i915(plane_state->base.plane->dev); to_i915(plane_state->uapi.plane->dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
unsigned int rotation = plane_state->hw.rotation; unsigned int rotation = plane_state->hw.rotation;
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
...@@ -4277,9 +4277,9 @@ u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state, ...@@ -4277,9 +4277,9 @@ u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
to_i915(plane_state->base.plane->dev); to_i915(plane_state->uapi.plane->dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
u32 plane_color_ctl = 0; u32 plane_color_ctl = 0;
plane_color_ctl |= PLANE_COLOR_PLANE_GAMMA_DISABLE; plane_color_ctl |= PLANE_COLOR_PLANE_GAMMA_DISABLE;
...@@ -5623,11 +5623,11 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state, ...@@ -5623,11 +5623,11 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,
struct intel_plane_state *plane_state) struct intel_plane_state *plane_state)
{ {
struct intel_plane *intel_plane = struct intel_plane *intel_plane =
to_intel_plane(plane_state->base.plane); to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(intel_plane->base.dev); struct drm_i915_private *dev_priv = to_i915(intel_plane->base.dev);
struct drm_framebuffer *fb = plane_state->hw.fb; struct drm_framebuffer *fb = plane_state->hw.fb;
int ret; int ret;
bool force_detach = !fb || !plane_state->base.visible; bool force_detach = !fb || !plane_state->uapi.visible;
bool need_scaler = false; bool need_scaler = false;
/* Pre-gen11 and SDR planes always need a scaler for planar formats. */ /* Pre-gen11 and SDR planes always need a scaler for planar formats. */
...@@ -5638,10 +5638,10 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state, ...@@ -5638,10 +5638,10 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,
ret = skl_update_scaler(crtc_state, force_detach, ret = skl_update_scaler(crtc_state, force_detach,
drm_plane_index(&intel_plane->base), drm_plane_index(&intel_plane->base),
&plane_state->scaler_id, &plane_state->scaler_id,
drm_rect_width(&plane_state->base.src) >> 16, drm_rect_width(&plane_state->uapi.src) >> 16,
drm_rect_height(&plane_state->base.src) >> 16, drm_rect_height(&plane_state->uapi.src) >> 16,
drm_rect_width(&plane_state->base.dst), drm_rect_width(&plane_state->uapi.dst),
drm_rect_height(&plane_state->base.dst), drm_rect_height(&plane_state->uapi.dst),
fb ? fb->format : NULL, need_scaler); fb ? fb->format : NULL, need_scaler);
if (ret || plane_state->scaler_id < 0) if (ret || plane_state->scaler_id < 0)
...@@ -6057,7 +6057,7 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state, ...@@ -6057,7 +6057,7 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state,
* So disable underrun reporting before all the planes get disabled. * So disable underrun reporting before all the planes get disabled.
*/ */
if (IS_GEN(dev_priv, 2) && old_primary_state->visible && if (IS_GEN(dev_priv, 2) && old_primary_state->visible &&
(modeset || !new_primary_state->base.visible)) (modeset || !new_primary_state->uapi.visible))
intel_set_cpu_fifo_underrun_reporting(dev_priv, crtc->pipe, false); intel_set_cpu_fifo_underrun_reporting(dev_priv, crtc->pipe, false);
} }
...@@ -6144,7 +6144,7 @@ static void intel_crtc_disable_planes(struct intel_atomic_state *state, ...@@ -6144,7 +6144,7 @@ static void intel_crtc_disable_planes(struct intel_atomic_state *state,
intel_disable_plane(plane, new_crtc_state); intel_disable_plane(plane, new_crtc_state);
if (old_plane_state->base.visible) if (old_plane_state->uapi.visible)
fb_bits |= plane->frontbuffer_bit; fb_bits |= plane->frontbuffer_bit;
} }
...@@ -7153,7 +7153,7 @@ static void intel_crtc_disable_noatomic(struct drm_crtc *crtc, ...@@ -7153,7 +7153,7 @@ static void intel_crtc_disable_noatomic(struct drm_crtc *crtc,
const struct intel_plane_state *plane_state = const struct intel_plane_state *plane_state =
to_intel_plane_state(plane->base.state); to_intel_plane_state(plane->base.state);
if (plane_state->base.visible) if (plane_state->uapi.visible)
intel_plane_disable_noatomic(intel_crtc, plane); intel_plane_disable_noatomic(intel_crtc, plane);
} }
...@@ -10728,7 +10728,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc, ...@@ -10728,7 +10728,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
static u32 intel_cursor_base(const struct intel_plane_state *plane_state) static u32 intel_cursor_base(const struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
to_i915(plane_state->base.plane->dev); to_i915(plane_state->uapi.plane->dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
const struct drm_i915_gem_object *obj = intel_fb_obj(fb); const struct drm_i915_gem_object *obj = intel_fb_obj(fb);
u32 base; u32 base;
...@@ -10743,8 +10743,8 @@ static u32 intel_cursor_base(const struct intel_plane_state *plane_state) ...@@ -10743,8 +10743,8 @@ static u32 intel_cursor_base(const struct intel_plane_state *plane_state)
static u32 intel_cursor_position(const struct intel_plane_state *plane_state) static u32 intel_cursor_position(const struct intel_plane_state *plane_state)
{ {
int x = plane_state->base.dst.x1; int x = plane_state->uapi.dst.x1;
int y = plane_state->base.dst.y1; int y = plane_state->uapi.dst.y1;
u32 pos = 0; u32 pos = 0;
if (x < 0) { if (x < 0) {
...@@ -10765,9 +10765,9 @@ static u32 intel_cursor_position(const struct intel_plane_state *plane_state) ...@@ -10765,9 +10765,9 @@ static u32 intel_cursor_position(const struct intel_plane_state *plane_state)
static bool intel_cursor_size_ok(const struct intel_plane_state *plane_state) static bool intel_cursor_size_ok(const struct intel_plane_state *plane_state)
{ {
const struct drm_mode_config *config = const struct drm_mode_config *config =
&plane_state->base.plane->dev->mode_config; &plane_state->uapi.plane->dev->mode_config;
int width = drm_rect_width(&plane_state->base.dst); int width = drm_rect_width(&plane_state->uapi.dst);
int height = drm_rect_height(&plane_state->base.dst); int height = drm_rect_height(&plane_state->uapi.dst);
return width > 0 && width <= config->cursor_width && return width > 0 && width <= config->cursor_width &&
height > 0 && height <= config->cursor_height; height > 0 && height <= config->cursor_height;
...@@ -10776,7 +10776,7 @@ static bool intel_cursor_size_ok(const struct intel_plane_state *plane_state) ...@@ -10776,7 +10776,7 @@ static bool intel_cursor_size_ok(const struct intel_plane_state *plane_state)
static int intel_cursor_check_surface(struct intel_plane_state *plane_state) static int intel_cursor_check_surface(struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
to_i915(plane_state->base.plane->dev); to_i915(plane_state->uapi.plane->dev);
unsigned int rotation = plane_state->hw.rotation; unsigned int rotation = plane_state->hw.rotation;
int src_x, src_y; int src_x, src_y;
u32 offset; u32 offset;
...@@ -10786,11 +10786,11 @@ static int intel_cursor_check_surface(struct intel_plane_state *plane_state) ...@@ -10786,11 +10786,11 @@ static int intel_cursor_check_surface(struct intel_plane_state *plane_state)
if (ret) if (ret)
return ret; return ret;
if (!plane_state->base.visible) if (!plane_state->uapi.visible)
return 0; return 0;
src_x = plane_state->base.src.x1 >> 16; src_x = plane_state->uapi.src.x1 >> 16;
src_y = plane_state->base.src.y1 >> 16; src_y = plane_state->uapi.src.y1 >> 16;
intel_add_fb_offsets(&src_x, &src_y, plane_state, 0); intel_add_fb_offsets(&src_x, &src_y, plane_state, 0);
offset = intel_plane_compute_aligned_offset(&src_x, &src_y, offset = intel_plane_compute_aligned_offset(&src_x, &src_y,
...@@ -10805,14 +10805,14 @@ static int intel_cursor_check_surface(struct intel_plane_state *plane_state) ...@@ -10805,14 +10805,14 @@ static int intel_cursor_check_surface(struct intel_plane_state *plane_state)
* Put the final coordinates back so that the src * Put the final coordinates back so that the src
* coordinate checks will see the right values. * coordinate checks will see the right values.
*/ */
drm_rect_translate_to(&plane_state->base.src, drm_rect_translate_to(&plane_state->uapi.src,
src_x << 16, src_y << 16); src_x << 16, src_y << 16);
/* ILK+ do this automagically in hardware */ /* ILK+ do this automagically in hardware */
if (HAS_GMCH(dev_priv) && rotation & DRM_MODE_ROTATE_180) { if (HAS_GMCH(dev_priv) && rotation & DRM_MODE_ROTATE_180) {
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
int src_w = drm_rect_width(&plane_state->base.src) >> 16; int src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
int src_h = drm_rect_height(&plane_state->base.src) >> 16; int src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
offset += (src_h * src_w - 1) * fb->format->cpp[0]; offset += (src_h * src_w - 1) * fb->format->cpp[0];
} }
...@@ -10835,7 +10835,7 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state, ...@@ -10835,7 +10835,7 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
return -EINVAL; return -EINVAL;
} }
ret = drm_atomic_helper_check_plane_state(&plane_state->base, ret = drm_atomic_helper_check_plane_state(&plane_state->uapi,
&crtc_state->uapi, &crtc_state->uapi,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
...@@ -10844,14 +10844,14 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state, ...@@ -10844,14 +10844,14 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
return ret; return ret;
/* Use the unclipped src/dst rectangles, which we program to hw */ /* Use the unclipped src/dst rectangles, which we program to hw */
plane_state->base.src = drm_plane_state_src(&plane_state->base); plane_state->uapi.src = drm_plane_state_src(&plane_state->uapi);
plane_state->base.dst = drm_plane_state_dest(&plane_state->base); plane_state->uapi.dst = drm_plane_state_dest(&plane_state->uapi);
ret = intel_cursor_check_surface(plane_state); ret = intel_cursor_check_surface(plane_state);
if (ret) if (ret)
return ret; return ret;
if (!plane_state->base.visible) if (!plane_state->uapi.visible)
return 0; return 0;
ret = intel_plane_check_src_coordinates(plane_state); ret = intel_plane_check_src_coordinates(plane_state);
...@@ -10889,7 +10889,7 @@ static u32 i845_cursor_ctl(const struct intel_crtc_state *crtc_state, ...@@ -10889,7 +10889,7 @@ static u32 i845_cursor_ctl(const struct intel_crtc_state *crtc_state,
static bool i845_cursor_size_ok(const struct intel_plane_state *plane_state) static bool i845_cursor_size_ok(const struct intel_plane_state *plane_state)
{ {
int width = drm_rect_width(&plane_state->base.dst); int width = drm_rect_width(&plane_state->uapi.dst);
/* /*
* 845g/865g are only limited by the width of their cursors, * 845g/865g are only limited by the width of their cursors,
...@@ -10915,12 +10915,12 @@ static int i845_check_cursor(struct intel_crtc_state *crtc_state, ...@@ -10915,12 +10915,12 @@ static int i845_check_cursor(struct intel_crtc_state *crtc_state,
/* Check for which cursor types we support */ /* Check for which cursor types we support */
if (!i845_cursor_size_ok(plane_state)) { if (!i845_cursor_size_ok(plane_state)) {
DRM_DEBUG("Cursor dimension %dx%d not supported\n", DRM_DEBUG("Cursor dimension %dx%d not supported\n",
drm_rect_width(&plane_state->base.dst), drm_rect_width(&plane_state->uapi.dst),
drm_rect_height(&plane_state->base.dst)); drm_rect_height(&plane_state->uapi.dst));
return -EINVAL; return -EINVAL;
} }
WARN_ON(plane_state->base.visible && WARN_ON(plane_state->uapi.visible &&
plane_state->color_plane[0].stride != fb->pitches[0]); plane_state->color_plane[0].stride != fb->pitches[0]);
switch (fb->pitches[0]) { switch (fb->pitches[0]) {
...@@ -10948,9 +10948,9 @@ static void i845_update_cursor(struct intel_plane *plane, ...@@ -10948,9 +10948,9 @@ static void i845_update_cursor(struct intel_plane *plane,
u32 cntl = 0, base = 0, pos = 0, size = 0; u32 cntl = 0, base = 0, pos = 0, size = 0;
unsigned long irqflags; unsigned long irqflags;
if (plane_state && plane_state->base.visible) { if (plane_state && plane_state->uapi.visible) {
unsigned int width = drm_rect_width(&plane_state->base.dst); unsigned int width = drm_rect_width(&plane_state->uapi.dst);
unsigned int height = drm_rect_height(&plane_state->base.dst); unsigned int height = drm_rect_height(&plane_state->uapi.dst);
cntl = plane_state->ctl | cntl = plane_state->ctl |
i845_cursor_ctl_crtc(crtc_state); i845_cursor_ctl_crtc(crtc_state);
...@@ -11046,13 +11046,13 @@ static u32 i9xx_cursor_ctl(const struct intel_crtc_state *crtc_state, ...@@ -11046,13 +11046,13 @@ static u32 i9xx_cursor_ctl(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
to_i915(plane_state->base.plane->dev); to_i915(plane_state->uapi.plane->dev);
u32 cntl = 0; u32 cntl = 0;
if (IS_GEN(dev_priv, 6) || IS_IVYBRIDGE(dev_priv)) if (IS_GEN(dev_priv, 6) || IS_IVYBRIDGE(dev_priv))
cntl |= MCURSOR_TRICKLE_FEED_DISABLE; cntl |= MCURSOR_TRICKLE_FEED_DISABLE;
switch (drm_rect_width(&plane_state->base.dst)) { switch (drm_rect_width(&plane_state->uapi.dst)) {
case 64: case 64:
cntl |= MCURSOR_MODE_64_ARGB_AX; cntl |= MCURSOR_MODE_64_ARGB_AX;
break; break;
...@@ -11063,7 +11063,7 @@ static u32 i9xx_cursor_ctl(const struct intel_crtc_state *crtc_state, ...@@ -11063,7 +11063,7 @@ static u32 i9xx_cursor_ctl(const struct intel_crtc_state *crtc_state,
cntl |= MCURSOR_MODE_256_ARGB_AX; cntl |= MCURSOR_MODE_256_ARGB_AX;
break; break;
default: default:
MISSING_CASE(drm_rect_width(&plane_state->base.dst)); MISSING_CASE(drm_rect_width(&plane_state->uapi.dst));
return 0; return 0;
} }
...@@ -11076,9 +11076,9 @@ static u32 i9xx_cursor_ctl(const struct intel_crtc_state *crtc_state, ...@@ -11076,9 +11076,9 @@ static u32 i9xx_cursor_ctl(const struct intel_crtc_state *crtc_state,
static bool i9xx_cursor_size_ok(const struct intel_plane_state *plane_state) static bool i9xx_cursor_size_ok(const struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
to_i915(plane_state->base.plane->dev); to_i915(plane_state->uapi.plane->dev);
int width = drm_rect_width(&plane_state->base.dst); int width = drm_rect_width(&plane_state->uapi.dst);
int height = drm_rect_height(&plane_state->base.dst); int height = drm_rect_height(&plane_state->uapi.dst);
if (!intel_cursor_size_ok(plane_state)) if (!intel_cursor_size_ok(plane_state))
return false; return false;
...@@ -11114,7 +11114,7 @@ static bool i9xx_cursor_size_ok(const struct intel_plane_state *plane_state) ...@@ -11114,7 +11114,7 @@ static bool i9xx_cursor_size_ok(const struct intel_plane_state *plane_state)
static int i9xx_check_cursor(struct intel_crtc_state *crtc_state, static int i9xx_check_cursor(struct intel_crtc_state *crtc_state,
struct intel_plane_state *plane_state) struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
enum pipe pipe = plane->pipe; enum pipe pipe = plane->pipe;
...@@ -11131,19 +11131,19 @@ static int i9xx_check_cursor(struct intel_crtc_state *crtc_state, ...@@ -11131,19 +11131,19 @@ static int i9xx_check_cursor(struct intel_crtc_state *crtc_state,
/* Check for which cursor types we support */ /* Check for which cursor types we support */
if (!i9xx_cursor_size_ok(plane_state)) { if (!i9xx_cursor_size_ok(plane_state)) {
DRM_DEBUG("Cursor dimension %dx%d not supported\n", DRM_DEBUG("Cursor dimension %dx%d not supported\n",
drm_rect_width(&plane_state->base.dst), drm_rect_width(&plane_state->uapi.dst),
drm_rect_height(&plane_state->base.dst)); drm_rect_height(&plane_state->uapi.dst));
return -EINVAL; return -EINVAL;
} }
WARN_ON(plane_state->base.visible && WARN_ON(plane_state->uapi.visible &&
plane_state->color_plane[0].stride != fb->pitches[0]); plane_state->color_plane[0].stride != fb->pitches[0]);
if (fb->pitches[0] != if (fb->pitches[0] !=
drm_rect_width(&plane_state->base.dst) * fb->format->cpp[0]) { drm_rect_width(&plane_state->uapi.dst) * fb->format->cpp[0]) {
DRM_DEBUG_KMS("Invalid cursor stride (%u) (cursor width %d)\n", DRM_DEBUG_KMS("Invalid cursor stride (%u) (cursor width %d)\n",
fb->pitches[0], fb->pitches[0],
drm_rect_width(&plane_state->base.dst)); drm_rect_width(&plane_state->uapi.dst));
return -EINVAL; return -EINVAL;
} }
...@@ -11158,7 +11158,7 @@ static int i9xx_check_cursor(struct intel_crtc_state *crtc_state, ...@@ -11158,7 +11158,7 @@ static int i9xx_check_cursor(struct intel_crtc_state *crtc_state,
* Refuse the put the cursor into that compromised position. * Refuse the put the cursor into that compromised position.
*/ */
if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_C && if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_C &&
plane_state->base.visible && plane_state->base.dst.x1 < 0) { plane_state->uapi.visible && plane_state->uapi.dst.x1 < 0) {
DRM_DEBUG_KMS("CHV cursor C not allowed to straddle the left screen edge\n"); DRM_DEBUG_KMS("CHV cursor C not allowed to straddle the left screen edge\n");
return -EINVAL; return -EINVAL;
} }
...@@ -11177,9 +11177,9 @@ static void i9xx_update_cursor(struct intel_plane *plane, ...@@ -11177,9 +11177,9 @@ static void i9xx_update_cursor(struct intel_plane *plane,
u32 cntl = 0, base = 0, pos = 0, fbc_ctl = 0; u32 cntl = 0, base = 0, pos = 0, fbc_ctl = 0;
unsigned long irqflags; unsigned long irqflags;
if (plane_state && plane_state->base.visible) { if (plane_state && plane_state->uapi.visible) {
unsigned width = drm_rect_width(&plane_state->base.dst); unsigned width = drm_rect_width(&plane_state->uapi.dst);
unsigned height = drm_rect_height(&plane_state->base.dst); unsigned height = drm_rect_height(&plane_state->uapi.dst);
cntl = plane_state->ctl | cntl = plane_state->ctl |
i9xx_cursor_ctl_crtc(crtc_state); i9xx_cursor_ctl_crtc(crtc_state);
...@@ -11714,7 +11714,7 @@ static bool intel_wm_need_update(const struct intel_plane_state *cur, ...@@ -11714,7 +11714,7 @@ static bool intel_wm_need_update(const struct intel_plane_state *cur,
struct intel_plane_state *new) struct intel_plane_state *new)
{ {
/* Update watermarks on tiling or size changes. */ /* Update watermarks on tiling or size changes. */
if (new->base.visible != cur->base.visible) if (new->uapi.visible != cur->uapi.visible)
return true; return true;
if (!cur->hw.fb || !new->hw.fb) if (!cur->hw.fb || !new->hw.fb)
...@@ -11722,10 +11722,10 @@ static bool intel_wm_need_update(const struct intel_plane_state *cur, ...@@ -11722,10 +11722,10 @@ static bool intel_wm_need_update(const struct intel_plane_state *cur,
if (cur->hw.fb->modifier != new->hw.fb->modifier || if (cur->hw.fb->modifier != new->hw.fb->modifier ||
cur->hw.rotation != new->hw.rotation || cur->hw.rotation != new->hw.rotation ||
drm_rect_width(&new->base.src) != drm_rect_width(&cur->base.src) || drm_rect_width(&new->uapi.src) != drm_rect_width(&cur->uapi.src) ||
drm_rect_height(&new->base.src) != drm_rect_height(&cur->base.src) || drm_rect_height(&new->uapi.src) != drm_rect_height(&cur->uapi.src) ||
drm_rect_width(&new->base.dst) != drm_rect_width(&cur->base.dst) || drm_rect_width(&new->uapi.dst) != drm_rect_width(&cur->uapi.dst) ||
drm_rect_height(&new->base.dst) != drm_rect_height(&cur->base.dst)) drm_rect_height(&new->uapi.dst) != drm_rect_height(&cur->uapi.dst))
return true; return true;
return false; return false;
...@@ -11733,10 +11733,10 @@ static bool intel_wm_need_update(const struct intel_plane_state *cur, ...@@ -11733,10 +11733,10 @@ static bool intel_wm_need_update(const struct intel_plane_state *cur,
static bool needs_scaling(const struct intel_plane_state *state) static bool needs_scaling(const struct intel_plane_state *state)
{ {
int src_w = drm_rect_width(&state->base.src) >> 16; int src_w = drm_rect_width(&state->uapi.src) >> 16;
int src_h = drm_rect_height(&state->base.src) >> 16; int src_h = drm_rect_height(&state->uapi.src) >> 16;
int dst_w = drm_rect_width(&state->base.dst); int dst_w = drm_rect_width(&state->uapi.dst);
int dst_h = drm_rect_height(&state->base.dst); int dst_h = drm_rect_height(&state->uapi.dst);
return (src_w != dst_w || src_h != dst_h); return (src_w != dst_w || src_h != dst_h);
} }
...@@ -11747,7 +11747,7 @@ int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_stat ...@@ -11747,7 +11747,7 @@ int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_stat
struct intel_plane_state *plane_state) struct intel_plane_state *plane_state)
{ {
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
bool mode_changed = needs_modeset(crtc_state); bool mode_changed = needs_modeset(crtc_state);
bool was_crtc_enabled = old_crtc_state->hw.active; bool was_crtc_enabled = old_crtc_state->hw.active;
...@@ -11761,8 +11761,8 @@ int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_stat ...@@ -11761,8 +11761,8 @@ int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_stat
return ret; return ret;
} }
was_visible = old_plane_state->base.visible; was_visible = old_plane_state->uapi.visible;
visible = plane_state->base.visible; visible = plane_state->uapi.visible;
if (!was_crtc_enabled && WARN_ON(was_visible)) if (!was_crtc_enabled && WARN_ON(was_visible))
was_visible = false; was_visible = false;
...@@ -11778,7 +11778,7 @@ int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_stat ...@@ -11778,7 +11778,7 @@ int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_stat
* only combine the results from all planes in the current place? * only combine the results from all planes in the current place?
*/ */
if (!is_crtc_enabled) { if (!is_crtc_enabled) {
plane_state->base.visible = visible = false; plane_state->uapi.visible = visible = false;
crtc_state->active_planes &= ~BIT(plane->id); crtc_state->active_planes &= ~BIT(plane->id);
crtc_state->data_rate[plane->id] = 0; crtc_state->data_rate[plane->id] = 0;
crtc_state->min_cdclk[plane->id] = 0; crtc_state->min_cdclk[plane->id] = 0;
...@@ -11938,7 +11938,7 @@ static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state) ...@@ -11938,7 +11938,7 @@ static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state)
continue; continue;
plane_state->planar_linked_plane = NULL; plane_state->planar_linked_plane = NULL;
if (plane_state->planar_slave && !plane_state->base.visible) { if (plane_state->planar_slave && !plane_state->uapi.visible) {
crtc_state->active_planes &= ~BIT(plane->id); crtc_state->active_planes &= ~BIT(plane->id);
crtc_state->update_planes |= BIT(plane->id); crtc_state->update_planes |= BIT(plane->id);
} }
...@@ -12352,14 +12352,14 @@ static const char *output_formats(enum intel_output_format format) ...@@ -12352,14 +12352,14 @@ static const char *output_formats(enum intel_output_format format)
static void intel_dump_plane_state(const struct intel_plane_state *plane_state) static void intel_dump_plane_state(const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
struct drm_format_name_buf format_name; struct drm_format_name_buf format_name;
if (!fb) { if (!fb) {
DRM_DEBUG_KMS("[PLANE:%d:%s] fb: [NOFB], visible: %s\n", DRM_DEBUG_KMS("[PLANE:%d:%s] fb: [NOFB], visible: %s\n",
plane->base.base.id, plane->base.name, plane->base.base.id, plane->base.name,
yesno(plane_state->base.visible)); yesno(plane_state->uapi.visible));
return; return;
} }
...@@ -12367,13 +12367,13 @@ static void intel_dump_plane_state(const struct intel_plane_state *plane_state) ...@@ -12367,13 +12367,13 @@ static void intel_dump_plane_state(const struct intel_plane_state *plane_state)
plane->base.base.id, plane->base.name, plane->base.base.id, plane->base.name,
fb->base.id, fb->width, fb->height, fb->base.id, fb->width, fb->height,
drm_get_format_name(fb->format->format, &format_name), drm_get_format_name(fb->format->format, &format_name),
yesno(plane_state->base.visible)); yesno(plane_state->uapi.visible));
DRM_DEBUG_KMS("\trotation: 0x%x, scaler: %d\n", DRM_DEBUG_KMS("\trotation: 0x%x, scaler: %d\n",
plane_state->hw.rotation, plane_state->scaler_id); plane_state->hw.rotation, plane_state->scaler_id);
if (plane_state->base.visible) if (plane_state->uapi.visible)
DRM_DEBUG_KMS("\tsrc: " DRM_RECT_FP_FMT " dst: " DRM_RECT_FMT "\n", DRM_DEBUG_KMS("\tsrc: " DRM_RECT_FP_FMT " dst: " DRM_RECT_FMT "\n",
DRM_RECT_FP_ARG(&plane_state->base.src), DRM_RECT_FP_ARG(&plane_state->uapi.src),
DRM_RECT_ARG(&plane_state->base.dst)); DRM_RECT_ARG(&plane_state->uapi.dst));
} }
static void intel_dump_pipe_config(const struct intel_crtc_state *pipe_config, static void intel_dump_pipe_config(const struct intel_crtc_state *pipe_config,
...@@ -13578,7 +13578,7 @@ intel_verify_planes(struct intel_atomic_state *state) ...@@ -13578,7 +13578,7 @@ intel_verify_planes(struct intel_atomic_state *state)
for_each_new_intel_plane_in_state(state, plane, for_each_new_intel_plane_in_state(state, plane,
plane_state, i) plane_state, i)
assert_plane(plane, plane_state->planar_slave || assert_plane(plane, plane_state->planar_slave ||
plane_state->base.visible); plane_state->uapi.visible);
} }
static void static void
...@@ -15037,7 +15037,7 @@ static void add_rps_boost_after_vblank(struct drm_crtc *crtc, ...@@ -15037,7 +15037,7 @@ static void add_rps_boost_after_vblank(struct drm_crtc *crtc,
static int intel_plane_pin_fb(struct intel_plane_state *plane_state) static int intel_plane_pin_fb(struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
struct drm_framebuffer *fb = plane_state->hw.fb; struct drm_framebuffer *fb = plane_state->hw.fb;
struct i915_vma *vma; struct i915_vma *vma;
...@@ -15102,7 +15102,7 @@ intel_prepare_plane_fb(struct drm_plane *plane, ...@@ -15102,7 +15102,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
struct intel_plane_state *new_plane_state = struct intel_plane_state *new_plane_state =
to_intel_plane_state(_new_plane_state); to_intel_plane_state(_new_plane_state);
struct intel_atomic_state *intel_state = struct intel_atomic_state *intel_state =
to_intel_atomic_state(new_plane_state->base.state); to_intel_atomic_state(new_plane_state->uapi.state);
struct drm_i915_private *dev_priv = to_i915(plane->dev); struct drm_i915_private *dev_priv = to_i915(plane->dev);
struct drm_framebuffer *fb = new_plane_state->hw.fb; struct drm_framebuffer *fb = new_plane_state->hw.fb;
struct drm_i915_gem_object *obj = intel_fb_obj(fb); struct drm_i915_gem_object *obj = intel_fb_obj(fb);
...@@ -15135,9 +15135,9 @@ intel_prepare_plane_fb(struct drm_plane *plane, ...@@ -15135,9 +15135,9 @@ intel_prepare_plane_fb(struct drm_plane *plane,
} }
} }
if (new_plane_state->base.fence) { /* explicit fencing */ if (new_plane_state->uapi.fence) { /* explicit fencing */
ret = i915_sw_fence_await_dma_fence(&intel_state->commit_ready, ret = i915_sw_fence_await_dma_fence(&intel_state->commit_ready,
new_plane_state->base.fence, new_plane_state->uapi.fence,
I915_FENCE_TIMEOUT, I915_FENCE_TIMEOUT,
GFP_KERNEL); GFP_KERNEL);
if (ret < 0) if (ret < 0)
...@@ -15160,7 +15160,7 @@ intel_prepare_plane_fb(struct drm_plane *plane, ...@@ -15160,7 +15160,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
fb_obj_bump_render_priority(obj); fb_obj_bump_render_priority(obj);
intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_DIRTYFB); intel_frontbuffer_flush(obj->frontbuffer, ORIGIN_DIRTYFB);
if (!new_plane_state->base.fence) { /* implicit fencing */ if (!new_plane_state->uapi.fence) { /* implicit fencing */
struct dma_fence *fence; struct dma_fence *fence;
ret = i915_sw_fence_await_reservation(&intel_state->commit_ready, ret = i915_sw_fence_await_reservation(&intel_state->commit_ready,
...@@ -15178,7 +15178,7 @@ intel_prepare_plane_fb(struct drm_plane *plane, ...@@ -15178,7 +15178,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,
} }
} else { } else {
add_rps_boost_after_vblank(new_plane_state->hw.crtc, add_rps_boost_after_vblank(new_plane_state->hw.crtc,
new_plane_state->base.fence); new_plane_state->uapi.fence);
} }
/* /*
...@@ -15211,7 +15211,7 @@ intel_cleanup_plane_fb(struct drm_plane *plane, ...@@ -15211,7 +15211,7 @@ intel_cleanup_plane_fb(struct drm_plane *plane,
struct intel_plane_state *old_plane_state = struct intel_plane_state *old_plane_state =
to_intel_plane_state(_old_plane_state); to_intel_plane_state(_old_plane_state);
struct intel_atomic_state *intel_state = struct intel_atomic_state *intel_state =
to_intel_atomic_state(old_plane_state->base.state); to_intel_atomic_state(old_plane_state->uapi.state);
struct drm_i915_private *dev_priv = to_i915(plane->dev); struct drm_i915_private *dev_priv = to_i915(plane->dev);
if (intel_state->rps_interactive) { if (intel_state->rps_interactive) {
...@@ -15343,8 +15343,8 @@ intel_legacy_cursor_update(struct drm_plane *_plane, ...@@ -15343,8 +15343,8 @@ intel_legacy_cursor_update(struct drm_plane *_plane,
* the plane. This prevents our async update's changes from getting * the plane. This prevents our async update's changes from getting
* overridden by a previous synchronous update's state. * overridden by a previous synchronous update's state.
*/ */
if (old_plane_state->base.commit && if (old_plane_state->uapi.commit &&
!try_wait_for_completion(&old_plane_state->base.commit->hw_done)) !try_wait_for_completion(&old_plane_state->uapi.commit->hw_done))
goto slow; goto slow;
/* /*
...@@ -17150,7 +17150,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc, ...@@ -17150,7 +17150,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc,
const struct intel_plane_state *plane_state = const struct intel_plane_state *plane_state =
to_intel_plane_state(plane->base.state); to_intel_plane_state(plane->base.state);
if (plane_state->base.visible && if (plane_state->uapi.visible &&
plane->base.type != DRM_PLANE_TYPE_PRIMARY) plane->base.type != DRM_PLANE_TYPE_PRIMARY)
intel_plane_disable_noatomic(crtc, plane); intel_plane_disable_noatomic(crtc, plane);
} }
...@@ -17483,14 +17483,14 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) ...@@ -17483,14 +17483,14 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
* FIXME don't have the fb yet, so can't * FIXME don't have the fb yet, so can't
* use intel_plane_data_rate() :( * use intel_plane_data_rate() :(
*/ */
if (plane_state->base.visible) if (plane_state->uapi.visible)
crtc_state->data_rate[plane->id] = crtc_state->data_rate[plane->id] =
4 * crtc_state->pixel_rate; 4 * crtc_state->pixel_rate;
/* /*
* FIXME don't have the fb yet, so can't * FIXME don't have the fb yet, so can't
* use plane->min_cdclk() :( * use plane->min_cdclk() :(
*/ */
if (plane_state->base.visible && plane->min_cdclk) { if (plane_state->uapi.visible && plane->min_cdclk) {
if (crtc_state->double_wide || if (crtc_state->double_wide ||
INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
crtc_state->min_cdclk[plane->id] = crtc_state->min_cdclk[plane->id] =
......
...@@ -430,7 +430,7 @@ static bool multiple_pipes_ok(struct intel_crtc *crtc, ...@@ -430,7 +430,7 @@ static bool multiple_pipes_ok(struct intel_crtc *crtc,
if (!no_fbc_on_multiple_pipes(dev_priv)) if (!no_fbc_on_multiple_pipes(dev_priv))
return true; return true;
if (plane_state->base.visible) if (plane_state->uapi.visible)
fbc->visible_pipes_mask |= (1 << pipe); fbc->visible_pipes_mask |= (1 << pipe);
else else
fbc->visible_pipes_mask &= ~(1 << pipe); fbc->visible_pipes_mask &= ~(1 << pipe);
...@@ -677,12 +677,12 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc, ...@@ -677,12 +677,12 @@ static void intel_fbc_update_state_cache(struct intel_crtc *crtc,
* the 90/270 degree plane rotation cases (to match the * the 90/270 degree plane rotation cases (to match the
* GTT mapping), hence no need to account for rotation here. * GTT mapping), hence no need to account for rotation here.
*/ */
cache->plane.src_w = drm_rect_width(&plane_state->base.src) >> 16; cache->plane.src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
cache->plane.src_h = drm_rect_height(&plane_state->base.src) >> 16; cache->plane.src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
cache->plane.visible = plane_state->base.visible; cache->plane.visible = plane_state->uapi.visible;
cache->plane.adjusted_x = plane_state->color_plane[0].x; cache->plane.adjusted_x = plane_state->color_plane[0].x;
cache->plane.adjusted_y = plane_state->color_plane[0].y; cache->plane.adjusted_y = plane_state->color_plane[0].y;
cache->plane.y = plane_state->base.src.y1 >> 16; cache->plane.y = plane_state->uapi.src.y1 >> 16;
cache->plane.pixel_blend_mode = plane_state->hw.pixel_blend_mode; cache->plane.pixel_blend_mode = plane_state->hw.pixel_blend_mode;
...@@ -1052,7 +1052,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv, ...@@ -1052,7 +1052,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *dev_priv,
if (!plane->has_fbc) if (!plane->has_fbc)
continue; continue;
if (!plane_state->base.visible) if (!plane_state->uapi.visible)
continue; continue;
crtc_state = intel_atomic_get_new_crtc_state(state, crtc); crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
......
...@@ -668,7 +668,7 @@ static void update_colorkey(struct intel_overlay *overlay, ...@@ -668,7 +668,7 @@ static void update_colorkey(struct intel_overlay *overlay,
if (overlay->color_key_enabled) if (overlay->color_key_enabled)
flags |= DST_KEY_ENABLE; flags |= DST_KEY_ENABLE;
if (state->base.visible) if (state->uapi.visible)
format = state->hw.fb->format->format; format = state->hw.fb->format->format;
switch (format) { switch (format) {
......
...@@ -240,7 +240,7 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state) ...@@ -240,7 +240,7 @@ void intel_pipe_update_end(struct intel_crtc_state *new_crtc_state)
int intel_plane_check_stride(const struct intel_plane_state *plane_state) int intel_plane_check_stride(const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
unsigned int rotation = plane_state->hw.rotation; unsigned int rotation = plane_state->hw.rotation;
u32 stride, max_stride; u32 stride, max_stride;
...@@ -252,7 +252,7 @@ int intel_plane_check_stride(const struct intel_plane_state *plane_state) ...@@ -252,7 +252,7 @@ int intel_plane_check_stride(const struct intel_plane_state *plane_state)
* kick in due the plane being invisible. * kick in due the plane being invisible.
*/ */
if (intel_plane_can_remap(plane_state) && if (intel_plane_can_remap(plane_state) &&
!plane_state->base.visible) !plane_state->uapi.visible)
return 0; return 0;
/* FIXME other color planes? */ /* FIXME other color planes? */
...@@ -273,7 +273,7 @@ int intel_plane_check_stride(const struct intel_plane_state *plane_state) ...@@ -273,7 +273,7 @@ int intel_plane_check_stride(const struct intel_plane_state *plane_state)
int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state) int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state)
{ {
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
struct drm_rect *src = &plane_state->base.src; struct drm_rect *src = &plane_state->uapi.src;
u32 src_x, src_y, src_w, src_h, hsub, vsub; u32 src_x, src_y, src_w, src_h, hsub, vsub;
bool rotated = drm_rotation_90_or_270(plane_state->hw.rotation); bool rotated = drm_rotation_90_or_270(plane_state->hw.rotation);
...@@ -328,7 +328,7 @@ skl_plane_ratio(const struct intel_crtc_state *crtc_state, ...@@ -328,7 +328,7 @@ skl_plane_ratio(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state, const struct intel_plane_state *plane_state,
unsigned int *num, unsigned int *den) unsigned int *num, unsigned int *den)
{ {
struct drm_i915_private *dev_priv = to_i915(plane_state->base.plane->dev); struct drm_i915_private *dev_priv = to_i915(plane_state->uapi.plane->dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
if (fb->format->cpp[0] == 8) { if (fb->format->cpp[0] == 8) {
...@@ -348,7 +348,7 @@ skl_plane_ratio(const struct intel_crtc_state *crtc_state, ...@@ -348,7 +348,7 @@ skl_plane_ratio(const struct intel_crtc_state *crtc_state,
static int skl_plane_min_cdclk(const struct intel_crtc_state *crtc_state, static int skl_plane_min_cdclk(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = to_i915(plane_state->base.plane->dev); struct drm_i915_private *dev_priv = to_i915(plane_state->uapi.plane->dev);
unsigned int pixel_rate = crtc_state->pixel_rate; unsigned int pixel_rate = crtc_state->pixel_rate;
unsigned int src_w, src_h, dst_w, dst_h; unsigned int src_w, src_h, dst_w, dst_h;
unsigned int num, den; unsigned int num, den;
...@@ -359,10 +359,10 @@ static int skl_plane_min_cdclk(const struct intel_crtc_state *crtc_state, ...@@ -359,10 +359,10 @@ static int skl_plane_min_cdclk(const struct intel_crtc_state *crtc_state,
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
den *= 2; den *= 2;
src_w = drm_rect_width(&plane_state->base.src) >> 16; src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
src_h = drm_rect_height(&plane_state->base.src) >> 16; src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
dst_w = drm_rect_width(&plane_state->base.dst); dst_w = drm_rect_width(&plane_state->uapi.dst);
dst_h = drm_rect_height(&plane_state->base.dst); dst_h = drm_rect_height(&plane_state->uapi.dst);
/* Downscaling limits the maximum pixel rate */ /* Downscaling limits the maximum pixel rate */
dst_w = min(src_w, dst_w); dst_w = min(src_w, dst_w);
...@@ -401,19 +401,19 @@ skl_program_scaler(struct intel_plane *plane, ...@@ -401,19 +401,19 @@ skl_program_scaler(struct intel_plane *plane,
int scaler_id = plane_state->scaler_id; int scaler_id = plane_state->scaler_id;
const struct intel_scaler *scaler = const struct intel_scaler *scaler =
&crtc_state->scaler_state.scalers[scaler_id]; &crtc_state->scaler_state.scalers[scaler_id];
int crtc_x = plane_state->base.dst.x1; int crtc_x = plane_state->uapi.dst.x1;
int crtc_y = plane_state->base.dst.y1; int crtc_y = plane_state->uapi.dst.y1;
u32 crtc_w = drm_rect_width(&plane_state->base.dst); u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
u32 crtc_h = drm_rect_height(&plane_state->base.dst); u32 crtc_h = drm_rect_height(&plane_state->uapi.dst);
u16 y_hphase, uv_rgb_hphase; u16 y_hphase, uv_rgb_hphase;
u16 y_vphase, uv_rgb_vphase; u16 y_vphase, uv_rgb_vphase;
int hscale, vscale; int hscale, vscale;
hscale = drm_rect_calc_hscale(&plane_state->base.src, hscale = drm_rect_calc_hscale(&plane_state->uapi.src,
&plane_state->base.dst, &plane_state->uapi.dst,
0, INT_MAX); 0, INT_MAX);
vscale = drm_rect_calc_vscale(&plane_state->base.src, vscale = drm_rect_calc_vscale(&plane_state->uapi.src,
&plane_state->base.dst, &plane_state->uapi.dst,
0, INT_MAX); 0, INT_MAX);
/* TODO: handle sub-pixel coordinates */ /* TODO: handle sub-pixel coordinates */
...@@ -584,12 +584,12 @@ skl_program_plane(struct intel_plane *plane, ...@@ -584,12 +584,12 @@ skl_program_plane(struct intel_plane *plane,
u32 surf_addr = plane_state->color_plane[color_plane].offset; u32 surf_addr = plane_state->color_plane[color_plane].offset;
u32 stride = skl_plane_stride(plane_state, color_plane); u32 stride = skl_plane_stride(plane_state, color_plane);
u32 aux_stride = skl_plane_stride(plane_state, 1); u32 aux_stride = skl_plane_stride(plane_state, 1);
int crtc_x = plane_state->base.dst.x1; int crtc_x = plane_state->uapi.dst.x1;
int crtc_y = plane_state->base.dst.y1; int crtc_y = plane_state->uapi.dst.y1;
u32 x = plane_state->color_plane[color_plane].x; u32 x = plane_state->color_plane[color_plane].x;
u32 y = plane_state->color_plane[color_plane].y; u32 y = plane_state->color_plane[color_plane].y;
u32 src_w = drm_rect_width(&plane_state->base.src) >> 16; u32 src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
u32 src_h = drm_rect_height(&plane_state->base.src) >> 16; u32 src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
struct intel_plane *linked = plane_state->planar_linked_plane; struct intel_plane *linked = plane_state->planar_linked_plane;
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
u8 alpha = plane_state->hw.alpha >> 8; u8 alpha = plane_state->hw.alpha >> 8;
...@@ -766,7 +766,7 @@ static void i9xx_plane_linear_gamma(u16 gamma[8]) ...@@ -766,7 +766,7 @@ static void i9xx_plane_linear_gamma(u16 gamma[8])
static void static void
chv_update_csc(const struct intel_plane_state *plane_state) chv_update_csc(const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
enum plane_id plane_id = plane->id; enum plane_id plane_id = plane->id;
...@@ -825,7 +825,7 @@ chv_update_csc(const struct intel_plane_state *plane_state) ...@@ -825,7 +825,7 @@ chv_update_csc(const struct intel_plane_state *plane_state)
static void static void
vlv_update_clrc(const struct intel_plane_state *plane_state) vlv_update_clrc(const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
enum pipe pipe = plane->pipe; enum pipe pipe = plane->pipe;
...@@ -1019,7 +1019,7 @@ static u32 vlv_sprite_ctl(const struct intel_crtc_state *crtc_state, ...@@ -1019,7 +1019,7 @@ static u32 vlv_sprite_ctl(const struct intel_crtc_state *crtc_state,
static void vlv_update_gamma(const struct intel_plane_state *plane_state) static void vlv_update_gamma(const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
enum pipe pipe = plane->pipe; enum pipe pipe = plane->pipe;
...@@ -1053,10 +1053,10 @@ vlv_update_plane(struct intel_plane *plane, ...@@ -1053,10 +1053,10 @@ vlv_update_plane(struct intel_plane *plane,
u32 sprsurf_offset = plane_state->color_plane[0].offset; u32 sprsurf_offset = plane_state->color_plane[0].offset;
u32 linear_offset; u32 linear_offset;
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
int crtc_x = plane_state->base.dst.x1; int crtc_x = plane_state->uapi.dst.x1;
int crtc_y = plane_state->base.dst.y1; int crtc_y = plane_state->uapi.dst.y1;
u32 crtc_w = drm_rect_width(&plane_state->base.dst); u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
u32 crtc_h = drm_rect_height(&plane_state->base.dst); u32 crtc_h = drm_rect_height(&plane_state->uapi.dst);
u32 x = plane_state->color_plane[0].x; u32 x = plane_state->color_plane[0].x;
u32 y = plane_state->color_plane[0].y; u32 y = plane_state->color_plane[0].y;
unsigned long irqflags; unsigned long irqflags;
...@@ -1245,8 +1245,8 @@ static int ivb_sprite_min_cdclk(const struct intel_crtc_state *crtc_state, ...@@ -1245,8 +1245,8 @@ static int ivb_sprite_min_cdclk(const struct intel_crtc_state *crtc_state,
*/ */
pixel_rate = crtc_state->pixel_rate; pixel_rate = crtc_state->pixel_rate;
src_w = drm_rect_width(&plane_state->base.src) >> 16; src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
dst_w = drm_rect_width(&plane_state->base.dst); dst_w = drm_rect_width(&plane_state->uapi.dst);
if (src_w != dst_w) if (src_w != dst_w)
ivb_plane_ratio_scaling(crtc_state, plane_state, &num, &den); ivb_plane_ratio_scaling(crtc_state, plane_state, &num, &den);
...@@ -1320,7 +1320,7 @@ static u32 ivb_sprite_ctl_crtc(const struct intel_crtc_state *crtc_state) ...@@ -1320,7 +1320,7 @@ static u32 ivb_sprite_ctl_crtc(const struct intel_crtc_state *crtc_state)
static bool ivb_need_sprite_gamma(const struct intel_plane_state *plane_state) static bool ivb_need_sprite_gamma(const struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
to_i915(plane_state->base.plane->dev); to_i915(plane_state->uapi.plane->dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
return fb->format->cpp[0] == 8 && return fb->format->cpp[0] == 8 &&
...@@ -1331,7 +1331,7 @@ static u32 ivb_sprite_ctl(const struct intel_crtc_state *crtc_state, ...@@ -1331,7 +1331,7 @@ static u32 ivb_sprite_ctl(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
to_i915(plane_state->base.plane->dev); to_i915(plane_state->uapi.plane->dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
unsigned int rotation = plane_state->hw.rotation; unsigned int rotation = plane_state->hw.rotation;
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
...@@ -1422,7 +1422,7 @@ static void ivb_sprite_linear_gamma(const struct intel_plane_state *plane_state, ...@@ -1422,7 +1422,7 @@ static void ivb_sprite_linear_gamma(const struct intel_plane_state *plane_state,
static void ivb_update_gamma(const struct intel_plane_state *plane_state) static void ivb_update_gamma(const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
enum pipe pipe = plane->pipe; enum pipe pipe = plane->pipe;
u16 gamma[18]; u16 gamma[18];
...@@ -1461,14 +1461,14 @@ ivb_update_plane(struct intel_plane *plane, ...@@ -1461,14 +1461,14 @@ ivb_update_plane(struct intel_plane *plane,
u32 sprsurf_offset = plane_state->color_plane[0].offset; u32 sprsurf_offset = plane_state->color_plane[0].offset;
u32 linear_offset; u32 linear_offset;
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
int crtc_x = plane_state->base.dst.x1; int crtc_x = plane_state->uapi.dst.x1;
int crtc_y = plane_state->base.dst.y1; int crtc_y = plane_state->uapi.dst.y1;
u32 crtc_w = drm_rect_width(&plane_state->base.dst); u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
u32 crtc_h = drm_rect_height(&plane_state->base.dst); u32 crtc_h = drm_rect_height(&plane_state->uapi.dst);
u32 x = plane_state->color_plane[0].x; u32 x = plane_state->color_plane[0].x;
u32 y = plane_state->color_plane[0].y; u32 y = plane_state->color_plane[0].y;
u32 src_w = drm_rect_width(&plane_state->base.src) >> 16; u32 src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
u32 src_h = drm_rect_height(&plane_state->base.src) >> 16; u32 src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
u32 sprctl, sprscale = 0; u32 sprctl, sprscale = 0;
unsigned long irqflags; unsigned long irqflags;
...@@ -1581,8 +1581,8 @@ static int g4x_sprite_min_cdclk(const struct intel_crtc_state *crtc_state, ...@@ -1581,8 +1581,8 @@ static int g4x_sprite_min_cdclk(const struct intel_crtc_state *crtc_state,
pixel_rate = crtc_state->pixel_rate; pixel_rate = crtc_state->pixel_rate;
/* Horizontal downscaling limits the maximum pixel rate */ /* Horizontal downscaling limits the maximum pixel rate */
hscale = drm_rect_calc_hscale(&plane_state->base.src, hscale = drm_rect_calc_hscale(&plane_state->uapi.src,
&plane_state->base.dst, &plane_state->uapi.dst,
0, INT_MAX); 0, INT_MAX);
if (hscale < 0x10000) if (hscale < 0x10000)
return pixel_rate; return pixel_rate;
...@@ -1636,7 +1636,7 @@ static u32 g4x_sprite_ctl(const struct intel_crtc_state *crtc_state, ...@@ -1636,7 +1636,7 @@ static u32 g4x_sprite_ctl(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
to_i915(plane_state->base.plane->dev); to_i915(plane_state->uapi.plane->dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
unsigned int rotation = plane_state->hw.rotation; unsigned int rotation = plane_state->hw.rotation;
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
...@@ -1699,7 +1699,7 @@ static u32 g4x_sprite_ctl(const struct intel_crtc_state *crtc_state, ...@@ -1699,7 +1699,7 @@ static u32 g4x_sprite_ctl(const struct intel_crtc_state *crtc_state,
static void g4x_update_gamma(const struct intel_plane_state *plane_state) static void g4x_update_gamma(const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
enum pipe pipe = plane->pipe; enum pipe pipe = plane->pipe;
...@@ -1731,7 +1731,7 @@ static void ilk_sprite_linear_gamma(u16 gamma[17]) ...@@ -1731,7 +1731,7 @@ static void ilk_sprite_linear_gamma(u16 gamma[17])
static void ilk_update_gamma(const struct intel_plane_state *plane_state) static void ilk_update_gamma(const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
enum pipe pipe = plane->pipe; enum pipe pipe = plane->pipe;
...@@ -1767,14 +1767,14 @@ g4x_update_plane(struct intel_plane *plane, ...@@ -1767,14 +1767,14 @@ g4x_update_plane(struct intel_plane *plane,
u32 dvssurf_offset = plane_state->color_plane[0].offset; u32 dvssurf_offset = plane_state->color_plane[0].offset;
u32 linear_offset; u32 linear_offset;
const struct drm_intel_sprite_colorkey *key = &plane_state->ckey; const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
int crtc_x = plane_state->base.dst.x1; int crtc_x = plane_state->uapi.dst.x1;
int crtc_y = plane_state->base.dst.y1; int crtc_y = plane_state->uapi.dst.y1;
u32 crtc_w = drm_rect_width(&plane_state->base.dst); u32 crtc_w = drm_rect_width(&plane_state->uapi.dst);
u32 crtc_h = drm_rect_height(&plane_state->base.dst); u32 crtc_h = drm_rect_height(&plane_state->uapi.dst);
u32 x = plane_state->color_plane[0].x; u32 x = plane_state->color_plane[0].x;
u32 y = plane_state->color_plane[0].y; u32 y = plane_state->color_plane[0].y;
u32 src_w = drm_rect_width(&plane_state->base.src) >> 16; u32 src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
u32 src_h = drm_rect_height(&plane_state->base.src) >> 16; u32 src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
u32 dvscntr, dvsscale = 0; u32 dvscntr, dvsscale = 0;
unsigned long irqflags; unsigned long irqflags;
...@@ -1888,8 +1888,8 @@ g4x_sprite_check_scaling(struct intel_crtc_state *crtc_state, ...@@ -1888,8 +1888,8 @@ g4x_sprite_check_scaling(struct intel_crtc_state *crtc_state,
struct intel_plane_state *plane_state) struct intel_plane_state *plane_state)
{ {
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
const struct drm_rect *src = &plane_state->base.src; const struct drm_rect *src = &plane_state->uapi.src;
const struct drm_rect *dst = &plane_state->base.dst; const struct drm_rect *dst = &plane_state->uapi.dst;
int src_x, src_w, src_h, crtc_w, crtc_h; int src_x, src_w, src_h, crtc_w, crtc_h;
const struct drm_display_mode *adjusted_mode = const struct drm_display_mode *adjusted_mode =
&crtc_state->hw.adjusted_mode; &crtc_state->hw.adjusted_mode;
...@@ -1948,7 +1948,7 @@ static int ...@@ -1948,7 +1948,7 @@ static int
g4x_sprite_check(struct intel_crtc_state *crtc_state, g4x_sprite_check(struct intel_crtc_state *crtc_state,
struct intel_plane_state *plane_state) struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
int min_scale = DRM_PLANE_HELPER_NO_SCALING; int min_scale = DRM_PLANE_HELPER_NO_SCALING;
int max_scale = DRM_PLANE_HELPER_NO_SCALING; int max_scale = DRM_PLANE_HELPER_NO_SCALING;
...@@ -1964,7 +1964,7 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state, ...@@ -1964,7 +1964,7 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state,
} }
} }
ret = drm_atomic_helper_check_plane_state(&plane_state->base, ret = drm_atomic_helper_check_plane_state(&plane_state->uapi,
&crtc_state->uapi, &crtc_state->uapi,
min_scale, max_scale, min_scale, max_scale,
true, true); true, true);
...@@ -1975,7 +1975,7 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state, ...@@ -1975,7 +1975,7 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state,
if (ret) if (ret)
return ret; return ret;
if (!plane_state->base.visible) if (!plane_state->uapi.visible)
return 0; return 0;
ret = intel_plane_check_src_coordinates(plane_state); ret = intel_plane_check_src_coordinates(plane_state);
...@@ -1996,7 +1996,7 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state, ...@@ -1996,7 +1996,7 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state,
int chv_plane_check_rotation(const struct intel_plane_state *plane_state) int chv_plane_check_rotation(const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
unsigned int rotation = plane_state->hw.rotation; unsigned int rotation = plane_state->hw.rotation;
...@@ -2021,7 +2021,7 @@ vlv_sprite_check(struct intel_crtc_state *crtc_state, ...@@ -2021,7 +2021,7 @@ vlv_sprite_check(struct intel_crtc_state *crtc_state,
if (ret) if (ret)
return ret; return ret;
ret = drm_atomic_helper_check_plane_state(&plane_state->base, ret = drm_atomic_helper_check_plane_state(&plane_state->uapi,
&crtc_state->uapi, &crtc_state->uapi,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
DRM_PLANE_HELPER_NO_SCALING, DRM_PLANE_HELPER_NO_SCALING,
...@@ -2033,7 +2033,7 @@ vlv_sprite_check(struct intel_crtc_state *crtc_state, ...@@ -2033,7 +2033,7 @@ vlv_sprite_check(struct intel_crtc_state *crtc_state,
if (ret) if (ret)
return ret; return ret;
if (!plane_state->base.visible) if (!plane_state->uapi.visible)
return 0; return 0;
ret = intel_plane_check_src_coordinates(plane_state); ret = intel_plane_check_src_coordinates(plane_state);
...@@ -2048,7 +2048,7 @@ vlv_sprite_check(struct intel_crtc_state *crtc_state, ...@@ -2048,7 +2048,7 @@ vlv_sprite_check(struct intel_crtc_state *crtc_state,
static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state, static int skl_plane_check_fb(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
unsigned int rotation = plane_state->hw.rotation; unsigned int rotation = plane_state->hw.rotation;
...@@ -2123,9 +2123,9 @@ static int skl_plane_check_dst_coordinates(const struct intel_crtc_state *crtc_s ...@@ -2123,9 +2123,9 @@ static int skl_plane_check_dst_coordinates(const struct intel_crtc_state *crtc_s
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
to_i915(plane_state->base.plane->dev); to_i915(plane_state->uapi.plane->dev);
int crtc_x = plane_state->base.dst.x1; int crtc_x = plane_state->uapi.dst.x1;
int crtc_w = drm_rect_width(&plane_state->base.dst); int crtc_w = drm_rect_width(&plane_state->uapi.dst);
int pipe_src_w = crtc_state->pipe_src_w; int pipe_src_w = crtc_state->pipe_src_w;
/* /*
...@@ -2153,7 +2153,7 @@ static int skl_plane_check_nv12_rotation(const struct intel_plane_state *plane_s ...@@ -2153,7 +2153,7 @@ static int skl_plane_check_nv12_rotation(const struct intel_plane_state *plane_s
{ {
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
unsigned int rotation = plane_state->hw.rotation; unsigned int rotation = plane_state->hw.rotation;
int src_w = drm_rect_width(&plane_state->base.src) >> 16; int src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
/* Display WA #1106 */ /* Display WA #1106 */
if (drm_format_info_is_yuv_semiplanar(fb->format) && src_w & 3 && if (drm_format_info_is_yuv_semiplanar(fb->format) && src_w & 3 &&
...@@ -2185,7 +2185,7 @@ static int skl_plane_max_scale(struct drm_i915_private *dev_priv, ...@@ -2185,7 +2185,7 @@ static int skl_plane_max_scale(struct drm_i915_private *dev_priv,
static int skl_plane_check(struct intel_crtc_state *crtc_state, static int skl_plane_check(struct intel_crtc_state *crtc_state,
struct intel_plane_state *plane_state) struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
int min_scale = DRM_PLANE_HELPER_NO_SCALING; int min_scale = DRM_PLANE_HELPER_NO_SCALING;
...@@ -2202,7 +2202,7 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state, ...@@ -2202,7 +2202,7 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state,
max_scale = skl_plane_max_scale(dev_priv, fb); max_scale = skl_plane_max_scale(dev_priv, fb);
} }
ret = drm_atomic_helper_check_plane_state(&plane_state->base, ret = drm_atomic_helper_check_plane_state(&plane_state->uapi,
&crtc_state->uapi, &crtc_state->uapi,
min_scale, max_scale, min_scale, max_scale,
true, true); true, true);
...@@ -2213,7 +2213,7 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state, ...@@ -2213,7 +2213,7 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state,
if (ret) if (ret)
return ret; return ret;
if (!plane_state->base.visible) if (!plane_state->uapi.visible)
return 0; return 0;
ret = skl_plane_check_dst_coordinates(crtc_state, plane_state); ret = skl_plane_check_dst_coordinates(crtc_state, plane_state);
...@@ -2230,7 +2230,7 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state, ...@@ -2230,7 +2230,7 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state,
/* HW only has 8 bits pixel precision, disable plane if invisible */ /* HW only has 8 bits pixel precision, disable plane if invisible */
if (!(plane_state->hw.alpha >> 8)) if (!(plane_state->hw.alpha >> 8))
plane_state->base.visible = false; plane_state->uapi.visible = false;
plane_state->ctl = skl_plane_ctl(crtc_state, plane_state); plane_state->ctl = skl_plane_ctl(crtc_state, plane_state);
...@@ -2249,7 +2249,7 @@ static bool has_dst_key_in_primary_plane(struct drm_i915_private *dev_priv) ...@@ -2249,7 +2249,7 @@ static bool has_dst_key_in_primary_plane(struct drm_i915_private *dev_priv)
static void intel_plane_set_ckey(struct intel_plane_state *plane_state, static void intel_plane_set_ckey(struct intel_plane_state *plane_state,
const struct drm_intel_sprite_colorkey *set) const struct drm_intel_sprite_colorkey *set)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
struct drm_intel_sprite_colorkey *key = &plane_state->ckey; struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
......
...@@ -786,7 +786,7 @@ static int intel_wm_num_levels(struct drm_i915_private *dev_priv) ...@@ -786,7 +786,7 @@ static int intel_wm_num_levels(struct drm_i915_private *dev_priv)
static bool intel_wm_plane_visible(const struct intel_crtc_state *crtc_state, static bool intel_wm_plane_visible(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
/* FIXME check the 'enable' instead */ /* FIXME check the 'enable' instead */
if (!crtc_state->hw.active) if (!crtc_state->hw.active)
...@@ -803,7 +803,7 @@ static bool intel_wm_plane_visible(const struct intel_crtc_state *crtc_state, ...@@ -803,7 +803,7 @@ static bool intel_wm_plane_visible(const struct intel_crtc_state *crtc_state,
if (plane->id == PLANE_CURSOR) if (plane->id == PLANE_CURSOR)
return plane_state->hw.fb != NULL; return plane_state->hw.fb != NULL;
else else
return plane_state->base.visible; return plane_state->uapi.visible;
} }
static struct intel_crtc *single_enabled_crtc(struct drm_i915_private *dev_priv) static struct intel_crtc *single_enabled_crtc(struct drm_i915_private *dev_priv)
...@@ -1075,7 +1075,7 @@ static u16 g4x_compute_wm(const struct intel_crtc_state *crtc_state, ...@@ -1075,7 +1075,7 @@ static u16 g4x_compute_wm(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state, const struct intel_plane_state *plane_state,
int level) int level)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
const struct drm_display_mode *adjusted_mode = const struct drm_display_mode *adjusted_mode =
&crtc_state->hw.adjusted_mode; &crtc_state->hw.adjusted_mode;
...@@ -1108,7 +1108,7 @@ static u16 g4x_compute_wm(const struct intel_crtc_state *crtc_state, ...@@ -1108,7 +1108,7 @@ static u16 g4x_compute_wm(const struct intel_crtc_state *crtc_state,
clock = adjusted_mode->crtc_clock; clock = adjusted_mode->crtc_clock;
htotal = adjusted_mode->crtc_htotal; htotal = adjusted_mode->crtc_htotal;
width = drm_rect_width(&plane_state->base.dst); width = drm_rect_width(&plane_state->uapi.dst);
if (plane->id == PLANE_CURSOR) { if (plane->id == PLANE_CURSOR) {
wm = intel_wm_method2(clock, htotal, width, cpp, latency); wm = intel_wm_method2(clock, htotal, width, cpp, latency);
...@@ -1174,7 +1174,7 @@ static u32 ilk_compute_fbc_wm(const struct intel_crtc_state *crtc_state, ...@@ -1174,7 +1174,7 @@ static u32 ilk_compute_fbc_wm(const struct intel_crtc_state *crtc_state,
static bool g4x_raw_plane_wm_compute(struct intel_crtc_state *crtc_state, static bool g4x_raw_plane_wm_compute(struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
int num_levels = intel_wm_num_levels(to_i915(plane->base.dev)); int num_levels = intel_wm_num_levels(to_i915(plane->base.dev));
enum plane_id plane_id = plane->id; enum plane_id plane_id = plane->id;
bool dirty = false; bool dirty = false;
...@@ -1581,7 +1581,7 @@ static u16 vlv_compute_wm_level(const struct intel_crtc_state *crtc_state, ...@@ -1581,7 +1581,7 @@ static u16 vlv_compute_wm_level(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state, const struct intel_plane_state *plane_state,
int level) int level)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
struct drm_i915_private *dev_priv = to_i915(plane->base.dev); struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
const struct drm_display_mode *adjusted_mode = const struct drm_display_mode *adjusted_mode =
&crtc_state->hw.adjusted_mode; &crtc_state->hw.adjusted_mode;
...@@ -1751,7 +1751,7 @@ static bool vlv_raw_plane_wm_set(struct intel_crtc_state *crtc_state, ...@@ -1751,7 +1751,7 @@ static bool vlv_raw_plane_wm_set(struct intel_crtc_state *crtc_state,
static bool vlv_raw_plane_wm_compute(struct intel_crtc_state *crtc_state, static bool vlv_raw_plane_wm_compute(struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
enum plane_id plane_id = plane->id; enum plane_id plane_id = plane->id;
int num_levels = intel_wm_num_levels(to_i915(plane->base.dev)); int num_levels = intel_wm_num_levels(to_i915(plane->base.dev));
int level; int level;
...@@ -2484,7 +2484,7 @@ static u32 ilk_compute_pri_wm(const struct intel_crtc_state *crtc_state, ...@@ -2484,7 +2484,7 @@ static u32 ilk_compute_pri_wm(const struct intel_crtc_state *crtc_state,
method2 = ilk_wm_method2(crtc_state->pixel_rate, method2 = ilk_wm_method2(crtc_state->pixel_rate,
crtc_state->hw.adjusted_mode.crtc_htotal, crtc_state->hw.adjusted_mode.crtc_htotal,
drm_rect_width(&plane_state->base.dst), drm_rect_width(&plane_state->uapi.dst),
cpp, mem_value); cpp, mem_value);
return min(method1, method2); return min(method1, method2);
...@@ -2512,7 +2512,7 @@ static u32 ilk_compute_spr_wm(const struct intel_crtc_state *crtc_state, ...@@ -2512,7 +2512,7 @@ static u32 ilk_compute_spr_wm(const struct intel_crtc_state *crtc_state,
method1 = ilk_wm_method1(crtc_state->pixel_rate, cpp, mem_value); method1 = ilk_wm_method1(crtc_state->pixel_rate, cpp, mem_value);
method2 = ilk_wm_method2(crtc_state->pixel_rate, method2 = ilk_wm_method2(crtc_state->pixel_rate,
crtc_state->hw.adjusted_mode.crtc_htotal, crtc_state->hw.adjusted_mode.crtc_htotal,
drm_rect_width(&plane_state->base.dst), drm_rect_width(&plane_state->uapi.dst),
cpp, mem_value); cpp, mem_value);
return min(method1, method2); return min(method1, method2);
} }
...@@ -2537,7 +2537,7 @@ static u32 ilk_compute_cur_wm(const struct intel_crtc_state *crtc_state, ...@@ -2537,7 +2537,7 @@ static u32 ilk_compute_cur_wm(const struct intel_crtc_state *crtc_state,
return ilk_wm_method2(crtc_state->pixel_rate, return ilk_wm_method2(crtc_state->pixel_rate,
crtc_state->hw.adjusted_mode.crtc_htotal, crtc_state->hw.adjusted_mode.crtc_htotal,
drm_rect_width(&plane_state->base.dst), drm_rect_width(&plane_state->uapi.dst),
cpp, mem_value); cpp, mem_value);
} }
...@@ -2553,7 +2553,8 @@ static u32 ilk_compute_fbc_wm(const struct intel_crtc_state *crtc_state, ...@@ -2553,7 +2553,8 @@ static u32 ilk_compute_fbc_wm(const struct intel_crtc_state *crtc_state,
cpp = plane_state->hw.fb->format->cpp[0]; cpp = plane_state->hw.fb->format->cpp[0];
return ilk_wm_fbc(pri_val, drm_rect_width(&plane_state->base.dst), cpp); return ilk_wm_fbc(pri_val, drm_rect_width(&plane_state->uapi.dst),
cpp);
} }
static unsigned int static unsigned int
...@@ -3097,10 +3098,10 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *crtc_state) ...@@ -3097,10 +3098,10 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *crtc_state)
pipe_wm->pipe_enabled = crtc_state->hw.active; pipe_wm->pipe_enabled = crtc_state->hw.active;
if (sprstate) { if (sprstate) {
pipe_wm->sprites_enabled = sprstate->base.visible; pipe_wm->sprites_enabled = sprstate->uapi.visible;
pipe_wm->sprites_scaled = sprstate->base.visible && pipe_wm->sprites_scaled = sprstate->uapi.visible &&
(drm_rect_width(&sprstate->base.dst) != drm_rect_width(&sprstate->base.src) >> 16 || (drm_rect_width(&sprstate->uapi.dst) != drm_rect_width(&sprstate->uapi.src) >> 16 ||
drm_rect_height(&sprstate->base.dst) != drm_rect_height(&sprstate->base.src) >> 16); drm_rect_height(&sprstate->uapi.dst) != drm_rect_height(&sprstate->uapi.src) >> 16);
} }
usable_level = max_level; usable_level = max_level;
...@@ -4072,10 +4073,10 @@ skl_plane_downscale_amount(const struct intel_crtc_state *crtc_state, ...@@ -4072,10 +4073,10 @@ skl_plane_downscale_amount(const struct intel_crtc_state *crtc_state,
* *
* n.b., src is 16.16 fixed point, dst is whole integer. * n.b., src is 16.16 fixed point, dst is whole integer.
*/ */
src_w = drm_rect_width(&plane_state->base.src) >> 16; src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
src_h = drm_rect_height(&plane_state->base.src) >> 16; src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
dst_w = drm_rect_width(&plane_state->base.dst); dst_w = drm_rect_width(&plane_state->uapi.dst);
dst_h = drm_rect_height(&plane_state->base.dst); dst_h = drm_rect_height(&plane_state->uapi.dst);
fp_w_ratio = div_fixed16(src_w, dst_w); fp_w_ratio = div_fixed16(src_w, dst_w);
fp_h_ratio = div_fixed16(src_h, dst_h); fp_h_ratio = div_fixed16(src_h, dst_h);
...@@ -4090,14 +4091,14 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *crtc_state, ...@@ -4090,14 +4091,14 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state, const struct intel_plane_state *plane_state,
int color_plane) int color_plane)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
u32 data_rate; u32 data_rate;
u32 width = 0, height = 0; u32 width = 0, height = 0;
uint_fixed_16_16_t down_scale_amount; uint_fixed_16_16_t down_scale_amount;
u64 rate; u64 rate;
if (!plane_state->base.visible) if (!plane_state->uapi.visible)
return 0; return 0;
if (plane->id == PLANE_CURSOR) if (plane->id == PLANE_CURSOR)
...@@ -4112,8 +4113,8 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *crtc_state, ...@@ -4112,8 +4113,8 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *crtc_state,
* the 90/270 degree plane rotation cases (to match the * the 90/270 degree plane rotation cases (to match the
* GTT mapping), hence no need to account for rotation here. * GTT mapping), hence no need to account for rotation here.
*/ */
width = drm_rect_width(&plane_state->base.src) >> 16; width = drm_rect_width(&plane_state->uapi.src) >> 16;
height = drm_rect_height(&plane_state->base.src) >> 16; height = drm_rect_height(&plane_state->uapi.src) >> 16;
/* UV plane does 1/2 pixel sub-sampling */ /* UV plane does 1/2 pixel sub-sampling */
if (color_plane == 1) { if (color_plane == 1) {
...@@ -4620,7 +4621,7 @@ skl_compute_plane_wm_params(const struct intel_crtc_state *crtc_state, ...@@ -4620,7 +4621,7 @@ skl_compute_plane_wm_params(const struct intel_crtc_state *crtc_state,
* the 90/270 degree plane rotation cases (to match the * the 90/270 degree plane rotation cases (to match the
* GTT mapping), hence no need to account for rotation here. * GTT mapping), hence no need to account for rotation here.
*/ */
width = drm_rect_width(&plane_state->base.src) >> 16; width = drm_rect_width(&plane_state->uapi.src) >> 16;
return skl_compute_wm_params(crtc_state, width, return skl_compute_wm_params(crtc_state, width,
fb->format, fb->modifier, fb->format, fb->modifier,
...@@ -4902,7 +4903,7 @@ static int skl_build_plane_wm_uv(struct intel_crtc_state *crtc_state, ...@@ -4902,7 +4903,7 @@ static int skl_build_plane_wm_uv(struct intel_crtc_state *crtc_state,
static int skl_build_plane_wm(struct intel_crtc_state *crtc_state, static int skl_build_plane_wm(struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
struct intel_plane *plane = to_intel_plane(plane_state->base.plane); struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
const struct drm_framebuffer *fb = plane_state->hw.fb; const struct drm_framebuffer *fb = plane_state->hw.fb;
enum plane_id plane_id = plane->id; enum plane_id plane_id = plane->id;
int ret; int ret;
...@@ -4928,7 +4929,7 @@ static int skl_build_plane_wm(struct intel_crtc_state *crtc_state, ...@@ -4928,7 +4929,7 @@ static int skl_build_plane_wm(struct intel_crtc_state *crtc_state,
static int icl_build_plane_wm(struct intel_crtc_state *crtc_state, static int icl_build_plane_wm(struct intel_crtc_state *crtc_state,
const struct intel_plane_state *plane_state) const struct intel_plane_state *plane_state)
{ {
enum plane_id plane_id = to_intel_plane(plane_state->base.plane)->id; enum plane_id plane_id = to_intel_plane(plane_state->uapi.plane)->id;
int ret; int ret;
/* Watermarks calculated in master */ /* Watermarks calculated in master */
...@@ -5928,7 +5929,7 @@ void g4x_wm_sanitize(struct drm_i915_private *dev_priv) ...@@ -5928,7 +5929,7 @@ void g4x_wm_sanitize(struct drm_i915_private *dev_priv)
enum plane_id plane_id = plane->id; enum plane_id plane_id = plane->id;
int level; int level;
if (plane_state->base.visible) if (plane_state->uapi.visible)
continue; continue;
for (level = 0; level < 3; level++) { for (level = 0; level < 3; level++) {
...@@ -6083,7 +6084,7 @@ void vlv_wm_sanitize(struct drm_i915_private *dev_priv) ...@@ -6083,7 +6084,7 @@ void vlv_wm_sanitize(struct drm_i915_private *dev_priv)
enum plane_id plane_id = plane->id; enum plane_id plane_id = plane->id;
int level; int level;
if (plane_state->base.visible) if (plane_state->uapi.visible)
continue; continue;
for (level = 0; level < wm_state->num_levels; level++) { for (level = 0; level < wm_state->num_levels; level++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment