[Mesa-dev] [Mesa-stable] [PATCH] st/va: use pipe transfer_map to upload mapped buffer
Leo Liu
leo.liu at amd.com
Wed Sep 27 12:53:10 UTC 2017
On 2017-09-27 04:30 AM, Marek Olšák wrote:
> Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Thanks for the review.
>
> If a 3D or array texture can't occur here, it would be better to set
> box.depth = 1.
The case here is to map a derived image, which is a RGB surface with
format "PIPE_FORMAT_B8G8R8X8_UNORM", and the depth is set to 1, when
allocating.
so the resource->depth0 can address that.
For the array texture case like interlaced NV12 surface will not get
here, because this is not supported by vaDeriveImage, and it goes to
vaCreateImage and vaGetImage path.
Leo
> If a 3D texture can't occur here but an array texture
> can, it needs to be box.depth = resource->array_size.
>
> Marek
>
> On Tue, Sep 26, 2017 at 5:04 PM, Leo Liu <leo.liu at amd.com> wrote:
>> The function pipe_buffer_map() is only for linear pipe buffer,
>> with height as 0, and it's not for any 2D textures.
>>
>> Signed-off-by: Leo Liu <leo.liu at amd.com>
>> Cc: mesa-stable at lists.freedesktop.org
>> Cc: Mark Thompson <sw at jkqxz.net>
>> ---
>> src/gallium/state_trackers/va/buffer.c | 12 +++++++++---
>> 1 file changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/gallium/state_trackers/va/buffer.c b/src/gallium/state_trackers/va/buffer.c
>> index fb5b20e44b..deaeb1939f 100644
>> --- a/src/gallium/state_trackers/va/buffer.c
>> +++ b/src/gallium/state_trackers/va/buffer.c
>> @@ -125,9 +125,15 @@ vlVaMapBuffer(VADriverContextP ctx, VABufferID buf_id, void **pbuff)
>> }
>>
>> if (buf->derived_surface.resource) {
>> - *pbuff = pipe_buffer_map(drv->pipe, buf->derived_surface.resource,
>> - PIPE_TRANSFER_WRITE,
>> - &buf->derived_surface.transfer);
>> + struct pipe_resource *resource;
>> + struct pipe_box box = {};
>> +
>> + resource = buf->derived_surface.resource;
>> + box.width = resource->width0;
>> + box.height = resource->height0;
>> + box.depth = resource->depth0;
>> + *pbuff = drv->pipe->transfer_map(drv->pipe, resource, 0, PIPE_TRANSFER_WRITE,
>> + &box, &buf->derived_surface.transfer);
>> mtx_unlock(&drv->mutex);
>>
>> if (!buf->derived_surface.transfer || !*pbuff)
>> --
>> 2.11.0
>>
>> _______________________________________________
>> mesa-stable mailing list
>> mesa-stable at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-stable
More information about the mesa-dev
mailing list