All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tobias Klausmann <tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
To: Ilia Mirkin <imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 1/2] nv30/draw: rework some of the output vertex buffer logic
Date: Tue, 26 May 2015 02:42:04 +0200	[thread overview]
Message-ID: <5563C15C.102@mni.thm.de> (raw)
In-Reply-To: <1432582152-29389-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>



On 25.05.2015 21:29, Ilia Mirkin wrote:
> This makes the vertex buffer go to GART, not VRAM, and redoes the
> mapping to not use the UNSYNCHRONIZED access (which is meaningless on a
> VRAM buffer anyways). While we're at it, add some flushes for VBO data.
>
> Moving the vertex buffer from VRAM to GART makes glxgears work fully
> with NV30_SWTNL=1. The other changes just seem like a good idea. I'm not
> sure *why* moving the buffer from VRAM makes it work... perhaps
> something doesn't get flushed in time? However this is a single use by
> the GPU buffer, so STREAM seems like the correct usage semantic for it.

i'm not really happy moving things to gart and don't see why this 
resolves the issue but granted if it works out :-)

Reviewed-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>

> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
> Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
> ---
>   src/gallium/drivers/nouveau/nv30/nv30_draw.c | 30 +++++++++++++++++++++-------
>   1 file changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_draw.c b/src/gallium/drivers/nouveau/nv30/nv30_draw.c
> index 6a0d06f..a681135 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_draw.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_draw.c
> @@ -71,12 +71,12 @@ nv30_render_allocate_vertices(struct vbuf_render *render,
>      struct nv30_render *r = nv30_render(render);
>      struct nv30_context *nv30 = r->nv30;
>   
> -   r->length = vertex_size * nr_vertices;
> +   r->length = (uint32_t)vertex_size * (uint32_t)nr_vertices;
>   
>      if (r->offset + r->length >= render->max_vertex_buffer_bytes) {
>         pipe_resource_reference(&r->buffer, NULL);
>         r->buffer = pipe_buffer_create(&nv30->screen->base.base,
> -                                     PIPE_BIND_VERTEX_BUFFER, 0,
> +                                     PIPE_BIND_VERTEX_BUFFER, PIPE_USAGE_STREAM,
>                                        render->max_vertex_buffer_bytes);
>         if (!r->buffer)
>            return FALSE;
> @@ -91,10 +91,14 @@ static void *
>   nv30_render_map_vertices(struct vbuf_render *render)
>   {
>      struct nv30_render *r = nv30_render(render);
> -   char *map = pipe_buffer_map(&r->nv30->base.pipe, r->buffer,
> -                               PIPE_TRANSFER_WRITE |
> -                               PIPE_TRANSFER_UNSYNCHRONIZED, &r->transfer);
> -   return map + r->offset;
> +   char *map = pipe_buffer_map_range(
> +         &r->nv30->base.pipe, r->buffer,
> +         r->offset, r->length,
> +         PIPE_TRANSFER_WRITE |
> +         PIPE_TRANSFER_DISCARD_RANGE,
> +         &r->transfer);
> +   assert(map);
> +   return map;
>   }
>   
>   static void
> @@ -127,12 +131,18 @@ nv30_render_draw_elements(struct vbuf_render *render,
>      for (i = 0; i < r->vertex_info.num_attribs; i++) {
>         PUSH_RESRC(push, NV30_3D(VTXBUF(i)), BUFCTX_VTXTMP,
>                          nv04_resource(r->buffer), r->offset + r->vtxptr[i],
> -                       NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, 0);
> +                       NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, NV30_3D_VTXBUF_DMA1);
>      }
>   
>      if (!nv30_state_validate(nv30, ~0, FALSE))
>         return;
>   
> +   if (nv30->base.vbo_dirty) {
> +      BEGIN_NV04(push, NV30_3D(VTX_CACHE_INVALIDATE_1710), 1);
> +      PUSH_DATA (push, 0);
> +      nv30->base.vbo_dirty = FALSE;
> +   }
> +
>      BEGIN_NV04(push, NV30_3D(VERTEX_BEGIN_END), 1);
>      PUSH_DATA (push, r->prim);
>   
> @@ -178,6 +188,12 @@ nv30_render_draw_arrays(struct vbuf_render *render, unsigned start, uint nr)
>      if (!nv30_state_validate(nv30, ~0, FALSE))
>         return;
>   
> +   if (nv30->base.vbo_dirty) {
> +      BEGIN_NV04(push, NV30_3D(VTX_CACHE_INVALIDATE_1710), 1);
> +      PUSH_DATA (push, 0);
> +      nv30->base.vbo_dirty = FALSE;
> +   }
> +
>      BEGIN_NV04(push, NV30_3D(VERTEX_BEGIN_END), 1);
>      PUSH_DATA (push, r->prim);
>   

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

      parent reply	other threads:[~2015-05-26  0:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-25 19:29 [PATCH 1/2] nv30/draw: rework some of the output vertex buffer logic Ilia Mirkin
2015-05-25 19:29 ` [PATCH 2/2] nv30/draw: switch varying hookup logic to know about texcoords Ilia Mirkin
     [not found]   ` <1432582152-29389-2-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2015-05-26  0:37     ` Tobias Klausmann
     [not found]       ` <5563C04D.7060303-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-05-26  0:49         ` Ilia Mirkin
     [not found]           ` <CAKb7UvhLi_r6A6L1SyjjT8TmuVRW+SS1p1Ewgg2bLJTiuh+zJQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-26  0:55             ` Tobias Klausmann
     [not found]               ` <5563C473.5070207-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2015-05-26  0:59                 ` Ilia Mirkin
     [not found]                   ` <CAKb7Uvh-c=RY=o7MxgayAATKYNPpEB2FFcnNrVm6n5Dk5vGw1g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-26 11:12                     ` Tobias Klausmann
     [not found] ` <1432582152-29389-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2015-05-26  0:42   ` Tobias Klausmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5563C15C.102@mni.thm.de \
    --to=tobias.johannes.klausmann-aqjdnwhu20eelga04laivw@public.gmane.org \
    --cc=imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.