Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc41eae2 authored by Inki Dae's avatar Inki Dae Committed by Dave Airlie
Browse files

drm/exynos: removed exynos_drm_fbdev_recreate function.



this function ins't needed anymore.

Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent c5614ae3
Loading
Loading
Loading
Loading
+4 −66
Original line number Diff line number Diff line
@@ -195,66 +195,6 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
	return ret;
}

static bool
exynos_drm_fbdev_is_samefb(struct drm_framebuffer *fb,
			    struct drm_fb_helper_surface_size *sizes)
{
	if (fb->width != sizes->surface_width)
		return false;
	if (fb->height != sizes->surface_height)
		return false;
	if (fb->bits_per_pixel != sizes->surface_bpp)
		return false;
	if (fb->depth != sizes->surface_depth)
		return false;

	return true;
}

static int exynos_drm_fbdev_recreate(struct drm_fb_helper *helper,
				      struct drm_fb_helper_surface_size *sizes)
{
	struct drm_device *dev = helper->dev;
	struct exynos_drm_fbdev *exynos_fbdev = to_exynos_fbdev(helper);
	struct exynos_drm_gem_obj *exynos_gem_obj;
	struct drm_framebuffer *fb = helper->fb;
	struct drm_mode_fb_cmd2 mode_cmd = { 0 };
	unsigned long size;

	DRM_DEBUG_KMS("%s\n", __FILE__);

	if (exynos_drm_fbdev_is_samefb(fb, sizes))
		return 0;

	mode_cmd.width = sizes->surface_width;
	mode_cmd.height = sizes->surface_height;
	mode_cmd.pitches[0] = sizes->surface_width * (sizes->surface_bpp >> 3);
	mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
							  sizes->surface_depth);

	if (exynos_fbdev->exynos_gem_obj)
		exynos_drm_gem_destroy(exynos_fbdev->exynos_gem_obj);

	if (fb->funcs->destroy)
		fb->funcs->destroy(fb);

	size = mode_cmd.pitches[0] * mode_cmd.height;
	exynos_gem_obj = exynos_drm_gem_create(dev, size);
	if (IS_ERR(exynos_gem_obj))
		return PTR_ERR(exynos_gem_obj);

	exynos_fbdev->exynos_gem_obj = exynos_gem_obj;

	helper->fb = exynos_drm_framebuffer_init(dev, &mode_cmd,
			&exynos_gem_obj->base);
	if (IS_ERR_OR_NULL(helper->fb)) {
		DRM_ERROR("failed to create drm framebuffer.\n");
		return PTR_ERR(helper->fb);
	}

	return exynos_drm_fbdev_update(helper, helper->fb);
}

static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper,
				   struct drm_fb_helper_surface_size *sizes)
{
@@ -262,6 +202,10 @@ static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper,

	DRM_DEBUG_KMS("%s\n", __FILE__);

	/*
	 * with !helper->fb, it means that this funcion is called first time
	 * and after that, the helper->fb would be used as clone mode.
	 */
	if (!helper->fb) {
		ret = exynos_drm_fbdev_create(helper, sizes);
		if (ret < 0) {
@@ -274,12 +218,6 @@ static int exynos_drm_fbdev_probe(struct drm_fb_helper *helper,
		 * because register_framebuffer() should be called.
		 */
		ret = 1;
	} else {
		ret = exynos_drm_fbdev_recreate(helper, sizes);
		if (ret < 0) {
			DRM_ERROR("failed to reconfigure fbdev\n");
			return ret;
		}
	}

	return ret;