aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tegra/fb.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-29 23:49:12 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-29 23:49:12 -0500
commit9b0cd304f26b9fca140de15deeac2bf357d1f388 (patch)
tree03a0d74614865a5b776b2a98a433232013b1d369 /drivers/gpu/drm/tegra/fb.c
parentca2a650f3dfdc30d71d21bcbb04d2d057779f3f9 (diff)
parentef64cf9d06049e4e9df661f3be60b217e476bee1 (diff)
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie: "Been a bit busy, first week of kids school, and waiting on other trees to go in before I could send this, so its a bit later than I'd normally like. Highlights: - core: timestamp fixes, lots of misc cleanups - new drivers: bochs virtual vga - vmwgfx: major overhaul for their nextgen virt gpu. - i915: runtime D3 on HSW, watermark fixes, power well work, fbc fixes, bdw is no longer prelim. - nouveau: gk110/208 acceleration, more pm groundwork, old overlay support - radeon: dpm rework and clockgating for CIK, pci config reset, big endian fixes - tegra: panel support and DSI support, build as module, prime. - armada, omap, gma500, rcar, exynos, mgag200, cirrus, ast: fixes - msm: hdmi support for mdp5" * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (595 commits) drm/nouveau: resume display if any later suspend bits fail drm/nouveau: fix lock unbalance in nouveau_crtc_page_flip drm/nouveau: implement hooks for needed for drm vblank timestamping support drm/nouveau/disp: add a method to fetch info needed by drm vblank timestamping drm/nv50: fill in crtc mode struct members from crtc_mode_fixup drm/radeon/dce8: workaround for atom BlankCrtc table drm/radeon/DCE4+: clear bios scratch dpms bit (v2) drm/radeon: set si_notify_smc_display_change properly drm/radeon: fix DAC interrupt handling on DCE5+ drm/radeon: clean up active vram sizing drm/radeon: skip async dma init on r6xx drm/radeon/runpm: don't runtime suspend non-PX cards drm/radeon: add ring to fence trace functions drm/radeon: add missing trace point drm/radeon: fix VMID use tracking drm: ast,cirrus,mgag200: use drm_can_sleep drm/gma500: Lock struct_mutex around cursor updates drm/i915: Fix the offset issue for the stolen GEM objects DRM: armada: fix missing DRM_KMS_FB_HELPER select drm/i915: Decouple GPU error reporting from ring initialisation ...
Diffstat (limited to 'drivers/gpu/drm/tegra/fb.c')
-rw-r--r--drivers/gpu/drm/tegra/fb.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
index a3835e7de184..f7fca09d4921 100644
--- a/drivers/gpu/drm/tegra/fb.c
+++ b/drivers/gpu/drm/tegra/fb.c
@@ -18,10 +18,12 @@ static inline struct tegra_fb *to_tegra_fb(struct drm_framebuffer *fb)
18 return container_of(fb, struct tegra_fb, base); 18 return container_of(fb, struct tegra_fb, base);
19} 19}
20 20
21#ifdef CONFIG_DRM_TEGRA_FBDEV
21static inline struct tegra_fbdev *to_tegra_fbdev(struct drm_fb_helper *helper) 22static inline struct tegra_fbdev *to_tegra_fbdev(struct drm_fb_helper *helper)
22{ 23{
23 return container_of(helper, struct tegra_fbdev, base); 24 return container_of(helper, struct tegra_fbdev, base);
24} 25}
26#endif
25 27
26struct tegra_bo *tegra_fb_get_plane(struct drm_framebuffer *framebuffer, 28struct tegra_bo *tegra_fb_get_plane(struct drm_framebuffer *framebuffer,
27 unsigned int index) 29 unsigned int index)
@@ -98,8 +100,10 @@ static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm,
98 return ERR_PTR(-ENOMEM); 100 return ERR_PTR(-ENOMEM);
99 101
100 fb->planes = kzalloc(num_planes * sizeof(*planes), GFP_KERNEL); 102 fb->planes = kzalloc(num_planes * sizeof(*planes), GFP_KERNEL);
101 if (!fb->planes) 103 if (!fb->planes) {
104 kfree(fb);
102 return ERR_PTR(-ENOMEM); 105 return ERR_PTR(-ENOMEM);
106 }
103 107
104 fb->num_planes = num_planes; 108 fb->num_planes = num_planes;
105 109
@@ -172,6 +176,7 @@ unreference:
172 return ERR_PTR(err); 176 return ERR_PTR(err);
173} 177}
174 178
179#ifdef CONFIG_DRM_TEGRA_FBDEV
175static struct fb_ops tegra_fb_ops = { 180static struct fb_ops tegra_fb_ops = {
176 .owner = THIS_MODULE, 181 .owner = THIS_MODULE,
177 .fb_fillrect = sys_fillrect, 182 .fb_fillrect = sys_fillrect,
@@ -339,6 +344,15 @@ static void tegra_fbdev_free(struct tegra_fbdev *fbdev)
339 kfree(fbdev); 344 kfree(fbdev);
340} 345}
341 346
347void tegra_fbdev_restore_mode(struct tegra_fbdev *fbdev)
348{
349 if (fbdev) {
350 drm_modeset_lock_all(fbdev->base.dev);
351 drm_fb_helper_restore_fbdev_mode(&fbdev->base);
352 drm_modeset_unlock_all(fbdev->base.dev);
353 }
354}
355
342static void tegra_fb_output_poll_changed(struct drm_device *drm) 356static void tegra_fb_output_poll_changed(struct drm_device *drm)
343{ 357{
344 struct tegra_drm *tegra = drm->dev_private; 358 struct tegra_drm *tegra = drm->dev_private;
@@ -346,16 +360,20 @@ static void tegra_fb_output_poll_changed(struct drm_device *drm)
346 if (tegra->fbdev) 360 if (tegra->fbdev)
347 drm_fb_helper_hotplug_event(&tegra->fbdev->base); 361 drm_fb_helper_hotplug_event(&tegra->fbdev->base);
348} 362}
363#endif
349 364
350static const struct drm_mode_config_funcs tegra_drm_mode_funcs = { 365static const struct drm_mode_config_funcs tegra_drm_mode_funcs = {
351 .fb_create = tegra_fb_create, 366 .fb_create = tegra_fb_create,
367#ifdef CONFIG_DRM_TEGRA_FBDEV
352 .output_poll_changed = tegra_fb_output_poll_changed, 368 .output_poll_changed = tegra_fb_output_poll_changed,
369#endif
353}; 370};
354 371
355int tegra_drm_fb_init(struct drm_device *drm) 372int tegra_drm_fb_init(struct drm_device *drm)
356{ 373{
374#ifdef CONFIG_DRM_TEGRA_FBDEV
357 struct tegra_drm *tegra = drm->dev_private; 375 struct tegra_drm *tegra = drm->dev_private;
358 struct tegra_fbdev *fbdev; 376#endif
359 377
360 drm->mode_config.min_width = 0; 378 drm->mode_config.min_width = 0;
361 drm->mode_config.min_height = 0; 379 drm->mode_config.min_height = 0;
@@ -365,28 +383,21 @@ int tegra_drm_fb_init(struct drm_device *drm)
365 383
366 drm->mode_config.funcs = &tegra_drm_mode_funcs; 384 drm->mode_config.funcs = &tegra_drm_mode_funcs;
367 385
368 fbdev = tegra_fbdev_create(drm, 32, drm->mode_config.num_crtc, 386#ifdef CONFIG_DRM_TEGRA_FBDEV
369 drm->mode_config.num_connector); 387 tegra->fbdev = tegra_fbdev_create(drm, 32, drm->mode_config.num_crtc,
370 if (IS_ERR(fbdev)) 388 drm->mode_config.num_connector);
371 return PTR_ERR(fbdev); 389 if (IS_ERR(tegra->fbdev))
372 390 return PTR_ERR(tegra->fbdev);
373 tegra->fbdev = fbdev; 391#endif
374 392
375 return 0; 393 return 0;
376} 394}
377 395
378void tegra_drm_fb_exit(struct drm_device *drm) 396void tegra_drm_fb_exit(struct drm_device *drm)
379{ 397{
398#ifdef CONFIG_DRM_TEGRA_FBDEV
380 struct tegra_drm *tegra = drm->dev_private; 399 struct tegra_drm *tegra = drm->dev_private;
381 400
382 tegra_fbdev_free(tegra->fbdev); 401 tegra_fbdev_free(tegra->fbdev);
383} 402#endif
384
385void tegra_fbdev_restore_mode(struct tegra_fbdev *fbdev)
386{
387 if (fbdev) {
388 drm_modeset_lock_all(fbdev->base.dev);
389 drm_fb_helper_restore_fbdev_mode(&fbdev->base);
390 drm_modeset_unlock_all(fbdev->base.dev);
391 }
392} 403}