[Mesa-dev] [PATCH v1] i965: Emitting 3DSTATE_SO_BUFFER of 0-size.

Sergii Romantsov sergii.romantsov at globallogic.com
Wed Aug 15 14:15:28 UTC 2018


Hello,
that patch is according to remark:
>
> "Additionally, we probably ought to fix the callers to stop allocating 0
> size BOs.
> It looks like most of them come from the 3DSTATE_SO_BUFFER code,
> where one stream has valid transform feedback info, and the other
> 3 are empty. "


 And seems additional one: https://patchwork.freedesktop.org/patch/244674/


On Wed, Aug 15, 2018 at 3:21 PM, Sergii Romantsov <
sergii.romantsov at gmail.com> wrote:

> Avoided filling of whole structure and bo-allocation if
> size of surface is 0.
>
> Signed-off-by: Sergii Romantsov <sergii.romantsov at globallogic.com>
> ---
>  src/mesa/drivers/dri/i965/genX_state_upload.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c
> b/src/mesa/drivers/dri/i965/genX_state_upload.c
> index ea5ad55..c051848 100644
> --- a/src/mesa/drivers/dri/i965/genX_state_upload.c
> +++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
> @@ -3787,19 +3787,20 @@ genX(upload_3dstate_so_buffers)(struct
> brw_context *brw)
>     for (int i = 0; i < 4; i++) {
>        struct intel_buffer_object *bufferobj =
>           intel_buffer_object(xfb_obj->Buffers[i]);
> +      uint32_t start = xfb_obj->Offset[i];
> +      uint32_t end = ALIGN(start + xfb_obj->Size[i], 4);
> +      uint32_t const size = end - start;
>
> -      if (!bufferobj) {
> +      if (!bufferobj || !size) {
>           brw_batch_emit(brw, GENX(3DSTATE_SO_BUFFER), sob) {
>              sob.SOBufferIndex = i;
>           }
>           continue;
>        }
>
> -      uint32_t start = xfb_obj->Offset[i];
>        assert(start % 4 == 0);
> -      uint32_t end = ALIGN(start + xfb_obj->Size[i], 4);
>        struct brw_bo *bo =
> -         intel_bufferobj_buffer(brw, bufferobj, start, end - start, true);
> +         intel_bufferobj_buffer(brw, bufferobj, start, size, true);
>        assert(end <= bo->size);
>
>        brw_batch_emit(brw, GENX(3DSTATE_SO_BUFFER), sob) {
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>



-- 
Sergii Romantsov
GlobalLogic Inc.
www.globallogic.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180815/b8b6136a/attachment.html>


More information about the mesa-dev mailing list