38 #define MAX_CONNECTOR 4
39 #define PREFERRED_BPP 32
41 #define to_exynos_fbdev(x) container_of(x, struct exynos_drm_fbdev,\
49 static struct fb_ops exynos_drm_fb_ops = {
61 static int exynos_drm_fbdev_update(
struct drm_fb_helper *helper,
70 DRM_DEBUG_KMS(
"%s\n", __FILE__);
78 DRM_LOG_KMS(
"buffer is null.\n");
98 static int exynos_drm_fbdev_create(
struct drm_fb_helper *helper,
110 DRM_DEBUG_KMS(
"%s\n", __FILE__);
112 DRM_DEBUG_KMS(
"surface width(%d), height(%d) and bpp(%d\n",
126 DRM_ERROR(
"failed to allocate fb info.\n");
135 if (IS_ERR(exynos_gem_obj)) {
136 ret = PTR_ERR(exynos_gem_obj);
143 &exynos_gem_obj->
base);
144 if (IS_ERR_OR_NULL(helper->
fb)) {
145 DRM_ERROR(
"failed to create drm framebuffer.\n");
146 ret = PTR_ERR(helper->
fb);
154 fbi->
fbops = &exynos_drm_fb_ops;
158 DRM_ERROR(
"failed to allocate cmap.\n");
162 ret = exynos_drm_fbdev_update(helper, helper->
fb);
178 static int exynos_drm_fbdev_probe(
struct drm_fb_helper *helper,
183 DRM_DEBUG_KMS(
"%s\n", __FILE__);
190 ret = exynos_drm_fbdev_create(helper, sizes);
192 DRM_ERROR(
"failed to create fbdev.\n");
207 .fb_probe = exynos_drm_fbdev_probe,
215 unsigned int num_crtc;
218 DRM_DEBUG_KMS(
"%s\n", __FILE__);
220 if (!dev->mode_config.num_crtc || !dev->mode_config.num_connector)
225 DRM_ERROR(
"failed to allocate drm fbdev.\n");
230 helper->
funcs = &exynos_drm_fb_helper_funcs;
232 num_crtc = dev->mode_config.num_crtc;
236 DRM_ERROR(
"failed to initialize drm fb helper.\n");
242 DRM_ERROR(
"failed to register drm_fb_helper_connector.\n");
249 DRM_ERROR(
"failed to set up hw configuration.\n");
259 private->fb_helper =
NULL;
265 static void exynos_drm_fbdev_destroy(
struct drm_device *dev,
271 if (fb_helper->
fb && fb_helper->
fb->funcs) {
278 if (fb_helper->
fbdev) {
282 info = fb_helper->
fbdev;
285 DRM_DEBUG_KMS(
"failed unregister_framebuffer()\n");
301 if (!
private || !private->fb_helper)
309 exynos_drm_fbdev_destroy(dev, private->fb_helper);
311 private->fb_helper =
NULL;
318 if (!
private || !private->fb_helper)