diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2019-06-27 10:09:09 +0200 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2019-06-27 19:19:04 +0200 |
commit | 5d17718997367c435dbe5341a8e270d9b19478d3 (patch) | |
tree | 100895abce41ced623ffe042a2f66735b8ca42b9 /drivers/gpu/drm/mgag200/mgag200_mode.c | |
parent | fdb29b738017672069f95747c48eac947b9beba2 (diff) |
drm/mgag200: Replace struct mga_framebuffer with GEM framebuffer helpers
The mgag200 driver's struct mga_framebuffer is a buffer object with GEM
interface. There are already GEM framebuffer helpers that implement the
same functionality. Convert mgag200 to these.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190627080909.30471-1-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/mgag200/mgag200_mode.c')
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_mode.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index a25054015e8c..5e382bf7fc1e 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -860,27 +860,21 @@ static int mga_crtc_do_set_base(struct drm_crtc *crtc, int x, int y, int atomic) { struct mga_device *mdev = crtc->dev->dev_private; - struct drm_gem_object *obj; - struct mga_framebuffer *mga_fb; struct drm_gem_vram_object *gbo; int ret; s64 gpu_addr; void *base; if (!atomic && fb) { - mga_fb = to_mga_framebuffer(fb); - obj = mga_fb->obj; - gbo = drm_gem_vram_of_gem(obj); + gbo = drm_gem_vram_of_gem(fb->obj[0]); /* unmap if console */ - if (&mdev->mfbdev->mfb == mga_fb) + if (mdev->mfbdev->helper.fb == fb) drm_gem_vram_kunmap(gbo); drm_gem_vram_unpin(gbo); } - mga_fb = to_mga_framebuffer(crtc->primary->fb); - obj = mga_fb->obj; - gbo = drm_gem_vram_of_gem(obj); + gbo = drm_gem_vram_of_gem(crtc->primary->fb->obj[0]); ret = drm_gem_vram_pin(gbo, DRM_GEM_VRAM_PL_FLAG_VRAM); if (ret) @@ -891,7 +885,7 @@ static int mga_crtc_do_set_base(struct drm_crtc *crtc, goto err_drm_gem_vram_unpin; } - if (&mdev->mfbdev->mfb == mga_fb) { + if (mdev->mfbdev->helper.fb == crtc->primary->fb) { /* if pushing console in kmap it */ base = drm_gem_vram_kmap(gbo, true, NULL); if (IS_ERR(base)) { @@ -1424,12 +1418,12 @@ static void mga_crtc_disable(struct drm_crtc *crtc) mga_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); if (crtc->primary->fb) { struct mga_device *mdev = crtc->dev->dev_private; - struct mga_framebuffer *mga_fb = to_mga_framebuffer(crtc->primary->fb); - struct drm_gem_object *obj = mga_fb->obj; - struct drm_gem_vram_object *gbo = drm_gem_vram_of_gem(obj); + struct drm_framebuffer *fb = crtc->primary->fb; + struct drm_gem_vram_object *gbo = + drm_gem_vram_of_gem(fb->obj[0]); /* unmap if console */ - if (&mdev->mfbdev->mfb == mga_fb) + if (mdev->mfbdev->helper.fb == fb) drm_gem_vram_kunmap(gbo); drm_gem_vram_unpin(gbo); } |