<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Jan 11, 2018 1:45 PM, "Rob Clark" <<a href="mailto:robdclark@gmail.com">robdclark@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="elided-text">On Wed, Jan 10, 2018 at 4:41 PM, Marek Olšák <<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>> wrote:<br>
> On Wed, Jan 10, 2018 at 9:36 PM, Rob Clark <<a href="mailto:robdclark@gmail.com">robdclark@gmail.com</a>> wrote:<br>
>> On Wed, Jan 10, 2018 at 3:33 PM, Rob Clark <<a href="mailto:robdclark@gmail.com">robdclark@gmail.com</a>> wrote:<br>
>>> On Wed, Jan 10, 2018 at 2:49 PM, Marek Olšák <<a href="mailto:maraeo@gmail.com">maraeo@gmail.com</a>> wrote:<br>
>>>> From: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>><br>
>>>><br>
>>>> ---<br>
>>>>  src/gallium/drivers/freedreno/<wbr>freedreno_screen.c |  4 +---<br>
>>>>  src/gallium/drivers/freedreno/<wbr>freedreno_state.c  | 13 +++++++++++++<br>
>>>>  2 files changed, 14 insertions(+), 3 deletions(-)<br>
>>>><br>
>>>> diff --git a/src/gallium/drivers/<wbr>freedreno/freedreno_screen.c b/src/gallium/drivers/<wbr>freedreno/freedreno_screen.c<br>
>>>> index 315b73a..639fbe7 100644<br>
>>>> --- a/src/gallium/drivers/<wbr>freedreno/freedreno_screen.c<br>
>>>> +++ b/src/gallium/drivers/<wbr>freedreno/freedreno_screen.c<br>
>>>> @@ -177,28 +177,26 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)<br>
>>>>         case PIPE_CAP_VERTEX_COLOR_<wbr>UNCLAMPED:<br>
>>>>         case PIPE_CAP_QUADS_FOLLOW_<wbr>PROVOKING_VERTEX_CONVENTION:<br>
>>>>         case PIPE_CAP_VERTEX_BUFFER_OFFSET_<wbr>4BYTE_ALIGNED_ONLY:<br>
>>>>         case PIPE_CAP_VERTEX_BUFFER_STRIDE_<wbr>4BYTE_ALIGNED_ONLY:<br>
>>>>         case PIPE_CAP_VERTEX_ELEMENT_SRC_<wbr>OFFSET_4BYTE_ALIGNED_ONLY:<br>
>>>>         case PIPE_CAP_BUFFER_MAP_<wbr>PERSISTENT_COHERENT:<br>
>>>>         case PIPE_CAP_STRING_MARKER:<br>
>>>>         case PIPE_CAP_MIXED_COLOR_DEPTH_<wbr>BITS:<br>
>>>>         case PIPE_CAP_TEXTURE_BARRIER:<br>
>>>>         case PIPE_CAP_INVALIDATE_BUFFER:<br>
>>>> +       case PIPE_CAP_USER_CONSTANT_<wbr>BUFFERS:<br>
>>>>                 return 1;<br>
>>>><br>
>>>>         case PIPE_CAP_VERTEXID_NOBASE:<br>
>>>>                 return is_a3xx(screen) || is_a4xx(screen);<br>
>>>><br>
>>>> -       case PIPE_CAP_USER_CONSTANT_<wbr>BUFFERS:<br>
>>>> -               return is_a4xx(screen) ? 0 : 1;<br>
>>>> -<br>
>>>>         case PIPE_CAP_COMPUTE:<br>
>>>>                 return has_compute(screen);<br>
>>>><br>
>>>>         case PIPE_CAP_SHADER_STENCIL_<wbr>EXPORT:<br>
>>>>         case PIPE_CAP_TGSI_TEXCOORD:<br>
>>>>         case PIPE_CAP_PREFER_BLIT_BASED_<wbr>TEXTURE_TRANSFER:<br>
>>>>         case PIPE_CAP_TEXTURE_MULTISAMPLE:<br>
>>>>         case PIPE_CAP_TEXTURE_MIRROR_CLAMP:<br>
>>>>         case PIPE_CAP_QUERY_MEMORY_INFO:<br>
>>>>         case PIPE_CAP_PCI_GROUP:<br>
>>>> diff --git a/src/gallium/drivers/<wbr>freedreno/freedreno_state.c b/src/gallium/drivers/<wbr>freedreno/freedreno_state.c<br>
>>>> index dd42aa0..9f0c490 100644<br>
>>>> --- a/src/gallium/drivers/<wbr>freedreno/freedreno_state.c<br>
>>>> +++ b/src/gallium/drivers/<wbr>freedreno/freedreno_state.c<br>
>>>> @@ -24,20 +24,21 @@<br>
>>>>   *<br>
>>>>   * Authors:<br>
>>>>   *    Rob Clark <<a href="mailto:robclark@freedesktop.org">robclark@freedesktop.org</a>><br>
>>>>   */<br>
>>>><br>
>>>>  #include "pipe/p_state.h"<br>
>>>>  #include "util/u_dual_blend.h"<br>
>>>>  #include "util/u_string.h"<br>
>>>>  #include "util/u_memory.h"<br>
>>>>  #include "util/u_helpers.h"<br>
>>>> +#include "util/u_upload_mgr.h"<br>
>>>><br>
>>>>  #include "freedreno_state.h"<br>
>>>>  #include "freedreno_context.h"<br>
>>>>  #include "freedreno_resource.h"<br>
>>>>  #include "freedreno_texture.h"<br>
>>>>  #include "freedreno_gmem.h"<br>
>>>>  #include "freedreno_query_hw.h"<br>
>>>>  #include "freedreno_util.h"<br>
>>>><br>
>>>>  /* All the generic state handling.. In case of CSO's that are specific<br>
>>>> @@ -88,20 +89,32 @@ fd_set_sample_mask(struct pipe_context *pctx, unsigned sample_mask)<br>
>>>>   * previous values.<br>
>>>>   * index>0 will be UBO's.. well, I'll worry about that later<br>
>>>>   */<br>
>>>>  static void<br>
>>>>  fd_set_constant_buffer(struct pipe_context *pctx,<br>
>>>>                 enum pipe_shader_type shader, uint index,<br>
>>>>                 const struct pipe_constant_buffer *cb)<br>
>>>>  {<br>
>>>>         struct fd_context *ctx = fd_context(pctx);<br>
>>>>         struct fd_constbuf_stateobj *so = &ctx->constbuf[shader];<br>
>>>> +       struct pipe_constant_buffer c;<br>
>>>> +<br>
>>>> +       if (is_a4xx(ctx->screen) && cb && cb->user_buffer) {<br>
>>>> +               c.buffer = NULL;<br>
>>>> +               c.buffer_size = cb->buffer_size;<br>
>>>> +               c.user_buffer = NULL;<br>
>>>> +<br>
>>>> +               u_upload_data(pctx->const_<wbr>uploader, 0, cb->buffer_size, 64,<br>
>>>> +                             cb->user_buffer, &c.buffer_offset, &c.buffer);<br>
>>>> +               u_upload_unmap(pctx->const_<wbr>uploader);<br>
>>>> +               cb = &c;<br>
>>>> +       }<br>
>>><br>
>>> It's probably ok to just drop this.. actually all of a3xx+ can do<br>
>>> non-user uniform buffer (I just haven't worked out the alignment<br>
>>> constraints on other gens)..<br>
>>><br>
>>> Really I just wanted a way to say kinda the opposite thing as this cap<br>
>>> to the state tracker (ie. that I could do both user and non-user)<br>
>>><br>
>><br>
>> btw, wouldn't u_threaded prefer non-user cb's?  That way you get a<br>
>> refcnt'd ptr to pass thru the queue between threads..<br>
>><br>
>> (That was kinda why I originally added non-user cb support in a4xx,<br>
>> when I was experimenting w/ a generic render reordering pipe driver<br>
>> shim thing)<br>
><br>
> u_threaded takes care of uploading user constant buffers.<br>
><br>
<br>
</div>yeah, so same approach that I took..<br>
<br>
I do kinda think we should probably have two different caps, one for<br>
whether driver supports user buffers, and one for whether it supports<br>
uploaded buffers.  (Or is adreno the only one that can either upload<br>
uniforms via cmdstream or via pointer in cmdstream?)<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">I prefer to have no caps. All drivers should support both.</div><div dir="auto"><br></div><div dir="auto">M.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
BR,<br>
-R<br>
</blockquote></div><br></div></div></div>