2 * Copyright © 2018 NVIDIA Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
30 #define DXVAHD_FRAME_FORMAT_PROGRESSIVE 0
31 #define DXVAHD_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST 1
32 #define DXVAHD_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST 2
33 #define DXVAHD_FRAME_FORMAT_TOP_FIELD 3
34 #define DXVAHD_FRAME_FORMAT_BOTTOM_FIELD 4
35 #define DXVAHD_FRAME_FORMAT_SUBPIC_PROGRESSIVE 5
36 #define DXVAHD_FRAME_FORMAT_SUBPIC_INTERLACED_TOP_FIELD_FIRST 6
37 #define DXVAHD_FRAME_FORMAT_SUBPIC_INTERLACED_BOTTOM_FIELD_FIRST 7
38 #define DXVAHD_FRAME_FORMAT_SUBPIC_TOP_FIELD 8
39 #define DXVAHD_FRAME_FORMAT_SUBPIC_BOTTOM_FIELD 9
40 #define DXVAHD_FRAME_FORMAT_TOP_FIELD_CHROMA_BOTTOM 10
41 #define DXVAHD_FRAME_FORMAT_BOTTOM_FIELD_CHROMA_TOP 11
42 #define DXVAHD_FRAME_FORMAT_SUBPIC_TOP_FIELD_CHROMA_BOTTOM 12
43 #define DXVAHD_FRAME_FORMAT_SUBPIC_BOTTOM_FIELD_CHROMA_TOP 13
45 #define DXVAHD_ALPHA_FILL_MODE_OPAQUE 0
46 #define DXVAHD_ALPHA_FILL_MODE_BACKGROUND 1
47 #define DXVAHD_ALPHA_FILL_MODE_DESTINATION 2
48 #define DXVAHD_ALPHA_FILL_MODE_SOURCE_STREAM 3
49 #define DXVAHD_ALPHA_FILL_MODE_COMPOSITED 4
50 #define DXVAHD_ALPHA_FILL_MODE_SOURCE_ALPHA 5
52 #define VIC_BLEND_SRCFACTC_K1 0
53 #define VIC_BLEND_SRCFACTC_K1_TIMES_DST 1
54 #define VIC_BLEND_SRCFACTC_NEG_K1_TIMES_DST 2
55 #define VIC_BLEND_SRCFACTC_K1_TIMES_SRC 3
56 #define VIC_BLEND_SRCFACTC_ZERO 4
58 #define VIC_BLEND_DSTFACTC_K1 0
59 #define VIC_BLEND_DSTFACTC_K2 1
60 #define VIC_BLEND_DSTFACTC_K1_TIMES_DST 2
61 #define VIC_BLEND_DSTFACTC_NEG_K1_TIMES_DST 3
62 #define VIC_BLEND_DSTFACTC_NEG_K1_TIMES_SRC 4
63 #define VIC_BLEND_DSTFACTC_ZERO 5
64 #define VIC_BLEND_DSTFACTC_ONE 6
66 #define VIC_BLEND_SRCFACTA_K1 0
67 #define VIC_BLEND_SRCFACTA_K2 1
68 #define VIC_BLEND_SRCFACTA_NEG_K1_TIMES_DST 2
69 #define VIC_BLEND_SRCFACTA_ZERO 3
71 #define VIC_BLEND_DSTFACTA_K2 0
72 #define VIC_BLEND_DSTFACTA_NEG_K1_TIMES_SRC 1
73 #define VIC_BLEND_DSTFACTA_ZERO 2
74 #define VIC_BLEND_DSTFACTA_ONE 3
76 #define VIC_BLK_KIND_PITCH 0
77 #define VIC_BLK_KIND_GENERIC_16Bx2 1
79 #define VIC_PIXEL_FORMAT_L8 1
80 #define VIC_PIXEL_FORMAT_R8 4
81 #define VIC_PIXEL_FORMAT_A8R8G8B8 32
82 #define VIC_PIXEL_FORMAT_R8G8B8A8 34
83 #define VIC_PIXEL_FORMAT_Y8_U8V8_N420 67
84 #define VIC_PIXEL_FORMAT_Y8_V8U8_N420 68
86 #define VIC_CACHE_WIDTH_16Bx16 0 /* BL16Bx2 */
87 #define VIC_CACHE_WIDTH_32Bx8 1 /* BL16Bx2 */
88 #define VIC_CACHE_WIDTH_64Bx4 2 /* BL16Bx2, PL */
89 #define VIC_CACHE_WIDTH_128Bx2 3 /* BL16Bx2, PL */
90 #define VIC_CACHE_WIDTH_256Bx1 4 /* PL */
92 struct vic_format_info
{
98 #define VIC_UCLASS_INCR_SYNCPT 0x00
99 #define VIC_UCLASS_METHOD_OFFSET 0x10
100 #define VIC_UCLASS_METHOD_DATA 0x11
102 static inline void VIC_PUSH_METHOD(struct drm_tegra_pushbuf
*pushbuf
,
103 uint32_t **ptrp
, uint32_t method
,
106 *(*ptrp
)++ = HOST1X_OPCODE_INCR(VIC_UCLASS_METHOD_OFFSET
, 2);
107 *(*ptrp
)++ = method
>> 2;
111 static inline void VIC_PUSH_BUFFER(struct drm_tegra_pushbuf
*pushbuf
,
112 uint32_t **ptrp
, uint32_t method
,
113 struct drm_tegra_mapping
*map
,
114 unsigned long offset
, unsigned long flags
)
116 *(*ptrp
)++ = HOST1X_OPCODE_INCR(VIC_UCLASS_METHOD_OFFSET
, 2);
117 *(*ptrp
)++ = method
>> 2;
119 drm_tegra_pushbuf_relocate(pushbuf
, ptrp
, map
, offset
, 8, flags
);
126 int (*fill
)(struct vic
*vic
, struct vic_image
*output
,
127 unsigned int left
, unsigned int top
,
128 unsigned int right
, unsigned int bottom
,
129 unsigned int alpha
, unsigned red
,
130 unsigned int green
, unsigned int blue
);
131 int (*blit
)(struct vic
*vic
, struct vic_image
*output
,
132 struct vic_image
*input
);
133 int (*flip
)(struct vic
*vic
, struct vic_image
*output
,
134 struct vic_image
*input
);
135 int (*execute
)(struct vic
*vic
,
136 struct drm_tegra_pushbuf
*pushbuf
,
138 struct vic_image
*output
,
139 struct vic_image
**inputs
,
140 unsigned int num_inputs
);
141 void (*free
)(struct vic
*vic
);
145 struct drm_tegra
*drm
;
146 struct drm_tegra_channel
*channel
;
147 struct drm_tegra_syncpoint
*syncpt
;
148 const struct vic_ops
*ops
;
149 unsigned int version
;
152 int vic_new(struct drm_tegra
*drm
, struct drm_tegra_channel
*channel
,
154 void vic_free(struct vic
*vic
);
156 int vic_clear(struct vic
*vic
, struct vic_image
*output
, unsigned int alpha
,
157 unsigned int red
, unsigned int green
, unsigned int blue
);
160 struct drm_tegra_bo
*bo
;
161 struct drm_tegra_mapping
*map
;
173 const struct vic_format_info
*vic_format_get_info(unsigned int format
);
175 int vic_image_new(struct vic
*vic
, unsigned int width
, unsigned int height
,
176 unsigned int format
, unsigned int kind
, uint32_t flags
,
177 struct vic_image
**imagep
);
178 void vic_image_free(struct vic_image
*image
);
179 void vic_image_dump(struct vic_image
*image
, FILE *fp
);