mirror of
https://github.com/torvalds/linux.git
synced 2024-12-22 10:56:40 +00:00
drm/exynos: reorder framebuffer init sequence
For user framebuffers it's easier to just inline the exynos_drm_framebuffer_init helper instead of trying to adjust it - most of the things that helper sets up need to be overwritten anyway again due to the multiple backing storage objects support exynos has, but does not use for the fbdev. Changelog v2: - fix NULL point issue to first gem object of exynos drm framebuffer. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Inki Dae <inki.dae@samsung.com>
This commit is contained in:
parent
a0e41b562b
commit
f2c0095acb
@ -177,6 +177,7 @@ exynos_drm_framebuffer_init(struct drm_device *dev,
|
|||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd);
|
||||||
exynos_fb->exynos_gem_obj[0] = exynos_gem_obj;
|
exynos_fb->exynos_gem_obj[0] = exynos_gem_obj;
|
||||||
|
|
||||||
ret = drm_framebuffer_init(dev, &exynos_fb->fb, &exynos_drm_fb_funcs);
|
ret = drm_framebuffer_init(dev, &exynos_fb->fb, &exynos_drm_fb_funcs);
|
||||||
@ -185,8 +186,6 @@ exynos_drm_framebuffer_init(struct drm_device *dev,
|
|||||||
return ERR_PTR(ret);
|
return ERR_PTR(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd);
|
|
||||||
|
|
||||||
return &exynos_fb->fb;
|
return &exynos_fb->fb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,9 +231,8 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
|
|||||||
struct drm_mode_fb_cmd2 *mode_cmd)
|
struct drm_mode_fb_cmd2 *mode_cmd)
|
||||||
{
|
{
|
||||||
struct drm_gem_object *obj;
|
struct drm_gem_object *obj;
|
||||||
struct drm_framebuffer *fb;
|
|
||||||
struct exynos_drm_fb *exynos_fb;
|
struct exynos_drm_fb *exynos_fb;
|
||||||
int i;
|
int i, ret;
|
||||||
|
|
||||||
DRM_DEBUG_KMS("%s\n", __FILE__);
|
DRM_DEBUG_KMS("%s\n", __FILE__);
|
||||||
|
|
||||||
@ -244,13 +242,14 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
|
|||||||
return ERR_PTR(-ENOENT);
|
return ERR_PTR(-ENOENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
fb = exynos_drm_framebuffer_init(dev, mode_cmd, obj);
|
exynos_fb = kzalloc(sizeof(*exynos_fb), GFP_KERNEL);
|
||||||
if (IS_ERR(fb)) {
|
if (!exynos_fb) {
|
||||||
drm_gem_object_unreference_unlocked(obj);
|
DRM_ERROR("failed to allocate exynos drm framebuffer\n");
|
||||||
return fb;
|
return ERR_PTR(-ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
exynos_fb = to_exynos_fb(fb);
|
drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd);
|
||||||
|
exynos_fb->exynos_gem_obj[0] = to_exynos_gem_obj(obj);
|
||||||
exynos_fb->buf_cnt = exynos_drm_format_num_buffers(mode_cmd);
|
exynos_fb->buf_cnt = exynos_drm_format_num_buffers(mode_cmd);
|
||||||
|
|
||||||
DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt);
|
DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt);
|
||||||
@ -263,7 +262,7 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
|
|||||||
mode_cmd->handles[i]);
|
mode_cmd->handles[i]);
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
DRM_ERROR("failed to lookup gem object\n");
|
DRM_ERROR("failed to lookup gem object\n");
|
||||||
exynos_drm_fb_destroy(fb);
|
kfree(exynos_fb);
|
||||||
return ERR_PTR(-ENOENT);
|
return ERR_PTR(-ENOENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,14 +271,27 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
|
|||||||
ret = check_fb_gem_memory_type(dev, exynos_gem_obj);
|
ret = check_fb_gem_memory_type(dev, exynos_gem_obj);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
DRM_ERROR("cannot use this gem memory type for fb.\n");
|
DRM_ERROR("cannot use this gem memory type for fb.\n");
|
||||||
exynos_drm_fb_destroy(fb);
|
kfree(exynos_fb);
|
||||||
return ERR_PTR(ret);
|
return ERR_PTR(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
exynos_fb->exynos_gem_obj[i] = to_exynos_gem_obj(obj);
|
exynos_fb->exynos_gem_obj[i] = to_exynos_gem_obj(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fb;
|
ret = drm_framebuffer_init(dev, &exynos_fb->fb, &exynos_drm_fb_funcs);
|
||||||
|
if (ret) {
|
||||||
|
for (i = 0; i < exynos_fb->buf_cnt; i++) {
|
||||||
|
struct exynos_drm_gem_obj *gem_obj;
|
||||||
|
|
||||||
|
gem_obj = exynos_fb->exynos_gem_obj[i];
|
||||||
|
drm_gem_object_unreference_unlocked(&gem_obj->base);
|
||||||
|
}
|
||||||
|
|
||||||
|
kfree(exynos_fb);
|
||||||
|
return ERR_PTR(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
return &exynos_fb->fb;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct exynos_drm_gem_buf *exynos_drm_fb_buffer(struct drm_framebuffer *fb,
|
struct exynos_drm_gem_buf *exynos_drm_fb_buffer(struct drm_framebuffer *fb,
|
||||||
|
Loading…
Reference in New Issue
Block a user