omap_voutdef.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * omap_voutdef.h
  3. *
  4. * Copyright (C) 2010 Texas Instruments.
  5. *
  6. * This file is licensed under the terms of the GNU General Public License
  7. * version 2. This program is licensed "as is" without any warranty of any
  8. * kind, whether express or implied.
  9. */
  10. #ifndef OMAP_VOUTDEF_H
  11. #define OMAP_VOUTDEF_H
  12. #include <plat/display.h>
  13. #define YUYV_BPP 2
  14. #define RGB565_BPP 2
  15. #define RGB24_BPP 3
  16. #define RGB32_BPP 4
  17. #define TILE_SIZE 32
  18. #define YUYV_VRFB_BPP 2
  19. #define RGB_VRFB_BPP 1
  20. #define MAX_CID 3
  21. #define MAC_VRFB_CTXS 4
  22. #define MAX_VOUT_DEV 2
  23. #define MAX_OVLS 3
  24. #define MAX_DISPLAYS 3
  25. #define MAX_MANAGERS 3
  26. /* Enum for Rotation
  27. * DSS understands rotation in 0, 1, 2, 3 context
  28. * while V4L2 driver understands it as 0, 90, 180, 270
  29. */
  30. enum dss_rotation {
  31. dss_rotation_0_degree = 0,
  32. dss_rotation_90_degree = 1,
  33. dss_rotation_180_degree = 2,
  34. dss_rotation_270_degree = 3,
  35. };
  36. /*
  37. * This structure is used to store the DMA transfer parameters
  38. * for VRFB hidden buffer
  39. */
  40. struct vid_vrfb_dma {
  41. int dev_id;
  42. int dma_ch;
  43. int req_status;
  44. int tx_status;
  45. wait_queue_head_t wait;
  46. };
  47. struct omapvideo_info {
  48. int id;
  49. int num_overlays;
  50. struct omap_overlay *overlays[MAX_OVLS];
  51. };
  52. struct omap2video_device {
  53. struct mutex mtx;
  54. int state;
  55. struct v4l2_device v4l2_dev;
  56. struct omap_vout_device *vouts[MAX_VOUT_DEV];
  57. int num_displays;
  58. struct omap_dss_device *displays[MAX_DISPLAYS];
  59. int num_overlays;
  60. struct omap_overlay *overlays[MAX_OVLS];
  61. int num_managers;
  62. struct omap_overlay_manager *managers[MAX_MANAGERS];
  63. };
  64. /* per-device data structure */
  65. struct omap_vout_device {
  66. struct omapvideo_info vid_info;
  67. struct video_device *vfd;
  68. struct omap2video_device *vid_dev;
  69. int vid;
  70. int opened;
  71. /* we don't allow to change image fmt/size once buffer has
  72. * been allocated
  73. */
  74. int buffer_allocated;
  75. /* allow to reuse previously allocated buffer which is big enough */
  76. int buffer_size;
  77. /* keep buffer info across opens */
  78. unsigned long buf_virt_addr[VIDEO_MAX_FRAME];
  79. unsigned long buf_phy_addr[VIDEO_MAX_FRAME];
  80. enum omap_color_mode dss_mode;
  81. /* we don't allow to request new buffer when old buffers are
  82. * still mmaped
  83. */
  84. int mmap_count;
  85. spinlock_t vbq_lock; /* spinlock for videobuf queues */
  86. unsigned long field_count; /* field counter for videobuf_buffer */
  87. /* non-NULL means streaming is in progress. */
  88. bool streaming;
  89. struct v4l2_pix_format pix;
  90. struct v4l2_rect crop;
  91. struct v4l2_window win;
  92. struct v4l2_framebuffer fbuf;
  93. /* Lock to protect the shared data structures in ioctl */
  94. struct mutex lock;
  95. /* V4L2 control structure for different control id */
  96. struct v4l2_control control[MAX_CID];
  97. enum dss_rotation rotation;
  98. bool mirror;
  99. int flicker_filter;
  100. /* V4L2 control structure for different control id */
  101. int bpp; /* bytes per pixel */
  102. int vrfb_bpp; /* bytes per pixel with respect to VRFB */
  103. struct vid_vrfb_dma vrfb_dma_tx;
  104. unsigned int smsshado_phy_addr[MAC_VRFB_CTXS];
  105. unsigned int smsshado_virt_addr[MAC_VRFB_CTXS];
  106. struct vrfb vrfb_context[MAC_VRFB_CTXS];
  107. bool vrfb_static_allocation;
  108. unsigned int smsshado_size;
  109. unsigned char pos;
  110. int ps, vr_ps, line_length, first_int, field_id;
  111. enum v4l2_memory memory;
  112. struct videobuf_buffer *cur_frm, *next_frm;
  113. struct list_head dma_queue;
  114. u8 *queued_buf_addr[VIDEO_MAX_FRAME];
  115. u32 cropped_offset;
  116. s32 tv_field1_offset;
  117. void *isr_handle;
  118. /* Buffer queue variables */
  119. struct omap_vout_device *vout;
  120. enum v4l2_buf_type type;
  121. struct videobuf_queue vbq;
  122. int io_allowed;
  123. };
  124. #endif /* ifndef OMAP_VOUTDEF_H */