[PATCH 5/7] drm/udl: Convert to drm_atomic_helper_dirtyfb()
Emil Velikov
emil.l.velikov at gmail.com
Fri Nov 29 18:04:02 UTC 2019
Hi Thomas,
On Tue, 26 Nov 2019 at 13:47, Thomas Zimmermann <tzimmermann at suse.de> wrote:
>
> The infrastruture for atomic modesetting allows us to use the generic
> code for dirty-FB and damage handling. Switch over udl and remove the
> driver's implementation.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
> drivers/gpu/drm/udl/udl_drv.h | 5 ---
> drivers/gpu/drm/udl/udl_fb.c | 67 -------------------------------
> drivers/gpu/drm/udl/udl_modeset.c | 11 +++--
> 3 files changed, 8 insertions(+), 75 deletions(-)
>
> diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h
> index 77b57d6abd23..c6fd5c08f5fc 100644
> --- a/drivers/gpu/drm/udl/udl_drv.h
> +++ b/drivers/gpu/drm/udl/udl_drv.h
> @@ -89,11 +89,6 @@ void udl_urb_completion(struct urb *urb);
> int udl_init(struct udl_device *udl);
> void udl_fini(struct drm_device *dev);
>
> -struct drm_framebuffer *
> -udl_fb_user_fb_create(struct drm_device *dev,
> - struct drm_file *file,
> - const struct drm_mode_fb_cmd2 *mode_cmd);
> -
> int udl_render_hline(struct drm_device *dev, int log_bpp, struct urb **urb_ptr,
> const char *front, char **urb_buf_ptr,
> u32 byte_offset, u32 device_byte_offset, u32 byte_width,
> diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
> index c1996ac73a1f..ed01ebaaf468 100644
> --- a/drivers/gpu/drm/udl/udl_fb.c
> +++ b/drivers/gpu/drm/udl/udl_fb.c
> @@ -9,14 +9,9 @@
> */
>
> #include <linux/moduleparam.h>
> -#include <linux/dma-buf.h>
>
> -#include <drm/drm_crtc_helper.h>
> -#include <drm/drm_drv.h>
> #include <drm/drm_fourcc.h>
> -#include <drm/drm_gem_framebuffer_helper.h>
> #include <drm/drm_gem_shmem_helper.h>
> -#include <drm/drm_modeset_helper.h>
>
> #include "udl_drv.h"
>
> @@ -152,65 +147,3 @@ int udl_handle_damage(struct drm_framebuffer *fb, int x, int y,
> drm_gem_shmem_vunmap(fb->obj[0], vaddr);
> return ret;
> }
> -
> -static int udl_user_framebuffer_dirty(struct drm_framebuffer *fb,
> - struct drm_file *file,
> - unsigned flags, unsigned color,
> - struct drm_clip_rect *clips,
> - unsigned num_clips)
> -{
> - struct udl_device *udl = fb->dev->dev_private;
> - struct dma_buf_attachment *import_attach;
> - int i;
> - int ret = 0;
> -
> - drm_modeset_lock_all(fb->dev);
> -
> - spin_lock(&udl->active_fb_16_lock);
> - if (udl->active_fb_16 != fb) {
> - spin_unlock(&udl->active_fb_16_lock);
> - goto unlock;
> - }
> - spin_unlock(&udl->active_fb_16_lock);
> -
> - import_attach = fb->obj[0]->import_attach;
> -
> - if (import_attach) {
> - ret = dma_buf_begin_cpu_access(import_attach->dmabuf,
> - DMA_FROM_DEVICE);
> - if (ret)
> - goto unlock;
> - }
> -
> - for (i = 0; i < num_clips; i++) {
> - ret = udl_handle_damage(fb, clips[i].x1, clips[i].y1,
> - clips[i].x2 - clips[i].x1,
> - clips[i].y2 - clips[i].y1);
> - if (ret)
> - break;
> - }
> -
> - if (import_attach)
> - ret = dma_buf_end_cpu_access(import_attach->dmabuf,
> - DMA_FROM_DEVICE);
> -
I cannot quite see how the existing atomic helper handles dma buf imports.
There are no dma_buf_begin_cpu_access/dma_buf_end_cpu_access calls around.
>From a quick look, imports don't seem to be prohibited in the helper.
Am I missing something? Alternatively can you add a brief note in the
commit message.
Thanks
-Emil
More information about the dri-devel
mailing list