summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/auxiliary/vl
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2021-07-22 10:50:50 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2021-07-22 10:50:50 +0000
commit9130ec005fbc78a62420643414d8354d0929ca50 (patch)
tree6762777acdd2d4eee17ef87290e80dc7afe2b73d /lib/mesa/src/gallium/auxiliary/vl
parentca11beabae33eb59fb981b8adf50b1d47a2a98f0 (diff)
Merge Mesa 21.1.5
Diffstat (limited to 'lib/mesa/src/gallium/auxiliary/vl')
-rw-r--r--lib/mesa/src/gallium/auxiliary/vl/vl_bicubic_filter.c10
-rw-r--r--lib/mesa/src/gallium/auxiliary/vl/vl_compositor.c24
-rw-r--r--lib/mesa/src/gallium/auxiliary/vl/vl_compositor.h1
-rw-r--r--lib/mesa/src/gallium/auxiliary/vl/vl_deint_filter.c11
-rw-r--r--lib/mesa/src/gallium/auxiliary/vl/vl_matrix_filter.c8
-rw-r--r--lib/mesa/src/gallium/auxiliary/vl/vl_median_filter.c8
-rw-r--r--lib/mesa/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c42
-rw-r--r--lib/mesa/src/gallium/auxiliary/vl/vl_vertex_buffers.c14
-rw-r--r--lib/mesa/src/gallium/auxiliary/vl/vl_video_buffer.c31
-rw-r--r--lib/mesa/src/gallium/auxiliary/vl/vl_winsys_dri.c10
-rw-r--r--lib/mesa/src/gallium/auxiliary/vl/vl_winsys_dri3.c4
-rw-r--r--lib/mesa/src/gallium/auxiliary/vl/vl_winsys_drm.c2
-rw-r--r--lib/mesa/src/gallium/auxiliary/vl/vl_zscan.c12
13 files changed, 114 insertions, 63 deletions
diff --git a/lib/mesa/src/gallium/auxiliary/vl/vl_bicubic_filter.c b/lib/mesa/src/gallium/auxiliary/vl/vl_bicubic_filter.c
index 5bcf65abf..674aa587d 100644
--- a/lib/mesa/src/gallium/auxiliary/vl/vl_bicubic_filter.c
+++ b/lib/mesa/src/gallium/auxiliary/vl/vl_bicubic_filter.c
@@ -422,6 +422,10 @@ vl_bicubic_filter_render(struct vl_bicubic_filter *filter,
viewport.scale[1] = dst->height;
}
viewport.scale[2] = 1;
+ viewport.swizzle_x = PIPE_VIEWPORT_SWIZZLE_POSITIVE_X;
+ viewport.swizzle_y = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Y;
+ viewport.swizzle_z = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Z;
+ viewport.swizzle_w = PIPE_VIEWPORT_SWIZZLE_POSITIVE_W;
struct pipe_constant_buffer cb = {0};
float *ptr = NULL;
@@ -446,18 +450,18 @@ vl_bicubic_filter_render(struct vl_bicubic_filter *filter,
filter->pipe->clear_render_target(filter->pipe, dst, &clear_color,
0, 0, dst->width, dst->height, false);
filter->pipe->set_constant_buffer(filter->pipe, PIPE_SHADER_FRAGMENT,
- 0, &cb);
+ 0, false, &cb);
filter->pipe->bind_rasterizer_state(filter->pipe, filter->rs_state);
filter->pipe->bind_blend_state(filter->pipe, filter->blend);
filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT,
0, 1, &filter->sampler);
filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT,
- 0, 1, &src);
+ 0, 1, 0, &src);
filter->pipe->bind_vs_state(filter->pipe, filter->vs);
filter->pipe->bind_fs_state(filter->pipe, filter->fs);
filter->pipe->set_framebuffer_state(filter->pipe, &fb_state);
filter->pipe->set_viewport_states(filter->pipe, 0, 1, &viewport);
- filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, &filter->quad);
+ filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, 0, false, &filter->quad);
filter->pipe->bind_vertex_elements_state(filter->pipe, filter->ves);
util_draw_arrays(filter->pipe, PIPE_PRIM_QUADS, 0, 4);
diff --git a/lib/mesa/src/gallium/auxiliary/vl/vl_compositor.c b/lib/mesa/src/gallium/auxiliary/vl/vl_compositor.c
index a381af108..a6ace3532 100644
--- a/lib/mesa/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/lib/mesa/src/gallium/auxiliary/vl/vl_compositor.c
@@ -193,9 +193,9 @@ init_pipe_state(struct vl_compositor *c)
c->rast = c->pipe->create_rasterizer_state(c->pipe, &rast);
memset(&dsa, 0, sizeof dsa);
- dsa.depth.enabled = 0;
- dsa.depth.writemask = 0;
- dsa.depth.func = PIPE_FUNC_ALWAYS;
+ dsa.depth_enabled = 0;
+ dsa.depth_writemask = 0;
+ dsa.depth_func = PIPE_FUNC_ALWAYS;
for (i = 0; i < 2; ++i) {
dsa.stencil[i].enabled = 0;
dsa.stencil[i].func = PIPE_FUNC_ALWAYS;
@@ -205,9 +205,9 @@ init_pipe_state(struct vl_compositor *c)
dsa.stencil[i].valuemask = 0;
dsa.stencil[i].writemask = 0;
}
- dsa.alpha.enabled = 0;
- dsa.alpha.func = PIPE_FUNC_ALWAYS;
- dsa.alpha.ref_value = 0;
+ dsa.alpha_enabled = 0;
+ dsa.alpha_func = PIPE_FUNC_ALWAYS;
+ dsa.alpha_ref_value = 0;
c->dsa = c->pipe->create_depth_stencil_alpha_state(c->pipe, &dsa);
c->pipe->bind_depth_stencil_alpha_state(c->pipe, c->dsa);
}
@@ -328,6 +328,7 @@ set_yuv_layer(struct vl_compositor_state *s, struct vl_compositor *c,
assert(layer < VL_COMPOSITOR_MAX_LAYERS);
+ s->interlaced = buffer->interlaced;
s->used_layers |= 1 << layer;
sampler_views = buffer->get_sampler_view_components(buffer);
for (i = 0; i < 3; ++i) {
@@ -435,7 +436,7 @@ vl_compositor_clear_layers(struct vl_compositor_state *s)
unsigned i, j;
assert(s);
-
+ s->interlaced = false;
s->used_layers = 0;
for ( i = 0; i < VL_COMPOSITOR_MAX_LAYERS; ++i) {
struct vertex4f v_one = { 1.0f, 1.0f, 1.0f, 1.0f };
@@ -445,6 +446,10 @@ vl_compositor_clear_layers(struct vl_compositor_state *s)
s->layers[i].cs = NULL;
s->layers[i].viewport.scale[2] = 1;
s->layers[i].viewport.translate[2] = 0;
+ s->layers[i].viewport.swizzle_x = PIPE_VIEWPORT_SWIZZLE_POSITIVE_X;
+ s->layers[i].viewport.swizzle_y = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Y;
+ s->layers[i].viewport.swizzle_z = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Z;
+ s->layers[i].viewport.swizzle_w = PIPE_VIEWPORT_SWIZZLE_POSITIVE_W;
s->layers[i].rotate = VL_COMPOSITOR_ROTATE_0;
for ( j = 0; j < 3; j++)
@@ -474,7 +479,7 @@ vl_compositor_set_csc_matrix(struct vl_compositor_state *s,
assert(s);
float *ptr = pipe_buffer_map(s->pipe, s->shader_params,
- PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE,
+ PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE,
&buf_transfer);
if (!ptr)
@@ -551,6 +556,7 @@ vl_compositor_set_buffer_layer(struct vl_compositor_state *s,
assert(layer < VL_COMPOSITOR_MAX_LAYERS);
+ s->interlaced = buffer->interlaced;
s->used_layers |= 1 << layer;
sampler_views = buffer->get_sampler_view_components(buffer);
for (i = 0; i < 3; ++i) {
@@ -813,7 +819,7 @@ vl_compositor_init_state(struct vl_compositor_state *s, struct pipe_context *pip
pipe->screen,
PIPE_BIND_CONSTANT_BUFFER,
PIPE_USAGE_DEFAULT,
- sizeof(csc_matrix) + 6*sizeof(float) + 6*sizeof(int)
+ sizeof(csc_matrix) + 6*sizeof(float) + 10*sizeof(int)
);
if (!s->shader_params)
diff --git a/lib/mesa/src/gallium/auxiliary/vl/vl_compositor.h b/lib/mesa/src/gallium/auxiliary/vl/vl_compositor.h
index 596e055cb..cccee0162 100644
--- a/lib/mesa/src/gallium/auxiliary/vl/vl_compositor.h
+++ b/lib/mesa/src/gallium/auxiliary/vl/vl_compositor.h
@@ -97,6 +97,7 @@ struct vl_compositor_state
unsigned used_layers:VL_COMPOSITOR_MAX_LAYERS;
struct vl_compositor_layer layers[VL_COMPOSITOR_MAX_LAYERS];
+ bool interlaced;
};
struct vl_compositor
diff --git a/lib/mesa/src/gallium/auxiliary/vl/vl_deint_filter.c b/lib/mesa/src/gallium/auxiliary/vl/vl_deint_filter.c
index ab64cebf8..950739b6c 100644
--- a/lib/mesa/src/gallium/auxiliary/vl/vl_deint_filter.c
+++ b/lib/mesa/src/gallium/auxiliary/vl/vl_deint_filter.c
@@ -262,7 +262,6 @@ vl_deint_filter_init(struct vl_deint_filter *filter, struct pipe_context *pipe,
PIPE_VIDEO_ENTRYPOINT_UNKNOWN,
PIPE_VIDEO_CAP_PREFERED_FORMAT
);
- templ.chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420;
templ.width = video_width;
templ.height = video_height;
templ.interlaced = true;
@@ -420,7 +419,7 @@ vl_deint_filter_check_buffers(struct vl_deint_filter *filter,
struct pipe_video_buffer *bufs[] = { prevprev, prev, cur, next };
for (i = 0; i < 4; i++) {
- if (bufs[i]->chroma_format != PIPE_VIDEO_CHROMA_FORMAT_420)
+ if (pipe_format_to_chroma_format(bufs[i]->buffer_format) != PIPE_VIDEO_CHROMA_FORMAT_420)
return false;
if (bufs[i]->width < filter->video_width ||
bufs[i]->height < filter->video_height)
@@ -464,7 +463,7 @@ vl_deint_filter_render(struct vl_deint_filter *filter,
/* set up pipe state */
filter->pipe->bind_rasterizer_state(filter->pipe, filter->rs_state);
- filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, &filter->quad);
+ filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, 0, false, &filter->quad);
filter->pipe->bind_vertex_elements_state(filter->pipe, filter->ves);
filter->pipe->bind_vs_state(filter->pipe, filter->vs);
filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT,
@@ -473,6 +472,10 @@ vl_deint_filter_render(struct vl_deint_filter *filter,
/* prepare viewport */
memset(&viewport, 0, sizeof(viewport));
viewport.scale[2] = 1;
+ viewport.swizzle_x = PIPE_VIEWPORT_SWIZZLE_POSITIVE_X;
+ viewport.swizzle_y = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Y;
+ viewport.swizzle_z = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Z;
+ viewport.swizzle_w = PIPE_VIEWPORT_SWIZZLE_POSITIVE_W;
/* prepare framebuffer */
memset(&fb_state, 0, sizeof(fb_state));
@@ -498,7 +501,7 @@ vl_deint_filter_render(struct vl_deint_filter *filter,
sampler_views[1] = prev_sv[k];
sampler_views[2] = cur_sv[k];
sampler_views[3] = next_sv[k];
- filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT, 0, 4, sampler_views);
+ filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT, 0, 4, 0, sampler_views);
/* blit current field */
fb_state.cbufs[0] = blit_surf;
diff --git a/lib/mesa/src/gallium/auxiliary/vl/vl_matrix_filter.c b/lib/mesa/src/gallium/auxiliary/vl/vl_matrix_filter.c
index 4a24c6a3f..6c912ea86 100644
--- a/lib/mesa/src/gallium/auxiliary/vl/vl_matrix_filter.c
+++ b/lib/mesa/src/gallium/auxiliary/vl/vl_matrix_filter.c
@@ -279,6 +279,10 @@ vl_matrix_filter_render(struct vl_matrix_filter *filter,
viewport.scale[0] = dst->width;
viewport.scale[1] = dst->height;
viewport.scale[2] = 1;
+ viewport.swizzle_x = PIPE_VIEWPORT_SWIZZLE_POSITIVE_X;
+ viewport.swizzle_y = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Y;
+ viewport.swizzle_z = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Z;
+ viewport.swizzle_w = PIPE_VIEWPORT_SWIZZLE_POSITIVE_W;
memset(&fb_state, 0, sizeof(fb_state));
fb_state.width = dst->width;
@@ -291,12 +295,12 @@ vl_matrix_filter_render(struct vl_matrix_filter *filter,
filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT,
0, 1, &filter->sampler);
filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT,
- 0, 1, &src);
+ 0, 1, 0, &src);
filter->pipe->bind_vs_state(filter->pipe, filter->vs);
filter->pipe->bind_fs_state(filter->pipe, filter->fs);
filter->pipe->set_framebuffer_state(filter->pipe, &fb_state);
filter->pipe->set_viewport_states(filter->pipe, 0, 1, &viewport);
- filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, &filter->quad);
+ filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, 0, false, &filter->quad);
filter->pipe->bind_vertex_elements_state(filter->pipe, filter->ves);
util_draw_arrays(filter->pipe, PIPE_PRIM_QUADS, 0, 4);
diff --git a/lib/mesa/src/gallium/auxiliary/vl/vl_median_filter.c b/lib/mesa/src/gallium/auxiliary/vl/vl_median_filter.c
index b10237d1e..90ae4fcf9 100644
--- a/lib/mesa/src/gallium/auxiliary/vl/vl_median_filter.c
+++ b/lib/mesa/src/gallium/auxiliary/vl/vl_median_filter.c
@@ -383,6 +383,10 @@ vl_median_filter_render(struct vl_median_filter *filter,
viewport.scale[0] = dst->width;
viewport.scale[1] = dst->height;
viewport.scale[2] = 1;
+ viewport.swizzle_x = PIPE_VIEWPORT_SWIZZLE_POSITIVE_X;
+ viewport.swizzle_y = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Y;
+ viewport.swizzle_z = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Z;
+ viewport.swizzle_w = PIPE_VIEWPORT_SWIZZLE_POSITIVE_W;
memset(&fb_state, 0, sizeof(fb_state));
fb_state.width = dst->width;
@@ -395,12 +399,12 @@ vl_median_filter_render(struct vl_median_filter *filter,
filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT,
0, 1, &filter->sampler);
filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT,
- 0, 1, &src);
+ 0, 1, 0, &src);
filter->pipe->bind_vs_state(filter->pipe, filter->vs);
filter->pipe->bind_fs_state(filter->pipe, filter->fs);
filter->pipe->set_framebuffer_state(filter->pipe, &fb_state);
filter->pipe->set_viewport_states(filter->pipe, 0, 1, &viewport);
- filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, &filter->quad);
+ filter->pipe->set_vertex_buffers(filter->pipe, 0, 1, 0, false, &filter->quad);
filter->pipe->bind_vertex_elements_state(filter->pipe, filter->ves);
util_draw_arrays(filter->pipe, PIPE_PRIM_QUADS, 0, 4);
diff --git a/lib/mesa/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/lib/mesa/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
index b7ef70f6c..e6225d2ec 100644
--- a/lib/mesa/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
+++ b/lib/mesa/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
@@ -629,8 +629,8 @@ vl_mpeg12_begin_frame(struct pipe_video_codec *decoder,
buf->texels =
dec->context->transfer_map(dec->context, tex, 0,
- PIPE_TRANSFER_WRITE |
- PIPE_TRANSFER_DISCARD_RANGE,
+ PIPE_MAP_WRITE |
+ PIPE_MAP_DISCARD_RANGE,
&rect, &buf->tex_transfer);
buf->block_num = 0;
@@ -769,7 +769,8 @@ vl_mpeg12_end_frame(struct pipe_video_codec *decoder,
vl_vb_unmap(&buf->vertex_stream, dec->context);
- dec->context->transfer_unmap(dec->context, buf->tex_transfer);
+ if (buf->tex_transfer)
+ dec->context->transfer_unmap(dec->context, buf->tex_transfer);
vb[0] = dec->quads;
vb[1] = dec->pos;
@@ -793,7 +794,7 @@ vl_mpeg12_end_frame(struct pipe_video_codec *decoder,
if (!ref_frames[j] || !ref_frames[j][i]) continue;
vb[2] = vl_vb_get_mv(&buf->vertex_stream, j);
- dec->context->set_vertex_buffers(dec->context, 0, 3, vb);
+ dec->context->set_vertex_buffers(dec->context, 0, 3, 0, false, vb);
vl_mc_render_ref(i ? &dec->mc_c : &dec->mc_y, &buf->mc[i], ref_frames[j][i]);
}
@@ -804,7 +805,7 @@ vl_mpeg12_end_frame(struct pipe_video_codec *decoder,
if (!buf->num_ycbcr_blocks[i]) continue;
vb[1] = vl_vb_get_ycbcr(&buf->vertex_stream, i);
- dec->context->set_vertex_buffers(dec->context, 0, 2, vb);
+ dec->context->set_vertex_buffers(dec->context, 0, 2, 0, false, vb);
vl_zscan_render(i ? &dec->zscan_c : & dec->zscan_y, &buf->zscan[i] , buf->num_ycbcr_blocks[i]);
@@ -823,13 +824,13 @@ vl_mpeg12_end_frame(struct pipe_video_codec *decoder,
if (!buf->num_ycbcr_blocks[plane]) continue;
vb[1] = vl_vb_get_ycbcr(&buf->vertex_stream, plane);
- dec->context->set_vertex_buffers(dec->context, 0, 2, vb);
+ dec->context->set_vertex_buffers(dec->context, 0, 2, 0, false, vb);
if (dec->base.entrypoint <= PIPE_VIDEO_ENTRYPOINT_IDCT)
vl_idct_prepare_stage2(i ? &dec->idct_c : &dec->idct_y, &buf->idct[plane]);
else {
dec->context->set_sampler_views(dec->context,
- PIPE_SHADER_FRAGMENT, 0, 1,
+ PIPE_SHADER_FRAGMENT, 0, 1, 0,
&mc_source_sv[plane]);
dec->context->bind_sampler_states(dec->context,
PIPE_SHADER_FRAGMENT,
@@ -861,9 +862,9 @@ init_pipe_state(struct vl_mpeg12_decoder *dec)
assert(dec);
memset(&dsa, 0, sizeof dsa);
- dsa.depth.enabled = 0;
- dsa.depth.writemask = 0;
- dsa.depth.func = PIPE_FUNC_ALWAYS;
+ dsa.depth_enabled = 0;
+ dsa.depth_writemask = 0;
+ dsa.depth_func = PIPE_FUNC_ALWAYS;
for (i = 0; i < 2; ++i) {
dsa.stencil[i].enabled = 0;
dsa.stencil[i].func = PIPE_FUNC_ALWAYS;
@@ -873,9 +874,9 @@ init_pipe_state(struct vl_mpeg12_decoder *dec)
dsa.stencil[i].valuemask = 0;
dsa.stencil[i].writemask = 0;
}
- dsa.alpha.enabled = 0;
- dsa.alpha.func = PIPE_FUNC_ALWAYS;
- dsa.alpha.ref_value = 0;
+ dsa.alpha_enabled = 0;
+ dsa.alpha_func = PIPE_FUNC_ALWAYS;
+ dsa.alpha_ref_value = 0;
dec->dsa = dec->context->create_depth_stencil_alpha_state(dec->context, &dsa);
dec->context->bind_depth_stencil_alpha_state(dec->context, dec->dsa);
@@ -985,11 +986,11 @@ init_idct(struct vl_mpeg12_decoder *dec, const struct format_config* format_conf
memset(&templat, 0, sizeof(templat));
templat.width = dec->base.width / 4;
templat.height = dec->base.height;
- templat.chroma_format = dec->base.chroma_format;
dec->idct_source = vl_video_buffer_create_ex
(
dec->context, &templat,
- formats, 1, 1, PIPE_USAGE_DEFAULT
+ formats, 1, 1, PIPE_USAGE_DEFAULT,
+ PIPE_VIDEO_CHROMA_FORMAT_420
);
if (!dec->idct_source)
@@ -999,11 +1000,11 @@ init_idct(struct vl_mpeg12_decoder *dec, const struct format_config* format_conf
memset(&templat, 0, sizeof(templat));
templat.width = dec->base.width / nr_of_idct_render_targets;
templat.height = dec->base.height / 4;
- templat.chroma_format = dec->base.chroma_format;
dec->mc_source = vl_video_buffer_create_ex
(
dec->context, &templat,
- formats, nr_of_idct_render_targets, 1, PIPE_USAGE_DEFAULT
+ formats, nr_of_idct_render_targets, 1, PIPE_USAGE_DEFAULT,
+ PIPE_VIDEO_CHROMA_FORMAT_420
);
if (!dec->mc_source)
@@ -1047,16 +1048,17 @@ init_mc_source_widthout_idct(struct vl_mpeg12_decoder *dec, const struct format_
struct pipe_video_buffer templat;
formats[0] = formats[1] = formats[2] = format_config->mc_source_format;
+ assert(pipe_format_to_chroma_format(formats[0]) == dec->base.chroma_format);
memset(&templat, 0, sizeof(templat));
templat.width = dec->base.width;
templat.height = dec->base.height;
- templat.chroma_format = dec->base.chroma_format;
dec->mc_source = vl_video_buffer_create_ex
(
dec->context, &templat,
- formats, 1, 1, PIPE_USAGE_DEFAULT
+ formats, 1, 1, PIPE_USAGE_DEFAULT,
+ PIPE_VIDEO_CHROMA_FORMAT_420
);
-
+
return dec->mc_source != NULL;
}
diff --git a/lib/mesa/src/gallium/auxiliary/vl/vl_vertex_buffers.c b/lib/mesa/src/gallium/auxiliary/vl/vl_vertex_buffers.c
index 7e6fdfaaf..00c424f3b 100644
--- a/lib/mesa/src/gallium/auxiliary/vl/vl_vertex_buffers.c
+++ b/lib/mesa/src/gallium/auxiliary/vl/vl_vertex_buffers.c
@@ -66,7 +66,7 @@ vl_vb_upload_quads(struct pipe_context *pipe)
(
pipe,
quad.buffer.resource,
- PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE,
+ PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE,
&buf_transfer
);
@@ -111,7 +111,7 @@ vl_vb_upload_pos(struct pipe_context *pipe, unsigned width, unsigned height)
(
pipe,
pos.buffer.resource,
- PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE,
+ PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE,
&buf_transfer
);
@@ -301,7 +301,7 @@ vl_vb_map(struct vl_vertex_buffer *buffer, struct pipe_context *pipe)
(
pipe,
buffer->ycbcr[i].resource,
- PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE,
+ PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE,
&buffer->ycbcr[i].transfer
);
}
@@ -311,7 +311,7 @@ vl_vb_map(struct vl_vertex_buffer *buffer, struct pipe_context *pipe)
(
pipe,
buffer->mv[i].resource,
- PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE,
+ PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE,
&buffer->mv[i].transfer
);
}
@@ -352,11 +352,13 @@ vl_vb_unmap(struct vl_vertex_buffer *buffer, struct pipe_context *pipe)
assert(buffer && pipe);
for (i = 0; i < VL_NUM_COMPONENTS; ++i) {
- pipe_buffer_unmap(pipe, buffer->ycbcr[i].transfer);
+ if (buffer->ycbcr[i].transfer)
+ pipe_buffer_unmap(pipe, buffer->ycbcr[i].transfer);
}
for (i = 0; i < VL_MAX_REF_FRAMES; ++i) {
- pipe_buffer_unmap(pipe, buffer->mv[i].transfer);
+ if (buffer->mv[i].transfer)
+ pipe_buffer_unmap(pipe, buffer->mv[i].transfer);
}
}
diff --git a/lib/mesa/src/gallium/auxiliary/vl/vl_video_buffer.c b/lib/mesa/src/gallium/auxiliary/vl/vl_video_buffer.c
index bcb19fdad..eb13f89dd 100644
--- a/lib/mesa/src/gallium/auxiliary/vl/vl_video_buffer.c
+++ b/lib/mesa/src/gallium/auxiliary/vl/vl_video_buffer.c
@@ -169,7 +169,8 @@ vl_video_buffer_template(struct pipe_resource *templ,
const struct pipe_video_buffer *tmpl,
enum pipe_format resource_format,
unsigned depth, unsigned array_size,
- unsigned usage, unsigned plane)
+ unsigned usage, unsigned plane,
+ enum pipe_video_chroma_format chroma_format)
{
unsigned height = tmpl->height;
@@ -188,7 +189,7 @@ vl_video_buffer_template(struct pipe_resource *templ,
templ->usage = usage;
vl_video_buffer_adjust_size(&templ->width0, &height, plane,
- tmpl->chroma_format, false);
+ chroma_format, false);
templ->height0 = height;
}
@@ -372,7 +373,8 @@ vl_video_buffer_create(struct pipe_context *pipe,
result = vl_video_buffer_create_ex
(
pipe, &templat, resource_formats,
- 1, tmpl->interlaced ? 2 : 1, PIPE_USAGE_DEFAULT
+ 1, tmpl->interlaced ? 2 : 1, PIPE_USAGE_DEFAULT,
+ pipe_format_to_chroma_format(templat.buffer_format)
);
@@ -386,7 +388,8 @@ struct pipe_video_buffer *
vl_video_buffer_create_ex(struct pipe_context *pipe,
const struct pipe_video_buffer *tmpl,
const enum pipe_format resource_formats[VL_NUM_COMPONENTS],
- unsigned depth, unsigned array_size, unsigned usage)
+ unsigned depth, unsigned array_size, unsigned usage,
+ enum pipe_video_chroma_format chroma_format)
{
struct pipe_resource res_tmpl;
struct pipe_resource *resources[VL_NUM_COMPONENTS];
@@ -396,7 +399,8 @@ vl_video_buffer_create_ex(struct pipe_context *pipe,
memset(resources, 0, sizeof resources);
- vl_video_buffer_template(&res_tmpl, tmpl, resource_formats[0], depth, array_size, usage, 0);
+ vl_video_buffer_template(&res_tmpl, tmpl, resource_formats[0], depth, array_size,
+ usage, 0, chroma_format);
resources[0] = pipe->screen->resource_create(pipe->screen, &res_tmpl);
if (!resources[0])
goto error;
@@ -406,7 +410,8 @@ vl_video_buffer_create_ex(struct pipe_context *pipe,
return vl_video_buffer_create_ex2(pipe, tmpl, resources);
}
- vl_video_buffer_template(&res_tmpl, tmpl, resource_formats[1], depth, array_size, usage, 1);
+ vl_video_buffer_template(&res_tmpl, tmpl, resource_formats[1], depth, array_size,
+ usage, 1, chroma_format);
resources[1] = pipe->screen->resource_create(pipe->screen, &res_tmpl);
if (!resources[1])
goto error;
@@ -414,7 +419,8 @@ vl_video_buffer_create_ex(struct pipe_context *pipe,
if (resource_formats[2] == PIPE_FORMAT_NONE)
return vl_video_buffer_create_ex2(pipe, tmpl, resources);
- vl_video_buffer_template(&res_tmpl, tmpl, resource_formats[2], depth, array_size, usage, 2);
+ vl_video_buffer_template(&res_tmpl, tmpl, resource_formats[2], depth, array_size,
+ usage, 2, chroma_format);
resources[2] = pipe->screen->resource_create(pipe->screen, &res_tmpl);
if (!resources[2])
goto error;
@@ -460,7 +466,9 @@ vl_video_buffer_create_ex2(struct pipe_context *pipe,
/* Create pipe_video_buffer by using resource_create with planar formats. */
struct pipe_video_buffer *
vl_video_buffer_create_as_resource(struct pipe_context *pipe,
- const struct pipe_video_buffer *tmpl)
+ const struct pipe_video_buffer *tmpl,
+ const uint64_t *modifiers,
+ int modifiers_count)
{
struct pipe_resource templ, *resources[VL_NUM_COMPONENTS] = {0};
unsigned array_size = tmpl->interlaced ? 2 : 1;
@@ -481,7 +489,12 @@ vl_video_buffer_create_as_resource(struct pipe_context *pipe,
else
templ.format = tmpl->buffer_format;
- resources[0] = pipe->screen->resource_create(pipe->screen, &templ);
+ if (modifiers)
+ resources[0] = pipe->screen->resource_create_with_modifiers(pipe->screen,
+ &templ, modifiers,
+ modifiers_count);
+ else
+ resources[0] = pipe->screen->resource_create(pipe->screen, &templ);
if (!resources[0])
return NULL;
diff --git a/lib/mesa/src/gallium/auxiliary/vl/vl_winsys_dri.c b/lib/mesa/src/gallium/auxiliary/vl/vl_winsys_dri.c
index 1905516a7..091395d27 100644
--- a/lib/mesa/src/gallium/auxiliary/vl/vl_winsys_dri.c
+++ b/lib/mesa/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -42,7 +42,7 @@
#include "pipe/p_context.h"
#include "pipe/p_state.h"
#include "pipe-loader/pipe_loader.h"
-#include "state_tracker/drm_driver.h"
+#include "frontend/drm_driver.h"
#include "util/u_memory.h"
#include "util/crc32.h"
@@ -52,6 +52,8 @@
#include "vl/vl_compositor.h"
#include "vl/vl_winsys.h"
+#include "drm-uapi/drm_fourcc.h"
+
struct vl_dri_screen
{
struct vl_screen base;
@@ -118,6 +120,7 @@ vl_dri2_get_flush_reply(struct vl_dri_screen *scrn)
static void
vl_dri2_flush_frontbuffer(struct pipe_screen *screen,
+ struct pipe_context *pipe,
struct pipe_resource *resource,
unsigned level, unsigned layer,
void *context_private, struct pipe_box *sub_box)
@@ -183,7 +186,7 @@ vl_dri2_screen_texture_from_drawable(struct vl_screen *vscreen, void *drawable)
struct pipe_resource templ, *tex;
xcb_dri2_get_buffers_reply_t *reply;
- xcb_dri2_dri2_buffer_t *buffers, *back_left;
+ xcb_dri2_dri2_buffer_t *buffers, *back_left = NULL;
unsigned depth = ((xcb_screen_t *)(vscreen->xcb_screen))->root_depth;
unsigned i;
@@ -214,7 +217,7 @@ vl_dri2_screen_texture_from_drawable(struct vl_screen *vscreen, void *drawable)
}
}
- if (i == reply->count) {
+ if (i == reply->count || !back_left) {
free(reply);
return NULL;
}
@@ -234,6 +237,7 @@ vl_dri2_screen_texture_from_drawable(struct vl_screen *vscreen, void *drawable)
dri2_handle.type = WINSYS_HANDLE_TYPE_SHARED;
dri2_handle.handle = back_left->name;
dri2_handle.stride = back_left->pitch;
+ dri2_handle.modifier = DRM_FORMAT_MOD_INVALID;
memset(&templ, 0, sizeof(templ));
templ.target = PIPE_TEXTURE_2D;
diff --git a/lib/mesa/src/gallium/auxiliary/vl/vl_winsys_dri3.c b/lib/mesa/src/gallium/auxiliary/vl/vl_winsys_dri3.c
index 45a979e1b..1866dbc41 100644
--- a/lib/mesa/src/gallium/auxiliary/vl/vl_winsys_dri3.c
+++ b/lib/mesa/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -45,6 +45,8 @@
#include "vl/vl_compositor.h"
#include "vl/vl_winsys.h"
+#include "drm-uapi/drm_fourcc.h"
+
#define BACK_BUFFER_NUM 3
struct vl_dri3_buffer
@@ -492,6 +494,7 @@ dri3_get_front_buffer(struct vl_dri3_screen *scrn)
whandle.type = WINSYS_HANDLE_TYPE_FD;
whandle.handle = (unsigned)fds[0];
whandle.stride = bp_reply->stride;
+ whandle.modifier = DRM_FORMAT_MOD_INVALID;
memset(&templ, 0, sizeof(templ));
templ.bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
templ.format = vl_dri2_format_for_depth(&scrn->base, bp_reply->depth);
@@ -552,6 +555,7 @@ dri3_get_screen_for_root(xcb_connection_t *conn, xcb_window_t root)
static void
vl_dri3_flush_frontbuffer(struct pipe_screen *screen,
+ struct pipe_context *pipe,
struct pipe_resource *resource,
unsigned level, unsigned layer,
void *context_private, struct pipe_box *sub_box)
diff --git a/lib/mesa/src/gallium/auxiliary/vl/vl_winsys_drm.c b/lib/mesa/src/gallium/auxiliary/vl/vl_winsys_drm.c
index 9014b97bd..bae0405e1 100644
--- a/lib/mesa/src/gallium/auxiliary/vl/vl_winsys_drm.c
+++ b/lib/mesa/src/gallium/auxiliary/vl/vl_winsys_drm.c
@@ -29,7 +29,7 @@
#include "pipe/p_screen.h"
#include "pipe-loader/pipe_loader.h"
-#include "state_tracker/drm_driver.h"
+#include "frontend/drm_driver.h"
#include "util/u_memory.h"
#include "vl/vl_winsys.h"
diff --git a/lib/mesa/src/gallium/auxiliary/vl/vl_zscan.c b/lib/mesa/src/gallium/auxiliary/vl/vl_zscan.c
index 769fc71ff..d225265d0 100644
--- a/lib/mesa/src/gallium/auxiliary/vl/vl_zscan.c
+++ b/lib/mesa/src/gallium/auxiliary/vl/vl_zscan.c
@@ -410,7 +410,7 @@ vl_zscan_layout(struct pipe_context *pipe, const int layout[64], unsigned blocks
goto error_resource;
f = pipe->transfer_map(pipe, res,
- 0, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE,
+ 0, PIPE_MAP_WRITE | PIPE_MAP_DISCARD_RANGE,
&rect, &buf_transfer);
if (!f)
goto error_map;
@@ -500,6 +500,10 @@ vl_zscan_init_buffer(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer,
buffer->viewport.translate[0] = 0;
buffer->viewport.translate[1] = 0;
buffer->viewport.translate[2] = 0;
+ buffer->viewport.swizzle_x = PIPE_VIEWPORT_SWIZZLE_POSITIVE_X;
+ buffer->viewport.swizzle_y = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Y;
+ buffer->viewport.swizzle_z = PIPE_VIEWPORT_SWIZZLE_POSITIVE_Z;
+ buffer->viewport.swizzle_w = PIPE_VIEWPORT_SWIZZLE_POSITIVE_W;
buffer->fb_state.width = dst->width;
buffer->fb_state.height = dst->height;
@@ -576,8 +580,8 @@ vl_zscan_upload_quant(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer,
rect.width *= zscan->blocks_per_line;
data = pipe->transfer_map(pipe, buffer->quant->texture,
- 0, PIPE_TRANSFER_WRITE |
- PIPE_TRANSFER_DISCARD_RANGE,
+ 0, PIPE_MAP_WRITE |
+ PIPE_MAP_DISCARD_RANGE,
&rect, &buf_transfer);
if (!data)
return;
@@ -604,7 +608,7 @@ vl_zscan_render(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, unsigned
zscan->pipe->set_framebuffer_state(zscan->pipe, &buffer->fb_state);
zscan->pipe->set_viewport_states(zscan->pipe, 0, 1, &buffer->viewport);
zscan->pipe->set_sampler_views(zscan->pipe, PIPE_SHADER_FRAGMENT,
- 0, 3, &buffer->src);
+ 0, 3, 0, &buffer->src);
zscan->pipe->bind_vs_state(zscan->pipe, zscan->vs);
zscan->pipe->bind_fs_state(zscan->pipe, zscan->fs);
util_draw_arrays_instanced(zscan->pipe, PIPE_PRIM_QUADS, 0, 4, 0, num_instances);