mtk_drm_session.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (c) 2015 MediaTek Inc.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef _MTK_DRM_SESSION_H_
  14. #define _MTK_DRM_SESSION_H_
  15. #include <drm/drmP.h>
  16. #include <drm/mediatek_drm.h>
  17. #define MAX_SESSION_COUNT 3
  18. #define MTK_SESSION_MODE(id) (((id) >> 24) & 0xff)
  19. #define MTK_SESSION_TYPE(id) (((id) >> 16) & 0xff)
  20. #define MTK_SESSION_DEV(id) ((id)&0xff)
  21. #define MAKE_MTK_SESSION(type, dev) (unsigned int)((type) << 16 | (dev))
  22. enum MTK_SESSION_TYPE {
  23. MTK_SESSION_PRIMARY = 1,
  24. MTK_SESSION_EXTERNAL = 2,
  25. MTK_SESSION_MEMORY = 3
  26. };
  27. struct mtk_session_mode_tb {
  28. unsigned int en;
  29. unsigned int ddp_mode[MAX_SESSION_COUNT];
  30. };
  31. /**
  32. * struct mtk_drm_session - MediaTek specific session structure.
  33. * @session_id:
  34. */
  35. struct mtk_drm_session {
  36. unsigned int session_id;
  37. struct mtk_session_mode_tb mode_tb[MTK_DRM_SESSION_NUM];
  38. };
  39. int mtk_drm_session_create(struct drm_device *dev,
  40. struct drm_mtk_session *config);
  41. int mtk_drm_session_destroy(struct drm_device *dev,
  42. struct drm_mtk_session *config);
  43. /* create session */
  44. int mtk_drm_session_create_ioctl(struct drm_device *dev, void *data,
  45. struct drm_file *file_priv);
  46. /* destroy session */
  47. int mtk_drm_session_destroy_ioctl(struct drm_device *dev, void *data,
  48. struct drm_file *file_priv);
  49. int mtk_session_get_mode(struct drm_device *dev, struct drm_crtc *crtc);
  50. int mtk_session_set_mode(struct drm_device *dev, unsigned int session_mode);
  51. int mtk_get_session_id(struct drm_crtc *crtc);
  52. #endif