From a3fb64c00d44a3ce869c0ca8210f95f99497aa9e Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Sun, 4 Oct 2020 16:17:58 +0200 Subject: Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached" This reverts commit 37054fc81443 ("gpu/drm: ingenic: Add option to mmap GEM buffers cached") At the very moment this commit was created, the DMA API it relied on was modified in the DMA tree, which caused the driver to break in linux-next. Revert it for now, and it will be resubmitted later to work with the new DMA API. Signed-off-by: Paul Cercueil Acked-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20201004141758.1013317-1-paul@crapouillou.net --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 116 +++--------------------------- drivers/gpu/drm/ingenic/ingenic-drm.h | 4 -- drivers/gpu/drm/ingenic/ingenic-ipu.c | 12 +--- 3 files changed, 13 insertions(+), 119 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index 937d080f5d06..1be1235bd546 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -9,8 +9,6 @@ #include #include #include -#include -#include #include #include #include @@ -21,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -79,11 +76,6 @@ static const u32 ingenic_drm_primary_formats[] = { DRM_FORMAT_XRGB8888, }; -static bool ingenic_drm_cached_gem_buf; -module_param_named(cached_gem_buffers, ingenic_drm_cached_gem_buf, bool, 0400); -MODULE_PARM_DESC(cached_gem_buffers, - "Enable fully cached GEM buffers [default=false]"); - static bool ingenic_drm_writeable_reg(struct device *dev, unsigned int reg) { switch (reg) { @@ -346,8 +338,6 @@ static int ingenic_drm_plane_atomic_check(struct drm_plane *plane, plane->state->fb->format->format != state->fb->format->format)) crtc_state->mode_changed = true; - drm_atomic_helper_check_plane_damage(state->state, state); - return 0; } @@ -450,35 +440,17 @@ void ingenic_drm_plane_config(struct device *dev, } } -void ingenic_drm_sync_data(struct device *dev, - struct drm_plane_state *old_state, - struct drm_plane_state *state) +static void ingenic_drm_update_palette(struct ingenic_drm *priv, + const struct drm_color_lut *lut) { - const struct drm_format_info *finfo = state->fb->format; - struct ingenic_drm *priv = dev_get_drvdata(dev); - struct drm_atomic_helper_damage_iter iter; - unsigned int offset, i; - struct drm_rect clip; - dma_addr_t paddr; - void *addr; - - if (!ingenic_drm_cached_gem_buf) - return; - - drm_atomic_helper_damage_iter_init(&iter, old_state, state); + unsigned int i; - drm_atomic_for_each_plane_damage(&iter, &clip) { - for (i = 0; i < finfo->num_planes; i++) { - paddr = drm_fb_cma_get_gem_addr(state->fb, state, i); - addr = phys_to_virt(paddr); + for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); i++) { + u16 color = drm_color_lut_extract(lut[i].red, 5) << 11 + | drm_color_lut_extract(lut[i].green, 6) << 5 + | drm_color_lut_extract(lut[i].blue, 5); - /* Ignore x1/x2 values, invalidate complete lines */ - offset = clip.y1 * state->fb->pitches[i]; - - dma_cache_sync(priv->dev, addr + offset, - (clip.y2 - clip.y1) * state->fb->pitches[i], - DMA_TO_DEVICE); - } + priv->dma_hwdescs->palette[i] = color; } } @@ -492,7 +464,7 @@ static void ingenic_drm_plane_atomic_update(struct drm_plane *plane, dma_addr_t addr; if (state && state->fb) { - ingenic_drm_sync_data(priv->dev, oldstate, state); + crtc_state = state->crtc->state; addr = drm_fb_cma_get_gem_addr(state->fb, state, 0); width = state->src_w >> 16; @@ -649,69 +621,7 @@ static void ingenic_drm_disable_vblank(struct drm_crtc *crtc) regmap_update_bits(priv->map, JZ_REG_LCD_CTRL, JZ_LCD_CTRL_EOF_IRQ, 0); } -static struct drm_framebuffer * -ingenic_drm_gem_fb_create(struct drm_device *dev, struct drm_file *file, - const struct drm_mode_fb_cmd2 *mode_cmd) -{ - if (ingenic_drm_cached_gem_buf) - return drm_gem_fb_create_with_dirty(dev, file, mode_cmd); - - return drm_gem_fb_create(dev, file, mode_cmd); -} - -static int ingenic_drm_gem_mmap(struct drm_gem_object *obj, - struct vm_area_struct *vma) -{ - struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(obj); - struct device *dev = cma_obj->base.dev->dev; - unsigned long attrs; - int ret; - - if (ingenic_drm_cached_gem_buf) - attrs = DMA_ATTR_NON_CONSISTENT; - else - attrs = DMA_ATTR_WRITE_COMBINE; - - /* - * Clear the VM_PFNMAP flag that was set by drm_gem_mmap(), and set the - * vm_pgoff (used as a fake buffer offset by DRM) to 0 as we want to map - * the whole buffer. - */ - vma->vm_flags &= ~VM_PFNMAP; - vma->vm_pgoff = 0; - vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); - - ret = dma_mmap_attrs(dev, vma, cma_obj->vaddr, cma_obj->paddr, - vma->vm_end - vma->vm_start, attrs); - if (ret) - drm_gem_vm_close(vma); - - return ret; -} - -static int ingenic_drm_gem_cma_mmap(struct file *filp, - struct vm_area_struct *vma) -{ - int ret; - - ret = drm_gem_mmap(filp, vma); - if (ret) - return ret; - - return ingenic_drm_gem_mmap(vma->vm_private_data, vma); -} - -static const struct file_operations ingenic_drm_fops = { - .owner = THIS_MODULE, - .open = drm_open, - .release = drm_release, - .unlocked_ioctl = drm_ioctl, - .compat_ioctl = drm_compat_ioctl, - .poll = drm_poll, - .read = drm_read, - .llseek = noop_llseek, - .mmap = ingenic_drm_gem_cma_mmap, -}; +DEFINE_DRM_GEM_CMA_FOPS(ingenic_drm_fops); static struct drm_driver ingenic_drm_driver_data = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC, @@ -775,7 +685,7 @@ static const struct drm_encoder_helper_funcs ingenic_drm_encoder_helper_funcs = }; static const struct drm_mode_config_funcs ingenic_drm_mode_config_funcs = { - .fb_create = ingenic_drm_gem_fb_create, + .fb_create = drm_gem_fb_create, .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit, @@ -902,8 +812,6 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) return ret; } - drm_plane_enable_fb_damage_clips(&priv->f1); - drm_crtc_helper_add(&priv->crtc, &ingenic_drm_crtc_helper_funcs); ret = drm_crtc_init_with_planes(drm, &priv->crtc, &priv->f1, @@ -929,8 +837,6 @@ static int ingenic_drm_bind(struct device *dev, bool has_components) return ret; } - drm_plane_enable_fb_damage_clips(&priv->f0); - if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU) && has_components) { ret = component_bind_all(dev, drm); if (ret) { diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.h b/drivers/gpu/drm/ingenic/ingenic-drm.h index df99f0f75d39..43f7d959cff7 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm.h +++ b/drivers/gpu/drm/ingenic/ingenic-drm.h @@ -168,10 +168,6 @@ void ingenic_drm_plane_config(struct device *dev, struct drm_plane *plane, u32 fourcc); void ingenic_drm_plane_disable(struct device *dev, struct drm_plane *plane); -void ingenic_drm_sync_data(struct device *dev, - struct drm_plane_state *old_state, - struct drm_plane_state *state); - extern struct platform_driver *ingenic_ipu_driver_ptr; #endif /* DRIVERS_GPU_DRM_INGENIC_INGENIC_DRM_H */ diff --git a/drivers/gpu/drm/ingenic/ingenic-ipu.c b/drivers/gpu/drm/ingenic/ingenic-ipu.c index 38c83e8cc6a5..fc8c6e970ee3 100644 --- a/drivers/gpu/drm/ingenic/ingenic-ipu.c +++ b/drivers/gpu/drm/ingenic/ingenic-ipu.c @@ -20,7 +20,6 @@ #include #include -#include #include #include #include @@ -317,8 +316,6 @@ static void ingenic_ipu_plane_atomic_update(struct drm_plane *plane, JZ_IPU_CTRL_CHIP_EN | JZ_IPU_CTRL_LCDC_SEL); } - ingenic_drm_sync_data(ipu->master, oldstate, state); - /* New addresses will be committed in vblank handler... */ ipu->addr_y = drm_fb_cma_get_gem_addr(state->fb, state, 0); if (finfo->num_planes > 1) @@ -537,7 +534,7 @@ static int ingenic_ipu_plane_atomic_check(struct drm_plane *plane, if (!state->crtc || !crtc_state->mode.hdisplay || !crtc_state->mode.vdisplay) - goto out_check_damage; + return 0; /* Plane must be fully visible */ if (state->crtc_x < 0 || state->crtc_y < 0 || @@ -554,7 +551,7 @@ static int ingenic_ipu_plane_atomic_check(struct drm_plane *plane, return -EINVAL; if (!osd_changed(state, plane->state)) - goto out_check_damage; + return 0; crtc_state->mode_changed = true; @@ -581,9 +578,6 @@ static int ingenic_ipu_plane_atomic_check(struct drm_plane *plane, ipu->denom_w = denom_w; ipu->denom_h = denom_h; -out_check_damage: - drm_atomic_helper_check_plane_damage(state->state, state); - return 0; } @@ -765,8 +759,6 @@ static int ingenic_ipu_bind(struct device *dev, struct device *master, void *d) return err; } - drm_plane_enable_fb_damage_clips(plane); - /* * Sharpness settings range is [0,32] * 0 : nearest-neighbor -- cgit v1.2.3 From 6561e0aa4627da90f59076fec5e3a1b72a8aa63f Mon Sep 17 00:00:00 2001 From: Ondrej Jirman Date: Wed, 1 Jul 2020 20:46:40 +0200 Subject: MAINTAINERS: Update entry for st7703 driver after the rename The driver was renamed, change the path in the MAINTAINERS file. Signed-off-by: Ondrej Jirman Signed-off-by: Daniel Vetter Link: https://lore.kernel.org/lkml/20200701184640.1674969-1-megous@megous.com/#t --- MAINTAINERS | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 10992f6541bd..99db89d21ddd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5594,12 +5594,13 @@ S: Maintained F: Documentation/devicetree/bindings/display/panel/raydium,rm67191.yaml F: drivers/gpu/drm/panel/panel-raydium-rm67191.c -DRM DRIVER FOR ROCKTECH JH057N00900 PANELS +DRM DRIVER FOR SITRONIX ST7703 PANELS M: Guido Günther R: Purism Kernel Team +R: Ondrej Jirman S: Maintained -F: Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.txt -F: drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c +F: Documentation/devicetree/bindings/display/panel/rocktech,jh057n00900.yaml +F: drivers/gpu/drm/panel/panel-sitronix-st7703.c DRM DRIVER FOR SAVAGE VIDEO CARDS S: Orphan / Obsolete -- cgit v1.2.3 From c2df75ad2a9f205820e4bc0db936d3d9af3da1ae Mon Sep 17 00:00:00 2001 From: Christian Hewitt Date: Thu, 8 Oct 2020 14:17:38 +0000 Subject: drm/panfrost: increase readl_relaxed_poll_timeout values Amlogic SoC devices report the following errors frequently causing excessive dmesg log spam and early log rotataion, although the errors appear to be harmless as everything works fine: [ 7.202702] panfrost ffe40000.gpu: error powering up gpu L2 [ 7.203760] panfrost ffe40000.gpu: error powering up gpu shader ARM staff have advised increasing the timeout values to eliminate the errors in most normal scenarios, and testing with several different G31/G52 devices shows 20000 to be a reliable value. Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver") Suggested-by: Steven Price Signed-off-by: Christian Hewitt Reviewed-by: Steven Price Signed-off-by: Steven Price Link: https://patchwork.freedesktop.org/patch/msgid/20201008141738.13560-1-christianshewitt@gmail.com --- drivers/gpu/drm/panfrost/panfrost_gpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c index e1b2a3376624..2aae636f1cf5 100644 --- a/drivers/gpu/drm/panfrost/panfrost_gpu.c +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c @@ -325,13 +325,13 @@ void panfrost_gpu_power_on(struct panfrost_device *pfdev) /* Just turn on everything for now */ gpu_write(pfdev, L2_PWRON_LO, pfdev->features.l2_present); ret = readl_relaxed_poll_timeout(pfdev->iomem + L2_READY_LO, - val, val == pfdev->features.l2_present, 100, 1000); + val, val == pfdev->features.l2_present, 100, 20000); if (ret) dev_err(pfdev->dev, "error powering up gpu L2"); gpu_write(pfdev, SHADER_PWRON_LO, pfdev->features.shader_present); ret = readl_relaxed_poll_timeout(pfdev->iomem + SHADER_READY_LO, - val, val == pfdev->features.shader_present, 100, 1000); + val, val == pfdev->features.shader_present, 100, 20000); if (ret) dev_err(pfdev->dev, "error powering up gpu shader"); -- cgit v1.2.3 From d3c8f2784d3266d27956659c78835ee1d1925ad2 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Mon, 12 Oct 2020 12:25:09 +0200 Subject: drm/ingenic: Fix bad revert Fix a badly reverted commit. The revert commit was cherry-picked from drm-misc-next to drm-misc-next-fixes, and in the process some unrelated code was added. Fixes: a3fb64c00d44 ("Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached"") Signed-off-by: Paul Cercueil Acked-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20201012102509.10690-1-paul@crapouillou.net --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index 1be1235bd546..a3d1617d7c67 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -440,20 +440,6 @@ void ingenic_drm_plane_config(struct device *dev, } } -static void ingenic_drm_update_palette(struct ingenic_drm *priv, - const struct drm_color_lut *lut) -{ - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); i++) { - u16 color = drm_color_lut_extract(lut[i].red, 5) << 11 - | drm_color_lut_extract(lut[i].green, 6) << 5 - | drm_color_lut_extract(lut[i].blue, 5); - - priv->dma_hwdescs->palette[i] = color; - } -} - static void ingenic_drm_plane_atomic_update(struct drm_plane *plane, struct drm_plane_state *oldstate) { @@ -464,8 +450,6 @@ static void ingenic_drm_plane_atomic_update(struct drm_plane *plane, dma_addr_t addr; if (state && state->fb) { - crtc_state = state->crtc->state; - addr = drm_fb_cma_get_gem_addr(state->fb, state, 0); width = state->src_w >> 16; height = state->src_h >> 16; -- cgit v1.2.3