diff options
author | Nayan Deshmukh <[email protected]> | 2017-01-03 16:17:45 +0530 |
---|---|---|
committer | Christian König <[email protected]> | 2017-01-03 12:02:15 +0100 |
commit | cee5af93ee5ea9e3c4dd19047952fec6bcfed2b6 (patch) | |
tree | 9000fa43de9c2b34c90e49dd14a21bd4fb625003 /src | |
parent | 1a83e9892dd4b3a1895ede1b2d3d5fac01d56dc3 (diff) |
vl/compositor: implement error handling
pipe_buffer_map and pipe_buffer_create may return NULL
Signed-off-by: Nayan Deshmukh <[email protected]>
Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/auxiliary/vl/vl_compositor.c | 13 | ||||
-rw-r--r-- | src/gallium/auxiliary/vl/vl_compositor.h | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 03a0a6453bd..297c3ab9dc7 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -919,7 +919,7 @@ vl_compositor_cleanup(struct vl_compositor *c) cleanup_pipe_state(c); } -void +bool vl_compositor_set_csc_matrix(struct vl_compositor_state *s, vl_csc_matrix const *matrix, float luma_min, float luma_max) @@ -932,6 +932,9 @@ vl_compositor_set_csc_matrix(struct vl_compositor_state *s, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD_RANGE, &buf_transfer); + if (!ptr) + return false; + memcpy(ptr, matrix, sizeof(vl_csc_matrix)); ptr += sizeof(vl_csc_matrix)/sizeof(float); @@ -939,6 +942,8 @@ vl_compositor_set_csc_matrix(struct vl_compositor_state *s, ptr[1] = luma_max; pipe_buffer_unmap(s->pipe, buf_transfer); + + return true; } void @@ -1246,10 +1251,14 @@ vl_compositor_init_state(struct vl_compositor_state *s, struct pipe_context *pip sizeof(csc_matrix) + 2*sizeof(float) ); + if (!s->csc_matrix) + return false; + vl_compositor_clear_layers(s); vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_IDENTITY, NULL, true, &csc_matrix); - 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, 1.0f, 0.0f)) + return false; return true; } diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h index ceab5e00471..54606190fda 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.h +++ b/src/gallium/auxiliary/vl/vl_compositor.h @@ -142,7 +142,7 @@ vl_compositor_init_state(struct vl_compositor_state *state, struct pipe_context /** * set yuv -> rgba conversion matrix */ -void +bool vl_compositor_set_csc_matrix(struct vl_compositor_state *settings, const vl_csc_matrix *matrix, float luma_min, float luma_max); |