drm/i915: Enable querying offset of UV plane with intel_plane_obj_offset
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Mon, 21 Sep 2015 09:45:35 +0000 (10:45 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 23 Sep 2015 15:31:29 +0000 (17:31 +0200)
v2: Rebase.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem_gtt.c
drivers/gpu/drm/i915/i915_gem_gtt.h
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_sprite.c

index ad0e7e03a91cb808268a4993e4fedf0f4a521653..bbb96a41c57bdc96dc53f773f328144fb39bc25e 100644 (file)
@@ -3332,6 +3332,8 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
                if (offset_in_page(rot_info->uv_offset))
                        uv_start_page--;
 
+               rot_info->uv_start_page = uv_start_page;
+
                rotate_pages(page_addr_list, uv_start_page,
                             rot_info->width_pages_uv,
                             rot_info->height_pages_uv,
index c80758628899b5da2fefc5bfcd9cb52c2a644497..9fbb07d6eaadf9aa4ff2b0c25ed195c34d1beffc 100644 (file)
@@ -145,6 +145,7 @@ struct intel_rotation_info {
        uint64_t size;
        unsigned int width_pages_uv, height_pages_uv;
        uint64_t size_uv;
+       unsigned int uv_start_page;
 };
 
 struct i915_ggtt_view {
index bdce4588c7b592a33bc791f7bb0f0f1c8abd6a12..9b1989166dbcd90b3e1cae5259ae256c890dd4c9 100644 (file)
@@ -2897,14 +2897,29 @@ u32 intel_fb_stride_alignment(struct drm_device *dev, uint64_t fb_modifier,
 }
 
 unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane,
-                                    struct drm_i915_gem_object *obj)
+                                    struct drm_i915_gem_object *obj,
+                                    unsigned int plane)
 {
        const struct i915_ggtt_view *view = &i915_ggtt_view_normal;
+       struct i915_vma *vma;
+       unsigned char *offset;
 
        if (intel_rotation_90_or_270(intel_plane->base.state->rotation))
                view = &i915_ggtt_view_rotated;
 
-       return i915_gem_obj_ggtt_offset_view(obj, view);
+       vma = i915_gem_obj_to_ggtt_view(obj, view);
+       if (WARN(!vma, "ggtt vma for display object not found! (view=%u)\n",
+               view->type))
+               return -1;
+
+       offset = (unsigned char *)vma->node.start;
+
+       if (plane == 1) {
+               offset += vma->ggtt_view.rotation_info.uv_start_page *
+                         PAGE_SIZE;
+       }
+
+       return (unsigned long)offset;
 }
 
 static void skl_detach_scaler(struct intel_crtc *intel_crtc, int id)
@@ -3060,7 +3075,7 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
        obj = intel_fb_obj(fb);
        stride_div = intel_fb_stride_alignment(dev, fb->modifier[0],
                                               fb->pixel_format);
-       surf_addr = intel_plane_obj_offset(to_intel_plane(plane), obj);
+       surf_addr = intel_plane_obj_offset(to_intel_plane(plane), obj, 0);
 
        /*
         * FIXME: intel_plane_state->src, dst aren't set when transitional
@@ -11423,8 +11438,9 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
        if (ret)
                goto cleanup_pending;
 
-       work->gtt_offset = intel_plane_obj_offset(to_intel_plane(primary), obj)
-                                                 + intel_crtc->dspaddr_offset;
+       work->gtt_offset = intel_plane_obj_offset(to_intel_plane(primary),
+                                                 obj, 0);
+       work->gtt_offset += intel_crtc->dspaddr_offset;
 
        if (mmio_flip) {
                ret = intel_queue_mmio_flip(dev, crtc, fb, obj, ring,
index 858c3821cdf7b7e7178ee3777e1a8d3f77cce9cc..bc674aac59cb3ce5fc4621d7b1fdb8e3c7990b01 100644 (file)
@@ -1170,7 +1170,9 @@ int skl_update_scaler_crtc(struct intel_crtc_state *crtc_state);
 int skl_max_scale(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state);
 
 unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane,
-                                    struct drm_i915_gem_object *obj);
+                                    struct drm_i915_gem_object *obj,
+                                    unsigned int plane);
+
 u32 skl_plane_ctl_format(uint32_t pixel_format);
 u32 skl_plane_ctl_tiling(uint64_t fb_modifier);
 u32 skl_plane_ctl_rotation(unsigned int rotation);
index 4372fa0b1ec53a12e0aea9c92de6cb1906a866c1..4349fde4b72cc20387a9348c7d3177571c45fce0 100644 (file)
@@ -235,7 +235,7 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
        else if (key->flags & I915_SET_COLORKEY_SOURCE)
                plane_ctl |= PLANE_CTL_KEY_ENABLE_SOURCE;
 
-       surf_addr = intel_plane_obj_offset(intel_plane, obj);
+       surf_addr = intel_plane_obj_offset(intel_plane, obj, 0);
 
        if (intel_rotation_90_or_270(rotation)) {
                /* stride: Surface height in tiles */