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>
dev
Harish Krupo 6 years ago committed by Ankit Nautiyal
parent 2844f8eaaf
commit 62626cbfec
  1. 16
      libweston/renderer-gl/gl-renderer.c

@ -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…
Cancel
Save