diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2022-09-22 15:09:44 +0200 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2022-09-27 10:27:00 +0200 |
commit | 4b5a51e45f296f0477485cadd1fb7e03295cc455 (patch) | |
tree | 913d811de45e26c65d45fb6748d1cac97bd18b1c /drivers/gpu/drm/tiny/simpledrm.c | |
parent | drm/simpledrm: Iterate over damage clips (diff) | |
download | linux-4b5a51e45f296f0477485cadd1fb7e03295cc455.tar.xz linux-4b5a51e45f296f0477485cadd1fb7e03295cc455.zip |
drm/simpledrm: Synchronize access to GEM BOs
Synchronize CPU access to GEM BOs with other drivers when updating the
screen buffer. Imported buffers might otherwise contain stale data.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220922130944.27138-6-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/tiny/simpledrm.c')
-rw-r--r-- | drivers/gpu/drm/tiny/simpledrm.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c index 5f242558891e..18489779fb8a 100644 --- a/drivers/gpu/drm/tiny/simpledrm.c +++ b/drivers/gpu/drm/tiny/simpledrm.c @@ -480,11 +480,15 @@ static void simpledrm_primary_plane_helper_atomic_update(struct drm_plane *plane struct simpledrm_device *sdev = simpledrm_device_of_dev(dev); struct drm_atomic_helper_damage_iter iter; struct drm_rect damage; - int idx; + int ret, idx; - if (!drm_dev_enter(dev, &idx)) + ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); + if (ret) return; + if (!drm_dev_enter(dev, &idx)) + goto out_drm_gem_fb_end_cpu_access; + drm_atomic_helper_damage_iter_init(&iter, old_plane_state, plane_state); drm_atomic_for_each_plane_damage(&iter, &damage) { struct iosys_map dst = IOSYS_MAP_INIT_VADDR(sdev->screen_base); @@ -499,6 +503,8 @@ static void simpledrm_primary_plane_helper_atomic_update(struct drm_plane *plane } drm_dev_exit(idx); +out_drm_gem_fb_end_cpu_access: + drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE); } static void simpledrm_primary_plane_helper_atomic_disable(struct drm_plane *plane, |