disp: remove kernel mapping of writeback framebuffer
This change removes the fb_kmap debugfs node along with kernel mapping of writeback framebuffer. It also replaces dma_buf_kmap calls with dma_buf_vmap. Change-Id: I2fbee7fa5922071f6805d8e6df540ce87056bc0b Signed-off-by: Narendra Muppalla <NarendraM@codeaurora.org>
This commit is contained in:
91
msm/msm_fb.c
91
msm/msm_fb.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (C) 2013 Red Hat
|
||||
* Author: Rob Clark <robdclark@gmail.com>
|
||||
*
|
||||
@@ -16,8 +16,6 @@
|
||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/dma-buf.h>
|
||||
#include <drm/drm_crtc.h>
|
||||
#include <drm/drm_damage_helper.h>
|
||||
#include <drm/drm_gem_framebuffer_helper.h>
|
||||
@@ -27,14 +25,9 @@
|
||||
#include "msm_kms.h"
|
||||
#include "msm_gem.h"
|
||||
|
||||
#define MSM_FRAMEBUFFER_FLAG_KMAP BIT(0)
|
||||
|
||||
struct msm_framebuffer {
|
||||
struct drm_framebuffer base;
|
||||
const struct msm_format *format;
|
||||
void *vaddr[MAX_PLANE];
|
||||
atomic_t kmap_count;
|
||||
u32 flags;
|
||||
};
|
||||
#define to_msm_framebuffer(x) container_of(x, struct msm_framebuffer, base)
|
||||
|
||||
@@ -101,81 +94,6 @@ void msm_framebuffer_set_keepattrs(struct drm_framebuffer *fb, bool enable)
|
||||
}
|
||||
}
|
||||
|
||||
void msm_framebuffer_set_kmap(struct drm_framebuffer *fb, bool enable)
|
||||
{
|
||||
struct msm_framebuffer *msm_fb;
|
||||
|
||||
if (!fb) {
|
||||
DRM_ERROR("from:%pS null fb\n", __builtin_return_address(0));
|
||||
return;
|
||||
}
|
||||
|
||||
msm_fb = to_msm_framebuffer(fb);
|
||||
if (enable)
|
||||
msm_fb->flags |= MSM_FRAMEBUFFER_FLAG_KMAP;
|
||||
else
|
||||
msm_fb->flags &= ~MSM_FRAMEBUFFER_FLAG_KMAP;
|
||||
}
|
||||
|
||||
static int msm_framebuffer_kmap(struct drm_framebuffer *fb)
|
||||
{
|
||||
struct msm_framebuffer *msm_fb;
|
||||
int i, n;
|
||||
struct drm_gem_object *bo;
|
||||
|
||||
if (!fb) {
|
||||
DRM_ERROR("from:%pS null fb\n", __builtin_return_address(0));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
msm_fb = to_msm_framebuffer(fb);
|
||||
n = fb->format->num_planes;
|
||||
if (atomic_inc_return(&msm_fb->kmap_count) > 1)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
bo = msm_framebuffer_bo(fb, i);
|
||||
if (!bo || !bo->dma_buf) {
|
||||
msm_fb->vaddr[i] = NULL;
|
||||
continue;
|
||||
}
|
||||
dma_buf_begin_cpu_access(bo->dma_buf, DMA_BIDIRECTIONAL);
|
||||
msm_fb->vaddr[i] = dma_buf_kmap(bo->dma_buf, 0);
|
||||
DRM_INFO("FB[%u]: vaddr[%d]:%ux%u:0x%llx\n", fb->base.id, i,
|
||||
fb->width, fb->height, (u64) msm_fb->vaddr[i]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void msm_framebuffer_kunmap(struct drm_framebuffer *fb)
|
||||
{
|
||||
struct msm_framebuffer *msm_fb;
|
||||
int i, n;
|
||||
struct drm_gem_object *bo;
|
||||
|
||||
if (!fb) {
|
||||
DRM_ERROR("from:%pS null fb\n", __builtin_return_address(0));
|
||||
return;
|
||||
}
|
||||
|
||||
msm_fb = to_msm_framebuffer(fb);
|
||||
n = fb->format->num_planes;
|
||||
if (atomic_dec_return(&msm_fb->kmap_count) > 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
bo = msm_framebuffer_bo(fb, i);
|
||||
if (!bo || !msm_fb->vaddr[i])
|
||||
continue;
|
||||
if (bo->dma_buf) {
|
||||
dma_buf_kunmap(bo->dma_buf, 0, msm_fb->vaddr[i]);
|
||||
dma_buf_end_cpu_access(bo->dma_buf, DMA_BIDIRECTIONAL);
|
||||
}
|
||||
msm_fb->vaddr[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* prepare/pin all the fb's bo's for scanout. Note that it is not valid
|
||||
* to prepare an fb more multiple different initiator 'id's. But that
|
||||
* should be fine, since only the scanout (mdpN) side of things needs
|
||||
@@ -202,9 +120,6 @@ int msm_framebuffer_prepare(struct drm_framebuffer *fb,
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (msm_fb->flags & MSM_FRAMEBUFFER_FLAG_KMAP)
|
||||
msm_framebuffer_kmap(fb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -222,9 +137,6 @@ void msm_framebuffer_cleanup(struct drm_framebuffer *fb,
|
||||
msm_fb = to_msm_framebuffer(fb);
|
||||
n = fb->format->num_planes;
|
||||
|
||||
if (msm_fb->flags & MSM_FRAMEBUFFER_FLAG_KMAP)
|
||||
msm_framebuffer_kunmap(fb);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
msm_gem_put_iova(fb->obj[i], aspace);
|
||||
}
|
||||
@@ -351,7 +263,6 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
|
||||
fb = &msm_fb->base;
|
||||
|
||||
msm_fb->format = format;
|
||||
atomic_set(&msm_fb->kmap_count, 0);
|
||||
|
||||
if (mode_cmd->flags & DRM_MODE_FB_MODIFIERS) {
|
||||
for (i = 0; i < ARRAY_SIZE(mode_cmd->modifier); i++) {
|
||||
|
Referens i nytt ärende
Block a user