Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.

Commit 5bdb675

Browse files
committed
VPP: clear a surface using media pipeline on GEN8+
Remove the extra sync between BCS and CS rings Signed-off-by: Haihao Xiang <[email protected]>
1 parent 3ccc26b commit 5bdb675

34 files changed

+2037
-78
lines changed

src/gen75_picture_process.c

Lines changed: 13 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -113,81 +113,23 @@ gen8plus_vpp_clear_surface(VADriverContextP ctx,
113113
struct object_surface *obj_surface,
114114
unsigned int color)
115115
{
116-
struct intel_batchbuffer *batch = pp_context->batch;
117-
unsigned int blt_cmd, br13;
118-
unsigned int tiling = 0, swizzle = 0;
119-
int pitch;
120116
unsigned char y, u, v, a = 0;
121-
int region_width, region_height;
122117

123-
/* Currently only support NV12 surface */
124-
if (!obj_surface || obj_surface->fourcc != VA_FOURCC_NV12)
118+
if (!obj_surface ||
119+
!obj_surface->bo ||
120+
!(color & 0xFF000000))
125121
return;
126122

127-
rgb_to_yuv(color, &y, &u, &v, &a);
128-
129-
if (a == 0)
130-
return;
131-
132-
dri_bo_get_tiling(obj_surface->bo, &tiling, &swizzle);
133-
blt_cmd = GEN8_XY_COLOR_BLT_CMD;
134-
pitch = obj_surface->width;
135-
136-
if (tiling != I915_TILING_NONE) {
137-
assert(tiling == I915_TILING_Y);
138-
// blt_cmd |= XY_COLOR_BLT_DST_TILED;
139-
// pitch >>= 2;
123+
if (obj_surface->fourcc == VA_FOURCC_RGBA ||
124+
obj_surface->fourcc == VA_FOURCC_RGBX ||
125+
obj_surface->fourcc == VA_FOURCC_BGRA ||
126+
obj_surface->fourcc == VA_FOURCC_BGRX)
127+
intel_common_clear_surface(ctx, pp_context, obj_surface, color);
128+
else {
129+
rgb_to_yuv(color, &y, &u, &v, &a);
130+
intel_common_clear_surface(ctx, pp_context, obj_surface,
131+
a << 24 | y << 16 | v << 8 | u);
140132
}
141-
142-
br13 = 0xf0 << 16;
143-
br13 |= BR13_8;
144-
br13 |= pitch;
145-
146-
intel_batchbuffer_start_atomic_blt(batch, 56);
147-
BEGIN_BLT_BATCH(batch, 14);
148-
149-
region_width = obj_surface->width;
150-
region_height = obj_surface->height;
151-
152-
OUT_BATCH(batch, blt_cmd);
153-
OUT_BATCH(batch, br13);
154-
OUT_BATCH(batch,
155-
0 << 16 |
156-
0);
157-
OUT_BATCH(batch,
158-
region_height << 16 |
159-
region_width);
160-
OUT_RELOC64(batch, obj_surface->bo,
161-
I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
162-
0);
163-
OUT_BATCH(batch, y);
164-
165-
br13 = 0xf0 << 16;
166-
br13 |= BR13_565;
167-
br13 |= pitch;
168-
169-
region_width = obj_surface->width / 2;
170-
region_height = obj_surface->height / 2;
171-
172-
if (tiling == I915_TILING_Y) {
173-
region_height = ALIGN(obj_surface->height / 2, 32);
174-
}
175-
176-
OUT_BATCH(batch, blt_cmd);
177-
OUT_BATCH(batch, br13);
178-
OUT_BATCH(batch,
179-
0 << 16 |
180-
0);
181-
OUT_BATCH(batch,
182-
region_height << 16 |
183-
region_width);
184-
OUT_RELOC64(batch, obj_surface->bo,
185-
I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
186-
obj_surface->width * obj_surface->y_cb_offset);
187-
OUT_BATCH(batch, v << 8 | u);
188-
189-
ADVANCE_BATCH(batch);
190-
intel_batchbuffer_end_atomic(batch);
191133
}
192134

193135
VAStatus
@@ -297,8 +239,7 @@ gen75_proc_picture(VADriverContextP ctx,
297239
assert(gpe_proc_ctx != NULL); // gpe_proc_ctx must be a non-NULL pointer
298240

299241
if ((gpe_proc_ctx->pp_context.scaling_gpe_context_initialized & VPPGPE_8BIT_8BIT) &&
300-
(obj_dst_surf->fourcc == VA_FOURCC_NV12) &&
301-
pipeline_param->output_background_color)
242+
(pipeline_param->output_background_color & 0xFF000000))
302243
gen8plus_vpp_clear_surface(ctx,
303244
&gpe_proc_ctx->pp_context,
304245
obj_dst_surf,

0 commit comments

Comments
 (0)