drm/i915: Move rotation from intel_plane to drm_plane_state
[deliverable/linux.git] / drivers / gpu / drm / i915 / intel_sprite.c
index 0a6094e2a586a84cd9a2fa474468cebf485d2cf7..ba85439e9ed495172adfecf60e15f5c5883968e9 100644 (file)
@@ -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);
 
This page took 0.033142 seconds and 5 git commands to generate.