From: Marek Olšák <marek.ol...@amd.com> Reviewed-by: Christian König <christian.koe...@amd.com> Reviewed-by: Nicolai Hähnle <nicolai.haeh...@amd.com> Tested-by: Edmondo Tommasina <edmondo.tommas...@gmail.com> --- src/gallium/auxiliary/vl/vl_compositor.c | 14 ++------------ src/gallium/auxiliary/vl/vl_compositor.h | 1 - src/gallium/state_trackers/va/context.c | 4 ---- 3 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 1efcb75..f98b185 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -775,21 +775,21 @@ calc_drawn_area(struct vl_compositor_state *s, struct vl_compositor_layer *layer static void gen_vertex_data(struct vl_compositor *c, struct vl_compositor_state *s, struct u_rect *dirty) { struct vertex2f *vb; unsigned i; assert(c); /* Allocate new memory for vertices. */ - u_upload_alloc(c->upload, 0, + u_upload_alloc(c->pipe->stream_uploader, 0, c->vertex_buf.stride * VL_COMPOSITOR_MAX_LAYERS * 4, /* size */ 4, /* alignment */ &c->vertex_buf.buffer_offset, &c->vertex_buf.buffer, (void**)&vb); for (i = 0; i < VL_COMPOSITOR_MAX_LAYERS; i++) { if (s->used_layers & (1 << i)) { struct vl_compositor_layer *layer = &s->layers[i]; gen_rect_verts(vb, layer); vb += 20; @@ -810,21 +810,21 @@ gen_vertex_data(struct vl_compositor *c, struct vl_compositor_state *s, struct u dirty->y1 <= drawn.y1) { // We clear the dirty area anyway, no need for clear_render_target dirty->x0 = dirty->y0 = MAX_DIRTY; dirty->x1 = dirty->y1 = MIN_DIRTY; } } } } - u_upload_unmap(c->upload); + u_upload_unmap(c->pipe->stream_uploader); } static void draw_layers(struct vl_compositor *c, struct vl_compositor_state *s, struct u_rect *dirty) { unsigned vb_index, i; assert(c); for (i = 0, vb_index = 0; i < VL_COMPOSITOR_MAX_LAYERS; ++i) { @@ -906,21 +906,20 @@ vl_compositor_clear_layers(struct vl_compositor_state *s) for ( j = 0; j < 4; ++j) s->layers[i].colors[j] = v_one; } } void vl_compositor_cleanup(struct vl_compositor *c) { assert(c); - u_upload_destroy(c->upload); cleanup_buffers(c); cleanup_shaders(c); cleanup_pipe_state(c); } bool vl_compositor_set_csc_matrix(struct vl_compositor_state *s, vl_csc_matrix const *matrix, float luma_min, float luma_max) { @@ -1190,39 +1189,30 @@ vl_compositor_render(struct vl_compositor_state *s, bool vl_compositor_init(struct vl_compositor *c, struct pipe_context *pipe) { assert(c); memset(c, 0, sizeof(*c)); c->pipe = pipe; - c->upload = u_upload_create(pipe, 128 * 1024, PIPE_BIND_VERTEX_BUFFER, - PIPE_USAGE_STREAM); - - if (!c->upload) - return false; - if (!init_pipe_state(c)) { - u_upload_destroy(c->upload); return false; } if (!init_shaders(c)) { - u_upload_destroy(c->upload); cleanup_pipe_state(c); return false; } if (!init_buffers(c)) { - u_upload_destroy(c->upload); cleanup_shaders(c); cleanup_pipe_state(c); return false; } return true; } bool vl_compositor_init_state(struct vl_compositor_state *s, struct pipe_context *pipe) diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h index 5460619..535abb7 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.h +++ b/src/gallium/auxiliary/vl/vl_compositor.h @@ -92,21 +92,20 @@ struct vl_compositor_state union pipe_color_union clear_color; unsigned used_layers:VL_COMPOSITOR_MAX_LAYERS; struct vl_compositor_layer layers[VL_COMPOSITOR_MAX_LAYERS]; }; struct vl_compositor { struct pipe_context *pipe; - struct u_upload_mgr *upload; struct pipe_framebuffer_state fb_state; struct pipe_vertex_buffer vertex_buf; void *sampler_linear; void *sampler_nearest; void *blend_clear, *blend_add; void *rast; void *dsa; void *vertex_elems_state; diff --git a/src/gallium/state_trackers/va/context.c b/src/gallium/state_trackers/va/context.c index 357c9be..d749e65 100644 --- a/src/gallium/state_trackers/va/context.c +++ b/src/gallium/state_trackers/va/context.c @@ -223,24 +223,20 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width, if (!(picture_width && picture_height) && !is_vpp) return VA_STATUS_ERROR_INVALID_IMAGE_FORMAT; context = CALLOC(1, sizeof(vlVaContext)); if (!context) return VA_STATUS_ERROR_ALLOCATION_FAILED; if (is_vpp) { context->decoder = NULL; - if (!drv->compositor.upload) { - FREE(context); - return VA_STATUS_ERROR_INVALID_CONTEXT; - } } else { context->templat.profile = config->profile; context->templat.entrypoint = config->entrypoint; context->templat.chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420; context->templat.width = picture_width; context->templat.height = picture_height; context->templat.expect_chunked_decode = true; switch (u_reduce_video_profile(context->templat.profile)) { case PIPE_VIDEO_FORMAT_MPEG12: -- 2.7.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev