From 4354d64ea90c4caf6f14522f5bf357e4e4857886 Mon Sep 17 00:00:00 2001 From: Souptick Joarder Date: Tue, 31 Jul 2018 00:53:26 +0530 Subject: drm: Remove drm_fbdev_cma_set_suspend() drm_fbdev_cma_set_suspend() is not getting called from any other places. If there is no plan to use it in future we can remove this API. Signed-off-by: Souptick Joarder Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20180730192326.GA31354@jordon-HP-15-Notebook-PC --- drivers/gpu/drm/drm_fb_cma_helper.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'drivers/gpu/drm/drm_fb_cma_helper.c') diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c index 9da36a6271d3..b127061b4cf3 100644 --- a/drivers/gpu/drm/drm_fb_cma_helper.c +++ b/drivers/gpu/drm/drm_fb_cma_helper.c @@ -218,21 +218,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 -- cgit 1.4.1 From c76abab59b3cb34a0bc819595614844ed28be721 Mon Sep 17 00:00:00 2001 From: Ayan Kumar Halder Date: Fri, 17 Aug 2018 17:54:00 +0100 Subject: drm: Use horizontal and vertical chroma subsampling factor while calculating offsets in the physical address of framebuffer For multi-planar formats, while calculating offsets in planes with index greater than 0 (ie second plane, third plane, etc), one needs to divide (src_x * cpp) with horizontal chroma subsampling factor and (src_y * pitch) with vertical chroma subsampling factor. The reason being that the planes contain subsampled (ie reduced) data (by a factor of 2) and thus while calculating the byte position coresponding to the x and y co-ordinates, one needs to divide it with the sampling factor. Signed-off-by: Ayan Kumar halder Reviewed-by: Liviu Dudau Link: https://patchwork.kernel.org/patch/10569263/ --- drivers/gpu/drm/drm_fb_cma_helper.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/drm/drm_fb_cma_helper.c') diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c index b127061b4cf3..47e0e2f6642d 100644 --- a/drivers/gpu/drm/drm_fb_cma_helper.c +++ b/drivers/gpu/drm/drm_fb_cma_helper.c @@ -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; } -- cgit 1.4.1