<div dir="ltr">This patch is:<br>Reviewed-by: Julien Isorce <<a href="mailto:j.isorce@samsung.com">j.isorce@samsung.com</a>><br>Tested-by: Julien Isorce <<a href="mailto:j.isorce@samsung.com">j.isorce@samsung.com</a>></div><div class="gmail_extra"><br><div class="gmail_quote">On 11 December 2015 at 12:33, Christian König <span dir="ltr"><<a href="mailto:deathsimple@vodafone.de" target="_blank">deathsimple@vodafone.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Christian König <<a href="mailto:christian.koenig@amd.com">christian.koenig@amd.com</a>><br>
<br>
Avoid referencing NULL pointers.<br>
<br>
Signed-off-by: Christian König <<a href="mailto:christian.koenig@amd.com">christian.koenig@amd.com</a>><br>
---<br>
 src/gallium/state_trackers/va/postproc.c | 36 +++++++++++++++++++++++++-------<br>
 1 file changed, 28 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/src/gallium/state_trackers/va/postproc.c b/src/gallium/state_trackers/va/postproc.c<br>
index 2d17694..105f251 100644<br>
--- a/src/gallium/state_trackers/va/postproc.c<br>
+++ b/src/gallium/state_trackers/va/postproc.c<br>
@@ -29,9 +29,26 @@<br>
<br>
 #include "va_private.h"<br>
<br>
+static const VARectangle *<br>
+vlVaRegionDefault(const VARectangle *region, struct pipe_video_buffer *buf,<br>
+                 VARectangle *def)<br>
+{<br>
+   if (region)<br>
+      return region;<br>
+<br>
+   def->x = 0;<br>
+   def->y = 0;<br>
+   def->width = buf->width;<br>
+   def->height = buf->height;<br>
+<br>
+   return def;<br>
+}<br>
+<br>
 VAStatus<br>
 vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)<br>
 {<br>
+   VARectangle def_src_region, def_dst_region;<br>
+   const VARectangle *src_region, *dst_region;<br>
    struct u_rect src_rect;<br>
    struct u_rect dst_rect;<br>
    vlVaSurface *src_surface;<br>
@@ -64,15 +81,18 @@ vlVaHandleVAProcPipelineParameterBufferType(vlVaDriver *drv, vlVaContext *contex<br>
<br>
    psurf = surfaces[0];<br>
<br>
-   src_rect.x0 = pipeline_param->surface_region->x;<br>
-   src_rect.y0 = pipeline_param->surface_region->y;<br>
-   src_rect.x1 = pipeline_param->surface_region->x + pipeline_param->surface_region->width;<br>
-   src_rect.y1 = pipeline_param->surface_region->y + pipeline_param->surface_region->height;<br>
+   src_region = vlVaRegionDefault(pipeline_param->surface_region, src_surface->buffer, &def_src_region);<br>
+   dst_region = vlVaRegionDefault(pipeline_param->output_region, context->target, &def_dst_region);<br>
+<br>
+   src_rect.x0 = src_region->x;<br>
+   src_rect.y0 = src_region->y;<br>
+   src_rect.x1 = src_region->x + src_region->width;<br>
+   src_rect.y1 = src_region->y + src_region->height;<br>
<br>
-   dst_rect.x0 = pipeline_param->output_region->x;<br>
-   dst_rect.y0 = pipeline_param->output_region->y;<br>
-   dst_rect.x1 = pipeline_param->output_region->x + pipeline_param->output_region->width;<br>
-   dst_rect.y1 = pipeline_param->output_region->y + pipeline_param->output_region->height;<br>
+   dst_rect.x0 = dst_region->x;<br>
+   dst_rect.y0 = dst_region->y;<br>
+   dst_rect.x1 = dst_region->x + dst_region->width;<br>
+   dst_rect.y1 = dst_region->y + dst_region->height;<br>
<br>
    vl_compositor_clear_layers(&drv->cstate);<br>
    vl_compositor_set_buffer_layer(&drv->cstate, &drv->compositor, 0, src_surface->buffer, &src_rect, NULL, VL_COMPOSITOR_WEAVE);<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>