omap_drv.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
  4. * Author: Rob Clark <[email protected]>
  5. */
  6. #ifndef __OMAPDRM_DRV_H__
  7. #define __OMAPDRM_DRV_H__
  8. #include <linux/module.h>
  9. #include <linux/types.h>
  10. #include <linux/workqueue.h>
  11. #include "dss/omapdss.h"
  12. #include "dss/dss.h"
  13. #include <drm/drm_atomic.h>
  14. #include <drm/drm_gem.h>
  15. #include <drm/omap_drm.h>
  16. #include "omap_crtc.h"
  17. #include "omap_encoder.h"
  18. #include "omap_fb.h"
  19. #include "omap_fbdev.h"
  20. #include "omap_gem.h"
  21. #include "omap_irq.h"
  22. #include "omap_plane.h"
  23. #include "omap_overlay.h"
  24. #define DBG(fmt, ...) DRM_DEBUG_DRIVER(fmt"\n", ##__VA_ARGS__)
  25. #define VERB(fmt, ...) if (0) DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__) /* verbose debug */
  26. #define MODULE_NAME "omapdrm"
  27. struct omap_drm_usergart;
  28. struct omap_drm_pipeline {
  29. struct drm_crtc *crtc;
  30. struct drm_encoder *encoder;
  31. struct drm_connector *connector;
  32. struct omap_dss_device *output;
  33. unsigned int alias_id;
  34. };
  35. /*
  36. * Global private object state for tracking resources that are shared across
  37. * multiple kms objects (planes/crtcs/etc).
  38. */
  39. #define to_omap_global_state(x) container_of(x, struct omap_global_state, base)
  40. struct omap_global_state {
  41. struct drm_private_state base;
  42. /* global atomic state of assignment between overlays and planes */
  43. struct drm_plane *hwoverlay_to_plane[8];
  44. };
  45. struct omap_drm_private {
  46. struct drm_device *ddev;
  47. struct device *dev;
  48. u32 omaprev;
  49. struct dss_device *dss;
  50. struct dispc_device *dispc;
  51. bool irq_enabled;
  52. unsigned int num_pipes;
  53. struct omap_drm_pipeline pipes[8];
  54. struct omap_drm_pipeline *channels[8];
  55. unsigned int num_planes;
  56. struct drm_plane *planes[8];
  57. unsigned int num_ovls;
  58. struct omap_hw_overlay *overlays[8];
  59. struct drm_private_obj glob_obj;
  60. struct drm_fb_helper *fbdev;
  61. struct workqueue_struct *wq;
  62. /* lock for obj_list below */
  63. struct mutex list_lock;
  64. /* list of GEM objects: */
  65. struct list_head obj_list;
  66. struct omap_drm_usergart *usergart;
  67. bool has_dmm;
  68. /* properties: */
  69. struct drm_property *zorder_prop;
  70. /* irq handling: */
  71. spinlock_t wait_lock; /* protects the wait_list */
  72. struct list_head wait_list; /* list of omap_irq_wait */
  73. u32 irq_mask; /* enabled irqs in addition to wait_list */
  74. /* memory bandwidth limit if it is needed on the platform */
  75. unsigned int max_bandwidth;
  76. };
  77. void omap_debugfs_init(struct drm_minor *minor);
  78. struct omap_global_state * __must_check omap_get_global_state(struct drm_atomic_state *s);
  79. struct omap_global_state *omap_get_existing_global_state(struct omap_drm_private *priv);
  80. #endif /* __OMAPDRM_DRV_H__ */