* [PATCH 1/3] drm: Add and export function drm_gem_cma_create_noalloc [not found] <20200930165212.GA8833@lst.de> @ 2020-09-30 17:16 ` Paul Cercueil 2020-10-01 8:51 ` Daniel Vetter 2020-09-30 17:16 ` [PATCH 2/3] drm/ingenic: Update code to mmap GEM buffers cached Paul Cercueil ` (2 subsequent siblings) 3 siblings, 1 reply; 13+ messages in thread From: Paul Cercueil @ 2020-09-30 17:16 UTC (permalink / raw) To: Christoph Hellwig Cc: Stephen Rothwell, Dave Airlie, Linux Kernel Mailing List, DRI, Paul Cercueil, Linux Next Mailing List Add and export the function drm_gem_cma_create_noalloc(), which is just __drm_gem_cma_create() renamed. This function can be used by drivers that need to create a GEM object without allocating the backing memory. Signed-off-by: Paul Cercueil <paul@crapouillou.net> --- drivers/gpu/drm/drm_gem_cma_helper.c | 11 ++++++----- include/drm/drm_gem_cma_helper.h | 3 +++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c index 59b9ca207b42..6abc4b306832 100644 --- a/drivers/gpu/drm/drm_gem_cma_helper.c +++ b/drivers/gpu/drm/drm_gem_cma_helper.c @@ -34,7 +34,7 @@ */ /** - * __drm_gem_cma_create - Create a GEM CMA object without allocating memory + * drm_gem_cma_create_noalloc - Create a GEM CMA object without allocating memory * @drm: DRM device * @size: size of the object to allocate * @@ -45,8 +45,8 @@ * A struct drm_gem_cma_object * on success or an ERR_PTR()-encoded negative * error code on failure. */ -static struct drm_gem_cma_object * -__drm_gem_cma_create(struct drm_device *drm, size_t size) +struct drm_gem_cma_object * +drm_gem_cma_create_noalloc(struct drm_device *drm, size_t size) { struct drm_gem_cma_object *cma_obj; struct drm_gem_object *gem_obj; @@ -76,6 +76,7 @@ __drm_gem_cma_create(struct drm_device *drm, size_t size) kfree(cma_obj); return ERR_PTR(ret); } +EXPORT_SYMBOL_GPL(drm_gem_cma_create_noalloc); /** * drm_gem_cma_create - allocate an object with the given size @@ -98,7 +99,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm, size = round_up(size, PAGE_SIZE); - cma_obj = __drm_gem_cma_create(drm, size); + cma_obj = drm_gem_cma_create_noalloc(drm, size); if (IS_ERR(cma_obj)) return cma_obj; @@ -476,7 +477,7 @@ drm_gem_cma_prime_import_sg_table(struct drm_device *dev, return ERR_PTR(-EINVAL); /* Create a CMA GEM buffer. */ - cma_obj = __drm_gem_cma_create(dev, attach->dmabuf->size); + cma_obj = drm_gem_cma_create_noalloc(dev, attach->dmabuf->size); if (IS_ERR(cma_obj)) return ERR_CAST(cma_obj); diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h index 2bfa2502607a..be2b8e3a8ab2 100644 --- a/include/drm/drm_gem_cma_helper.h +++ b/include/drm/drm_gem_cma_helper.h @@ -83,6 +83,9 @@ int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma); struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm, size_t size); +struct drm_gem_cma_object * +drm_gem_cma_create_noalloc(struct drm_device *drm, size_t size); + extern const struct vm_operations_struct drm_gem_cma_vm_ops; #ifndef CONFIG_MMU -- 2.28.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/3] drm: Add and export function drm_gem_cma_create_noalloc 2020-09-30 17:16 ` [PATCH 1/3] drm: Add and export function drm_gem_cma_create_noalloc Paul Cercueil @ 2020-10-01 8:51 ` Daniel Vetter 0 siblings, 0 replies; 13+ messages in thread From: Daniel Vetter @ 2020-10-01 8:51 UTC (permalink / raw) To: Paul Cercueil Cc: Stephen Rothwell, Dave Airlie, Linux Kernel Mailing List, DRI, Linux Next Mailing List, Christoph Hellwig On Wed, Sep 30, 2020 at 07:16:42PM +0200, Paul Cercueil wrote: > Add and export the function drm_gem_cma_create_noalloc(), which is just > __drm_gem_cma_create() renamed. > > This function can be used by drivers that need to create a GEM object > without allocating the backing memory. > > Signed-off-by: Paul Cercueil <paul@crapouillou.net> > --- > drivers/gpu/drm/drm_gem_cma_helper.c | 11 ++++++----- > include/drm/drm_gem_cma_helper.h | 3 +++ > 2 files changed, 9 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c > index 59b9ca207b42..6abc4b306832 100644 > --- a/drivers/gpu/drm/drm_gem_cma_helper.c > +++ b/drivers/gpu/drm/drm_gem_cma_helper.c > @@ -34,7 +34,7 @@ > */ > > /** > - * __drm_gem_cma_create - Create a GEM CMA object without allocating memory > + * drm_gem_cma_create_noalloc - Create a GEM CMA object without allocating memory > * @drm: DRM device > * @size: size of the object to allocate > * > @@ -45,8 +45,8 @@ > * A struct drm_gem_cma_object * on success or an ERR_PTR()-encoded negative > * error code on failure. > */ > -static struct drm_gem_cma_object * > -__drm_gem_cma_create(struct drm_device *drm, size_t size) > +struct drm_gem_cma_object * > +drm_gem_cma_create_noalloc(struct drm_device *drm, size_t size) > { > struct drm_gem_cma_object *cma_obj; > struct drm_gem_object *gem_obj; > @@ -76,6 +76,7 @@ __drm_gem_cma_create(struct drm_device *drm, size_t size) > kfree(cma_obj); > return ERR_PTR(ret); > } > +EXPORT_SYMBOL_GPL(drm_gem_cma_create_noalloc); This feels a bit awkward, since for drivers who want to roll their own we can do that already. I think the better approach is to export a cma function which allocates non-coherent dma memory. -Daniel > > /** > * drm_gem_cma_create - allocate an object with the given size > @@ -98,7 +99,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm, > > size = round_up(size, PAGE_SIZE); > > - cma_obj = __drm_gem_cma_create(drm, size); > + cma_obj = drm_gem_cma_create_noalloc(drm, size); > if (IS_ERR(cma_obj)) > return cma_obj; > > @@ -476,7 +477,7 @@ drm_gem_cma_prime_import_sg_table(struct drm_device *dev, > return ERR_PTR(-EINVAL); > > /* Create a CMA GEM buffer. */ > - cma_obj = __drm_gem_cma_create(dev, attach->dmabuf->size); > + cma_obj = drm_gem_cma_create_noalloc(dev, attach->dmabuf->size); > if (IS_ERR(cma_obj)) > return ERR_CAST(cma_obj); > > diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h > index 2bfa2502607a..be2b8e3a8ab2 100644 > --- a/include/drm/drm_gem_cma_helper.h > +++ b/include/drm/drm_gem_cma_helper.h > @@ -83,6 +83,9 @@ int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma); > struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm, > size_t size); > > +struct drm_gem_cma_object * > +drm_gem_cma_create_noalloc(struct drm_device *drm, size_t size); > + > extern const struct vm_operations_struct drm_gem_cma_vm_ops; > > #ifndef CONFIG_MMU > -- > 2.28.0 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/3] drm/ingenic: Update code to mmap GEM buffers cached [not found] <20200930165212.GA8833@lst.de> 2020-09-30 17:16 ` [PATCH 1/3] drm: Add and export function drm_gem_cma_create_noalloc Paul Cercueil @ 2020-09-30 17:16 ` Paul Cercueil 2020-09-30 17:16 ` [PATCH 3/3] drm/ingenic: Alloc cached GEM buffers with dma_alloc_noncoherent Paul Cercueil 2020-10-04 14:17 ` [PATCH] Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached" Paul Cercueil 3 siblings, 0 replies; 13+ messages in thread From: Paul Cercueil @ 2020-09-30 17:16 UTC (permalink / raw) To: Christoph Hellwig Cc: Stephen Rothwell, Dave Airlie, Linux Kernel Mailing List, DRI, Paul Cercueil, Linux Next Mailing List The DMA API changed at the same time commit 37054fc81443 ("gpu/drm: ingenic: Add option to mmap GEM buffers cached") was added. Rework the code to work with the new DMA API. Signed-off-by: Paul Cercueil <paul@crapouillou.net> --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 24 +++++++---------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index 0225dc1f5eb8..07a1da7266e4 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -526,12 +526,10 @@ void ingenic_drm_sync_data(struct device *dev, struct drm_plane_state *state) { 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; @@ -541,12 +539,11 @@ void ingenic_drm_sync_data(struct device *dev, 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); /* Ignore x1/x2 values, invalidate complete lines */ offset = clip.y1 * state->fb->pitches[i]; - dma_cache_sync(priv->dev, addr + offset, + dma_sync_single_for_device(dev, paddr + offset, (clip.y2 - clip.y1) * state->fb->pitches[i], DMA_TO_DEVICE); } @@ -766,14 +763,6 @@ 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 @@ -784,12 +773,13 @@ static int ingenic_drm_gem_mmap(struct drm_gem_object *obj, 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); + if (!ingenic_drm_cached_gem_buf) + vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); - return ret; + return remap_pfn_range(vma, vma->vm_start, + cma_obj->paddr >> PAGE_SHIFT, + vma->vm_end - vma->vm_start, + vma->vm_page_prot); } static int ingenic_drm_gem_cma_mmap(struct file *filp, -- 2.28.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/3] drm/ingenic: Alloc cached GEM buffers with dma_alloc_noncoherent [not found] <20200930165212.GA8833@lst.de> 2020-09-30 17:16 ` [PATCH 1/3] drm: Add and export function drm_gem_cma_create_noalloc Paul Cercueil 2020-09-30 17:16 ` [PATCH 2/3] drm/ingenic: Update code to mmap GEM buffers cached Paul Cercueil @ 2020-09-30 17:16 ` Paul Cercueil 2020-10-04 14:17 ` [PATCH] Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached" Paul Cercueil 3 siblings, 0 replies; 13+ messages in thread From: Paul Cercueil @ 2020-09-30 17:16 UTC (permalink / raw) To: Christoph Hellwig Cc: Stephen Rothwell, Dave Airlie, Linux Kernel Mailing List, DRI, Paul Cercueil, Linux Next Mailing List It turns out that if you want to mmap GEM buffers fully cached, then they should be allocated as such as well. Who would have known? Introduce a custom .dumb_create callback, that will behave just like drm_gem_cma_dumb_create(), except that it will allocate the GEM buffer using dma_alloc_noncoherent() if non-coherent memory is what we want. Signed-off-by: Paul Cercueil <paul@crapouillou.net> --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 48 ++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index 07a1da7266e4..8ece269c040f 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -794,6 +794,52 @@ static int ingenic_drm_gem_cma_mmap(struct file *filp, return ingenic_drm_gem_mmap(vma->vm_private_data, vma); } +static int ingenic_drm_gem_cma_dumb_create(struct drm_file *file_priv, + struct drm_device *drm, + struct drm_mode_create_dumb *args) +{ + /* + * This is basically a copy of drm_gem_cma_dumb_create, which supports + * creating fully cached GEM buffers. + */ + struct drm_gem_cma_object *cma_obj; + struct drm_gem_object *gem_obj; + size_t size; + int ret; + + args->pitch = DIV_ROUND_UP(args->width * args->bpp, 8); + args->size = args->pitch * args->height; + + size = PAGE_ALIGN(args->size); + + cma_obj = drm_gem_cma_create_noalloc(drm, size); + if (IS_ERR(cma_obj)) + return PTR_ERR(cma_obj); + + if (ingenic_drm_cached_gem_buf) { + cma_obj->vaddr = dma_alloc_noncoherent(drm->dev, size, + &cma_obj->paddr, + DMA_TO_DEVICE, + GFP_KERNEL | __GFP_NOWARN); + } else { + cma_obj->vaddr = dma_alloc_wc(drm->dev, size, &cma_obj->paddr, + GFP_KERNEL | __GFP_NOWARN); + } + if (!cma_obj->vaddr) { + dev_err(drm->dev, "Failed to allocate buffer with size %zu\n", size); + ret = -ENOMEM; + goto out_gem_object_put; + } + + gem_obj = &cma_obj->base; + + ret = drm_gem_handle_create(file_priv, gem_obj, &args->handle); + +out_gem_object_put: + drm_gem_object_put(gem_obj); + return ret; +} + static const struct file_operations ingenic_drm_fops = { .owner = THIS_MODULE, .open = drm_open, @@ -816,7 +862,7 @@ static struct drm_driver ingenic_drm_driver_data = { .patchlevel = 0, .fops = &ingenic_drm_fops, - DRM_GEM_CMA_DRIVER_OPS, + DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(ingenic_drm_gem_cma_dumb_create), .irq_handler = ingenic_drm_irq_handler, }; -- 2.28.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH] Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached" [not found] <20200930165212.GA8833@lst.de> ` (2 preceding siblings ...) 2020-09-30 17:16 ` [PATCH 3/3] drm/ingenic: Alloc cached GEM buffers with dma_alloc_noncoherent Paul Cercueil @ 2020-10-04 14:17 ` Paul Cercueil 2020-10-04 19:59 ` Sam Ravnborg 3 siblings, 1 reply; 13+ messages in thread From: Paul Cercueil @ 2020-10-04 14:17 UTC (permalink / raw) To: Christoph Hellwig, Dave Airlie Cc: Stephen Rothwell, Linux Kernel Mailing List, DRI, Paul Cercueil, od, Linux Next Mailing List, Sam Ravnborg This reverts commit 37054fc81443cc6a8c3a38395f384412b8373d82. 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 <paul@crapouillou.net> --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 114 +--------------------- drivers/gpu/drm/ingenic/ingenic-drm.h | 4 - drivers/gpu/drm/ingenic/ingenic-ipu.c | 12 +-- 3 files changed, 4 insertions(+), 126 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index 0225dc1f5eb8..7d8b0ad52979 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -9,8 +9,6 @@ #include <linux/component.h> #include <linux/clk.h> #include <linux/dma-mapping.h> -#include <linux/dma-noncoherent.h> -#include <linux/io.h> #include <linux/module.h> #include <linux/mutex.h> #include <linux/of_device.h> @@ -24,7 +22,6 @@ #include <drm/drm_color_mgmt.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> -#include <drm/drm_damage_helper.h> #include <drm/drm_drv.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_fb_cma_helper.h> @@ -100,11 +97,6 @@ struct ingenic_drm { struct notifier_block clock_nb; }; -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) { @@ -402,8 +394,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; } @@ -521,38 +511,6 @@ 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) -{ - 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); - - 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); - - /* 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); - } - } -} - static void ingenic_drm_update_palette(struct ingenic_drm *priv, const struct drm_color_lut *lut) { @@ -581,8 +539,6 @@ static void ingenic_drm_plane_atomic_update(struct drm_plane *plane, if (state && state->fb) { crtc_state = state->crtc->state; - ingenic_drm_sync_data(priv->dev, oldstate, state); - addr = drm_fb_cma_get_gem_addr(state->fb, state, 0); width = state->src_w >> 16; height = state->src_h >> 16; @@ -752,69 +708,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, @@ -878,7 +772,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, @@ -1032,8 +926,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, @@ -1062,8 +954,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 ee3a892c0383..9b48ce02803d 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm.h +++ b/drivers/gpu/drm/ingenic/ingenic-drm.h @@ -171,10 +171,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 <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> -#include <drm/drm_damage_helper.h> #include <drm/drm_drv.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_fourcc.h> @@ -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 -- 2.28.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached" 2020-10-04 14:17 ` [PATCH] Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached" Paul Cercueil @ 2020-10-04 19:59 ` Sam Ravnborg 2020-10-04 20:11 ` Paul Cercueil 0 siblings, 1 reply; 13+ messages in thread From: Sam Ravnborg @ 2020-10-04 19:59 UTC (permalink / raw) To: Paul Cercueil Cc: Stephen Rothwell, od, Dave Airlie, Linux Kernel Mailing List, DRI, Linux Next Mailing List, Christoph Hellwig Hi Paul. On Sun, Oct 04, 2020 at 04:17:58PM +0200, Paul Cercueil wrote: > This reverts commit 37054fc81443cc6a8c3a38395f384412b8373d82. In the changelog please refer to commits like this: 37054fc81443 ("gpu/drm: ingenic: Add option to mmap GEM buffers cached") Use "dim cite 37054fc81443cc6a8c3a38395f384412b8373d82" to get the right format. > > 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 <paul@crapouillou.net> With the changelog updated: Acked-by: Sam Ravnborg <sam@ravnborg.org> > --- > drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 114 +--------------------- > drivers/gpu/drm/ingenic/ingenic-drm.h | 4 - > drivers/gpu/drm/ingenic/ingenic-ipu.c | 12 +-- > 3 files changed, 4 insertions(+), 126 deletions(-) > > diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c > index 0225dc1f5eb8..7d8b0ad52979 100644 > --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c > +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c > @@ -9,8 +9,6 @@ > #include <linux/component.h> > #include <linux/clk.h> > #include <linux/dma-mapping.h> > -#include <linux/dma-noncoherent.h> > -#include <linux/io.h> > #include <linux/module.h> > #include <linux/mutex.h> > #include <linux/of_device.h> > @@ -24,7 +22,6 @@ > #include <drm/drm_color_mgmt.h> > #include <drm/drm_crtc.h> > #include <drm/drm_crtc_helper.h> > -#include <drm/drm_damage_helper.h> > #include <drm/drm_drv.h> > #include <drm/drm_gem_cma_helper.h> > #include <drm/drm_fb_cma_helper.h> > @@ -100,11 +97,6 @@ struct ingenic_drm { > struct notifier_block clock_nb; > }; > > -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) { > @@ -402,8 +394,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; > } > > @@ -521,38 +511,6 @@ 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) > -{ > - 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); > - > - 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); > - > - /* 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); > - } > - } > -} > - > static void ingenic_drm_update_palette(struct ingenic_drm *priv, > const struct drm_color_lut *lut) > { > @@ -581,8 +539,6 @@ static void ingenic_drm_plane_atomic_update(struct drm_plane *plane, > if (state && state->fb) { > crtc_state = state->crtc->state; > > - ingenic_drm_sync_data(priv->dev, oldstate, state); > - > addr = drm_fb_cma_get_gem_addr(state->fb, state, 0); > width = state->src_w >> 16; > height = state->src_h >> 16; > @@ -752,69 +708,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, > @@ -878,7 +772,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, > @@ -1032,8 +926,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, > @@ -1062,8 +954,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 ee3a892c0383..9b48ce02803d 100644 > --- a/drivers/gpu/drm/ingenic/ingenic-drm.h > +++ b/drivers/gpu/drm/ingenic/ingenic-drm.h > @@ -171,10 +171,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 <drm/drm_atomic.h> > #include <drm/drm_atomic_helper.h> > -#include <drm/drm_damage_helper.h> > #include <drm/drm_drv.h> > #include <drm/drm_fb_cma_helper.h> > #include <drm/drm_fourcc.h> > @@ -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 > -- > 2.28.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached" 2020-10-04 19:59 ` Sam Ravnborg @ 2020-10-04 20:11 ` Paul Cercueil 2020-10-05 12:01 ` Stephen Rothwell 0 siblings, 1 reply; 13+ messages in thread From: Paul Cercueil @ 2020-10-04 20:11 UTC (permalink / raw) To: Sam Ravnborg, Stephen Rothwell Cc: od, Dave Airlie, Linux Kernel Mailing List, DRI, Linux Next Mailing List, Christoph Hellwig Hi, Le dim. 4 oct. 2020 à 21:59, Sam Ravnborg <sam@ravnborg.org> a écrit : > Hi Paul. > > On Sun, Oct 04, 2020 at 04:17:58PM +0200, Paul Cercueil wrote: >> This reverts commit 37054fc81443cc6a8c3a38395f384412b8373d82. > > In the changelog please refer to commits like this: > 37054fc81443 ("gpu/drm: ingenic: Add option to mmap GEM buffers > cached") > > Use "dim cite 37054fc81443cc6a8c3a38395f384412b8373d82" to get the > right format. > >> >> 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 <paul@crapouillou.net> > > With the changelog updated: > Acked-by: Sam Ravnborg <sam@ravnborg.org> Pushed to drm-misc-next with the changelog fix, thanks. Stephen: Now it should build fine again. Could you remove the BROKEN flag? Cheers, -Paul >> --- >> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 114 >> +--------------------- >> drivers/gpu/drm/ingenic/ingenic-drm.h | 4 - >> drivers/gpu/drm/ingenic/ingenic-ipu.c | 12 +-- >> 3 files changed, 4 insertions(+), 126 deletions(-) >> >> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c >> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c >> index 0225dc1f5eb8..7d8b0ad52979 100644 >> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c >> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c >> @@ -9,8 +9,6 @@ >> #include <linux/component.h> >> #include <linux/clk.h> >> #include <linux/dma-mapping.h> >> -#include <linux/dma-noncoherent.h> >> -#include <linux/io.h> >> #include <linux/module.h> >> #include <linux/mutex.h> >> #include <linux/of_device.h> >> @@ -24,7 +22,6 @@ >> #include <drm/drm_color_mgmt.h> >> #include <drm/drm_crtc.h> >> #include <drm/drm_crtc_helper.h> >> -#include <drm/drm_damage_helper.h> >> #include <drm/drm_drv.h> >> #include <drm/drm_gem_cma_helper.h> >> #include <drm/drm_fb_cma_helper.h> >> @@ -100,11 +97,6 @@ struct ingenic_drm { >> struct notifier_block clock_nb; >> }; >> >> -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) { >> @@ -402,8 +394,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; >> } >> >> @@ -521,38 +511,6 @@ 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) >> -{ >> - 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); >> - >> - 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); >> - >> - /* 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); >> - } >> - } >> -} >> - >> static void ingenic_drm_update_palette(struct ingenic_drm *priv, >> const struct drm_color_lut *lut) >> { >> @@ -581,8 +539,6 @@ static void >> ingenic_drm_plane_atomic_update(struct drm_plane *plane, >> if (state && state->fb) { >> crtc_state = state->crtc->state; >> >> - ingenic_drm_sync_data(priv->dev, oldstate, state); >> - >> addr = drm_fb_cma_get_gem_addr(state->fb, state, 0); >> width = state->src_w >> 16; >> height = state->src_h >> 16; >> @@ -752,69 +708,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, >> @@ -878,7 +772,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, >> @@ -1032,8 +926,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, >> @@ -1062,8 +954,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 ee3a892c0383..9b48ce02803d 100644 >> --- a/drivers/gpu/drm/ingenic/ingenic-drm.h >> +++ b/drivers/gpu/drm/ingenic/ingenic-drm.h >> @@ -171,10 +171,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 <drm/drm_atomic.h> >> #include <drm/drm_atomic_helper.h> >> -#include <drm/drm_damage_helper.h> >> #include <drm/drm_drv.h> >> #include <drm/drm_fb_cma_helper.h> >> #include <drm/drm_fourcc.h> >> @@ -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 >> -- >> 2.28.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached" 2020-10-04 20:11 ` Paul Cercueil @ 2020-10-05 12:01 ` Stephen Rothwell 2020-10-05 14:05 ` Daniel Vetter 2020-10-06 4:30 ` Stephen Rothwell 0 siblings, 2 replies; 13+ messages in thread From: Stephen Rothwell @ 2020-10-05 12:01 UTC (permalink / raw) To: Paul Cercueil Cc: od, Dave Airlie, Linux Kernel Mailing List, DRI, Linux Next Mailing List, Sam Ravnborg, Christoph Hellwig [-- Attachment #1.1: Type: text/plain, Size: 542 bytes --] Hi Paul, On Sun, 04 Oct 2020 22:11:23 +0200 Paul Cercueil <paul@crapouillou.net> wrote: > > Pushed to drm-misc-next with the changelog fix, thanks. > > Stephen: > Now it should build fine again. Could you remove the BROKEN flag? Thanks for letting me know, but the fix has not appeared in any drm tree included in linux-next yet ... If it doesn't show up by the time I will merge the drm tree tomorrow, I will apply this revert patch myself (instead of the patch marking the driver BROKEN). -- Cheers, Stephen Rothwell [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 488 bytes --] [-- Attachment #2: Type: text/plain, Size: 160 bytes --] _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached" 2020-10-05 12:01 ` Stephen Rothwell @ 2020-10-05 14:05 ` Daniel Vetter 2020-10-05 14:47 ` Paul Cercueil 2020-10-06 4:30 ` Stephen Rothwell 1 sibling, 1 reply; 13+ messages in thread From: Daniel Vetter @ 2020-10-05 14:05 UTC (permalink / raw) To: Stephen Rothwell Cc: od, Dave Airlie, Linux Kernel Mailing List, DRI, Paul Cercueil, Linux Next Mailing List, Sam Ravnborg, Christoph Hellwig On Mon, Oct 05, 2020 at 11:01:50PM +1100, Stephen Rothwell wrote: > Hi Paul, > > On Sun, 04 Oct 2020 22:11:23 +0200 Paul Cercueil <paul@crapouillou.net> wrote: > > > > Pushed to drm-misc-next with the changelog fix, thanks. > > > > Stephen: > > Now it should build fine again. Could you remove the BROKEN flag? > > Thanks for letting me know, but the fix has not appeared in any drm > tree included in linux-next yet ... > > If it doesn't show up by the time I will merge the drm tree tomorrow, I > will apply this revert patch myself (instead of the patch marking the > driver BROKEN). Yeah it should have been pushed to drm-misc-next-fixes per https://drm.pages.freedesktop.org/maintainer-tools/committer-drm-misc.html#where-do-i-apply-my-patch Paul, can you pls git cherry-pick -x this over to drm-misc-next-fixes? Thanks, Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached" 2020-10-05 14:05 ` Daniel Vetter @ 2020-10-05 14:47 ` Paul Cercueil 2020-10-05 17:38 ` Daniel Vetter 2020-10-05 22:31 ` Daniel Vetter 0 siblings, 2 replies; 13+ messages in thread From: Paul Cercueil @ 2020-10-05 14:47 UTC (permalink / raw) To: Daniel Vetter Cc: Stephen Rothwell, od, Dave Airlie, Linux Kernel Mailing List, DRI, Linux Next Mailing List, Sam Ravnborg, Christoph Hellwig Hi, Le lun. 5 oct. 2020 à 16:05, Daniel Vetter <daniel@ffwll.ch> a écrit : > On Mon, Oct 05, 2020 at 11:01:50PM +1100, Stephen Rothwell wrote: >> Hi Paul, >> >> On Sun, 04 Oct 2020 22:11:23 +0200 Paul Cercueil >> <paul@crapouillou.net> wrote: >> > >> > Pushed to drm-misc-next with the changelog fix, thanks. >> > >> > Stephen: >> > Now it should build fine again. Could you remove the BROKEN flag? >> >> Thanks for letting me know, but the fix has not appeared in any drm >> tree included in linux-next yet ... >> >> If it doesn't show up by the time I will merge the drm tree >> tomorrow, I >> will apply this revert patch myself (instead of the patch marking >> the >> driver BROKEN). > > Yeah it should have been pushed to drm-misc-next-fixes per > > https://drm.pages.freedesktop.org/maintainer-tools/committer-drm-misc.html#where-do-i-apply-my-patch > > Paul, can you pls git cherry-pick -x this over to drm-misc-next-fixes? I had a few commits on top of it in drm-misc-next, so the revert doesn't apply cleanly in drm-misc-next-fixes... I can revert it there, but then we'd have a different revert commit in drm-misc-next and drm-misc-next-next. Sorry for the mess. What should I do? -Paul _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached" 2020-10-05 14:47 ` Paul Cercueil @ 2020-10-05 17:38 ` Daniel Vetter 2020-10-05 22:31 ` Daniel Vetter 1 sibling, 0 replies; 13+ messages in thread From: Daniel Vetter @ 2020-10-05 17:38 UTC (permalink / raw) To: Paul Cercueil Cc: Stephen Rothwell, od, Dave Airlie, Linux Kernel Mailing List, DRI, Linux Next Mailing List, Sam Ravnborg, Christoph Hellwig On Mon, Oct 5, 2020 at 4:47 PM Paul Cercueil <paul@crapouillou.net> wrote: > > Hi, > > Le lun. 5 oct. 2020 à 16:05, Daniel Vetter <daniel@ffwll.ch> a écrit : > > On Mon, Oct 05, 2020 at 11:01:50PM +1100, Stephen Rothwell wrote: > >> Hi Paul, > >> > >> On Sun, 04 Oct 2020 22:11:23 +0200 Paul Cercueil > >> <paul@crapouillou.net> wrote: > >> > > >> > Pushed to drm-misc-next with the changelog fix, thanks. > >> > > >> > Stephen: > >> > Now it should build fine again. Could you remove the BROKEN flag? > >> > >> Thanks for letting me know, but the fix has not appeared in any drm > >> tree included in linux-next yet ... > >> > >> If it doesn't show up by the time I will merge the drm tree > >> tomorrow, I > >> will apply this revert patch myself (instead of the patch marking > >> the > >> driver BROKEN). > > > > Yeah it should have been pushed to drm-misc-next-fixes per > > > > https://drm.pages.freedesktop.org/maintainer-tools/committer-drm-misc.html#where-do-i-apply-my-patch > > > > Paul, can you pls git cherry-pick -x this over to drm-misc-next-fixes? > > I had a few commits on top of it in drm-misc-next, so the revert > doesn't apply cleanly in drm-misc-next-fixes... I can revert it there, > but then we'd have a different revert commit in drm-misc-next and > drm-misc-next-next. > > Sorry for the mess. What should I do? We need the revert in drm-misc-next-fixes or the drm-next pull request doesn't work out. So cherry-pick over, fix up conflicts, push the tree, and don't forget to fix up the conflicts when dim rebuilds drm-tip. Also tell drm-misc maintainers what you've done, they probably want to do a backmerge to clean this up a bit once the drm-next pull request has landed. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached" 2020-10-05 14:47 ` Paul Cercueil 2020-10-05 17:38 ` Daniel Vetter @ 2020-10-05 22:31 ` Daniel Vetter 1 sibling, 0 replies; 13+ messages in thread From: Daniel Vetter @ 2020-10-05 22:31 UTC (permalink / raw) To: Paul Cercueil, Maxime Ripard, Maarten Lankhorst, Thomas Zimmermann Cc: Stephen Rothwell, od, Dave Airlie, Linux Kernel Mailing List, DRI, Linux Next Mailing List, Sam Ravnborg, Christoph Hellwig On Mon, Oct 5, 2020 at 4:47 PM Paul Cercueil <paul@crapouillou.net> wrote: > > Hi, > > Le lun. 5 oct. 2020 à 16:05, Daniel Vetter <daniel@ffwll.ch> a écrit : > > On Mon, Oct 05, 2020 at 11:01:50PM +1100, Stephen Rothwell wrote: > >> Hi Paul, > >> > >> On Sun, 04 Oct 2020 22:11:23 +0200 Paul Cercueil > >> <paul@crapouillou.net> wrote: > >> > > >> > Pushed to drm-misc-next with the changelog fix, thanks. > >> > > >> > Stephen: > >> > Now it should build fine again. Could you remove the BROKEN flag? > >> > >> Thanks for letting me know, but the fix has not appeared in any drm > >> tree included in linux-next yet ... > >> > >> If it doesn't show up by the time I will merge the drm tree > >> tomorrow, I > >> will apply this revert patch myself (instead of the patch marking > >> the > >> driver BROKEN). > > > > Yeah it should have been pushed to drm-misc-next-fixes per > > > > https://drm.pages.freedesktop.org/maintainer-tools/committer-drm-misc.html#where-do-i-apply-my-patch > > > > Paul, can you pls git cherry-pick -x this over to drm-misc-next-fixes? > > I had a few commits on top of it in drm-misc-next, so the revert > doesn't apply cleanly in drm-misc-next-fixes... I can revert it there, > but then we'd have a different revert commit in drm-misc-next and > drm-misc-next-next. > > Sorry for the mess. What should I do? Hm not sure why, but the reply I thought I've typed didn't seem to have gone out. Cherry pick up, fix up conflict and then fix up the conflict when rebuilding drm-tip. Please tell drm-misc maintainers, they probably want to do a backmerge once the drm-next merge window pull is merged in Linus tree. If we don't fix this up then the drm-next pull goes nowhere. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached" 2020-10-05 12:01 ` Stephen Rothwell 2020-10-05 14:05 ` Daniel Vetter @ 2020-10-06 4:30 ` Stephen Rothwell 1 sibling, 0 replies; 13+ messages in thread From: Stephen Rothwell @ 2020-10-06 4:30 UTC (permalink / raw) To: Paul Cercueil Cc: od, Dave Airlie, Linux Kernel Mailing List, DRI, Linux Next Mailing List, Sam Ravnborg, Christoph Hellwig [-- Attachment #1.1: Type: text/plain, Size: 781 bytes --] Hi all, On Mon, 5 Oct 2020 23:01:50 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote: > > On Sun, 04 Oct 2020 22:11:23 +0200 Paul Cercueil <paul@crapouillou.net> wrote: > > > > Pushed to drm-misc-next with the changelog fix, thanks. > > > > Stephen: > > Now it should build fine again. Could you remove the BROKEN flag? > > Thanks for letting me know, but the fix has not appeared in any drm > tree included in linux-next yet ... > > If it doesn't show up by the time I will merge the drm tree tomorrow, I > will apply this revert patch myself (instead of the patch marking the > driver BROKEN). Unfortunately, the revert patch does not apply to the drm tree merge, so I have just marked the driver BROKEN again today. -- Cheers, Stephen Rothwell [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 488 bytes --] [-- Attachment #2: Type: text/plain, Size: 160 bytes --] _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2020-10-06 7:31 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20200930165212.GA8833@lst.de> 2020-09-30 17:16 ` [PATCH 1/3] drm: Add and export function drm_gem_cma_create_noalloc Paul Cercueil 2020-10-01 8:51 ` Daniel Vetter 2020-09-30 17:16 ` [PATCH 2/3] drm/ingenic: Update code to mmap GEM buffers cached Paul Cercueil 2020-09-30 17:16 ` [PATCH 3/3] drm/ingenic: Alloc cached GEM buffers with dma_alloc_noncoherent Paul Cercueil 2020-10-04 14:17 ` [PATCH] Revert "gpu/drm: ingenic: Add option to mmap GEM buffers cached" Paul Cercueil 2020-10-04 19:59 ` Sam Ravnborg 2020-10-04 20:11 ` Paul Cercueil 2020-10-05 12:01 ` Stephen Rothwell 2020-10-05 14:05 ` Daniel Vetter 2020-10-05 14:47 ` Paul Cercueil 2020-10-05 17:38 ` Daniel Vetter 2020-10-05 22:31 ` Daniel Vetter 2020-10-06 4:30 ` Stephen Rothwell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).