fb.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (C) 2012 Avionic Design GmbH
  3. * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #include "drm.h"
  10. static void tegra_drm_fb_output_poll_changed(struct drm_device *drm)
  11. {
  12. struct host1x *host1x = drm->dev_private;
  13. drm_fbdev_cma_hotplug_event(host1x->fbdev);
  14. }
  15. static const struct drm_mode_config_funcs tegra_drm_mode_funcs = {
  16. .fb_create = drm_fb_cma_create,
  17. .output_poll_changed = tegra_drm_fb_output_poll_changed,
  18. };
  19. int tegra_drm_fb_init(struct drm_device *drm)
  20. {
  21. struct host1x *host1x = drm->dev_private;
  22. struct drm_fbdev_cma *fbdev;
  23. drm->mode_config.min_width = 0;
  24. drm->mode_config.min_height = 0;
  25. drm->mode_config.max_width = 4096;
  26. drm->mode_config.max_height = 4096;
  27. drm->mode_config.funcs = &tegra_drm_mode_funcs;
  28. fbdev = drm_fbdev_cma_init(drm, 32, drm->mode_config.num_crtc,
  29. drm->mode_config.num_connector);
  30. if (IS_ERR(fbdev))
  31. return PTR_ERR(fbdev);
  32. host1x->fbdev = fbdev;
  33. return 0;
  34. }
  35. void tegra_drm_fb_exit(struct drm_device *drm)
  36. {
  37. struct host1x *host1x = drm->dev_private;
  38. drm_fbdev_cma_fini(host1x->fbdev);
  39. }