[Mesa-dev] [PATCH] vl: u_upload_alloc might fail to allocate buffer in bicubic filter

Marek Olšák maraeo at gmail.com
Wed Feb 22 20:16:21 UTC 2017


OK sounds good.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Wed, Feb 22, 2017 at 9:16 PM, Nayan Deshmukh
<nayan26deshmukh at gmail.com> wrote:
> On Thu, Feb 23, 2017 at 1:34 AM, Marek Olšák <maraeo at gmail.com> wrote:
>> It would be better to return from the function in that case.
>>
> We can still execute it as it will display the video properly though
> the edges will be
> a bit jagged but it won't be much noticeable in most cases.
>
> Regards,
> Nayan
>
>
>> Marek
>>
>> On Wed, Feb 22, 2017 at 9:25 AM, Nayan Deshmukh
>> <nayan26deshmukh at gmail.com> wrote:
>>> Signed-off-by: Nayan Deshmukh <nayan26deshmukh at gmail.com>
>>> ---
>>>  src/gallium/auxiliary/vl/vl_bicubic_filter.c | 8 +++++---
>>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c b/src/gallium/auxiliary/vl/vl_bicubic_filter.c
>>> index 570f153..275dd2a 100644
>>> --- a/src/gallium/auxiliary/vl/vl_bicubic_filter.c
>>> +++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c
>>> @@ -416,14 +416,16 @@ vl_bicubic_filter_render(struct vl_bicubic_filter *filter,
>>>     viewport.scale[2] = 1;
>>>
>>>     struct pipe_constant_buffer cb = {};
>>> -   float *ptr;
>>> +   float *ptr = NULL;
>>>
>>>     u_upload_alloc(filter->pipe->const_uploader, 0, 2 * sizeof(float), 256,
>>>                    &cb.buffer_offset, &cb.buffer, (void**)&ptr);
>>>     cb.buffer_size = 2 * sizeof(float);
>>>
>>> -   ptr[0] = 0.5f/viewport.scale[0];
>>> -   ptr[1] = 0.5f/viewport.scale[1];
>>> +   if (ptr) {
>>> +      ptr[0] = 0.5f/viewport.scale[0];
>>> +      ptr[1] = 0.5f/viewport.scale[1];
>>> +   }
>>>     u_upload_unmap(filter->pipe->const_uploader);
>>>
>>>     memset(&fb_state, 0, sizeof(fb_state));
>>> --
>>> 2.9.3
>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list