drm/i915: Move rotation from intel_plane to drm_plane_state
Runtime state that can be manipulated via properties should now go in intel_plane_state/drm_plane_state so that it can be tracked as part of an atomic transaction. We add a new 'intel_create_plane_state' function so that the proper initial value for this property (and future properties) doesn't have to be repeated at each plane initialization site. v2: - Stick rotation in common drm_plane_state rather than intel_plane_state. (Daniel) - Add intel_create_plane_state() to consolidate the places where we have to set initial state values. (Ander) Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:

committed by
Daniel Vetter

parent
7c59a9c133
commit
8e7d688b7a
@@ -256,7 +256,7 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
if (intel_plane->rotation == BIT(DRM_ROTATE_180))
|
||||
if (drm_plane->state->rotation == BIT(DRM_ROTATE_180))
|
||||
plane_ctl |= PLANE_CTL_ROTATE_180;
|
||||
|
||||
plane_ctl |= PLANE_CTL_ENABLE;
|
||||
@@ -493,7 +493,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc,
|
||||
fb->pitches[0]);
|
||||
linear_offset -= sprsurf_offset;
|
||||
|
||||
if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
|
||||
if (dplane->state->rotation == BIT(DRM_ROTATE_180)) {
|
||||
sprctl |= SP_ROTATE_180;
|
||||
|
||||
x += src_w;
|
||||
@@ -684,7 +684,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
|
||||
pixel_size, fb->pitches[0]);
|
||||
linear_offset -= sprsurf_offset;
|
||||
|
||||
if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
|
||||
if (plane->state->rotation == BIT(DRM_ROTATE_180)) {
|
||||
sprctl |= SPRITE_ROTATE_180;
|
||||
|
||||
/* HSW and BDW does this automagically in hardware */
|
||||
@@ -884,7 +884,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
|
||||
pixel_size, fb->pitches[0]);
|
||||
linear_offset -= dvssurf_offset;
|
||||
|
||||
if (intel_plane->rotation == BIT(DRM_ROTATE_180)) {
|
||||
if (plane->state->rotation == BIT(DRM_ROTATE_180)) {
|
||||
dvscntr |= DVS_ROTATE_180;
|
||||
|
||||
x += src_w;
|
||||
@@ -1125,7 +1125,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
|
||||
min_scale = intel_plane->can_scale ? 1 : (1 << 16);
|
||||
|
||||
drm_rect_rotate(src, fb->width << 16, fb->height << 16,
|
||||
intel_plane->rotation);
|
||||
state->base.rotation);
|
||||
|
||||
hscale = drm_rect_calc_hscale_relaxed(src, dst, min_scale, max_scale);
|
||||
BUG_ON(hscale < 0);
|
||||
@@ -1166,7 +1166,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
|
||||
drm_rect_height(dst) * vscale - drm_rect_height(src));
|
||||
|
||||
drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16,
|
||||
intel_plane->rotation);
|
||||
state->base.rotation);
|
||||
|
||||
/* sanity check to make sure the src viewport wasn't enlarged */
|
||||
WARN_ON(src->x1 < (int) state->base.src_x ||
|
||||
@@ -1367,7 +1367,6 @@ int intel_plane_set_property(struct drm_plane *plane,
|
||||
uint64_t val)
|
||||
{
|
||||
struct drm_device *dev = plane->dev;
|
||||
struct intel_plane *intel_plane = to_intel_plane(plane);
|
||||
uint64_t old_val;
|
||||
int ret = -ENOENT;
|
||||
|
||||
@@ -1376,14 +1375,14 @@ int intel_plane_set_property(struct drm_plane *plane,
|
||||
if (hweight32(val & 0xf) != 1)
|
||||
return -EINVAL;
|
||||
|
||||
if (intel_plane->rotation == val)
|
||||
if (plane->state->rotation == val)
|
||||
return 0;
|
||||
|
||||
old_val = intel_plane->rotation;
|
||||
intel_plane->rotation = val;
|
||||
old_val = plane->state->rotation;
|
||||
plane->state->rotation = val;
|
||||
ret = intel_plane_restore(plane);
|
||||
if (ret)
|
||||
intel_plane->rotation = old_val;
|
||||
plane->state->rotation = old_val;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -1457,6 +1456,7 @@ int
|
||||
intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
|
||||
{
|
||||
struct intel_plane *intel_plane;
|
||||
struct intel_plane_state *state;
|
||||
unsigned long possible_crtcs;
|
||||
const uint32_t *plane_formats;
|
||||
int num_plane_formats;
|
||||
@@ -1469,12 +1469,12 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
|
||||
if (!intel_plane)
|
||||
return -ENOMEM;
|
||||
|
||||
intel_plane->base.state =
|
||||
intel_plane_duplicate_state(&intel_plane->base);
|
||||
if (intel_plane->base.state == NULL) {
|
||||
state = intel_create_plane_state(&intel_plane->base);
|
||||
if (!state) {
|
||||
kfree(intel_plane);
|
||||
return -ENOMEM;
|
||||
}
|
||||
intel_plane->base.state = &state->base;
|
||||
|
||||
switch (INTEL_INFO(dev)->gen) {
|
||||
case 5:
|
||||
@@ -1545,7 +1545,6 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
|
||||
|
||||
intel_plane->pipe = pipe;
|
||||
intel_plane->plane = plane;
|
||||
intel_plane->rotation = BIT(DRM_ROTATE_0);
|
||||
intel_plane->check_plane = intel_check_sprite_plane;
|
||||
intel_plane->commit_plane = intel_commit_sprite_plane;
|
||||
possible_crtcs = (1 << pipe);
|
||||
@@ -1567,7 +1566,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
|
||||
if (dev->mode_config.rotation_property)
|
||||
drm_object_attach_property(&intel_plane->base.base,
|
||||
dev->mode_config.rotation_property,
|
||||
intel_plane->rotation);
|
||||
state->base.rotation);
|
||||
|
||||
drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs);
|
||||
|
||||
|
Reference in New Issue
Block a user