Merge tag 'drm-next-2018-10-24' of git://anongit.freedesktop.org/drm/drm
[platform/kernel/linux-starfive.git] / drivers / gpu / drm / drm_fb_cma_helper.c
index 9ac1f2e..fb0dfc6 100644 (file)
@@ -86,14 +86,21 @@ dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb,
 {
        struct drm_gem_cma_object *obj;
        dma_addr_t paddr;
+       u8 h_div = 1, v_div = 1;
 
        obj = drm_fb_cma_get_gem_obj(fb, plane);
        if (!obj)
                return 0;
 
        paddr = obj->paddr + fb->offsets[plane];
-       paddr += fb->format->cpp[plane] * (state->src_x >> 16);
-       paddr += fb->pitches[plane] * (state->src_y >> 16);
+
+       if (plane > 0) {
+               h_div = fb->format->hsub;
+               v_div = fb->format->vsub;
+       }
+
+       paddr += (fb->format->cpp[plane] * (state->src_x >> 16)) / h_div;
+       paddr += (fb->pitches[plane] * (state->src_y >> 16)) / v_div;
 
        return paddr;
 }
@@ -221,21 +228,6 @@ void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma)
 EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
 
 /**
- * drm_fbdev_cma_set_suspend - wrapper around drm_fb_helper_set_suspend
- * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
- * @state: desired state, zero to resume, non-zero to suspend
- *
- * Calls drm_fb_helper_set_suspend, which is a wrapper around
- * fb_set_suspend implemented by fbdev core.
- */
-void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state)
-{
-       if (fbdev_cma)
-               drm_fb_helper_set_suspend(&fbdev_cma->fb_helper, state);
-}
-EXPORT_SYMBOL(drm_fbdev_cma_set_suspend);
-
-/**
  * drm_fbdev_cma_set_suspend_unlocked - wrapper around
  *                                      drm_fb_helper_set_suspend_unlocked
  * @fbdev_cma: The drm_fbdev_cma struct, may be NULL