malidp_drv.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * (C) COPYRIGHT 2016 ARM Limited. All rights reserved.
  3. * Author: Liviu Dudau <Liviu.Dudau@arm.com>
  4. *
  5. * This program is free software and is provided to you under the terms of the
  6. * GNU General Public License version 2 as published by the Free Software
  7. * Foundation, and any use by you of this program is subject to the terms
  8. * of such GNU licence.
  9. *
  10. * ARM Mali DP500/DP550/DP650 KMS/DRM driver structures
  11. */
  12. #ifndef __MALIDP_DRV_H__
  13. #define __MALIDP_DRV_H__
  14. #include <linux/mutex.h>
  15. #include <linux/wait.h>
  16. #include <drm/drmP.h>
  17. #include "malidp_hw.h"
  18. struct malidp_drm {
  19. struct malidp_hw_device *dev;
  20. struct drm_fbdev_cma *fbdev;
  21. struct drm_crtc crtc;
  22. wait_queue_head_t wq;
  23. atomic_t config_valid;
  24. struct drm_atomic_state *pm_state;
  25. u32 core_id;
  26. };
  27. #define crtc_to_malidp_device(x) container_of(x, struct malidp_drm, crtc)
  28. struct malidp_plane {
  29. struct drm_plane base;
  30. struct malidp_hw_device *hwdev;
  31. const struct malidp_layer *layer;
  32. };
  33. struct malidp_plane_state {
  34. struct drm_plane_state base;
  35. /* size of the required rotation memory if plane is rotated */
  36. u32 rotmem_size;
  37. /* internal format ID */
  38. u8 format;
  39. u8 n_planes;
  40. };
  41. #define to_malidp_plane(x) container_of(x, struct malidp_plane, base)
  42. #define to_malidp_plane_state(x) container_of(x, struct malidp_plane_state, base)
  43. struct malidp_crtc_state {
  44. struct drm_crtc_state base;
  45. u32 gamma_coeffs[MALIDP_COEFFTAB_NUM_COEFFS];
  46. u32 coloradj_coeffs[MALIDP_COLORADJ_NUM_COEFFS];
  47. struct malidp_se_config scaler_config;
  48. /* Bitfield of all the planes that have requested a scaled output. */
  49. u8 scaled_planes_mask;
  50. };
  51. #define to_malidp_crtc_state(x) container_of(x, struct malidp_crtc_state, base)
  52. int malidp_de_planes_init(struct drm_device *drm);
  53. void malidp_de_planes_destroy(struct drm_device *drm);
  54. int malidp_crtc_init(struct drm_device *drm);
  55. /* often used combination of rotational bits */
  56. #define MALIDP_ROTATED_MASK (DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270)
  57. #endif /* __MALIDP_DRV_H__ */