vpif_display.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * VPIF display header file
  3. *
  4. * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation version 2.
  9. *
  10. * This program is distributed .as is. WITHOUT ANY WARRANTY of any
  11. * kind, whether express or implied; without even the implied warranty
  12. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #ifndef VPIF_DISPLAY_H
  16. #define VPIF_DISPLAY_H
  17. /* Header files */
  18. #include <media/videobuf2-dma-contig.h>
  19. #include <media/v4l2-device.h>
  20. #include "vpif.h"
  21. /* Macros */
  22. #define VPIF_DISPLAY_VERSION "0.0.2"
  23. #define VPIF_VALID_FIELD(field) \
  24. (((V4L2_FIELD_ANY == field) || (V4L2_FIELD_NONE == field)) || \
  25. (((V4L2_FIELD_INTERLACED == field) || (V4L2_FIELD_SEQ_TB == field)) || \
  26. (V4L2_FIELD_SEQ_BT == field)))
  27. #define VPIF_DISPLAY_MAX_DEVICES (2)
  28. #define VPIF_SLICED_BUF_SIZE (256)
  29. #define VPIF_SLICED_MAX_SERVICES (3)
  30. #define VPIF_VIDEO_INDEX (0)
  31. #define VPIF_VBI_INDEX (1)
  32. #define VPIF_HBI_INDEX (2)
  33. /* Setting it to 1 as HBI/VBI support yet to be added , else 3*/
  34. #define VPIF_NUMOBJECTS (1)
  35. /* Macros */
  36. #define ISALIGNED(a) (0 == ((a) & 7))
  37. /* enumerated data types */
  38. /* Enumerated data type to give id to each device per channel */
  39. enum vpif_channel_id {
  40. VPIF_CHANNEL2_VIDEO = 0, /* Channel2 Video */
  41. VPIF_CHANNEL3_VIDEO, /* Channel3 Video */
  42. };
  43. /* structures */
  44. struct video_obj {
  45. enum v4l2_field buf_field;
  46. u32 latest_only; /* indicate whether to return
  47. * most recent displayed frame only */
  48. v4l2_std_id stdid; /* Currently selected or default
  49. * standard */
  50. struct v4l2_dv_timings dv_timings;
  51. };
  52. struct vpif_disp_buffer {
  53. struct vb2_v4l2_buffer vb;
  54. struct list_head list;
  55. };
  56. struct common_obj {
  57. struct vpif_disp_buffer *cur_frm; /* Pointer pointing to current
  58. * vb2_buffer */
  59. struct vpif_disp_buffer *next_frm; /* Pointer pointing to next
  60. * vb2_buffer */
  61. struct v4l2_format fmt; /* Used to store the format */
  62. struct vb2_queue buffer_queue; /* Buffer queue used in
  63. * video-buf */
  64. /* allocator-specific contexts for each plane */
  65. struct vb2_alloc_ctx *alloc_ctx;
  66. struct list_head dma_queue; /* Queue of filled frames */
  67. spinlock_t irqlock; /* Used in video-buf */
  68. /* channel specific parameters */
  69. struct mutex lock; /* lock used to access this
  70. * structure */
  71. u32 ytop_off; /* offset of Y top from the
  72. * starting of the buffer */
  73. u32 ybtm_off; /* offset of Y bottom from the
  74. * starting of the buffer */
  75. u32 ctop_off; /* offset of C top from the
  76. * starting of the buffer */
  77. u32 cbtm_off; /* offset of C bottom from the
  78. * starting of the buffer */
  79. /* Function pointer to set the addresses */
  80. void (*set_addr)(unsigned long, unsigned long,
  81. unsigned long, unsigned long);
  82. u32 height;
  83. u32 width;
  84. };
  85. struct channel_obj {
  86. /* V4l2 specific parameters */
  87. struct video_device video_dev; /* Identifies video device for
  88. * this channel */
  89. u32 field_id; /* Indicates id of the field
  90. * which is being displayed */
  91. u8 initialized; /* flag to indicate whether
  92. * encoder is initialized */
  93. u32 output_idx; /* Current output index */
  94. struct v4l2_subdev *sd; /* Current output subdev(may be NULL) */
  95. enum vpif_channel_id channel_id;/* Identifies channel */
  96. struct vpif_params vpifparams;
  97. struct common_obj common[VPIF_NUMOBJECTS];
  98. struct video_obj video;
  99. };
  100. /* vpif device structure */
  101. struct vpif_device {
  102. struct v4l2_device v4l2_dev;
  103. struct channel_obj *dev[VPIF_DISPLAY_NUM_CHANNELS];
  104. struct v4l2_subdev **sd;
  105. struct v4l2_async_notifier notifier;
  106. struct vpif_display_config *config;
  107. };
  108. #endif /* VPIF_DISPLAY_H */