summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/ast/ast_main.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2019-06-27 19:34:10 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2019-06-28 09:02:29 +0200
commit5ed7191dd97b212887a9cb4715c2ef09ea50ae47 (patch)
treee95e44344dd68a64ce0ac08778ca2f15baba3ee9 /drivers/gpu/drm/ast/ast_main.c
parent66ab700506e729e49ca13586a7b0201a1c2093af (diff)
drm/ast: Replace struct ast_framebuffer with GEM framebuffer helpers
The ast driver's struct ast_framebuffer is a buffer object with GEM interface. There are already GEM framebuffer helpers that implement the same functionality. Convert ast 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/20190627173410.8300-1-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/ast/ast_main.c')
-rw-r--r--drivers/gpu/drm/ast/ast_main.c65
1 files changed, 3 insertions, 62 deletions
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index 4c7e31cb45ff..1bd61696e509 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -28,9 +28,9 @@
#include <drm/drmP.h>
#include "ast_drv.h"
-
-#include <drm/drm_fb_helper.h>
#include <drm/drm_crtc_helper.h>
+#include <drm/drm_fb_helper.h>
+#include <drm/drm_gem_framebuffer_helper.h>
void ast_set_index_reg_mask(struct ast_private *ast,
uint32_t base, uint8_t index,
@@ -383,67 +383,8 @@ static int ast_get_dram_info(struct drm_device *dev)
return 0;
}
-static void ast_user_framebuffer_destroy(struct drm_framebuffer *fb)
-{
- struct ast_framebuffer *ast_fb = to_ast_framebuffer(fb);
-
- drm_gem_object_put_unlocked(ast_fb->obj);
- drm_framebuffer_cleanup(fb);
- kfree(ast_fb);
-}
-
-static const struct drm_framebuffer_funcs ast_fb_funcs = {
- .destroy = ast_user_framebuffer_destroy,
-};
-
-
-int ast_framebuffer_init(struct drm_device *dev,
- struct ast_framebuffer *ast_fb,
- const struct drm_mode_fb_cmd2 *mode_cmd,
- struct drm_gem_object *obj)
-{
- int ret;
-
- drm_helper_mode_fill_fb_struct(dev, &ast_fb->base, mode_cmd);
- ast_fb->obj = obj;
- ret = drm_framebuffer_init(dev, &ast_fb->base, &ast_fb_funcs);
- if (ret) {
- DRM_ERROR("framebuffer init failed %d\n", ret);
- return ret;
- }
- return 0;
-}
-
-static struct drm_framebuffer *
-ast_user_framebuffer_create(struct drm_device *dev,
- struct drm_file *filp,
- const struct drm_mode_fb_cmd2 *mode_cmd)
-{
- struct drm_gem_object *obj;
- struct ast_framebuffer *ast_fb;
- int ret;
-
- obj = drm_gem_object_lookup(filp, mode_cmd->handles[0]);
- if (obj == NULL)
- return ERR_PTR(-ENOENT);
-
- ast_fb = kzalloc(sizeof(*ast_fb), GFP_KERNEL);
- if (!ast_fb) {
- drm_gem_object_put_unlocked(obj);
- return ERR_PTR(-ENOMEM);
- }
-
- ret = ast_framebuffer_init(dev, ast_fb, mode_cmd, obj);
- if (ret) {
- drm_gem_object_put_unlocked(obj);
- kfree(ast_fb);
- return ERR_PTR(ret);
- }
- return &ast_fb->base;
-}
-
static const struct drm_mode_config_funcs ast_mode_funcs = {
- .fb_create = ast_user_framebuffer_create,
+ .fb_create = drm_gem_fb_create
};
static u32 ast_get_vram_info(struct drm_device *dev)