mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 08:10:10 +01:00
gl-renderer: Obscure protected content on unprotected display
The content protection protocol requires that in enforced mode, parts of the surfaces which lie on outputs with protection level lower than that of the surface be censored. This patch uses a solid shader to color such regions with dark red. Signed-off-by: Harish Krupo <harishkrupo@gmail.com>
This commit is contained in:
parent
2844f8eaaf
commit
62626cbfec
1 changed files with 16 additions and 0 deletions
|
|
@ -955,6 +955,8 @@ draw_view(struct weston_view *ev, struct weston_output *output,
|
|||
pixman_region32_t surface_blend;
|
||||
GLint filter;
|
||||
int i;
|
||||
bool shader_replaced = false;
|
||||
struct gl_shader *tmp_shader = NULL;
|
||||
|
||||
/* In case of a runtime switch of renderers, we may not have received
|
||||
* an attach for this surface since the switch. In that case we don't
|
||||
|
|
@ -973,6 +975,17 @@ draw_view(struct weston_view *ev, struct weston_output *output,
|
|||
if (ensure_surface_buffer_is_ready(gr, gs) < 0)
|
||||
goto out;
|
||||
|
||||
if (ev->surface->protection_mode == WESTON_SURFACE_PROTECTION_MODE_ENFORCED &&
|
||||
ev->surface->desired_protection > output->current_protection) {
|
||||
tmp_shader = gs->shader;
|
||||
shader_replaced = true;
|
||||
gs->color[0] = 0.40;
|
||||
gs->color[1] = 0.0;
|
||||
gs->color[2] = 0.0;
|
||||
gs->color[3] = 1.0;
|
||||
gs->shader = &gr->solid_shader;
|
||||
}
|
||||
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (gr->fan_debug) {
|
||||
|
|
@ -1046,6 +1059,9 @@ draw_view(struct weston_view *ev, struct weston_output *output,
|
|||
|
||||
out:
|
||||
pixman_region32_fini(&repaint);
|
||||
|
||||
if (shader_replaced)
|
||||
gs->shader = tmp_shader;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue