Commit 62626cbf authored by Harish Krupo's avatar Harish Krupo Committed by Ankit Nautiyal

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's avatarHarish Krupo <harishkrupo@gmail.com>
parent 2844f8ea
...@@ -955,6 +955,8 @@ draw_view(struct weston_view *ev, struct weston_output *output, ...@@ -955,6 +955,8 @@ draw_view(struct weston_view *ev, struct weston_output *output,
pixman_region32_t surface_blend; pixman_region32_t surface_blend;
GLint filter; GLint filter;
int i; 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 /* 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 * 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, ...@@ -973,6 +975,17 @@ draw_view(struct weston_view *ev, struct weston_output *output,
if (ensure_surface_buffer_is_ready(gr, gs) < 0) if (ensure_surface_buffer_is_ready(gr, gs) < 0)
goto out; 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); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
if (gr->fan_debug) { if (gr->fan_debug) {
...@@ -1046,6 +1059,9 @@ draw_view(struct weston_view *ev, struct weston_output *output, ...@@ -1046,6 +1059,9 @@ draw_view(struct weston_view *ev, struct weston_output *output,
out: out:
pixman_region32_fini(&repaint); pixman_region32_fini(&repaint);
if (shader_replaced)
gs->shader = tmp_shader;
} }
static void static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment