mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
gallium/vl: Remove luma key support
This was only used for VDPAU. Acked-by: Ruijing Dong <ruijing.dong@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37058>
This commit is contained in:
parent
69717c257f
commit
a46aeff216
4 changed files with 10 additions and 33 deletions
|
|
@ -510,14 +510,11 @@ vl_compositor_cleanup(struct vl_compositor *c)
|
|||
|
||||
bool
|
||||
vl_compositor_set_csc_matrix(struct vl_compositor_state *s,
|
||||
vl_csc_matrix const *matrix,
|
||||
float luma_min, float luma_max)
|
||||
vl_csc_matrix const *matrix)
|
||||
{
|
||||
assert(s);
|
||||
|
||||
memcpy(&s->csc_matrix, matrix, sizeof(vl_csc_matrix));
|
||||
s->luma_min = luma_min;
|
||||
s->luma_max = luma_max;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -888,7 +885,7 @@ vl_compositor_init_state(struct vl_compositor_state *s, struct pipe_context *pip
|
|||
pipe->screen,
|
||||
PIPE_BIND_CONSTANT_BUFFER,
|
||||
PIPE_USAGE_DEFAULT,
|
||||
sizeof(vl_csc_matrix) * 3 + 30 * sizeof(float) + 4 * sizeof(int)
|
||||
sizeof(vl_csc_matrix) * 3 + 28 * sizeof(float) + 4 * sizeof(int)
|
||||
);
|
||||
|
||||
if (!s->shader_params)
|
||||
|
|
@ -899,7 +896,7 @@ vl_compositor_init_state(struct vl_compositor_state *s, struct pipe_context *pip
|
|||
vl_csc_get_rgbyuv_matrix(PIPE_VIDEO_VPP_MCF_BT709, PIPE_FORMAT_NV12, PIPE_FORMAT_B8G8R8A8_UNORM,
|
||||
PIPE_VIDEO_VPP_CHROMA_COLOR_RANGE_REDUCED, PIPE_VIDEO_VPP_CHROMA_COLOR_RANGE_FULL,
|
||||
&csc_matrix);
|
||||
if (!vl_compositor_set_csc_matrix(s, (const vl_csc_matrix *)&csc_matrix, 1.0f, 0.0f))
|
||||
if (!vl_compositor_set_csc_matrix(s, (const vl_csc_matrix *)&csc_matrix))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -138,7 +138,6 @@ struct vl_compositor_state
|
|||
vl_csc_matrix primaries;
|
||||
|
||||
vl_csc_matrix csc_matrix;
|
||||
float luma_min, luma_max;
|
||||
};
|
||||
|
||||
struct vl_compositor
|
||||
|
|
@ -229,8 +228,7 @@ vl_compositor_init_state(struct vl_compositor_state *state, struct pipe_context
|
|||
*/
|
||||
bool
|
||||
vl_compositor_set_csc_matrix(struct vl_compositor_state *settings,
|
||||
const vl_csc_matrix *matrix,
|
||||
float luma_min, float luma_max);
|
||||
const vl_csc_matrix *matrix);
|
||||
|
||||
/**
|
||||
* reset dirty area, so it's cleared with the clear colour
|
||||
|
|
|
|||
|
|
@ -84,8 +84,6 @@ static nir_def *cs_create_shader(struct vl_compositor *c, struct cs_shader *s)
|
|||
layout (std140, binding = 0) uniform ubo
|
||||
{
|
||||
vec4 yuv2rgb[3]; // params[0-2]
|
||||
float luma_min; // params[3].x
|
||||
float luma_max; // params[3].y
|
||||
vec2 chroma_offset; // params[3].zw
|
||||
int trc_in; // params[4].x
|
||||
int trc_out; // params[4].y
|
||||
|
|
@ -198,19 +196,6 @@ static inline nir_def *cs_proj(struct cs_shader *s, nir_def *src, unsigned flags
|
|||
return nir_vec3(b, x, y, s->fzero);
|
||||
}
|
||||
|
||||
static inline nir_def *cs_luma_key(struct cs_shader *s, nir_def *src)
|
||||
{
|
||||
/*
|
||||
bool luma_min = params[3].x >= src;
|
||||
bool luma_max = params[3].y < src;
|
||||
return float(luma_min || luma_max);
|
||||
*/
|
||||
nir_builder *b = &s->b;
|
||||
nir_def *luma_min = nir_fge(b, nir_channel(b, s->params[3], 0), src);
|
||||
nir_def *luma_max = nir_flt(b, nir_channel(b, s->params[3], 1), src);
|
||||
return nir_b2f32(b, nir_ior(b, luma_min, luma_max));
|
||||
}
|
||||
|
||||
static inline nir_def *cs_chroma_offset(struct cs_shader *s, nir_def *src, unsigned flags)
|
||||
{
|
||||
/*
|
||||
|
|
@ -496,13 +481,11 @@ static void *create_video_buffer_shader(struct vl_compositor *c)
|
|||
for (unsigned i = 0; i < 3; ++i)
|
||||
col[i] = cs_fetch_texel(&s, pos[MIN2(i, 1)], i);
|
||||
|
||||
nir_def *alpha = cs_luma_key(&s, col[2]);
|
||||
|
||||
nir_def *color = nir_vec4(b, col[0], col[1], col[2], s.fone);
|
||||
for (unsigned i = 0; i < 3; ++i)
|
||||
col[i] = cs_color_conversion(&s, color, i, YUV2RGB);
|
||||
|
||||
color = nir_vec4(b, col[0], col[1], col[2], alpha);
|
||||
color = nir_vec4(b, col[0], col[1], col[2], s.fone);
|
||||
color = cs_prim_trc_conversion(&s, color);
|
||||
cs_image_store(&s, cs_translate(&s, ipos), color);
|
||||
|
||||
|
|
@ -743,10 +726,9 @@ static nir_def *create_weave_shader(struct vl_compositor *c, bool rgb, bool y)
|
|||
nir_def *color = nir_flrp(b, color_down, color_top, tex_layer);
|
||||
|
||||
if (rgb) {
|
||||
nir_def *alpha = cs_luma_key(&s, nir_channel(b, color, 2));
|
||||
for (unsigned i = 0; i < 3; ++i)
|
||||
col[i] = cs_color_conversion(&s, color, i, YUV2RGB);
|
||||
color = nir_vec4(b, col[0], col[1], col[2], alpha);
|
||||
color = nir_vec4(b, col[0], col[1], col[2], s.fone);
|
||||
} else if (y) {
|
||||
color = nir_channel(b, color, 0);
|
||||
} else {
|
||||
|
|
@ -963,8 +945,8 @@ set_viewport(struct vl_compositor_state *s,
|
|||
|
||||
float *ptr_float = (float *)ptr;
|
||||
ptr_float += sizeof(vl_csc_matrix) / sizeof(float);
|
||||
*ptr_float++ = s->luma_min;
|
||||
*ptr_float++ = s->luma_max;
|
||||
|
||||
ptr_float += 2; /* pad */
|
||||
*ptr_float++ = drawn->chroma_offset_x;
|
||||
*ptr_float++ = drawn->chroma_offset_y;
|
||||
|
||||
|
|
|
|||
|
|
@ -661,8 +661,8 @@ set_csc_matrix(struct vl_compositor_state *s)
|
|||
memcpy(ptr, &s->csc_matrix, sizeof(vl_csc_matrix));
|
||||
|
||||
ptr += sizeof(vl_csc_matrix) / sizeof(float);
|
||||
*ptr++ = s->luma_min;
|
||||
*ptr++ = s->luma_max;
|
||||
*ptr++ = 0.0f; /* luma_min */
|
||||
*ptr++ = 1.0f; /* luma_max */
|
||||
|
||||
pipe_buffer_unmap(s->pipe, buf_transfer);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue