omap_drv.h 2.5 KB

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