drm/i915: add sprite restore function v3
authorJesse Barnes <jbarnes@virtuousgeek.org>
Tue, 26 Mar 2013 16:25:43 +0000 (09:25 -0700)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 26 Mar 2013 20:35:04 +0000 (21:35 +0100)
To be used to restore sprite state on resume.

v2: move sprite tracking bits up so we don't track modified sprite state
v3: use src_x/y in sprite suspend/resume code (Ville)

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_sprite.c

index 599e978d5c6796df1a03b1bba5007b4d8097e377..276f6651dcc30228906b4eddcd6d9cb387dfd58d 100644 (file)
@@ -247,6 +247,10 @@ struct intel_plane {
        bool can_scale;
        int max_downscale;
        u32 lut_r[1024], lut_g[1024], lut_b[1024];
+       int crtc_x, crtc_y;
+       unsigned int crtc_w, crtc_h;
+       uint32_t src_x, src_y;
+       uint32_t src_w, src_h;
        void (*update_plane)(struct drm_plane *plane,
                             struct drm_framebuffer *fb,
                             struct drm_i915_gem_object *obj,
@@ -532,6 +536,7 @@ extern bool intel_encoder_check_is_cloned(struct intel_encoder *encoder);
 extern void intel_connector_dpms(struct drm_connector *, int mode);
 extern bool intel_connector_get_hw_state(struct intel_connector *connector);
 extern void intel_modeset_check_state(struct drm_device *dev);
+extern void intel_plane_restore(struct drm_plane *plane);
 
 
 static inline struct intel_encoder *intel_attached_encoder(struct drm_connector *connector)
index 1b6eb76beb7c1dcebf2f7f5df9596fff18a97ada..6fdd42704533da3312bbdb28a78b514e0beca4c6 100644 (file)
@@ -441,6 +441,15 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 
        old_obj = intel_plane->obj;
 
+       intel_plane->crtc_x = crtc_x;
+       intel_plane->crtc_y = crtc_y;
+       intel_plane->crtc_w = crtc_w;
+       intel_plane->crtc_h = crtc_h;
+       intel_plane->src_x = src_x;
+       intel_plane->src_y = src_y;
+       intel_plane->src_w = src_w;
+       intel_plane->src_h = src_h;
+
        src_w = src_w >> 16;
        src_h = src_h >> 16;
 
@@ -647,6 +656,20 @@ out_unlock:
        return ret;
 }
 
+void intel_plane_restore(struct drm_plane *plane)
+{
+       struct intel_plane *intel_plane = to_intel_plane(plane);
+
+       if (!plane->crtc || !plane->fb)
+               return;
+
+       intel_update_plane(plane, plane->crtc, plane->fb,
+                          intel_plane->crtc_x, intel_plane->crtc_y,
+                          intel_plane->crtc_w, intel_plane->crtc_h,
+                          intel_plane->src_x, intel_plane->src_y,
+                          intel_plane->src_w, intel_plane->src_h);
+}
+
 static const struct drm_plane_funcs intel_plane_funcs = {
        .update_plane = intel_update_plane,
        .disable_plane = intel_disable_plane,