[Mesa-dev] [Bug 74204] Steam crashes right after upgrading to mesa git driver(oibaf ppa, ubuntu 13.10 64 bit, 3.13 kernel, radeon hd4570)

2014-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=74204

Emil Velikov emil.l.veli...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #4 from Emil Velikov emil.l.veli...@gmail.com ---
Seems like a duplicate of bug 74127.

*** This bug has been marked as a duplicate of bug 74127 ***

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 74127] [bisected] GL programs fail with loader.c:112: asserted_dlsym: Assertion `result' failed.

2014-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=74127

Emil Velikov emil.l.veli...@gmail.com changed:

   What|Removed |Added

 CC||avgd...@gmail.com

--- Comment #7 from Emil Velikov emil.l.veli...@gmail.com ---
*** Bug 74204 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa: Removed unnecessary check for NULL pointer when freeing memory block using _mesa_align_free.

2014-01-30 Thread Siavash Eliasi
Note that it is OK to pass NULL pointers to this function since this commit:

mesa: modified _mesa_align_free() to accept NULL pointer
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f0cc59d68a9f5231e8e2111393a1834858820735
---
 src/mesa/main/bufferobj.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index cde6ac2..06928a0 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -562,8 +562,7 @@ _mesa_buffer_data( struct gl_context *ctx, GLenum target, 
GLsizeiptrARB size,
 
(void) target;
 
-   if (bufObj-Data)
-  _mesa_align_free( bufObj-Data );
+   _mesa_align_free( bufObj-Data );
 
new_data = _mesa_align_malloc( size, ctx-Const.MinMapBufferAlignment );
if (new_data) {
-- 
1.8.5.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl/glx: Remove egl_glx driver

2014-01-30 Thread Pekka Paalanen
On Thu, 30 Jan 2014 02:55:54 +0100
Marek Olšák mar...@gmail.com wrote:

 egl_gallium also seems to have backends for Wayland, DRM, etc. I guess
 this should really be in core Mesa though.

From what I have tested, egl_gallium is also the only way to use
software rendering (llvmpipe) on Wayland. egl_dri2 simply fails, I
guess it cannot use wl_shm buffers.

This is a bit inconvenient, because egl_gallium is currently the only
way to support sw GL on Wayland clients (works also when the compositor
itself does not use EGL at all!), but if you actually build
egl_gallium, it will be preferred over egl_dri2, which means that both
nouveau and radeon hardware drivers get used through egl_gallium by
default. Just today someone came complaining about a bug due to
egl_gallium with nouveau on Wayland.

I suspect this is a PITA for distributions.


Thanks,
pq

 On Thu, Jan 30, 2014 at 2:39 AM, Matt Turner matts...@gmail.com
 wrote:
  On Wed, Jan 29, 2014 at 4:14 PM, Michel Dänzer mic...@daenzer.net
  wrote:
  On Mit, 2014-01-29 at 12:18 -0800, Matt Turner wrote:
  On Wed, Jan 29, 2014 at 9:25 AM, Chad Versace
  chad.vers...@linux.intel.com wrote:
   Mesa now has a real, feature-rich EGL implementation on X11 via
   xcb. Therefore I believe there is no longer a practical need
   for the egl_glx driver.
  
   Furthermore, egl_glx appears to be unmaintained.  The most
   recent nontrivial commit driver was 6baa5f1 on 2011-11-25.
  
   Signed-off-by: Chad Versace chad.vers...@linux.intel.com
   ---
 
  In a similar vein -- is gallium_egl useful for anything these
  days? The only time I hear it mentioned is when telling others to
  not use it.
 
  In contrast to egl_dri2, egl_gallium supports OpenVG.
 
  I suppose I could ask whether OpenVG is useful for anything these
  days? :)
 
  I've heard on IRC that we could simply add OpenVG support to DRI if
  anyone actually cared about it.
  ___
  mesa-dev mailing list
  mesa-dev@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/mesa-dev
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl/glx: Remove egl_glx driver

2014-01-30 Thread Matt Turner
On Thu, Jan 30, 2014 at 12:14 AM, Pekka Paalanen ppaala...@gmail.com wrote:
 I suspect this is a PITA for distributions.

For Gentoo, we started enabling gallium-egl only when openvg is requested.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] loader: Make drmGetVersion logic conditional on non-pci devices

2014-01-30 Thread Stéphane Marchesin
On Thu, Jan 30, 2014 at 12:07 AM, Eric Anholt e...@anholt.net wrote:

 Stéphane Marchesin marc...@chromium.org writes:

  On systems without libudev, the loader_get_pci_id_for_fd() call will
  return 0, which will trigger the drmGetVersion logic. Sadly, this
  logic assumes that the kernel driver name matches the dri driver name,
  which is not the case on recent intel GPUs (for example i965 dri
  driver and i915 kernel module).
 
  This patch changes this logic by making it conditional on a list of
  known non-pci drivers (freedreno and tegra). This fixes dri on machines
  without libudev.

 So, why are Linux people building without libudev?  Is it just that we
 forgot to make libudev-devel required in configure.ac?


I talked with krh on irc, he seemed opposed to it. But yes, that would be
fine by me. That said, it doesn't answer the question of other OSes. What
should we do there?

Stéphane
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] loader: Make drmGetVersion logic conditional on non-pci devices

2014-01-30 Thread Stéphane Marchesin
On Thu, Jan 30, 2014 at 12:20 AM, Stéphane Marchesin 
stephane.marche...@gmail.com wrote:




 On Thu, Jan 30, 2014 at 12:07 AM, Eric Anholt e...@anholt.net wrote:

 Stéphane Marchesin marc...@chromium.org writes:

  On systems without libudev, the loader_get_pci_id_for_fd() call will
  return 0, which will trigger the drmGetVersion logic. Sadly, this
  logic assumes that the kernel driver name matches the dri driver name,
  which is not the case on recent intel GPUs (for example i965 dri
  driver and i915 kernel module).
 
  This patch changes this logic by making it conditional on a list of
  known non-pci drivers (freedreno and tegra). This fixes dri on machines
  without libudev.

 So, why are Linux people building without libudev?  Is it just that we
 forgot to make libudev-devel required in configure.ac?


 I talked with krh on irc, he seemed opposed to it. But yes, that would be
 fine by me. That said, it doesn't answer the question of other OSes. What
 should we do there?


Oh and of course, there's the recent udev-systemd integration. At least for
Chrome OS I know of no plans to use systemd.

Stéphane
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 26/35] meta: Use common GLSL code for blits

2014-01-30 Thread Rogovin, Kevin
 @@ -487,6 +486,7 @@ setup_shader_for_sampler(struct gl_context *ctx, struct 
 glsl_sampler
 *sampler)
   void main()\n
  {\n
 gl_FragColor = %s(texSampler, %s);\n
 + gl_FragDepth = gl_FragColor.x;\n

*IF* I understood what this is to do, is to provide FBO blit API implementation 
from upstairs mesa. Should not a different shader be used base on the 8 
possibilities(really 7 since all 0 means no-op) of the bits being up and down: 
COLOR_BUFFER_BIT, DEPTH_BUFFER_BIT and STENCIL_BUFFER_BIT ? The above looks 
like to me to handle either COLOR_BUFFER_BIT or DEPTH_BUFFER_BIT up, but not 
both. With that in mind then there would be up to 3 separate samplers (one for 
color, one for stencil and one for depth).

Or am I missing something?

-Kevin


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/13] GL_ARB_buffer_storage

2014-01-30 Thread Michel Dänzer
On Don, 2014-01-30 at 02:20 +0100, Marek Olšák wrote:
 This series implements GL_ARB_buffer_storage, which most importantly
 allows rendering with mapped buffers. There is a new test on the
 piglit mailing list, which should test all aspects of persistent
 buffer mappings.
 
 I used both the extension specification and the OpenGL 4.4
 specification, because the latter adds some GL errors which are not
 mentioned in the former. This may cause compatibility issues with apps
 that only target the extension, but all the new GL errors from 4.4
 seemed reasonable to me.
 
 u_upload_mgr, the Gallium module for uploading dynamic data to
 buffers, is updated not to unmap buffers if this extension is
 supported.

The Gallium changes look good to me.


-- 
Earthling Michel Dänzer|  http://www.amd.com
Libre software enthusiast  |Mesa and X developer

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] loader: Make drmGetVersion logic conditional on non-pci devices

2014-01-30 Thread Lauri Kasanen
On Wed, 29 Jan 2014 17:33:23 -0800
Stéphane Marchesin marc...@chromium.org wrote:

 On systems without libudev, the loader_get_pci_id_for_fd() call will
 return 0, which will trigger the drmGetVersion logic. Sadly, this
 logic assumes that the kernel driver name matches the dri driver name,
 which is not the case on recent intel GPUs (for example i965 dri
 driver and i915 kernel module).
 
 This patch changes this logic by making it conditional on a list of
 known non-pci drivers (freedreno and tegra). This fixes dri on machines
 without libudev.
 ---

Reviewed-by: Lauri Kasanen c...@gmx.com

This should also fix r600 (which got mapped to radeon_dri.so).

As for why I don't have libudev - nothing needed it so far, and now
that udev is in systemd, it will not be coming to my systems.

- Lauri
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Removed unnecessary check for NULL pointer when freeing memory block using _mesa_align_free.

2014-01-30 Thread Marek Olšák
Reviewed-by: Marek Olšák marek.ol...@amd.com

Marek

On Thu, Jan 30, 2014 at 9:08 AM, Siavash Eliasi siavashser...@gmail.com wrote:
 Note that it is OK to pass NULL pointers to this function since this commit:

 mesa: modified _mesa_align_free() to accept NULL pointer
 http://cgit.freedesktop.org/mesa/mesa/commit/?id=f0cc59d68a9f5231e8e2111393a1834858820735
 ---
  src/mesa/main/bufferobj.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

 diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
 index cde6ac2..06928a0 100644
 --- a/src/mesa/main/bufferobj.c
 +++ b/src/mesa/main/bufferobj.c
 @@ -562,8 +562,7 @@ _mesa_buffer_data( struct gl_context *ctx, GLenum target, 
 GLsizeiptrARB size,

 (void) target;

 -   if (bufObj-Data)
 -  _mesa_align_free( bufObj-Data );
 +   _mesa_align_free( bufObj-Data );

 new_data = _mesa_align_malloc( size, ctx-Const.MinMapBufferAlignment );
 if (new_data) {
 --
 1.8.5.3

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 74127] [bisected] GL programs fail with loader.c:112: asserted_dlsym: Assertion `result' failed.

2014-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=74127

--- Comment #8 from Dmitry Avgustis avgd...@gmail.com ---
(In reply to comment #6)
 Indeed, mesa requires libudev v151, which provides libudev.so.0.
 
 So we can either bump the minimum required version or fall-back to
 libudev.so.0.
 
 I believe that Eric will be the judge of that.

Is there any workaround for that? I was trying to play with libraries in
synaptic, but didn't succeed.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] Gallium/dri2: Fix dri2_dup_image

2014-01-30 Thread Axel Davy
dri2_dup_image was not copying the dri_format field.

This was causing some bugs, for example:
. we create an gbm_bo.
. we get an EGLImage from the gbm_bo.
. Bug: impossible to get again the gbm_bo from the EGLImage by importing. (gbm 
dri2 backend)

Signed-off-by: Axel Davy axel.d...@ens.fr
---
 src/gallium/state_trackers/dri/drm/dri2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/state_trackers/dri/drm/dri2.c 
b/src/gallium/state_trackers/dri/drm/dri2.c
index 2a5b7b4..0589644 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -777,6 +777,7 @@ dri2_dup_image(__DRIimage *image, void *loaderPrivate)
pipe_resource_reference(img-texture, image-texture);
img-level = image-level;
img-layer = image-layer;
+   img-dri_format = image-dri_format;
/* This should be 0 for sub images, but dup is also used for base images. */
img-dri_components = image-dri_components;
img-loader_private = loaderPrivate;
-- 
1.8.3.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 74127] [bisected] GL programs fail with loader.c:112: asserted_dlsym: Assertion `result' failed.

2014-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=74127

--- Comment #9 from Scott Moreau ore...@gmail.com ---
(In reply to comment #8)
 (In reply to comment #6)
  Indeed, mesa requires libudev v151, which provides libudev.so.0.
  
  So we can either bump the minimum required version or fall-back to
  libudev.so.0.
  
  I believe that Eric will be the judge of that.
 
 Is there any workaround for that? I was trying to play with libraries in
 synaptic, but didn't succeed.

You can either 1) use mesa commit d51dbe048a, 2) change the instance of
libudev.so.1 in loader.c to libudev.so.0 or 3) install the libudev1 package
for your distribution.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] R600/SI: Fix fneg for 0.0

2014-01-30 Thread Tom Stellard
On Wed, Jan 29, 2014 at 06:23:00PM +0900, Michel Dänzer wrote:
 From: Michel Dänzer michel.daen...@amd.com
 
 V_ADD_F32 with source modifier does not produce -0.0 for this. Just
 manipulate the sign bit directly instead.
 

That's strange, so does this mean we can never use these modifiers?

 Also add a pattern for (fneg (fabs ...)).
 
 Fixes a bunch of bit encoding piglit tests with radeonsi.
 
 Signed-off-by: Michel Dänzer michel.daen...@amd.com
 ---
  lib/Target/R600/SIInstructions.td | 11 +++
  1 file changed, 7 insertions(+), 4 deletions(-)
 
 diff --git a/lib/Target/R600/SIInstructions.td 
 b/lib/Target/R600/SIInstructions.td
 index 912b59a..43fe63c 100644
 --- a/lib/Target/R600/SIInstructions.td
 +++ b/lib/Target/R600/SIInstructions.td
 @@ -1684,15 +1684,18 @@ def : Pat 
  ;
  
  def : Pat 
 +  (fneg (fabs f32:$src)),
 +  (V_OR_B32_e32 $src, (V_MOV_B32_e32 0x8000)) /* Set sign bit */
 +;
 +
 +def : Pat 
(fabs f32:$src),
 -  (V_ADD_F32_e64 $src, (i32 0 /* SRC1 */),
 -   1 /* ABS */, 0 /* CLAMP */, 0 /* OMOD */, 0 /* NEG */)
 +  (V_AND_B32_e32 $src, (V_MOV_B32_e32 0x7fff)) /* Clear sign bit */
  ;
  
  def : Pat 
(fneg f32:$src),
 -  (V_ADD_F32_e64 $src, (i32 0 /* SRC1 */),
 -   0 /* ABS */, 0 /* CLAMP */, 0 /* OMOD */, 1 /* NEG */)
 +  (V_XOR_B32_e32 $src, (V_MOV_B32_e32 0x8000)) /* Toggle sign bit */
  ;

I think you may be able to achieve the same results by marking
ISD::FNEG and ISD::FABS as Expand in SIISelLowering.  Also, we
have implemented isFAbsFree() and isFNegFree() in AMDGPUISelLowering.cpp
We will need to move these implementations into R600ISelLowering.cpp
now that FAbs and FNeg are no longer free on SI.

-Tom

  
  /** == **/
 -- 
 1.8.5.3
 
 ___
 llvm-commits mailing list
 llvm-comm...@cs.uiuc.edu
 http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 07/13] gallium: add interface for persistent and coherent buffer mappings

2014-01-30 Thread Roland Scheidegger
Am 30.01.2014 02:20, schrieb Marek Olšák:
 From: Marek Olšák marek.ol...@amd.com
 
 Required for ARB_buffer_storage.
 ---
  src/gallium/docs/source/context.rst| 22 ++
  src/gallium/docs/source/screen.rst |  3 +++
  src/gallium/drivers/trace/tr_context.c | 16 
  src/gallium/include/pipe/p_context.h   |  7 ++-
  src/gallium/include/pipe/p_defines.h   | 31 +--
  5 files changed, 76 insertions(+), 3 deletions(-)
 
 diff --git a/src/gallium/docs/source/context.rst 
 b/src/gallium/docs/source/context.rst
 index 1037162..4258e43 100644
 --- a/src/gallium/docs/source/context.rst
 +++ b/src/gallium/docs/source/context.rst
 @@ -520,6 +520,16 @@ invalidates all read caches of the currently-set 
 samplers.
  
  
  
 +.. _memory_barrier:
 +
 +memory_barrier
 +%%%
 +
 +This function flushes caches according to which of the PIPE_BARRIER_* flags
 +are set.
 +
 +
 +
  .. _pipe_transfer:
  
  PIPE_TRANSFER
 @@ -557,6 +567,18 @@ These flags control the behavior of a transfer object.
Written ranges will be notified later with :ref:`transfer_flush_region`.
Cannot be used with ``PIPE_TRANSFER_READ``.
  
 +``PIPE_TRANSFER_PERSISTENT``
 +  Allows the resource to be used for rendering while mapped.
 +  PIPE_RESOURCE_FLAG_TRANSFER_PERSISTENT must be set when creating
 +  the resource.
 +  If COHERENT is not set, memory_barrier(PIPE_BARRIER_MAPPED_BUFFER)
 +  must be called to ensure the device can see what the CPU has written.
 +
 +``PIPE_TRANSFER_COHERENT``
 +  If PERSISTENT is set, this ensures any writes done by the device are
 +  immediately visible to the CPU and vice versa.
 +  PIPE_RESOURCE_FLAG_TRANSFER_COHERENT must be set when creating
 +  the resource.
  
  Compute kernel execution
  
 diff --git a/src/gallium/docs/source/screen.rst 
 b/src/gallium/docs/source/screen.rst
 index ed8e832..cbb07d6 100644
 --- a/src/gallium/docs/source/screen.rst
 +++ b/src/gallium/docs/source/screen.rst
 @@ -176,6 +176,9 @@ The integer capabilities:
ARB_framebuffer_object is provided.
  * ``PIPE_CAP_TGSI_VS_LAYER``: Whether TGSI_SEMANTIC_LAYER is supported
as a vertex shader output.
 +* ``PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT``: Whether
 +  PIPE_TRANSFER_PERSISTENT and PIPE_TRANSFER_COHERENT are supported
 +  for buffers.
  
  
  .. _pipe_capf:
 diff --git a/src/gallium/drivers/trace/tr_context.c 
 b/src/gallium/drivers/trace/tr_context.c
 index 60ebea4..c10e010 100644
 --- a/src/gallium/drivers/trace/tr_context.c
 +++ b/src/gallium/drivers/trace/tr_context.c
 @@ -1489,6 +1489,21 @@ static void trace_context_texture_barrier(struct 
 pipe_context *_context)
  }
  
  
 +static void trace_context_memory_barrier(struct pipe_context *_context,
 + unsigned flags)
 +{
 +   struct trace_context *tr_context = trace_context(_context);
 +   struct pipe_context *context = tr_context-pipe;
 +
 +   trace_dump_call_begin(pipe_context, memory_barrier);
 +   trace_dump_arg(ptr, context);
 +   trace_dump_arg(uint, flags);
 +   trace_dump_call_end();
 +
 +   context-memory_barrier(context, flags);
 +}
 +
 +
  static const struct debug_named_value rbug_blocker_flags[] = {
 {before, 1, NULL},
 {after, 2, NULL},
 @@ -1577,6 +1592,7 @@ trace_context_create(struct trace_screen *tr_scr,
 TR_CTX_INIT(clear_depth_stencil);
 TR_CTX_INIT(flush);
 TR_CTX_INIT(texture_barrier);
 +   TR_CTX_INIT(memory_barrier);
  
 TR_CTX_INIT(transfer_map);
 TR_CTX_INIT(transfer_unmap);
 diff --git a/src/gallium/include/pipe/p_context.h 
 b/src/gallium/include/pipe/p_context.h
 index 8ef6e27..93f4c57 100644
 --- a/src/gallium/include/pipe/p_context.h
 +++ b/src/gallium/include/pipe/p_context.h
 @@ -406,7 +406,12 @@ struct pipe_context {
  * Flush any pending framebuffer writes and invalidate texture caches.
  */
 void (*texture_barrier)(struct pipe_context *);
 -   
 +
 +   /**
 +* Flush caches according to flags.
 +*/
 +   void (*memory_barrier)(struct pipe_context *, unsigned flags);
 +
 /**
  * Creates a video codec for a specific video format/profile
  */
 diff --git a/src/gallium/include/pipe/p_defines.h 
 b/src/gallium/include/pipe/p_defines.h
 index 8d08a90..31a9c72 100644
 --- a/src/gallium/include/pipe/p_defines.h
 +++ b/src/gallium/include/pipe/p_defines.h
 @@ -295,8 +295,27 @@ enum pipe_transfer_usage {
  * - D3D10 DDI's D3D10_DDI_MAP_WRITE_DISCARD flag
  * - D3D10's D3D10_MAP_WRITE_DISCARD flag.
  */
 -   PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE = (1  12)
 +   PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE = (1  12),
  
 +   /**
 +* Allows the resource to be used for rendering while mapped.
 +*
 +* PIPE_RESOURCE_FLAG_TRANSFER_PERSISTENT must be set when creating
 +* the resource.
 +*
 +* If COHERENT is not set, memory_barrier(PIPE_BARRIER_MAPPED_BUFFER)
 +* must be called to ensure the device can see what the CPU has 

Re: [Mesa-dev] [PATCH 2/2] pipe-loader: Add support for render nodes v2

2014-01-30 Thread Tom Stellard
On Tue, Jan 28, 2014 at 03:04:00PM +0100, David Herrmann wrote:
 Hi Tom
 
 On Mon, Jan 27, 2014 at 5:13 PM, Tom Stellard t...@stellard.net wrote:
  From: Tom Stellard thomas.stell...@amd.com
 
  v2:
 - Add missing call to pipe_loader_drm_release()
 - Fix render node macros
 - Drop render-node configure option
 
 Patch looks fine to me, but I lack mesa-insights to really comment on
 it. But I'd like to get a feedback whether there's still any open
 issues with render-nodes. If not, I will fix the minor-allocation-race
 and then try to make rnodes the default in 3.15.


I am in favor of enabling rnodes by default for 3.15.  I haven't notice
any problems with them so far.

-Tom

 Thanks
 David
 
  ---
 
  For reference, version 1 of this patch:
  http://lists.freedesktop.org/archives/mesa-dev/2013-October/047296.html
 
   .../auxiliary/pipe-loader/pipe_loader_drm.c| 80 
  +-
   1 file changed, 77 insertions(+), 3 deletions(-)
 
  diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c 
  b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
  index 9484db8..7a1af91 100644
  --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
  +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
  @@ -49,6 +49,11 @@
   #include util/u_dl.h
   #include util/u_debug.h
 
  +#define DRM_RENDER_NODE_DEV_NAME_FORMAT %s/renderD%d
  +#define DRM_RENDER_NODE_MAX_NODES 63
  +#define DRM_RENDER_NODE_MIN_MINOR 128
  +#define DRM_RENDER_NODE_MAX_MINOR (DRM_RENDER_NODE_MIN_MINOR + 
  DRM_RENDER_NODE_MAX_NODES)
  +
   struct pipe_loader_drm_device {
  struct pipe_loader_device base;
  struct util_dl_library *lib;
  @@ -152,18 +157,87 @@ open_drm_minor(int minor)
  return open(path, O_RDWR, 0);
   }
 
  +static int
  +open_drm_render_node_minor(int minor)
  +{
  +   char path[PATH_MAX];
  +   snprintf(path, sizeof(path), DRM_RENDER_NODE_DEV_NAME_FORMAT, 
  DRM_DIR_NAME,
  +minor);
  +   return open(path, O_RDWR, 0);
  +}
  +
   int
   pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
   {
  -   int i, j, fd;
  +   int i, k, fd, num_render_node_devs;
  +   int j = 0;
  +
  +   struct {
  +  unsigned vendor_id;
  +  unsigned chip_id;
  +   } render_node_devs[DRM_RENDER_NODE_MAX_NODES];
  +
  +   /* Look for render nodes first */
  +   for (i = DRM_RENDER_NODE_MIN_MINOR, j = 0;
  +i = DRM_RENDER_NODE_MAX_MINOR; i++) {
  +  fd = open_drm_render_node_minor(i);
  +  struct pipe_loader_device *dev;
  +  if (fd  0)
  + continue;
 
  -   for (i = 0, j = 0; i  DRM_MAX_MINOR; i++) {
  +  if (!pipe_loader_drm_probe_fd(dev, fd, false)) {
  + close(fd);
  + continue;
  +  }
  +
  +  render_node_devs[j].vendor_id = dev-u.pci.vendor_id;
  +  render_node_devs[j].chip_id = dev-u.pci.chip_id;
  +
  +  if (j  ndev) {
  + devs[j] = dev;
  +  } else {
  + close(fd);
  + dev-ops-release(dev);
  +  }
  +  j++;
  +   }
  +
  +   num_render_node_devs = j;
  +
  +   /* Next look for drm devices. */
  +   for (i = 0; i  DRM_MAX_MINOR; i++) {
  +  struct pipe_loader_device *dev;
  +  boolean duplicate = FALSE;
 fd = open_drm_minor(i);
 if (fd  0)
continue;
 
  -  if (j = ndev || !pipe_loader_drm_probe_fd(devs[j], fd, true))
  +  if (!pipe_loader_drm_probe_fd(dev, fd, true)) {
close(fd);
  + continue;
  +  }
  +
  +  /* Check to make sure we aren't already accessing this device via
  +   * render nodes.
  +   */
  +  for (k = 0; k  num_render_node_devs; k++) {
  + if (dev-u.pci.vendor_id == render_node_devs[k].vendor_id 
  + dev-u.pci.chip_id == render_node_devs[k].chip_id) {
  +close(fd);
  +dev-ops-release(dev);
  +duplicate = TRUE;
  +break;
  + }
  +  }
  +
  +  if (duplicate)
  + continue;
  +
  +  if (j  ndev) {
  + devs[j] = dev;
  +  } else {
  + dev-ops-release(dev);
  +  }
 
 j++;
  }
  --
  1.8.1.5
 
  ___
  mesa-dev mailing list
  mesa-dev@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 11/13] gallium/upload_mgr: don't unmap buffers if persistent mappings are supported

2014-01-30 Thread Roland Scheidegger
Am 30.01.2014 02:20, schrieb Marek Olšák:
 From: Marek Olšák marek.ol...@amd.com
 
 ---
  src/gallium/auxiliary/util/u_upload_mgr.c | 65 
 ---
  1 file changed, 51 insertions(+), 14 deletions(-)
 
 diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c 
 b/src/gallium/auxiliary/util/u_upload_mgr.c
 index 7349d00..ccaab27 100644
 --- a/src/gallium/auxiliary/util/u_upload_mgr.c
 +++ b/src/gallium/auxiliary/util/u_upload_mgr.c
 @@ -44,6 +44,8 @@ struct u_upload_mgr {
 unsigned default_size;  /* Minimum size of the upload buffer, in bytes. */
 unsigned alignment; /* Alignment of each sub-allocation. */
 unsigned bind;  /* Bitmask of PIPE_BIND_* flags. */
 +   unsigned map_flags; /* Bitmask of PIPE_TRANSFER_* flags. */
 +   boolean map_persistent; /* If persistent mappings are supported. */
  
 struct pipe_resource *buffer;   /* Upload buffer. */
 struct pipe_transfer *transfer; /* Transfer object for the upload buffer. 
 */
 @@ -67,20 +69,39 @@ struct u_upload_mgr *u_upload_create( struct pipe_context 
 *pipe,
 upload-default_size = default_size;
 upload-alignment = alignment;
 upload-bind = bind;
 -   upload-buffer = NULL;
 +
 +   upload-map_persistent =
 +  pipe-screen-get_param(pipe-screen,
 +  PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT);
 +
 +   if (upload-map_persistent) {
 +  upload-map_flags = PIPE_TRANSFER_WRITE |
 +  PIPE_TRANSFER_PERSISTENT |
 +  PIPE_TRANSFER_COHERENT;
 +   }
 +   else {
 +  upload-map_flags = PIPE_TRANSFER_WRITE |
 +  PIPE_TRANSFER_UNSYNCHRONIZED |
 +  PIPE_TRANSFER_FLUSH_EXPLICIT;
 +   }
  
 return upload;
  }
  
 -void u_upload_unmap( struct u_upload_mgr *upload )
 +
 +static void upload_unmap_internal(struct u_upload_mgr *upload, boolean 
 destroying)
  {
 +   if (!destroying  upload-map_persistent)
 +  return;
 +
 if (upload-transfer) {
struct pipe_box *box = upload-transfer-box;
 -  if ((int) upload-offset  box-x) {
  
 +  if (!upload-map_persistent  (int) upload-offset  box-x) {
   pipe_buffer_flush_mapped_range(upload-pipe, upload-transfer,
  box-x, upload-offset - box-x);
}
 +
pipe_transfer_unmap(upload-pipe, upload-transfer);
upload-transfer = NULL;
upload-map = NULL;
 @@ -88,10 +109,16 @@ void u_upload_unmap( struct u_upload_mgr *upload )
  }
  
  
 +void u_upload_unmap( struct u_upload_mgr *upload )
 +{
 +   upload_unmap_internal(upload, FALSE);
 +}
 +
 +
  static void u_upload_release_buffer(struct u_upload_mgr *upload)
  {
 /* Unmap and unreference the upload buffer. */
 -   u_upload_unmap(upload);
 +   upload_unmap_internal(upload, TRUE);
 pipe_resource_reference( upload-buffer, NULL );
 upload-size = 0;
  }
 @@ -108,6 +135,8 @@ static enum pipe_error
  u_upload_alloc_buffer( struct u_upload_mgr *upload,
 unsigned min_size )
  {
 +   struct pipe_screen *screen = upload-pipe-screen;
 +   struct pipe_resource buffer;
 unsigned size;
  
 /* Release the old buffer, if present:
 @@ -118,19 +147,29 @@ u_upload_alloc_buffer( struct u_upload_mgr *upload,
  */
 size = align(MAX2(upload-default_size, min_size), 4096);
  
 -   upload-buffer = pipe_buffer_create( upload-pipe-screen,
 -upload-bind,
 -PIPE_USAGE_STREAM,
 -size );
 +   memset(buffer, 0, sizeof buffer);
 +   buffer.target = PIPE_BUFFER;
 +   buffer.format = PIPE_FORMAT_R8_UNORM; /* want TYPELESS or similar */
 +   buffer.bind = upload-bind;
 +   buffer.usage = PIPE_USAGE_STREAM;
 +   buffer.width0 = size;
 +   buffer.height0 = 1;
 +   buffer.depth0 = 1;
 +   buffer.array_size = 1;
 +
 +   if (upload-map_persistent) {
 +  buffer.flags = PIPE_RESOURCE_FLAG_TRANSFER_PERSISTENT |
 + PIPE_RESOURCE_FLAG_TRANSFER_COHERENT;
 +   }
 +
 +   upload-buffer = screen-resource_create(screen, buffer);
 if (upload-buffer == NULL) {
return PIPE_ERROR_OUT_OF_MEMORY;
 }
  
 /* Map the new buffer. */
 upload-map = pipe_buffer_map_range(upload-pipe, upload-buffer,
 -   0, size,
 -   PIPE_TRANSFER_WRITE |
 -   PIPE_TRANSFER_FLUSH_EXPLICIT,
 +   0, size, upload-map_flags,
 upload-transfer);
 if (upload-map == NULL) {
upload-transfer = NULL;
 @@ -176,9 +215,7 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr 
 *upload,
 if (!upload-map) {
upload-map = pipe_buffer_map_range(upload-pipe, upload-buffer,
 offset, upload-size - offset,
 - 

Re: [Mesa-dev] [PATCH 1/2] pipe-loader: Add auth_x parameter to pipe_loader_drm_probe_fd()

2014-01-30 Thread Tom Stellard
On Mon, Jan 27, 2014 at 05:22:06PM +0100, Erik Faye-Lund wrote:
 On Mon, Jan 27, 2014 at 5:13 PM, Tom Stellard t...@stellard.net wrote:
  From: Tom Stellard thomas.stell...@amd.com
 
  The caller can use this boolean to parameter to tell the pipe-loader
 
 Boolean to parameter? A superfluous to, perhaps?

Thanks for catching this, I will fix it up before I commit.

-Tom
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 07/13] gallium: add interface for persistent and coherent buffer mappings

2014-01-30 Thread Marek Olšák
On Thu, Jan 30, 2014 at 5:31 PM, Roland Scheidegger srol...@vmware.com wrote:
 Am 30.01.2014 02:20, schrieb Marek Olšák:
 From: Marek Olšák marek.ol...@amd.com

 Required for ARB_buffer_storage.
 ---
  src/gallium/docs/source/context.rst| 22 ++
  src/gallium/docs/source/screen.rst |  3 +++
  src/gallium/drivers/trace/tr_context.c | 16 
  src/gallium/include/pipe/p_context.h   |  7 ++-
  src/gallium/include/pipe/p_defines.h   | 31 +--
  5 files changed, 76 insertions(+), 3 deletions(-)

 diff --git a/src/gallium/docs/source/context.rst 
 b/src/gallium/docs/source/context.rst
 index 1037162..4258e43 100644
 --- a/src/gallium/docs/source/context.rst
 +++ b/src/gallium/docs/source/context.rst
 @@ -520,6 +520,16 @@ invalidates all read caches of the currently-set 
 samplers.



 +.. _memory_barrier:
 +
 +memory_barrier
 +%%%
 +
 +This function flushes caches according to which of the PIPE_BARRIER_* flags
 +are set.
 +
 +
 +
  .. _pipe_transfer:

  PIPE_TRANSFER
 @@ -557,6 +567,18 @@ These flags control the behavior of a transfer object.
Written ranges will be notified later with :ref:`transfer_flush_region`.
Cannot be used with ``PIPE_TRANSFER_READ``.

 +``PIPE_TRANSFER_PERSISTENT``
 +  Allows the resource to be used for rendering while mapped.
 +  PIPE_RESOURCE_FLAG_TRANSFER_PERSISTENT must be set when creating
 +  the resource.
 +  If COHERENT is not set, memory_barrier(PIPE_BARRIER_MAPPED_BUFFER)
 +  must be called to ensure the device can see what the CPU has written.
 +
 +``PIPE_TRANSFER_COHERENT``
 +  If PERSISTENT is set, this ensures any writes done by the device are
 +  immediately visible to the CPU and vice versa.
 +  PIPE_RESOURCE_FLAG_TRANSFER_COHERENT must be set when creating
 +  the resource.

  Compute kernel execution
  
 diff --git a/src/gallium/docs/source/screen.rst 
 b/src/gallium/docs/source/screen.rst
 index ed8e832..cbb07d6 100644
 --- a/src/gallium/docs/source/screen.rst
 +++ b/src/gallium/docs/source/screen.rst
 @@ -176,6 +176,9 @@ The integer capabilities:
ARB_framebuffer_object is provided.
  * ``PIPE_CAP_TGSI_VS_LAYER``: Whether TGSI_SEMANTIC_LAYER is supported
as a vertex shader output.
 +* ``PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT``: Whether
 +  PIPE_TRANSFER_PERSISTENT and PIPE_TRANSFER_COHERENT are supported
 +  for buffers.


  .. _pipe_capf:
 diff --git a/src/gallium/drivers/trace/tr_context.c 
 b/src/gallium/drivers/trace/tr_context.c
 index 60ebea4..c10e010 100644
 --- a/src/gallium/drivers/trace/tr_context.c
 +++ b/src/gallium/drivers/trace/tr_context.c
 @@ -1489,6 +1489,21 @@ static void trace_context_texture_barrier(struct 
 pipe_context *_context)
  }


 +static void trace_context_memory_barrier(struct pipe_context *_context,
 + unsigned flags)
 +{
 +   struct trace_context *tr_context = trace_context(_context);
 +   struct pipe_context *context = tr_context-pipe;
 +
 +   trace_dump_call_begin(pipe_context, memory_barrier);
 +   trace_dump_arg(ptr, context);
 +   trace_dump_arg(uint, flags);
 +   trace_dump_call_end();
 +
 +   context-memory_barrier(context, flags);
 +}
 +
 +
  static const struct debug_named_value rbug_blocker_flags[] = {
 {before, 1, NULL},
 {after, 2, NULL},
 @@ -1577,6 +1592,7 @@ trace_context_create(struct trace_screen *tr_scr,
 TR_CTX_INIT(clear_depth_stencil);
 TR_CTX_INIT(flush);
 TR_CTX_INIT(texture_barrier);
 +   TR_CTX_INIT(memory_barrier);

 TR_CTX_INIT(transfer_map);
 TR_CTX_INIT(transfer_unmap);
 diff --git a/src/gallium/include/pipe/p_context.h 
 b/src/gallium/include/pipe/p_context.h
 index 8ef6e27..93f4c57 100644
 --- a/src/gallium/include/pipe/p_context.h
 +++ b/src/gallium/include/pipe/p_context.h
 @@ -406,7 +406,12 @@ struct pipe_context {
  * Flush any pending framebuffer writes and invalidate texture caches.
  */
 void (*texture_barrier)(struct pipe_context *);
 -
 +
 +   /**
 +* Flush caches according to flags.
 +*/
 +   void (*memory_barrier)(struct pipe_context *, unsigned flags);
 +
 /**
  * Creates a video codec for a specific video format/profile
  */
 diff --git a/src/gallium/include/pipe/p_defines.h 
 b/src/gallium/include/pipe/p_defines.h
 index 8d08a90..31a9c72 100644
 --- a/src/gallium/include/pipe/p_defines.h
 +++ b/src/gallium/include/pipe/p_defines.h
 @@ -295,8 +295,27 @@ enum pipe_transfer_usage {
  * - D3D10 DDI's D3D10_DDI_MAP_WRITE_DISCARD flag
  * - D3D10's D3D10_MAP_WRITE_DISCARD flag.
  */
 -   PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE = (1  12)
 +   PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE = (1  12),

 +   /**
 +* Allows the resource to be used for rendering while mapped.
 +*
 +* PIPE_RESOURCE_FLAG_TRANSFER_PERSISTENT must be set when creating
 +* the resource.
 +*
 +* If COHERENT is not set, memory_barrier(PIPE_BARRIER_MAPPED_BUFFER)
 +* must be 

Re: [Mesa-dev] [PATCH 11/13] gallium/upload_mgr: don't unmap buffers if persistent mappings are supported

2014-01-30 Thread Marek Olšák
On Thu, Jan 30, 2014 at 5:33 PM, Roland Scheidegger srol...@vmware.com wrote:
 Am 30.01.2014 02:20, schrieb Marek Olšák:
 From: Marek Olšák marek.ol...@amd.com

 ---
  src/gallium/auxiliary/util/u_upload_mgr.c | 65 
 ---
  1 file changed, 51 insertions(+), 14 deletions(-)

 diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c 
 b/src/gallium/auxiliary/util/u_upload_mgr.c
 index 7349d00..ccaab27 100644
 --- a/src/gallium/auxiliary/util/u_upload_mgr.c
 +++ b/src/gallium/auxiliary/util/u_upload_mgr.c
 @@ -44,6 +44,8 @@ struct u_upload_mgr {
 unsigned default_size;  /* Minimum size of the upload buffer, in bytes. 
 */
 unsigned alignment; /* Alignment of each sub-allocation. */
 unsigned bind;  /* Bitmask of PIPE_BIND_* flags. */
 +   unsigned map_flags; /* Bitmask of PIPE_TRANSFER_* flags. */
 +   boolean map_persistent; /* If persistent mappings are supported. */

 struct pipe_resource *buffer;   /* Upload buffer. */
 struct pipe_transfer *transfer; /* Transfer object for the upload 
 buffer. */
 @@ -67,20 +69,39 @@ struct u_upload_mgr *u_upload_create( struct 
 pipe_context *pipe,
 upload-default_size = default_size;
 upload-alignment = alignment;
 upload-bind = bind;
 -   upload-buffer = NULL;
 +
 +   upload-map_persistent =
 +  pipe-screen-get_param(pipe-screen,
 +  PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT);
 +
 +   if (upload-map_persistent) {
 +  upload-map_flags = PIPE_TRANSFER_WRITE |
 +  PIPE_TRANSFER_PERSISTENT |
 +  PIPE_TRANSFER_COHERENT;
 +   }
 +   else {
 +  upload-map_flags = PIPE_TRANSFER_WRITE |
 +  PIPE_TRANSFER_UNSYNCHRONIZED |
 +  PIPE_TRANSFER_FLUSH_EXPLICIT;
 +   }

 return upload;
  }

 -void u_upload_unmap( struct u_upload_mgr *upload )
 +
 +static void upload_unmap_internal(struct u_upload_mgr *upload, boolean 
 destroying)
  {
 +   if (!destroying  upload-map_persistent)
 +  return;
 +
 if (upload-transfer) {
struct pipe_box *box = upload-transfer-box;
 -  if ((int) upload-offset  box-x) {

 +  if (!upload-map_persistent  (int) upload-offset  box-x) {
   pipe_buffer_flush_mapped_range(upload-pipe, upload-transfer,
  box-x, upload-offset - box-x);
}
 +
pipe_transfer_unmap(upload-pipe, upload-transfer);
upload-transfer = NULL;
upload-map = NULL;
 @@ -88,10 +109,16 @@ void u_upload_unmap( struct u_upload_mgr *upload )
  }


 +void u_upload_unmap( struct u_upload_mgr *upload )
 +{
 +   upload_unmap_internal(upload, FALSE);
 +}
 +
 +
  static void u_upload_release_buffer(struct u_upload_mgr *upload)
  {
 /* Unmap and unreference the upload buffer. */
 -   u_upload_unmap(upload);
 +   upload_unmap_internal(upload, TRUE);
 pipe_resource_reference( upload-buffer, NULL );
 upload-size = 0;
  }
 @@ -108,6 +135,8 @@ static enum pipe_error
  u_upload_alloc_buffer( struct u_upload_mgr *upload,
 unsigned min_size )
  {
 +   struct pipe_screen *screen = upload-pipe-screen;
 +   struct pipe_resource buffer;
 unsigned size;

 /* Release the old buffer, if present:
 @@ -118,19 +147,29 @@ u_upload_alloc_buffer( struct u_upload_mgr *upload,
  */
 size = align(MAX2(upload-default_size, min_size), 4096);

 -   upload-buffer = pipe_buffer_create( upload-pipe-screen,
 -upload-bind,
 -PIPE_USAGE_STREAM,
 -size );
 +   memset(buffer, 0, sizeof buffer);
 +   buffer.target = PIPE_BUFFER;
 +   buffer.format = PIPE_FORMAT_R8_UNORM; /* want TYPELESS or similar */
 +   buffer.bind = upload-bind;
 +   buffer.usage = PIPE_USAGE_STREAM;
 +   buffer.width0 = size;
 +   buffer.height0 = 1;
 +   buffer.depth0 = 1;
 +   buffer.array_size = 1;
 +
 +   if (upload-map_persistent) {
 +  buffer.flags = PIPE_RESOURCE_FLAG_TRANSFER_PERSISTENT |
 + PIPE_RESOURCE_FLAG_TRANSFER_COHERENT;
 +   }
 +
 +   upload-buffer = screen-resource_create(screen, buffer);
 if (upload-buffer == NULL) {
return PIPE_ERROR_OUT_OF_MEMORY;
 }

 /* Map the new buffer. */
 upload-map = pipe_buffer_map_range(upload-pipe, upload-buffer,
 -   0, size,
 -   PIPE_TRANSFER_WRITE |
 -   PIPE_TRANSFER_FLUSH_EXPLICIT,
 +   0, size, upload-map_flags,
 upload-transfer);
 if (upload-map == NULL) {
upload-transfer = NULL;
 @@ -176,9 +215,7 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr 
 *upload,
 if (!upload-map) {
upload-map = pipe_buffer_map_range(upload-pipe, upload-buffer,
 

Re: [Mesa-dev] [PATCH 07/13] gallium: add interface for persistent and coherent buffer mappings

2014-01-30 Thread Roland Scheidegger
Am 30.01.2014 17:50, schrieb Marek Olšák:
 On Thu, Jan 30, 2014 at 5:31 PM, Roland Scheidegger srol...@vmware.com 
 wrote:
 Am 30.01.2014 02:20, schrieb Marek Olšák:
 From: Marek Olšák marek.ol...@amd.com

 Required for ARB_buffer_storage.
 ---
  src/gallium/docs/source/context.rst| 22 ++
  src/gallium/docs/source/screen.rst |  3 +++
  src/gallium/drivers/trace/tr_context.c | 16 
  src/gallium/include/pipe/p_context.h   |  7 ++-
  src/gallium/include/pipe/p_defines.h   | 31 +--
  5 files changed, 76 insertions(+), 3 deletions(-)

 diff --git a/src/gallium/docs/source/context.rst 
 b/src/gallium/docs/source/context.rst
 index 1037162..4258e43 100644
 --- a/src/gallium/docs/source/context.rst
 +++ b/src/gallium/docs/source/context.rst
 @@ -520,6 +520,16 @@ invalidates all read caches of the currently-set 
 samplers.



 +.. _memory_barrier:
 +
 +memory_barrier
 +%%%
 +
 +This function flushes caches according to which of the PIPE_BARRIER_* flags
 +are set.
 +
 +
 +
  .. _pipe_transfer:

  PIPE_TRANSFER
 @@ -557,6 +567,18 @@ These flags control the behavior of a transfer object.
Written ranges will be notified later with :ref:`transfer_flush_region`.
Cannot be used with ``PIPE_TRANSFER_READ``.

 +``PIPE_TRANSFER_PERSISTENT``
 +  Allows the resource to be used for rendering while mapped.
 +  PIPE_RESOURCE_FLAG_TRANSFER_PERSISTENT must be set when creating
 +  the resource.
 +  If COHERENT is not set, memory_barrier(PIPE_BARRIER_MAPPED_BUFFER)
 +  must be called to ensure the device can see what the CPU has written.
 +
 +``PIPE_TRANSFER_COHERENT``
 +  If PERSISTENT is set, this ensures any writes done by the device are
 +  immediately visible to the CPU and vice versa.
 +  PIPE_RESOURCE_FLAG_TRANSFER_COHERENT must be set when creating
 +  the resource.

  Compute kernel execution
  
 diff --git a/src/gallium/docs/source/screen.rst 
 b/src/gallium/docs/source/screen.rst
 index ed8e832..cbb07d6 100644
 --- a/src/gallium/docs/source/screen.rst
 +++ b/src/gallium/docs/source/screen.rst
 @@ -176,6 +176,9 @@ The integer capabilities:
ARB_framebuffer_object is provided.
  * ``PIPE_CAP_TGSI_VS_LAYER``: Whether TGSI_SEMANTIC_LAYER is supported
as a vertex shader output.
 +* ``PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT``: Whether
 +  PIPE_TRANSFER_PERSISTENT and PIPE_TRANSFER_COHERENT are supported
 +  for buffers.


  .. _pipe_capf:
 diff --git a/src/gallium/drivers/trace/tr_context.c 
 b/src/gallium/drivers/trace/tr_context.c
 index 60ebea4..c10e010 100644
 --- a/src/gallium/drivers/trace/tr_context.c
 +++ b/src/gallium/drivers/trace/tr_context.c
 @@ -1489,6 +1489,21 @@ static void trace_context_texture_barrier(struct 
 pipe_context *_context)
  }


 +static void trace_context_memory_barrier(struct pipe_context *_context,
 + unsigned flags)
 +{
 +   struct trace_context *tr_context = trace_context(_context);
 +   struct pipe_context *context = tr_context-pipe;
 +
 +   trace_dump_call_begin(pipe_context, memory_barrier);
 +   trace_dump_arg(ptr, context);
 +   trace_dump_arg(uint, flags);
 +   trace_dump_call_end();
 +
 +   context-memory_barrier(context, flags);
 +}
 +
 +
  static const struct debug_named_value rbug_blocker_flags[] = {
 {before, 1, NULL},
 {after, 2, NULL},
 @@ -1577,6 +1592,7 @@ trace_context_create(struct trace_screen *tr_scr,
 TR_CTX_INIT(clear_depth_stencil);
 TR_CTX_INIT(flush);
 TR_CTX_INIT(texture_barrier);
 +   TR_CTX_INIT(memory_barrier);

 TR_CTX_INIT(transfer_map);
 TR_CTX_INIT(transfer_unmap);
 diff --git a/src/gallium/include/pipe/p_context.h 
 b/src/gallium/include/pipe/p_context.h
 index 8ef6e27..93f4c57 100644
 --- a/src/gallium/include/pipe/p_context.h
 +++ b/src/gallium/include/pipe/p_context.h
 @@ -406,7 +406,12 @@ struct pipe_context {
  * Flush any pending framebuffer writes and invalidate texture caches.
  */
 void (*texture_barrier)(struct pipe_context *);
 -
 +
 +   /**
 +* Flush caches according to flags.
 +*/
 +   void (*memory_barrier)(struct pipe_context *, unsigned flags);
 +
 /**
  * Creates a video codec for a specific video format/profile
  */
 diff --git a/src/gallium/include/pipe/p_defines.h 
 b/src/gallium/include/pipe/p_defines.h
 index 8d08a90..31a9c72 100644
 --- a/src/gallium/include/pipe/p_defines.h
 +++ b/src/gallium/include/pipe/p_defines.h
 @@ -295,8 +295,27 @@ enum pipe_transfer_usage {
  * - D3D10 DDI's D3D10_DDI_MAP_WRITE_DISCARD flag
  * - D3D10's D3D10_MAP_WRITE_DISCARD flag.
  */
 -   PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE = (1  12)
 +   PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE = (1  12),

 +   /**
 +* Allows the resource to be used for rendering while mapped.
 +*
 +* PIPE_RESOURCE_FLAG_TRANSFER_PERSISTENT must be set when creating
 +* the resource.
 +*
 +* If COHERENT is not set, 

Re: [Mesa-dev] [PATCH 07/13] gallium: add interface for persistent and coherent buffer mappings

2014-01-30 Thread Marek Olšák
On Thu, Jan 30, 2014 at 6:34 PM, Roland Scheidegger srol...@vmware.com wrote:
 Am 30.01.2014 17:50, schrieb Marek Olšák:
 On Thu, Jan 30, 2014 at 5:31 PM, Roland Scheidegger srol...@vmware.com 
 wrote:
 Am 30.01.2014 02:20, schrieb Marek Olšák:
 From: Marek Olšák marek.ol...@amd.com

 Required for ARB_buffer_storage.
 ---
  src/gallium/docs/source/context.rst| 22 ++
  src/gallium/docs/source/screen.rst |  3 +++
  src/gallium/drivers/trace/tr_context.c | 16 
  src/gallium/include/pipe/p_context.h   |  7 ++-
  src/gallium/include/pipe/p_defines.h   | 31 
 +--
  5 files changed, 76 insertions(+), 3 deletions(-)

 diff --git a/src/gallium/docs/source/context.rst 
 b/src/gallium/docs/source/context.rst
 index 1037162..4258e43 100644
 --- a/src/gallium/docs/source/context.rst
 +++ b/src/gallium/docs/source/context.rst
 @@ -520,6 +520,16 @@ invalidates all read caches of the currently-set 
 samplers.



 +.. _memory_barrier:
 +
 +memory_barrier
 +%%%
 +
 +This function flushes caches according to which of the PIPE_BARRIER_* 
 flags
 +are set.
 +
 +
 +
  .. _pipe_transfer:

  PIPE_TRANSFER
 @@ -557,6 +567,18 @@ These flags control the behavior of a transfer object.
Written ranges will be notified later with :ref:`transfer_flush_region`.
Cannot be used with ``PIPE_TRANSFER_READ``.

 +``PIPE_TRANSFER_PERSISTENT``
 +  Allows the resource to be used for rendering while mapped.
 +  PIPE_RESOURCE_FLAG_TRANSFER_PERSISTENT must be set when creating
 +  the resource.
 +  If COHERENT is not set, memory_barrier(PIPE_BARRIER_MAPPED_BUFFER)
 +  must be called to ensure the device can see what the CPU has written.
 +
 +``PIPE_TRANSFER_COHERENT``
 +  If PERSISTENT is set, this ensures any writes done by the device are
 +  immediately visible to the CPU and vice versa.
 +  PIPE_RESOURCE_FLAG_TRANSFER_COHERENT must be set when creating
 +  the resource.

  Compute kernel execution
  
 diff --git a/src/gallium/docs/source/screen.rst 
 b/src/gallium/docs/source/screen.rst
 index ed8e832..cbb07d6 100644
 --- a/src/gallium/docs/source/screen.rst
 +++ b/src/gallium/docs/source/screen.rst
 @@ -176,6 +176,9 @@ The integer capabilities:
ARB_framebuffer_object is provided.
  * ``PIPE_CAP_TGSI_VS_LAYER``: Whether TGSI_SEMANTIC_LAYER is supported
as a vertex shader output.
 +* ``PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT``: Whether
 +  PIPE_TRANSFER_PERSISTENT and PIPE_TRANSFER_COHERENT are supported
 +  for buffers.


  .. _pipe_capf:
 diff --git a/src/gallium/drivers/trace/tr_context.c 
 b/src/gallium/drivers/trace/tr_context.c
 index 60ebea4..c10e010 100644
 --- a/src/gallium/drivers/trace/tr_context.c
 +++ b/src/gallium/drivers/trace/tr_context.c
 @@ -1489,6 +1489,21 @@ static void trace_context_texture_barrier(struct 
 pipe_context *_context)
  }


 +static void trace_context_memory_barrier(struct pipe_context *_context,
 + unsigned flags)
 +{
 +   struct trace_context *tr_context = trace_context(_context);
 +   struct pipe_context *context = tr_context-pipe;
 +
 +   trace_dump_call_begin(pipe_context, memory_barrier);
 +   trace_dump_arg(ptr, context);
 +   trace_dump_arg(uint, flags);
 +   trace_dump_call_end();
 +
 +   context-memory_barrier(context, flags);
 +}
 +
 +
  static const struct debug_named_value rbug_blocker_flags[] = {
 {before, 1, NULL},
 {after, 2, NULL},
 @@ -1577,6 +1592,7 @@ trace_context_create(struct trace_screen *tr_scr,
 TR_CTX_INIT(clear_depth_stencil);
 TR_CTX_INIT(flush);
 TR_CTX_INIT(texture_barrier);
 +   TR_CTX_INIT(memory_barrier);

 TR_CTX_INIT(transfer_map);
 TR_CTX_INIT(transfer_unmap);
 diff --git a/src/gallium/include/pipe/p_context.h 
 b/src/gallium/include/pipe/p_context.h
 index 8ef6e27..93f4c57 100644
 --- a/src/gallium/include/pipe/p_context.h
 +++ b/src/gallium/include/pipe/p_context.h
 @@ -406,7 +406,12 @@ struct pipe_context {
  * Flush any pending framebuffer writes and invalidate texture caches.
  */
 void (*texture_barrier)(struct pipe_context *);
 -
 +
 +   /**
 +* Flush caches according to flags.
 +*/
 +   void (*memory_barrier)(struct pipe_context *, unsigned flags);
 +
 /**
  * Creates a video codec for a specific video format/profile
  */
 diff --git a/src/gallium/include/pipe/p_defines.h 
 b/src/gallium/include/pipe/p_defines.h
 index 8d08a90..31a9c72 100644
 --- a/src/gallium/include/pipe/p_defines.h
 +++ b/src/gallium/include/pipe/p_defines.h
 @@ -295,8 +295,27 @@ enum pipe_transfer_usage {
  * - D3D10 DDI's D3D10_DDI_MAP_WRITE_DISCARD flag
  * - D3D10's D3D10_MAP_WRITE_DISCARD flag.
  */
 -   PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE = (1  12)
 +   PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE = (1  12),

 +   /**
 +* Allows the resource to be used for rendering while mapped.
 +*
 +* PIPE_RESOURCE_FLAG_TRANSFER_PERSISTENT must be set when 

Re: [Mesa-dev] [PATCH] loader: Make drmGetVersion logic conditional on non-pci devices

2014-01-30 Thread Kristian Høgsberg
On Thu, Jan 30, 2014 at 12:20 AM, Stéphane Marchesin
stephane.marche...@gmail.com wrote:



 On Thu, Jan 30, 2014 at 12:07 AM, Eric Anholt e...@anholt.net wrote:

 Stéphane Marchesin marc...@chromium.org writes:

  On systems without libudev, the loader_get_pci_id_for_fd() call will
  return 0, which will trigger the drmGetVersion logic. Sadly, this
  logic assumes that the kernel driver name matches the dri driver name,
  which is not the case on recent intel GPUs (for example i965 dri
  driver and i915 kernel module).
 
  This patch changes this logic by making it conditional on a list of
  known non-pci drivers (freedreno and tegra). This fixes dri on machines
  without libudev.

 So, why are Linux people building without libudev?  Is it just that we
 forgot to make libudev-devel required in configure.ac?


 I talked with krh on irc, he seemed opposed to it. But yes, that would be
 fine by me. That said, it doesn't answer the question of other OSes. What
 should we do there?

I think I made a snarky remark, but I'm not opposed.  I introduced the
libudev dependeny in the first place and I'd be happy to just make
udev a hard requirement. On the other hand, we could keep glx+dri2
working without udev as it has in the past, and only require it for
new window systems (egl, glx+dri3) that have always required it.  I'm
fine either way.

Kristian

 Stéphane


 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 00/13] GL_ARB_buffer_storage

2014-01-30 Thread Marek Olšák
I forgot to mention an extension spec bug. The spec mentions
glMemoryBarrier, but doesn't define it anywhere, nor does the spec
define dependencies on other extensions or GL versions.
glMemoryBarrier is required for non-coherent buffer mappings to be
usable. Without it, you have to always use coherent mappings.

glMemoryBarrier is added by GL_ARB_shader_image_load_store and GL 4.2.

I think glMemoryBarrier is always exposed by Mesa no matter what
extensions are supported, but it's an out-of-spec behavior.

Marek

On Thu, Jan 30, 2014 at 2:20 AM, Marek Olšák mar...@gmail.com wrote:
 This series implements GL_ARB_buffer_storage, which most importantly allows 
 rendering with mapped buffers. There is a new test on the piglit mailing 
 list, which should test all aspects of persistent buffer mappings.

 I used both the extension specification and the OpenGL 4.4 specification, 
 because the latter adds some GL errors which are not mentioned in the former. 
 This may cause compatibility issues with apps that only target the extension, 
 but all the new GL errors from 4.4 seemed reasonable to me.

 u_upload_mgr, the Gallium module for uploading dynamic data to buffers, is 
 updated not to unmap buffers if this extension is supported.

 Please review.

 Marek
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 74085] [Counter Strike: Source] Blue smoke in very specific places (nv50, r600g) (cannot bisect)

2014-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=74085

--- Comment #3 from Steffen steffen-wink...@gmx.de ---
can confirm. I've a AMD Radeon HD5870 and I'm on Ubuntu 13.10 with GLX Version:
3.0 Mesa 10.1.0-devel (git-a487b4d saucy-oibaf-ppa+curaga)

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 01/13] mesa: remove unused driver hook BindBuffer

2014-01-30 Thread Fredrik Höglund
On Thursday 30 January 2014, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 ---
  src/mesa/main/bufferobj.c | 5 -
  src/mesa/main/dd.h| 3 ---
  2 files changed, 8 deletions(-)
 
 diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
 index e305038..802c9e3 100644
 --- a/src/mesa/main/bufferobj.c
 +++ b/src/mesa/main/bufferobj.c
 @@ -952,10 +952,6 @@ bind_buffer_object(struct gl_context *ctx, GLenum 
 target, GLuint buffer)
 
 /* bind new buffer */
 _mesa_reference_buffer_object(ctx, bindTarget, newBufObj);
 -
 -   /* Pass BindBuffer call to device driver */
 -   if (ctx-Driver.BindBuffer)
 -  ctx-Driver.BindBuffer( ctx, target, newBufObj );
  }
  
  
 @@ -1020,7 +1016,6 @@ _mesa_init_buffer_object_functions(struct 
 dd_function_table *driver)
 /* GL_ARB_vertex/pixel_buffer_object */
 driver-NewBufferObject = _mesa_new_buffer_object;
 driver-DeleteBuffer = _mesa_delete_buffer_object;
 -   driver-BindBuffer = NULL;
 driver-BufferData = _mesa_buffer_data;
 driver-BufferSubData = _mesa_buffer_subdata;
 driver-GetBufferSubData = _mesa_buffer_get_subdata;
 diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
 index cb6fac4..db55dba 100644
 --- a/src/mesa/main/dd.h
 +++ b/src/mesa/main/dd.h
 @@ -555,9 +555,6 @@ struct dd_function_table {
  * \name Vertex/pixel buffer object functions
  */
 /*@{*/
 -   void (*BindBuffer)( struct gl_context *ctx, GLenum target,
 -struct gl_buffer_object *obj );
 -
 struct gl_buffer_object * (*NewBufferObject)( struct gl_context *ctx, 
 GLuint buffer,
GLenum target );

Reviewed-by: Fredrik Höglund fred...@kde.org

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 01/13] mesa: remove unused driver hook BindBuffer

2014-01-30 Thread Marek Olšák
Is it for all patches or just this patch?

Marek

On Thu, Jan 30, 2014 at 7:21 PM, Fredrik Höglund fred...@kde.org wrote:
 On Thursday 30 January 2014, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com

 ---
  src/mesa/main/bufferobj.c | 5 -
  src/mesa/main/dd.h| 3 ---
  2 files changed, 8 deletions(-)

 diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
 index e305038..802c9e3 100644
 --- a/src/mesa/main/bufferobj.c
 +++ b/src/mesa/main/bufferobj.c
 @@ -952,10 +952,6 @@ bind_buffer_object(struct gl_context *ctx, GLenum 
 target, GLuint buffer)

 /* bind new buffer */
 _mesa_reference_buffer_object(ctx, bindTarget, newBufObj);
 -
 -   /* Pass BindBuffer call to device driver */
 -   if (ctx-Driver.BindBuffer)
 -  ctx-Driver.BindBuffer( ctx, target, newBufObj );
  }


 @@ -1020,7 +1016,6 @@ _mesa_init_buffer_object_functions(struct 
 dd_function_table *driver)
 /* GL_ARB_vertex/pixel_buffer_object */
 driver-NewBufferObject = _mesa_new_buffer_object;
 driver-DeleteBuffer = _mesa_delete_buffer_object;
 -   driver-BindBuffer = NULL;
 driver-BufferData = _mesa_buffer_data;
 driver-BufferSubData = _mesa_buffer_subdata;
 driver-GetBufferSubData = _mesa_buffer_get_subdata;
 diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
 index cb6fac4..db55dba 100644
 --- a/src/mesa/main/dd.h
 +++ b/src/mesa/main/dd.h
 @@ -555,9 +555,6 @@ struct dd_function_table {
  * \name Vertex/pixel buffer object functions
  */
 /*@{*/
 -   void (*BindBuffer)( struct gl_context *ctx, GLenum target,
 -struct gl_buffer_object *obj );
 -
 struct gl_buffer_object * (*NewBufferObject)( struct gl_context *ctx, 
 GLuint buffer,
GLenum target );

 Reviewed-by: Fredrik Höglund fred...@kde.org

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 02/13] mesa: add storage flags parameter to Driver.BufferData

2014-01-30 Thread Fredrik Höglund
On Thursday 30 January 2014, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 It will be used by glBufferStorage. The parameters are chosen according
 to ARB_buffer_storage.
 ---
  src/mesa/drivers/dri/i915/intel_buffer_objects.c| 5 -
  src/mesa/drivers/dri/i965/intel_buffer_objects.c| 5 -
  src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c| 3 ++-
  src/mesa/drivers/dri/radeon/radeon_buffer_objects.c | 2 ++
  src/mesa/main/bufferobj.c   | 9 +++--
  src/mesa/main/dd.h  | 2 +-
  src/mesa/main/mtypes.h  | 1 +
  src/mesa/state_tracker/st_cb_bufferobjects.c| 6 +-
  src/mesa/vbo/vbo_exec_api.c | 6 +-
  src/mesa/vbo/vbo_exec_draw.c| 8 ++--
  src/mesa/vbo/vbo_save_api.c | 3 +++
  11 files changed, 40 insertions(+), 10 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/i915/intel_buffer_objects.c 
 b/src/mesa/drivers/dri/i915/intel_buffer_objects.c
 index 345db6d..f4fb999 100644
 --- a/src/mesa/drivers/dri/i915/intel_buffer_objects.c
 +++ b/src/mesa/drivers/dri/i915/intel_buffer_objects.c
 @@ -116,13 +116,16 @@ intel_bufferobj_data(struct gl_context * ctx,
   GLenum target,
   GLsizeiptrARB size,
   const GLvoid * data,
 - GLenum usage, struct gl_buffer_object *obj)
 + GLenum usage,
 + GLbitfield storageFlags,
 + struct gl_buffer_object *obj)
  {
 struct intel_context *intel = intel_context(ctx);
 struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
  
 intel_obj-Base.Size = size;
 intel_obj-Base.Usage = usage;
 +   intel_obj-Base.StorageFlags = storageFlags;
  
 assert(!obj-Pointer); /* Mesa should have unmapped it */
  
 diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c 
 b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
 index 4d7044a..f7b9020 100644
 --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
 +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
 @@ -142,7 +142,9 @@ intel_bufferobj_data(struct gl_context * ctx,
   GLenum target,
   GLsizeiptrARB size,
   const GLvoid * data,
 - GLenum usage, struct gl_buffer_object *obj)
 + GLenum usage,
 + GLbitfield storageFlags,
 + struct gl_buffer_object *obj)
  {
 struct brw_context *brw = brw_context(ctx);
 struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
 @@ -153,6 +155,7 @@ intel_bufferobj_data(struct gl_context * ctx,
  
 intel_obj-Base.Size = size;
 intel_obj-Base.Usage = usage;
 +   intel_obj-Base.StorageFlags = storageFlags;
  
 assert(!obj-Pointer); /* Mesa should have unmapped it */
  
 diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c 
 b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
 index 717c0b8..af17196 100644
 --- a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
 +++ b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
 @@ -73,7 +73,7 @@ nouveau_bufferobj_del(struct gl_context *ctx, struct 
 gl_buffer_object *obj)
  
  static GLboolean
  nouveau_bufferobj_data(struct gl_context *ctx, GLenum target, GLsizeiptrARB 
 size,
 -const GLvoid *data, GLenum usage,
 +const GLvoid *data, GLenum usage, GLbitfield 
 storageFlags,
  struct gl_buffer_object *obj)
  {
   struct nouveau_bufferobj *nbo = to_nouveau_bufferobj(obj);
 @@ -81,6 +81,7 @@ nouveau_bufferobj_data(struct gl_context *ctx, GLenum 
 target, GLsizeiptrARB size
  
   obj-Size = size;
   obj-Usage = usage;
 +obj-StorageFlags = storageFlags;
  
   /* Free previous storage */
   nouveau_bo_ref(NULL, nbo-bo);
 diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c 
 b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
 index 40a16c3..1fa3088 100644
 --- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
 +++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
 @@ -86,6 +86,7 @@ radeonBufferData(struct gl_context * ctx,
   GLsizeiptrARB size,
   const GLvoid * data,
   GLenum usage,
 + GLbitfield storageFlags,
   struct gl_buffer_object *obj)
  {
  radeonContextPtr radeon = RADEON_CONTEXT(ctx);
 @@ -93,6 +94,7 @@ radeonBufferData(struct gl_context * ctx,
  
  radeon_obj-Base.Size = size;
  radeon_obj-Base.Usage = usage;
 +radeon_obj-Base.StorageFlags = storageFlags;
  
  if (radeon_obj-bo != NULL) {
  radeon_bo_unref(radeon_obj-bo);
 diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
 index 802c9e3..d9fb812 100644
 --- a/src/mesa/main/bufferobj.c
 +++ b/src/mesa/main/bufferobj.c
 @@ -555,7 +555,7 

Re: [Mesa-dev] [PATCH 04/13] glapi: add ARB_buffer_storage

2014-01-30 Thread Fredrik Höglund
On Thursday 30 January 2014, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 ---
  src/mapi/glapi/gen/gl_API.xml | 19 +++
  1 file changed, 19 insertions(+)
 
 diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
 index 193ee37..4a70542 100644
 --- a/src/mapi/glapi/gen/gl_API.xml
 +++ b/src/mapi/glapi/gen/gl_API.xml
 @@ -8488,6 +8488,25 @@
  
  xi:include href=ARB_texture_storage_multisample.xml 
 xmlns:xi=http://www.w3.org/2001/XInclude/
  
 +!-- ARB extension 142 - 143. --
 +
 +category name=GL_ARB_buffer_storage number=144
 +enum name=MAP_PERSISTENT_BIT value=0x40 /
 +enum name=MAP_COHERENT_BIT value=0x80 /
 +enum name=DYNAMIC_STORAGE_BIT value=0x100 /
 +enum name=CLIENT_STORAGE_BIT value=0x200 /
 +enum name=BUFFER_IMMUTABLE_STORAGE value=0x821F /
 +enum name=BUFFER_STORAGE_FLAGS value=0x8220 /
 +enum name=CLIENT_MAPPED_BUFFER_BARRIER_BIT value=0x4000 /
 +
 +function name=BufferStorage offset=assign
 +param name=target type=GLenum/
 +param name=size type=GLsizeiptr/
 +param name=data type=const GLvoid */
 +param name=flags type=GLbitfield/
 +/function
 +/category
 +
  !-- Non-ARB extensions sorted by extension number. --
  
  category name=GL_EXT_blend_color number=2

Reviewed-by: Fredrik Höglund fred...@kde.org

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 03/13] mesa: implement glBufferStorage, immutable buffers; add extension enable flag

2014-01-30 Thread Fredrik Höglund
On Thursday 30 January 2014, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 ---
  src/mesa/main/bufferobj.c  | 98 
 ++
  src/mesa/main/bufferobj.h  |  4 ++
  src/mesa/main/extensions.c |  1 +
  src/mesa/main/mtypes.h |  2 +
  4 files changed, 105 insertions(+)
 
 diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
 index d9fb812..55184f1 100644
 --- a/src/mesa/main/bufferobj.c
 +++ b/src/mesa/main/bufferobj.c
 @@ -1232,6 +1232,73 @@ _mesa_IsBuffer(GLuint id)
  
  
  void GLAPIENTRY
 +_mesa_BufferStorage(GLenum target, GLsizeiptr size, const GLvoid *data,
 +GLbitfield flags)
 +{
 +   GET_CURRENT_CONTEXT(ctx);
 +   struct gl_buffer_object *bufObj;
 +
 +   if (size  0) {
 +  _mesa_error(ctx, GL_INVALID_VALUE, glBufferStorage(size  0));
 +  return;
 +   }

An INVALID_VALUE error is generated if size is less than or equal to zero.

With that fixed, this patch is:

Reviewed-by: Fredrik Höglund fred...@kde.org

 +   if (flags  ~(GL_MAP_READ_BIT |
 + GL_MAP_WRITE_BIT |
 + GL_MAP_PERSISTENT_BIT |
 + GL_MAP_COHERENT_BIT |
 + GL_DYNAMIC_STORAGE_BIT |
 + GL_CLIENT_STORAGE_BIT)) {
 +  _mesa_error(ctx, GL_INVALID_VALUE, glBufferStorage(flags));
 +  return;
 +   }
 +
 +   if (flags  GL_MAP_PERSISTENT_BIT 
 +   !(flags  (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT))) {
 +  _mesa_error(ctx, GL_INVALID_VALUE, 
 glBufferStorage(flags!=READ/WRITE));
 +  return;
 +   }
 +
 +   if (flags  GL_MAP_COHERENT_BIT  !(flags  GL_MAP_PERSISTENT_BIT)) {
 +  _mesa_error(ctx, GL_INVALID_VALUE, 
 glBufferStorage(flags!=PERSISTENT));
 +  return;
 +   }
 +
 +   if (flags  GL_MAP_WRITE_BIT  !(flags  GL_DYNAMIC_STORAGE_BIT)) {
 +  _mesa_error(ctx, GL_INVALID_VALUE, glBufferStorage(flags!=DYNAMIC));
 +  return;
 +   }
 +
 +   bufObj = get_buffer(ctx, glBufferStorage, target, GL_INVALID_OPERATION);
 +   if (!bufObj)
 +  return;
 +
 +   if (bufObj-Immutable) {
 +  _mesa_error(ctx, GL_INVALID_OPERATION, glBufferStorage(immutable));
 +  return;
 +   }
 +
 +   if (_mesa_bufferobj_mapped(bufObj)) {
 +  /* Unmap the existing buffer.  We'll replace it now.  Not an error. */
 +  ctx-Driver.UnmapBuffer(ctx, bufObj);
 +  bufObj-AccessFlags = 0;
 +  ASSERT(bufObj-Pointer == NULL);
 +   }
 +
 +   FLUSH_VERTICES(ctx, _NEW_BUFFER_OBJECT);
 +
 +   bufObj-Written = GL_TRUE;
 +   bufObj-Immutable = GL_TRUE;
 +
 +   ASSERT(ctx-Driver.BufferData);
 +   if (!ctx-Driver.BufferData(ctx, target, size, data, GL_DYNAMIC_DRAW,
 +   flags, bufObj)) {
 +  _mesa_error(ctx, GL_OUT_OF_MEMORY, glBufferStorage());
 +   }
 +}
 +
 +
 +void GLAPIENTRY
  _mesa_BufferData(GLenum target, GLsizeiptrARB size,
  const GLvoid * data, GLenum usage)
  {
 @@ -1283,6 +1350,11 @@ _mesa_BufferData(GLenum target, GLsizeiptrARB size,
 if (!bufObj)
return;
  
 +   if (bufObj-Immutable) {
 +  _mesa_error(ctx, GL_INVALID_OPERATION, glBufferData(immutable);
 +  return;
 +   }
 +
 if (_mesa_bufferobj_mapped(bufObj)) {
/* Unmap the existing buffer.  We'll replace it now.  Not an error. */
ctx-Driver.UnmapBuffer(ctx, bufObj);
 @@ -1329,6 +1401,12 @@ _mesa_BufferSubData(GLenum target, GLintptrARB offset,
return;
 }
  
 +   if (bufObj-Immutable 
 +   !(bufObj-StorageFlags  GL_DYNAMIC_STORAGE_BIT)) {
 +  _mesa_error(ctx, GL_INVALID_OPERATION, glBufferSubData);
 +  return;
 +   }
 +
 if (size == 0)
return;
  
 @@ -1661,6 +1739,16 @@ _mesa_GetBufferParameteriv(GLenum target, GLenum 
 pname, GLint *params)
   goto invalid_pname;
*params = (GLint) bufObj-Length;
return;
 +   case GL_BUFFER_IMMUTABLE_STORAGE:
 +  if (!ctx-Extensions.ARB_buffer_storage)
 + goto invalid_pname;
 +  *params = bufObj-Immutable;
 +  return;
 +   case GL_BUFFER_STORAGE_FLAGS:
 +  if (!ctx-Extensions.ARB_buffer_storage)
 + goto invalid_pname;
 +  *params = bufObj-StorageFlags;
 +  return;
 default:
; /* fall-through */
 }
 @@ -1715,6 +1803,16 @@ _mesa_GetBufferParameteri64v(GLenum target, GLenum 
 pname, GLint64 *params)
   goto invalid_pname;
*params = bufObj-Length;
return;
 +   case GL_BUFFER_IMMUTABLE_STORAGE:
 +  if (!ctx-Extensions.ARB_buffer_storage)
 + goto invalid_pname;
 +  *params = bufObj-Immutable;
 +  return;
 +   case GL_BUFFER_STORAGE_FLAGS:
 +  if (!ctx-Extensions.ARB_buffer_storage)
 + goto invalid_pname;
 +  *params = bufObj-StorageFlags;
 +  return;
 default:
; /* fall-through */
 }
 diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
 index 71988b0..174fd60 100644
 --- a/src/mesa/main/bufferobj.h
 +++ b/src/mesa/main/bufferobj.h
 @@ -118,6 +118,10 @@ GLboolean GLAPIENTRY
  

[Mesa-dev] [PATCH 1/3] dri: Require libudev-dev for building DRI on Linux.

2014-01-30 Thread Eric Anholt
The loader infrastructure for everything but DRI2 requires that udev be
present, so we can figure out an appropriate driver from the fd.  We don't
have a portable solution yet, but presumably it will similar lookup based
on the device node.

It will also be even more required for krh's udev-based hwdb support,
which lets us have a loader that actually loads DRI drivers not included
in the loader's source distribution.
---
 configure.ac | 4 
 1 file changed, 4 insertions(+)

diff --git a/configure.ac b/configure.ac
index ba158e8..7d2f7ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -986,6 +986,10 @@ if test x$enable_dri = xyes; then
 DEFINES=$DEFINES -DHAVE_DRI3
 fi
 
+if test x$have_libudev != xyes; then
+AC_MSG_ERROR([libudev-dev required for building DRI])
+fi
+
 case $host_cpu in
 x86_64|amd64)
 if test x$DRI_DIRS = xyes; then
-- 
1.8.5.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/3] dri: Add a useful error message if someone's packages mised libudev deps.

2014-01-30 Thread Eric Anholt
---
 src/loader/loader.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/loader/loader.c b/src/loader/loader.c
index 5d25899..811f8a2 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -111,6 +111,11 @@ udev_dlopen_handle(void)
   * might be ia64.
   */
  udev_handle = dlopen(libudev.so.0, RTLD_LOCAL | RTLD_LAZY);
+
+ if (!udev_handle) {
+log_(_LOADER_FATAL, Couldn't dlopen libudev.so.1 or libudev.so.0, 

+ driver detection may be broken.\n);
+ }
   }
}
 
-- 
1.8.5.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/3] dri: Also support the loader with libudev.so.0.

2014-01-30 Thread Eric Anholt
As far as I know, this should be safe.  If not, we have to decide whether
to have variable lookup of the functions, or just drop support for .so.0
(which is a year and a half old it looks like)
---
 src/loader/loader.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/src/loader/loader.c b/src/loader/loader.c
index 626046a..5d25899 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -102,6 +102,16 @@ udev_dlopen_handle(void)
 {
if (!udev_handle) {
   udev_handle = dlopen(libudev.so.1, RTLD_LOCAL | RTLD_LAZY);
+
+  if (!udev_handle) {
+ /* libudev.so.1 changed the return types of the two unref functions
+  * from voids to pointers.  We don't use those return values, and the
+  * only ABI I've heard that cares about this kind of change (calling
+  * a function with a void * return that actually only returns void)
+  * might be ia64.
+  */
+ udev_handle = dlopen(libudev.so.0, RTLD_LOCAL | RTLD_LAZY);
+  }
}
 
return udev_handle;
-- 
1.8.5.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 05/13] mesa: add error checks to glMapBufferRange for ARB_buffer_storage

2014-01-30 Thread Fredrik Höglund
On Thursday 30 January 2014, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 ---
  src/mesa/main/bufferobj.c | 46 +++---
  1 file changed, 39 insertions(+), 7 deletions(-)
 
 diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
 index 55184f1..ca0b5dd 100644
 --- a/src/mesa/main/bufferobj.c
 +++ b/src/mesa/main/bufferobj.c
 @@ -1934,6 +1934,7 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, 
 GLsizeiptr length,
 GET_CURRENT_CONTEXT(ctx);
 struct gl_buffer_object *bufObj;
 void *map;
 +   GLbitfield allowed_access;
  
 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
  
 @@ -1968,13 +1969,20 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, 
 GLsizeiptr length,
return NULL;
 }
  
 -   if (access  ~(GL_MAP_READ_BIT |
 -  GL_MAP_WRITE_BIT |
 -  GL_MAP_INVALIDATE_RANGE_BIT |
 -  GL_MAP_INVALIDATE_BUFFER_BIT |
 -  GL_MAP_FLUSH_EXPLICIT_BIT |
 -  GL_MAP_UNSYNCHRONIZED_BIT)) {
 -  /* generate an error if any undefind bit is set */
 +   allowed_access = GL_MAP_READ_BIT |
 +GL_MAP_WRITE_BIT |
 +GL_MAP_INVALIDATE_RANGE_BIT |
 +GL_MAP_INVALIDATE_BUFFER_BIT |
 +GL_MAP_FLUSH_EXPLICIT_BIT |
 +GL_MAP_UNSYNCHRONIZED_BIT;
 +
 +   if (ctx-Extensions.ARB_buffer_storage) {
 + allowed_access |= GL_MAP_PERSISTENT_BIT |
 +   GL_MAP_COHERENT_BIT;
 +   }
 +
 +   if (access  ~allowed_access) {
 +  /* generate an error if any other than allowed bit is set */
_mesa_error(ctx, GL_INVALID_VALUE, glMapBufferRange(access));
return NULL;
 }
 @@ -2005,6 +2013,30 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, 
 GLsizeiptr length,
 if (!bufObj)
return NULL;
  
 +   if (access  GL_MAP_READ_BIT 
 +   !(bufObj-StorageFlags  GL_MAP_READ_BIT)) {
 +  _mesa_error(ctx, GL_INVALID_OPERATION,
 +  glMapBufferRange(invalid read flag));
 +   }
 +
 +   if (access  GL_MAP_WRITE_BIT 
 +   !(bufObj-StorageFlags  GL_MAP_WRITE_BIT)) {
 +  _mesa_error(ctx, GL_INVALID_OPERATION,
 +  glMapBufferRange(invalid write flag));
 +   }
 +
 +   if (access  GL_MAP_COHERENT_BIT 
 +   !(bufObj-StorageFlags  GL_MAP_COHERENT_BIT)) {
 +  _mesa_error(ctx, GL_INVALID_OPERATION,
 +  glMapBufferRange(invalid coherent flag));
 +   }
 +
 +   if (access  GL_MAP_PERSISTENT_BIT 
 +   !(bufObj-StorageFlags  GL_MAP_PERSISTENT_BIT)) {
 +  _mesa_error(ctx, GL_INVALID_OPERATION,
 +  glMapBufferRange(invalid persistent flag));
 +   }
 +
 if (offset + length  bufObj-Size) {
_mesa_error(ctx, GL_INVALID_VALUE,
glMapBufferRange(offset + length  size));

Reviewed-by: Fredrik Höglund fred...@kde.org


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] pipe-loader: Add support for render nodes v2

2014-01-30 Thread Jan Vesely
Hi,

are these patches the last thing necessary to get CL programs running
without needing X permission? 
I tried to test them, but got:
pci id for fd 3: 1002:675d, driver r600
pci id for fd 3: 1002:675d, driver r600
radeon: Failed to get PCI ID, error number -13

which is kind of funny combination of messages.

regards,
Jan

PS: $ ls /dev/dri/
card0  controlD64  renderD128

On Thu, 2014-01-30 at 11:34 -0500, Tom Stellard wrote:
 On Tue, Jan 28, 2014 at 03:04:00PM +0100, David Herrmann wrote:
  Hi Tom
  
  On Mon, Jan 27, 2014 at 5:13 PM, Tom Stellard t...@stellard.net wrote:
   From: Tom Stellard thomas.stell...@amd.com
  
   v2:
  - Add missing call to pipe_loader_drm_release()
  - Fix render node macros
  - Drop render-node configure option
  
  Patch looks fine to me, but I lack mesa-insights to really comment on
  it. But I'd like to get a feedback whether there's still any open
  issues with render-nodes. If not, I will fix the minor-allocation-race
  and then try to make rnodes the default in 3.15.
 
 
 I am in favor of enabling rnodes by default for 3.15.  I haven't notice
 any problems with them so far.
 
 -Tom
 
  Thanks
  David
  
   ---
  
   For reference, version 1 of this patch:
   http://lists.freedesktop.org/archives/mesa-dev/2013-October/047296.html
  
.../auxiliary/pipe-loader/pipe_loader_drm.c| 80 
   +-
1 file changed, 77 insertions(+), 3 deletions(-)
  
   diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c 
   b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
   index 9484db8..7a1af91 100644
   --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
   +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
   @@ -49,6 +49,11 @@
#include util/u_dl.h
#include util/u_debug.h
  
   +#define DRM_RENDER_NODE_DEV_NAME_FORMAT %s/renderD%d
   +#define DRM_RENDER_NODE_MAX_NODES 63
   +#define DRM_RENDER_NODE_MIN_MINOR 128
   +#define DRM_RENDER_NODE_MAX_MINOR (DRM_RENDER_NODE_MIN_MINOR + 
   DRM_RENDER_NODE_MAX_NODES)
   +
struct pipe_loader_drm_device {
   struct pipe_loader_device base;
   struct util_dl_library *lib;
   @@ -152,18 +157,87 @@ open_drm_minor(int minor)
   return open(path, O_RDWR, 0);
}
  
   +static int
   +open_drm_render_node_minor(int minor)
   +{
   +   char path[PATH_MAX];
   +   snprintf(path, sizeof(path), DRM_RENDER_NODE_DEV_NAME_FORMAT, 
   DRM_DIR_NAME,
   +minor);
   +   return open(path, O_RDWR, 0);
   +}
   +
int
pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
{
   -   int i, j, fd;
   +   int i, k, fd, num_render_node_devs;
   +   int j = 0;
   +
   +   struct {
   +  unsigned vendor_id;
   +  unsigned chip_id;
   +   } render_node_devs[DRM_RENDER_NODE_MAX_NODES];
   +
   +   /* Look for render nodes first */
   +   for (i = DRM_RENDER_NODE_MIN_MINOR, j = 0;
   +i = DRM_RENDER_NODE_MAX_MINOR; i++) {
   +  fd = open_drm_render_node_minor(i);
   +  struct pipe_loader_device *dev;
   +  if (fd  0)
   + continue;
  
   -   for (i = 0, j = 0; i  DRM_MAX_MINOR; i++) {
   +  if (!pipe_loader_drm_probe_fd(dev, fd, false)) {
   + close(fd);
   + continue;
   +  }
   +
   +  render_node_devs[j].vendor_id = dev-u.pci.vendor_id;
   +  render_node_devs[j].chip_id = dev-u.pci.chip_id;
   +
   +  if (j  ndev) {
   + devs[j] = dev;
   +  } else {
   + close(fd);
   + dev-ops-release(dev);
   +  }
   +  j++;
   +   }
   +
   +   num_render_node_devs = j;
   +
   +   /* Next look for drm devices. */
   +   for (i = 0; i  DRM_MAX_MINOR; i++) {
   +  struct pipe_loader_device *dev;
   +  boolean duplicate = FALSE;
  fd = open_drm_minor(i);
  if (fd  0)
 continue;
  
   -  if (j = ndev || !pipe_loader_drm_probe_fd(devs[j], fd, true))
   +  if (!pipe_loader_drm_probe_fd(dev, fd, true)) {
 close(fd);
   + continue;
   +  }
   +
   +  /* Check to make sure we aren't already accessing this device via
   +   * render nodes.
   +   */
   +  for (k = 0; k  num_render_node_devs; k++) {
   + if (dev-u.pci.vendor_id == render_node_devs[k].vendor_id 
   + dev-u.pci.chip_id == render_node_devs[k].chip_id) {
   +close(fd);
   +dev-ops-release(dev);
   +duplicate = TRUE;
   +break;
   + }
   +  }
   +
   +  if (duplicate)
   + continue;
   +
   +  if (j  ndev) {
   + devs[j] = dev;
   +  } else {
   + dev-ops-release(dev);
   +  }
  
  j++;
   }
   --
   1.8.1.5
  
   ___
   mesa-dev mailing list
   mesa-dev@lists.freedesktop.org
   http://lists.freedesktop.org/mailman/listinfo/mesa-dev
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 

Re: [Mesa-dev] [PATCH 2/2] pipe-loader: Add support for render nodes v2

2014-01-30 Thread Tom Stellard
On Thu, Jan 30, 2014 at 01:55:40PM -0500, Jan Vesely wrote:
 Hi,
 
 are these patches the last thing necessary to get CL programs running
 without needing X permission? 

You also need a 3.12 or newer kernel and you must enable render nodes
ether by adding drm.rnodes=1 to you kernel command line arguments in
grub, or by adding:
options drm rnodes=1
to a config file in /etc/modprobe.d/

-Tom

 I tried to test them, but got:
 pci id for fd 3: 1002:675d, driver r600
 pci id for fd 3: 1002:675d, driver r600
 radeon: Failed to get PCI ID, error number -13
 
 which is kind of funny combination of messages.
 
 regards,
 Jan
 
 PS: $ ls /dev/dri/
 card0  controlD64  renderD128
 
 On Thu, 2014-01-30 at 11:34 -0500, Tom Stellard wrote:
  On Tue, Jan 28, 2014 at 03:04:00PM +0100, David Herrmann wrote:
   Hi Tom
   
   On Mon, Jan 27, 2014 at 5:13 PM, Tom Stellard t...@stellard.net wrote:
From: Tom Stellard thomas.stell...@amd.com
   
v2:
   - Add missing call to pipe_loader_drm_release()
   - Fix render node macros
   - Drop render-node configure option
   
   Patch looks fine to me, but I lack mesa-insights to really comment on
   it. But I'd like to get a feedback whether there's still any open
   issues with render-nodes. If not, I will fix the minor-allocation-race
   and then try to make rnodes the default in 3.15.
  
  
  I am in favor of enabling rnodes by default for 3.15.  I haven't notice
  any problems with them so far.
  
  -Tom
  
   Thanks
   David
   
---
   
For reference, version 1 of this patch:
http://lists.freedesktop.org/archives/mesa-dev/2013-October/047296.html
   
 .../auxiliary/pipe-loader/pipe_loader_drm.c| 80 
+-
 1 file changed, 77 insertions(+), 3 deletions(-)
   
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c 
b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index 9484db8..7a1af91 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -49,6 +49,11 @@
 #include util/u_dl.h
 #include util/u_debug.h
   
+#define DRM_RENDER_NODE_DEV_NAME_FORMAT %s/renderD%d
+#define DRM_RENDER_NODE_MAX_NODES 63
+#define DRM_RENDER_NODE_MIN_MINOR 128
+#define DRM_RENDER_NODE_MAX_MINOR (DRM_RENDER_NODE_MIN_MINOR + 
DRM_RENDER_NODE_MAX_NODES)
+
 struct pipe_loader_drm_device {
struct pipe_loader_device base;
struct util_dl_library *lib;
@@ -152,18 +157,87 @@ open_drm_minor(int minor)
return open(path, O_RDWR, 0);
 }
   
+static int
+open_drm_render_node_minor(int minor)
+{
+   char path[PATH_MAX];
+   snprintf(path, sizeof(path), DRM_RENDER_NODE_DEV_NAME_FORMAT, 
DRM_DIR_NAME,
+minor);
+   return open(path, O_RDWR, 0);
+}
+
 int
 pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
 {
-   int i, j, fd;
+   int i, k, fd, num_render_node_devs;
+   int j = 0;
+
+   struct {
+  unsigned vendor_id;
+  unsigned chip_id;
+   } render_node_devs[DRM_RENDER_NODE_MAX_NODES];
+
+   /* Look for render nodes first */
+   for (i = DRM_RENDER_NODE_MIN_MINOR, j = 0;
+i = DRM_RENDER_NODE_MAX_MINOR; i++) {
+  fd = open_drm_render_node_minor(i);
+  struct pipe_loader_device *dev;
+  if (fd  0)
+ continue;
   
-   for (i = 0, j = 0; i  DRM_MAX_MINOR; i++) {
+  if (!pipe_loader_drm_probe_fd(dev, fd, false)) {
+ close(fd);
+ continue;
+  }
+
+  render_node_devs[j].vendor_id = dev-u.pci.vendor_id;
+  render_node_devs[j].chip_id = dev-u.pci.chip_id;
+
+  if (j  ndev) {
+ devs[j] = dev;
+  } else {
+ close(fd);
+ dev-ops-release(dev);
+  }
+  j++;
+   }
+
+   num_render_node_devs = j;
+
+   /* Next look for drm devices. */
+   for (i = 0; i  DRM_MAX_MINOR; i++) {
+  struct pipe_loader_device *dev;
+  boolean duplicate = FALSE;
   fd = open_drm_minor(i);
   if (fd  0)
  continue;
   
-  if (j = ndev || !pipe_loader_drm_probe_fd(devs[j], fd, true))
+  if (!pipe_loader_drm_probe_fd(dev, fd, true)) {
  close(fd);
+ continue;
+  }
+
+  /* Check to make sure we aren't already accessing this device via
+   * render nodes.
+   */
+  for (k = 0; k  num_render_node_devs; k++) {
+ if (dev-u.pci.vendor_id == render_node_devs[k].vendor_id 
+ dev-u.pci.chip_id == render_node_devs[k].chip_id) {
+close(fd);
+dev-ops-release(dev);
+duplicate = TRUE;
+break;
+ }
+  }
+
+  if (duplicate)
+ continue;
+
+  

Re: [Mesa-dev] [PATCH 3/3] dri: Add a useful error message if someone's packages mised libudev deps.

2014-01-30 Thread Matt Turner
s/mised/missed/ in the commit summary

Series is

Reviewed-by: Matt Turner matts...@gmail.com
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] pipe-loader: Add support for render nodes v2

2014-01-30 Thread Emil Velikov
On 27/01/14 16:13, Tom Stellard wrote:
 From: Tom Stellard thomas.stell...@amd.com
 
 v2:
- Add missing call to pipe_loader_drm_release()
- Fix render node macros
- Drop render-node configure option
 ---
 
 For reference, version 1 of this patch:
 http://lists.freedesktop.org/archives/mesa-dev/2013-October/047296.html
 
  .../auxiliary/pipe-loader/pipe_loader_drm.c| 80 
 +-
  1 file changed, 77 insertions(+), 3 deletions(-)
 
 diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c 
 b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
 index 9484db8..7a1af91 100644
 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
 +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
 @@ -49,6 +49,11 @@
  #include util/u_dl.h
  #include util/u_debug.h
  
 +#define DRM_RENDER_NODE_DEV_NAME_FORMAT %s/renderD%d
 +#define DRM_RENDER_NODE_MAX_NODES 63
 +#define DRM_RENDER_NODE_MIN_MINOR 128
 +#define DRM_RENDER_NODE_MAX_MINOR (DRM_RENDER_NODE_MIN_MINOR + 
 DRM_RENDER_NODE_MAX_NODES)
 +
Hello gents,
Slightly silly question here, so plese be gentle. Shouldn't the above
defines come from a libdrm header ?

Similar to the following (from xf86drm.h)

#define DRM_DIR_NAME  /dev/dri
#define DRM_DEV_NAME  %s/card%d
#define DRM_CONTROL_DEV_NAME  %s/controlD%d

-Emil

  struct pipe_loader_drm_device {
 struct pipe_loader_device base;
 struct util_dl_library *lib;
 @@ -152,18 +157,87 @@ open_drm_minor(int minor)
 return open(path, O_RDWR, 0);
  }
  
 +static int
 +open_drm_render_node_minor(int minor)
 +{
 +   char path[PATH_MAX];
 +   snprintf(path, sizeof(path), DRM_RENDER_NODE_DEV_NAME_FORMAT, 
 DRM_DIR_NAME,
 +minor);
 +   return open(path, O_RDWR, 0);
 +}
 +
  int
  pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
  {
 -   int i, j, fd;
 +   int i, k, fd, num_render_node_devs;
 +   int j = 0;
 +
 +   struct {
 +  unsigned vendor_id;
 +  unsigned chip_id;
 +   } render_node_devs[DRM_RENDER_NODE_MAX_NODES];
 +
 +   /* Look for render nodes first */
 +   for (i = DRM_RENDER_NODE_MIN_MINOR, j = 0;
 +i = DRM_RENDER_NODE_MAX_MINOR; i++) {
 +  fd = open_drm_render_node_minor(i);
 +  struct pipe_loader_device *dev;
 +  if (fd  0)
 + continue;
  
 -   for (i = 0, j = 0; i  DRM_MAX_MINOR; i++) {
 +  if (!pipe_loader_drm_probe_fd(dev, fd, false)) {
 + close(fd);
 + continue;
 +  }
 +
 +  render_node_devs[j].vendor_id = dev-u.pci.vendor_id;
 +  render_node_devs[j].chip_id = dev-u.pci.chip_id;
 +
 +  if (j  ndev) {
 + devs[j] = dev;
 +  } else {
 + close(fd);
 + dev-ops-release(dev);
 +  }
 +  j++;
 +   }
 +
 +   num_render_node_devs = j;
 +
 +   /* Next look for drm devices. */
 +   for (i = 0; i  DRM_MAX_MINOR; i++) {
 +  struct pipe_loader_device *dev;
 +  boolean duplicate = FALSE;
fd = open_drm_minor(i);
if (fd  0)
   continue;
  
 -  if (j = ndev || !pipe_loader_drm_probe_fd(devs[j], fd, true))
 +  if (!pipe_loader_drm_probe_fd(dev, fd, true)) {
   close(fd);
 + continue;
 +  }
 +
 +  /* Check to make sure we aren't already accessing this device via
 +   * render nodes.
 +   */
 +  for (k = 0; k  num_render_node_devs; k++) {
 + if (dev-u.pci.vendor_id == render_node_devs[k].vendor_id 
 + dev-u.pci.chip_id == render_node_devs[k].chip_id) {
 +close(fd);
 +dev-ops-release(dev);
 +duplicate = TRUE;
 +break;
 + }
 +  }
 +
 +  if (duplicate)
 + continue;
 +
 +  if (j  ndev) {
 + devs[j] = dev;
 +  } else {
 + dev-ops-release(dev);
 +  }
  
j++;
 }
 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glcpp: Reject #version after the version has been resolved.

2014-01-30 Thread Carl Worth
Matt Turner matts...@gmail.com writes:
 + if (parser-version_resolved) {
 + glcpp_error( @1, parser, #version after
 version is resolved);

The phrasing after version is resolved makes a lot of sense from the
point-of-view of the implementation, but it's not ideal for guiding the
user to a solution.

Perhaps better would be something like:

#version must be on first line

You might come up with better wording, still. I don't know if it's worth
trying to clarify that comment lines or blank lines can appear before
#version.

It would also be possible to distinguish a separate Duplicate #version
error case, but that would require additional state in the parser so is
likely not worth it. And the first line wording should guide the user
appropriately even if there are duplicate #version directives.

Regardless of the specific wording finally chosen:

Reviewed-by: Carl Worth cwo...@cworth.org

-Carl

-- 
carl.d.wo...@intel.com


pgprLcG_fpZUy.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 06/13] mesa: allow buffers mapped with the persistent flag to be used by the GPU

2014-01-30 Thread Fredrik Höglund
On Thursday 30 January 2014, Chris Forbes wrote:
 Marek,
 
 I think there's an interaction with software primitive restart here.
 
 The primitive restart path maps the index buffer (and the indirect
 buffer, for indirect draws), and relies on these checks to guarantee
 that's possible.
 
 That may not be an issue for your driver, though -- I don't know.

This is also an issue with display list compilation and PBO fallbacks,
which is relevant for the gallium state tracker.

I'm not sure how to best deal with it.  Maybe we need another driver
hook that can create a private mapping of an already mapped buffer
object.

Fredrik

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 08/13] st/mesa: implement ARB_buffer_storage

2014-01-30 Thread Fredrik Höglund
On Thursday 30 January 2014, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 ---
  src/mesa/state_tracker/st_cb_bufferobjects.c  | 81 
 +++
  src/mesa/state_tracker/st_cb_texturebarrier.c | 17 ++
  src/mesa/state_tracker/st_extensions.c|  1 +
  3 files changed, 76 insertions(+), 23 deletions(-)
 
 diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c 
 b/src/mesa/state_tracker/st_cb_bufferobjects.c
 index dac63a5..3e8822c 100644
 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c
 +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
 @@ -182,7 +182,7 @@ st_bufferobj_data(struct gl_context *ctx,
 struct st_context *st = st_context(ctx);
 struct pipe_context *pipe = st-pipe;
 struct st_buffer_object *st_obj = st_buffer_object(obj);
 -   unsigned bind, pipe_usage;
 +   unsigned bind, pipe_usage, pipe_flags = 0;
  
 if (size  data  st_obj-buffer 
 st_obj-Base.Size == size 
 @@ -229,25 +229,42 @@ st_bufferobj_data(struct gl_context *ctx,
bind = 0;
 }
  
 -   switch (usage) {
 -   case GL_STATIC_DRAW:
 -   case GL_STATIC_READ:
 -   case GL_STATIC_COPY:
 -  pipe_usage = PIPE_USAGE_STATIC;
 -  break;
 -   case GL_DYNAMIC_DRAW:
 -   case GL_DYNAMIC_READ:
 -   case GL_DYNAMIC_COPY:
 -  pipe_usage = PIPE_USAGE_DYNAMIC;
 -  break;
 -   case GL_STREAM_DRAW:
 -   case GL_STREAM_READ:
 -   case GL_STREAM_COPY:
 -  pipe_usage = PIPE_USAGE_STREAM;
 -  break;
 -   default:
 -  pipe_usage = PIPE_USAGE_DEFAULT;
 +   /* Set usage. */
 +   if (st_obj-Base.Immutable) {
 +  /* BufferStorage */
 +  if (storageFlags  GL_CLIENT_STORAGE_BIT)
 + pipe_usage = PIPE_USAGE_STAGING;
 +  else
 + pipe_usage = PIPE_USAGE_STATIC;
 }
 +   else {
 +  /* BufferData */
 +  switch (usage) {
 +  case GL_STATIC_DRAW:
 +  case GL_STATIC_READ:
 +  case GL_STATIC_COPY:
 + pipe_usage = PIPE_USAGE_STATIC;
 + break;
 +  case GL_DYNAMIC_DRAW:
 +  case GL_DYNAMIC_READ:
 +  case GL_DYNAMIC_COPY:
 + pipe_usage = PIPE_USAGE_DYNAMIC;
 + break;
 +  case GL_STREAM_DRAW:
 +  case GL_STREAM_READ:
 +  case GL_STREAM_COPY:
 + pipe_usage = PIPE_USAGE_STREAM;
 + break;
 +  default:
 + pipe_usage = PIPE_USAGE_DEFAULT;
 +  }
 +   }
 +
 +   /* Set flags. */
 +   if (storageFlags  GL_MAP_PERSISTENT_BIT)
 +  pipe_flags |= PIPE_RESOURCE_FLAG_TRANSFER_PERSISTENT;
 +   if (storageFlags  GL_MAP_COHERENT_BIT)
 +  pipe_flags |= PIPE_RESOURCE_FLAG_TRANSFER_COHERENT;
  
 pipe_resource_reference( st_obj-buffer, NULL );
  
 @@ -256,8 +273,20 @@ st_bufferobj_data(struct gl_context *ctx,
 }
  
 if (size != 0) {
 -  st_obj-buffer = pipe_buffer_create(pipe-screen, bind,
 -  pipe_usage, size);
 +  struct pipe_resource buffer;
 +
 +  memset(buffer, 0, sizeof buffer);
 +  buffer.target = PIPE_BUFFER;
 +  buffer.format = PIPE_FORMAT_R8_UNORM; /* want TYPELESS or similar */
 +  buffer.bind = bind;
 +  buffer.usage = pipe_usage;
 +  buffer.flags = pipe_flags;
 +  buffer.width0 = size;
 +  buffer.height0 = 1;
 +  buffer.depth0 = 1;
 +  buffer.array_size = 1;
 +
 +  st_obj-buffer = pipe-screen-resource_create(pipe-screen, buffer);
  
if (!st_obj-buffer) {
   /* out of memory */
 @@ -310,6 +339,12 @@ st_bufferobj_map_range(struct gl_context *ctx,
 if (access  GL_MAP_UNSYNCHRONIZED_BIT)
flags |= PIPE_TRANSFER_UNSYNCHRONIZED;
  
 +   if (access  GL_MAP_PERSISTENT_BIT)
 +  flags |= PIPE_TRANSFER_PERSISTENT;
 +
 +   if (access  GL_MAP_COHERENT_BIT)
 +  flags |= PIPE_TRANSFER_COHERENT;
 +
 /* ... other flags ...
  */
  
 @@ -400,8 +435,8 @@ st_copy_buffer_subdata(struct gl_context *ctx,
return;
  
 /* buffer should not already be mapped */
 -   assert(!src-Pointer);
 -   assert(!dst-Pointer);
 +   assert(!_mesa_check_disallowed_mapping(src));
 +   assert(!_mesa_check_disallowed_mapping(dst));
  
 u_box_1d(readOffset, size, box);
  
 diff --git a/src/mesa/state_tracker/st_cb_texturebarrier.c 
 b/src/mesa/state_tracker/st_cb_texturebarrier.c
 index 2f1a22b..b74b9b2 100644
 --- a/src/mesa/state_tracker/st_cb_texturebarrier.c
 +++ b/src/mesa/state_tracker/st_cb_texturebarrier.c
 @@ -54,7 +54,24 @@ st_TextureBarrier(struct gl_context *ctx)
  }
  
  
 +/**
 + * Called via ctx-Driver.MemoryBarrier()
 + */
 +static void
 +st_MemoryBarrier(struct gl_context *ctx, GLbitfield barriers)
 +{
 +   struct pipe_context *pipe = st_context(ctx)-pipe;
 +   unsigned flags = 0;
 +
 +   if (barriers  GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT)
 +  flags |= PIPE_BARRIER_MAPPED_BUFFER;
 +
 +   if (flags)
 +  pipe-memory_barrier(pipe, flags);

This function should probably check if pipe-memory_barrier is NULL in
case a client calls glMemoryBarrier() without checking if it's supported.

Aside from that nit, 

Re: [Mesa-dev] [PATCH 09/13] r300g, r600g, radeonsi: add support for ARB_buffer_storage

2014-01-30 Thread Fredrik Höglund
On Thursday 30 January 2014, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 All GTT memory mappings are coherent and therefore can be persistent.

As we discussed on IRC, I think there should be a comment somewhere
explaining that VRAM mappings are uncached, so the memory_barrier
implementations don't need to do anything for those.

Aside from that, this patch is:

Reviewed-by: Fredrik Höglund fred...@kde.org

 ---
  src/gallium/drivers/r300/r300_screen.c  | 1 +
  src/gallium/drivers/r300/r300_state.c   | 5 +
  src/gallium/drivers/r600/r600_pipe.c| 1 +
  src/gallium/drivers/radeon/r600_buffer_common.c | 4 
  src/gallium/drivers/radeon/r600_pipe_common.c   | 5 +
  src/gallium/drivers/radeonsi/si_pipe.c  | 1 +
  6 files changed, 17 insertions(+)
 
 diff --git a/src/gallium/drivers/r300/r300_screen.c 
 b/src/gallium/drivers/r300/r300_screen.c
 index 4b790af..a3ca829 100644
 --- a/src/gallium/drivers/r300/r300_screen.c
 +++ b/src/gallium/drivers/r300/r300_screen.c
 @@ -106,6 +106,7 @@ static int r300_get_param(struct pipe_screen* pscreen, 
 enum pipe_cap param)
  case PIPE_CAP_USER_INDEX_BUFFERS:
  case PIPE_CAP_USER_CONSTANT_BUFFERS:
  case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
 +case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
  return 1;
  
  case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
 diff --git a/src/gallium/drivers/r300/r300_state.c 
 b/src/gallium/drivers/r300/r300_state.c
 index 048672c..5472263 100644
 --- a/src/gallium/drivers/r300/r300_state.c
 +++ b/src/gallium/drivers/r300/r300_state.c
 @@ -2129,6 +2129,10 @@ static void r300_texture_barrier(struct pipe_context 
 *pipe)
  r300_mark_atom_dirty(r300, r300-texture_cache_inval);
  }
  
 +static void r300_memory_barrier(struct pipe_context *pipe, unsigned flags)
 +{
 +}
 +
  void r300_init_state_functions(struct r300_context* r300)
  {
  r300-context.create_blend_state = r300_create_blend_state;
 @@ -2189,4 +2193,5 @@ void r300_init_state_functions(struct r300_context* 
 r300)
  r300-context.delete_vs_state = r300_delete_vs_state;
  
  r300-context.texture_barrier = r300_texture_barrier;
 +r300-context.memory_barrier = r300_memory_barrier;
  }
 diff --git a/src/gallium/drivers/r600/r600_pipe.c 
 b/src/gallium/drivers/r600/r600_pipe.c
 index 49521e0..3210b2c 100644
 --- a/src/gallium/drivers/r600/r600_pipe.c
 +++ b/src/gallium/drivers/r600/r600_pipe.c
 @@ -354,6 +354,7 @@ static int r600_get_param(struct pipe_screen* pscreen, 
 enum pipe_cap param)
  case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
   case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
   case PIPE_CAP_TEXTURE_MULTISAMPLE:
 +case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
   return 1;
  
   case PIPE_CAP_TGSI_TEXCOORD:
 diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
 b/src/gallium/drivers/radeon/r600_buffer_common.c
 index d29671e..3fff3cf 100644
 --- a/src/gallium/drivers/radeon/r600_buffer_common.c
 +++ b/src/gallium/drivers/radeon/r600_buffer_common.c
 @@ -103,6 +103,10 @@ bool r600_init_resource(struct r600_common_screen 
 *rscreen,
  {
   uint32_t initial_domain, domains;
  
 + /* Use GTT for coherent mappings. */
 + if (res-b.b.flags  PIPE_RESOURCE_FLAG_TRANSFER_COHERENT)
 + usage = PIPE_USAGE_STAGING;
 +
   switch(usage) {
   case PIPE_USAGE_STAGING:
   /* Staging resources participate in transfers, i.e. are used
 diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
 b/src/gallium/drivers/radeon/r600_pipe_common.c
 index 98164f0..307bb47 100644
 --- a/src/gallium/drivers/radeon/r600_pipe_common.c
 +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
 @@ -39,6 +39,10 @@
   * pipe_context
   */
  
 +static void r600_memory_barrier(struct pipe_context *ctx, unsigned flags)
 +{
 +}
 +
  bool r600_common_context_init(struct r600_common_context *rctx,
 struct r600_common_screen *rscreen)
  {
 @@ -56,6 +60,7 @@ bool r600_common_context_init(struct r600_common_context 
 *rctx,
   rctx-b.transfer_flush_region = u_default_transfer_flush_region;
   rctx-b.transfer_unmap = u_transfer_unmap_vtbl;
   rctx-b.transfer_inline_write = u_default_transfer_inline_write;
 +rctx-b.memory_barrier = r600_memory_barrier;
  
   r600_streamout_init(rctx);
   r600_query_init(rctx);
 diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
 b/src/gallium/drivers/radeonsi/si_pipe.c
 index 14dfd30..54a6107 100644
 --- a/src/gallium/drivers/radeonsi/si_pipe.c
 +++ b/src/gallium/drivers/radeonsi/si_pipe.c
 @@ -252,6 +252,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum 
 pipe_cap param)
   case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
  case PIPE_CAP_TGSI_VS_LAYER:
   case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
 + case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
   return 1;
  
   case 

Re: [Mesa-dev] [PATCH 10/13] gallium: the other drivers don't support ARB_buffer_storage

2014-01-30 Thread Fredrik Höglund
On Thursday 30 January 2014, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 ---
  src/gallium/drivers/freedreno/freedreno_screen.c | 1 +
  src/gallium/drivers/i915/i915_screen.c   | 1 +
  src/gallium/drivers/ilo/ilo_screen.c | 1 +
  src/gallium/drivers/llvmpipe/lp_screen.c | 1 +
  src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 1 +
  src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 1 +
  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 1 +
  src/gallium/drivers/softpipe/sp_screen.c | 1 +
  src/gallium/drivers/svga/svga_screen.c   | 1 +
  9 files changed, 9 insertions(+)
 
 diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
 b/src/gallium/drivers/freedreno/freedreno_screen.c
 index c10efd8..250570d 100644
 --- a/src/gallium/drivers/freedreno/freedreno_screen.c
 +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
 @@ -201,6 +201,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
   case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
   case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
  case PIPE_CAP_TGSI_VS_LAYER:
 +case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
   return 0;
  
   /* Stream output. */
 diff --git a/src/gallium/drivers/i915/i915_screen.c 
 b/src/gallium/drivers/i915/i915_screen.c
 index c9f2c35..7920b4f 100644
 --- a/src/gallium/drivers/i915/i915_screen.c
 +++ b/src/gallium/drivers/i915/i915_screen.c
 @@ -225,6 +225,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap 
 cap)
 case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
 case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;
  
 case PIPE_CAP_GLSL_FEATURE_LEVEL:
 diff --git a/src/gallium/drivers/ilo/ilo_screen.c 
 b/src/gallium/drivers/ilo/ilo_screen.c
 index 2c68fcd..c75195b 100644
 --- a/src/gallium/drivers/ilo/ilo_screen.c
 +++ b/src/gallium/drivers/ilo/ilo_screen.c
 @@ -430,6 +430,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap 
 param)
 case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
return true;
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;
  
 default:
 diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
 b/src/gallium/drivers/llvmpipe/lp_screen.c
 index 5643fbe..ed21401 100644
 --- a/src/gallium/drivers/llvmpipe/lp_screen.c
 +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
 @@ -231,6 +231,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum 
 pipe_cap param)
 case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_NATIVE;
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;
 }
 /* should only get here on unhandled cases */
 diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c 
 b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 index 787802d..3df6e64 100644
 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 @@ -124,6 +124,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
 case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
 case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;
 case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
 case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
 diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c 
 b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
 index 2b6ec3a..333f0b1 100644
 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
 +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
 @@ -193,6 +193,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
 case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;
 default:
NOUVEAU_ERR(unknown PIPE_CAP %d\n, param);
 diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c 
 b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
 index 752d72b..b60740f 100644
 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
 +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
 @@ -171,6 +171,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
 case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;
 default:
NOUVEAU_ERR(unknown PIPE_CAP %d\n, param);
 diff --git a/src/gallium/drivers/softpipe/sp_screen.c 
 b/src/gallium/drivers/softpipe/sp_screen.c
 index ed29cea..1f9fe32 100644
 --- a/src/gallium/drivers/softpipe/sp_screen.c
 +++ b/src/gallium/drivers/softpipe/sp_screen.c
 @@ -183,6 +183,7 @@ softpipe_get_param(struct pipe_screen *screen, enum 
 

[Mesa-dev] [Bug 74251] New: Segfault in st_finalize_texture with Texture Buffer

2014-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=74251

  Priority: medium
Bug ID: 74251
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: Segfault in st_finalize_texture with Texture Buffer
  Severity: normal
Classification: Unclassified
OS: Linux (All)
  Reporter: ianml...@gmail.com
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: 10.0
 Component: Mesa core
   Product: Mesa

Using a texture buffer in mesa 10.1 causes a segfault at st_finalize_texture
(st_cb_texture.c:1488). This only appears to occur if the texture buffer is
used by the shader. Additionally, if I never unbind and rebind the texture,
there is no segfault but the texture buffer still doesn't seem to work
properly.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 74251] Segfault in st_finalize_texture with Texture Buffer

2014-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=74251

--- Comment #1 from Ian Milligan ianml...@gmail.com ---
I forgot to add that I am using the r600g driver.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 74251] Segfault in st_finalize_texture with Texture Buffer

2014-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=74251

--- Comment #2 from Marek Olšák mar...@gmail.com ---
Could you please attach the backtrace?

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 74251] Segfault in st_finalize_texture with Texture Buffer

2014-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=74251

--- Comment #3 from Ian Milligan ianml...@gmail.com ---
Oops, I meant mesa 10.0 of course. Here is the backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x726296f4 in st_finalize_texture (ctx=0x71324010, pipe=0xf1b2e0,
tObj=0xf25d70) at state_tracker/st_cb_texture.c:1488
1488state_tracker/st_cb_texture.c: No such file or directory.
(gdb) bt
#0  0x726296f4 in st_finalize_texture (ctx=0x71324010,
pipe=0xf1b2e0, tObj=0xf25d70) at state_tracker/st_cb_texture.c:1488
#1  0x726147aa in finalize_textures (st=0xfc5660) at
state_tracker/st_atom_texture.c:420
#2  0x7260d546 in st_validate_state (st=0xfc5660) at
state_tracker/st_atom.c:202
#3  0x72619c40 in st_Clear (ctx=0x71324010, mask=2) at
state_tracker/st_cb_clear.c:390
#4  0x7249901a in _mesa_Clear (mask=16384) at main/clear.c:202
#5  0x0040970c in sbXU_info ()
#6  0x73dd9010 in ?? ()
#7  0x in ?? ()

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 02/13] mesa: add storage flags parameter to Driver.BufferData

2014-01-30 Thread Marek Olšák
Thanks. I updated the patch here:

http://cgit.freedesktop.org/~mareko/mesa/log/?h=buffer-storage

Marek

On Thu, Jan 30, 2014 at 7:26 PM, Fredrik Höglund fred...@kde.org wrote:
 On Thursday 30 January 2014, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com

 It will be used by glBufferStorage. The parameters are chosen according
 to ARB_buffer_storage.
 ---
  src/mesa/drivers/dri/i915/intel_buffer_objects.c| 5 -
  src/mesa/drivers/dri/i965/intel_buffer_objects.c| 5 -
  src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c| 3 ++-
  src/mesa/drivers/dri/radeon/radeon_buffer_objects.c | 2 ++
  src/mesa/main/bufferobj.c   | 9 +++--
  src/mesa/main/dd.h  | 2 +-
  src/mesa/main/mtypes.h  | 1 +
  src/mesa/state_tracker/st_cb_bufferobjects.c| 6 +-
  src/mesa/vbo/vbo_exec_api.c | 6 +-
  src/mesa/vbo/vbo_exec_draw.c| 8 ++--
  src/mesa/vbo/vbo_save_api.c | 3 +++
  11 files changed, 40 insertions(+), 10 deletions(-)

 diff --git a/src/mesa/drivers/dri/i915/intel_buffer_objects.c 
 b/src/mesa/drivers/dri/i915/intel_buffer_objects.c
 index 345db6d..f4fb999 100644
 --- a/src/mesa/drivers/dri/i915/intel_buffer_objects.c
 +++ b/src/mesa/drivers/dri/i915/intel_buffer_objects.c
 @@ -116,13 +116,16 @@ intel_bufferobj_data(struct gl_context * ctx,
   GLenum target,
   GLsizeiptrARB size,
   const GLvoid * data,
 - GLenum usage, struct gl_buffer_object *obj)
 + GLenum usage,
 + GLbitfield storageFlags,
 + struct gl_buffer_object *obj)
  {
 struct intel_context *intel = intel_context(ctx);
 struct intel_buffer_object *intel_obj = intel_buffer_object(obj);

 intel_obj-Base.Size = size;
 intel_obj-Base.Usage = usage;
 +   intel_obj-Base.StorageFlags = storageFlags;

 assert(!obj-Pointer); /* Mesa should have unmapped it */

 diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c 
 b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
 index 4d7044a..f7b9020 100644
 --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
 +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
 @@ -142,7 +142,9 @@ intel_bufferobj_data(struct gl_context * ctx,
   GLenum target,
   GLsizeiptrARB size,
   const GLvoid * data,
 - GLenum usage, struct gl_buffer_object *obj)
 + GLenum usage,
 + GLbitfield storageFlags,
 + struct gl_buffer_object *obj)
  {
 struct brw_context *brw = brw_context(ctx);
 struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
 @@ -153,6 +155,7 @@ intel_bufferobj_data(struct gl_context * ctx,

 intel_obj-Base.Size = size;
 intel_obj-Base.Usage = usage;
 +   intel_obj-Base.StorageFlags = storageFlags;

 assert(!obj-Pointer); /* Mesa should have unmapped it */

 diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c 
 b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
 index 717c0b8..af17196 100644
 --- a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
 +++ b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
 @@ -73,7 +73,7 @@ nouveau_bufferobj_del(struct gl_context *ctx, struct 
 gl_buffer_object *obj)

  static GLboolean
  nouveau_bufferobj_data(struct gl_context *ctx, GLenum target, GLsizeiptrARB 
 size,
 -const GLvoid *data, GLenum usage,
 +const GLvoid *data, GLenum usage, GLbitfield 
 storageFlags,
  struct gl_buffer_object *obj)
  {
   struct nouveau_bufferobj *nbo = to_nouveau_bufferobj(obj);
 @@ -81,6 +81,7 @@ nouveau_bufferobj_data(struct gl_context *ctx, GLenum 
 target, GLsizeiptrARB size

   obj-Size = size;
   obj-Usage = usage;
 +obj-StorageFlags = storageFlags;

   /* Free previous storage */
   nouveau_bo_ref(NULL, nbo-bo);
 diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c 
 b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
 index 40a16c3..1fa3088 100644
 --- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
 +++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
 @@ -86,6 +86,7 @@ radeonBufferData(struct gl_context * ctx,
   GLsizeiptrARB size,
   const GLvoid * data,
   GLenum usage,
 + GLbitfield storageFlags,
   struct gl_buffer_object *obj)
  {
  radeonContextPtr radeon = RADEON_CONTEXT(ctx);
 @@ -93,6 +94,7 @@ radeonBufferData(struct gl_context * ctx,

  radeon_obj-Base.Size = size;
  radeon_obj-Base.Usage = usage;
 +radeon_obj-Base.StorageFlags = storageFlags;

  if (radeon_obj-bo != NULL) {
  radeon_bo_unref(radeon_obj-bo);
 diff --git 

Re: [Mesa-dev] [PATCH 11/13] gallium/upload_mgr: don't unmap buffers if persistent mappings are supported

2014-01-30 Thread Fredrik Höglund
On Thursday 30 January 2014, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 ---
  src/gallium/auxiliary/util/u_upload_mgr.c | 65 
 ---
  1 file changed, 51 insertions(+), 14 deletions(-)
 
 diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c 
 b/src/gallium/auxiliary/util/u_upload_mgr.c
 index 7349d00..ccaab27 100644
 --- a/src/gallium/auxiliary/util/u_upload_mgr.c
 +++ b/src/gallium/auxiliary/util/u_upload_mgr.c
 @@ -44,6 +44,8 @@ struct u_upload_mgr {
 unsigned default_size;  /* Minimum size of the upload buffer, in bytes. */
 unsigned alignment; /* Alignment of each sub-allocation. */
 unsigned bind;  /* Bitmask of PIPE_BIND_* flags. */
 +   unsigned map_flags; /* Bitmask of PIPE_TRANSFER_* flags. */
 +   boolean map_persistent; /* If persistent mappings are supported. */
  
 struct pipe_resource *buffer;   /* Upload buffer. */
 struct pipe_transfer *transfer; /* Transfer object for the upload buffer. 
 */
 @@ -67,20 +69,39 @@ struct u_upload_mgr *u_upload_create( struct pipe_context 
 *pipe,
 upload-default_size = default_size;
 upload-alignment = alignment;
 upload-bind = bind;
 -   upload-buffer = NULL;
 +
 +   upload-map_persistent =
 +  pipe-screen-get_param(pipe-screen,
 +  PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT);
 +
 +   if (upload-map_persistent) {
 +  upload-map_flags = PIPE_TRANSFER_WRITE |
 +  PIPE_TRANSFER_PERSISTENT |
 +  PIPE_TRANSFER_COHERENT;
 +   }
 +   else {
 +  upload-map_flags = PIPE_TRANSFER_WRITE |
 +  PIPE_TRANSFER_UNSYNCHRONIZED |
 +  PIPE_TRANSFER_FLUSH_EXPLICIT;
 +   }
  
 return upload;
  }
  
 -void u_upload_unmap( struct u_upload_mgr *upload )
 +
 +static void upload_unmap_internal(struct u_upload_mgr *upload, boolean 
 destroying)
  {
 +   if (!destroying  upload-map_persistent)
 +  return;
 +
 if (upload-transfer) {
struct pipe_box *box = upload-transfer-box;
 -  if ((int) upload-offset  box-x) {
  
 +  if (!upload-map_persistent  (int) upload-offset  box-x) {
   pipe_buffer_flush_mapped_range(upload-pipe, upload-transfer,
  box-x, upload-offset - box-x);
}
 +
pipe_transfer_unmap(upload-pipe, upload-transfer);
upload-transfer = NULL;
upload-map = NULL;
 @@ -88,10 +109,16 @@ void u_upload_unmap( struct u_upload_mgr *upload )
  }
  
  
 +void u_upload_unmap( struct u_upload_mgr *upload )
 +{
 +   upload_unmap_internal(upload, FALSE);
 +}
 +
 +
  static void u_upload_release_buffer(struct u_upload_mgr *upload)
  {
 /* Unmap and unreference the upload buffer. */
 -   u_upload_unmap(upload);
 +   upload_unmap_internal(upload, TRUE);
 pipe_resource_reference( upload-buffer, NULL );
 upload-size = 0;
  }
 @@ -108,6 +135,8 @@ static enum pipe_error
  u_upload_alloc_buffer( struct u_upload_mgr *upload,
 unsigned min_size )
  {
 +   struct pipe_screen *screen = upload-pipe-screen;
 +   struct pipe_resource buffer;
 unsigned size;
  
 /* Release the old buffer, if present:
 @@ -118,19 +147,29 @@ u_upload_alloc_buffer( struct u_upload_mgr *upload,
  */
 size = align(MAX2(upload-default_size, min_size), 4096);
  
 -   upload-buffer = pipe_buffer_create( upload-pipe-screen,
 -upload-bind,
 -PIPE_USAGE_STREAM,
 -size );
 +   memset(buffer, 0, sizeof buffer);
 +   buffer.target = PIPE_BUFFER;
 +   buffer.format = PIPE_FORMAT_R8_UNORM; /* want TYPELESS or similar */
 +   buffer.bind = upload-bind;
 +   buffer.usage = PIPE_USAGE_STREAM;
 +   buffer.width0 = size;
 +   buffer.height0 = 1;
 +   buffer.depth0 = 1;
 +   buffer.array_size = 1;
 +
 +   if (upload-map_persistent) {
 +  buffer.flags = PIPE_RESOURCE_FLAG_TRANSFER_PERSISTENT |
 + PIPE_RESOURCE_FLAG_TRANSFER_COHERENT;
 +   }
 +
 +   upload-buffer = screen-resource_create(screen, buffer);
 if (upload-buffer == NULL) {
return PIPE_ERROR_OUT_OF_MEMORY;
 }
  
 /* Map the new buffer. */
 upload-map = pipe_buffer_map_range(upload-pipe, upload-buffer,
 -   0, size,
 -   PIPE_TRANSFER_WRITE |
 -   PIPE_TRANSFER_FLUSH_EXPLICIT,
 +   0, size, upload-map_flags,
 upload-transfer);
 if (upload-map == NULL) {
upload-transfer = NULL;
 @@ -176,9 +215,7 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr 
 *upload,
 if (!upload-map) {
upload-map = pipe_buffer_map_range(upload-pipe, upload-buffer,
 offset, upload-size - offset,
 -   

Re: [Mesa-dev] [PATCH 12/13] gallium/upload_mgr: remove useless variable size

2014-01-30 Thread Fredrik Höglund
On Thursday 30 January 2014, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 ---
  src/gallium/auxiliary/util/u_upload_mgr.c | 10 --
  1 file changed, 4 insertions(+), 6 deletions(-)
 
 diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c 
 b/src/gallium/auxiliary/util/u_upload_mgr.c
 index ccaab27..80ad5c3 100644
 --- a/src/gallium/auxiliary/util/u_upload_mgr.c
 +++ b/src/gallium/auxiliary/util/u_upload_mgr.c
 @@ -50,7 +50,6 @@ struct u_upload_mgr {
 struct pipe_resource *buffer;   /* Upload buffer. */
 struct pipe_transfer *transfer; /* Transfer object for the upload buffer. 
 */
 uint8_t *map;/* Pointer to the mapped upload buffer. */
 -   unsigned size;   /* Actual size of the upload buffer. */
 unsigned offset; /* Aligned offset to the upload buffer, pointing
   * at the first unused byte. */
  };
 @@ -120,7 +119,6 @@ static void u_upload_release_buffer(struct u_upload_mgr 
 *upload)
 /* Unmap and unreference the upload buffer. */
 upload_unmap_internal(upload, TRUE);
 pipe_resource_reference( upload-buffer, NULL );
 -   upload-size = 0;
  }
  
  
 @@ -173,12 +171,10 @@ u_upload_alloc_buffer( struct u_upload_mgr *upload,
 upload-transfer);
 if (upload-map == NULL) {
upload-transfer = NULL;
 -  upload-size = 0;
pipe_resource_reference(upload-buffer, NULL);
return PIPE_ERROR_OUT_OF_MEMORY;
 }
  
 -   upload-size = size;
 upload-offset = 0;
 return PIPE_OK;
  }
 @@ -203,7 +199,8 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr 
 *upload,
  
 /* Make sure we have enough space in the upload buffer
  * for the sub-allocation. */
 -   if (MAX2(upload-offset, alloc_offset) + alloc_size  upload-size) {
 +   if (!upload-buffer ||
 +   MAX2(upload-offset, alloc_offset) + alloc_size  
 upload-buffer-width0) {
enum pipe_error ret = u_upload_alloc_buffer(upload,
alloc_offset + alloc_size);
if (ret != PIPE_OK)
 @@ -214,7 +211,8 @@ enum pipe_error u_upload_alloc( struct u_upload_mgr 
 *upload,
  
 if (!upload-map) {
upload-map = pipe_buffer_map_range(upload-pipe, upload-buffer,
 -   offset, upload-size - offset,
 +  offset,
 +  upload-buffer-width0 - offset,
upload-map_flags,
 upload-transfer);
if (!upload-map) {
 

Reviewed-by: Fredrik Höglund fred...@kde.org


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 13/13] docs: update ARB_buffer_storage status

2014-01-30 Thread Fredrik Höglund
On Thursday 30 January 2014, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com
 
 ---
  docs/GL3.txt| 2 +-
  docs/relnotes/10.1.html | 1 +
  2 files changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/docs/GL3.txt b/docs/GL3.txt
 index 6d6fe71..04edcef 100644
 --- a/docs/GL3.txt
 +++ b/docs/GL3.txt
 @@ -170,7 +170,7 @@ GL 4.4:
  
GLSL 4.4 not started
GL_MAX_VERTEX_ATTRIB_STRIDE  not started
 -  GL_ARB_buffer_storagenot started
 +  GL_ARB_buffer_storageDONE (r300, r600, 
 radeonsi)
GL_ARB_clear_texture not started
GL_ARB_enhanced_layouts  not started
GL_ARB_multi_bindstarted (Fredrik 
 Höglund)
 diff --git a/docs/relnotes/10.1.html b/docs/relnotes/10.1.html
 index d2556da..4130ea2 100644
 --- a/docs/relnotes/10.1.html
 +++ b/docs/relnotes/10.1.html
 @@ -44,6 +44,7 @@ Note: some of the new features are only available with 
 certain drivers.
  /p
  
  ul
 +liGL_ARB_buffer_storage on r300, r600, and radeonsi/li
  liGL_ARB_draw_indirect on i965./li
  liGL_ARB_clear_buffer_object/li
  liGL_ARB_viewport_array on i965./li

Reviewed-by: Fredrik Höglund fred...@kde.org

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 10/13] gallium: the other drivers don't support ARB_buffer_storage

2014-01-30 Thread Marek Olšák
I guess softpipe should be fine. I'm not sure about llvmpipe and its
parallelism.

Marek

On Thu, Jan 30, 2014 at 11:55 PM, Fredrik Höglund fred...@kde.org wrote:
 On Thursday 30 January 2014, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com

 ---
  src/gallium/drivers/freedreno/freedreno_screen.c | 1 +
  src/gallium/drivers/i915/i915_screen.c   | 1 +
  src/gallium/drivers/ilo/ilo_screen.c | 1 +
  src/gallium/drivers/llvmpipe/lp_screen.c | 1 +
  src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 1 +
  src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 1 +
  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 1 +
  src/gallium/drivers/softpipe/sp_screen.c | 1 +
  src/gallium/drivers/svga/svga_screen.c   | 1 +
  9 files changed, 9 insertions(+)

 diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
 b/src/gallium/drivers/freedreno/freedreno_screen.c
 index c10efd8..250570d 100644
 --- a/src/gallium/drivers/freedreno/freedreno_screen.c
 +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
 @@ -201,6 +201,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
   case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
   case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
  case PIPE_CAP_TGSI_VS_LAYER:
 +case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
   return 0;

   /* Stream output. */
 diff --git a/src/gallium/drivers/i915/i915_screen.c 
 b/src/gallium/drivers/i915/i915_screen.c
 index c9f2c35..7920b4f 100644
 --- a/src/gallium/drivers/i915/i915_screen.c
 +++ b/src/gallium/drivers/i915/i915_screen.c
 @@ -225,6 +225,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap 
 cap)
 case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
 case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;

 case PIPE_CAP_GLSL_FEATURE_LEVEL:
 diff --git a/src/gallium/drivers/ilo/ilo_screen.c 
 b/src/gallium/drivers/ilo/ilo_screen.c
 index 2c68fcd..c75195b 100644
 --- a/src/gallium/drivers/ilo/ilo_screen.c
 +++ b/src/gallium/drivers/ilo/ilo_screen.c
 @@ -430,6 +430,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap 
 param)
 case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
return true;
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;

 default:
 diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
 b/src/gallium/drivers/llvmpipe/lp_screen.c
 index 5643fbe..ed21401 100644
 --- a/src/gallium/drivers/llvmpipe/lp_screen.c
 +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
 @@ -231,6 +231,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum 
 pipe_cap param)
 case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_NATIVE;
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;
 }
 /* should only get here on unhandled cases */
 diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c 
 b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 index 787802d..3df6e64 100644
 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 @@ -124,6 +124,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
 case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
 case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;
 case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
 case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
 diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c 
 b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
 index 2b6ec3a..333f0b1 100644
 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
 +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
 @@ -193,6 +193,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
 case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;
 default:
NOUVEAU_ERR(unknown PIPE_CAP %d\n, param);
 diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c 
 b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
 index 752d72b..b60740f 100644
 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
 +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
 @@ -171,6 +171,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
 case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;
 default:
NOUVEAU_ERR(unknown PIPE_CAP %d\n, param);
 diff --git a/src/gallium/drivers/softpipe/sp_screen.c 
 b/src/gallium/drivers/softpipe/sp_screen.c
 index ed29cea..1f9fe32 100644
 --- 

[Mesa-dev] [Bug 74251] Segfault in st_finalize_texture with Texture Buffer

2014-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=74251

--- Comment #4 from Marek Olšák mar...@gmail.com ---
Do you have a code sample how to reproduce this?

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 74251] Segfault in st_finalize_texture with Texture Buffer

2014-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=74251

--- Comment #5 from Ian Milligan ianml...@gmail.com ---
I do but it's not written in C. Let me try to write something which can
reproduce this.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Add warning to _REV pack/unpack functions with incorrect behavior

2014-01-30 Thread Marek Olšák
Pushed, thanks.

Marek

On Sun, Jan 26, 2014 at 7:43 PM, Mark Mueller markkmuel...@gmail.com wrote:
 Signed-off-by: Mark Mueller markkmuel...@gmail.com
 ---
  src/mesa/main/format_pack.c   |  7 ++-
  src/mesa/main/format_unpack.c | 12 
  2 files changed, 18 insertions(+), 1 deletion(-)

 diff --git a/src/mesa/main/format_pack.c b/src/mesa/main/format_pack.c
 index 39d767a..4c7ed58 100644
 --- a/src/mesa/main/format_pack.c
 +++ b/src/mesa/main/format_pack.c
 @@ -492,6 +492,8 @@ pack_row_float_RGB565(GLuint n, const GLfloat src[][4], 
 void *dst)

  /*
   * MESA_FORMAT_R5G6B5_UNORM
 + * Warning: these functions do not match the current Mesa definition
 + * of MESA_FORMAT_R5G6B5_UNORM.
   */

  static void
 @@ -621,7 +623,10 @@ pack_float_ARGB1555(const GLfloat src[4], void *dst)
  }


 -/* MESA_FORMAT_A1R5G5B5_UNORM */
 +/* MESA_FORMAT_A1R5G5B5_UNORM
 + * Warning: these functions do not match the current Mesa definition
 + * of MESA_FORMAT_A1R5G5B5_UNORM.
 + */

  static void
  pack_ubyte_ARGB1555_REV(const GLubyte src[4], void *dst)
 diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
 index 52aa7d2..dc9eba7 100644
 --- a/src/mesa/main/format_unpack.c
 +++ b/src/mesa/main/format_unpack.c
 @@ -234,6 +234,9 @@ unpack_RGB565(const void *src, GLfloat dst[][4], GLuint n)
  static void
  unpack_RGB565_REV(const void *src, GLfloat dst[][4], GLuint n)
  {
 +   /* Warning: this function does not match the current Mesa definition
 +* of MESA_FORMAT_R5G6B5_UNORM.
 +*/
 const GLushort *s = ((const GLushort *) src);
 GLuint i;
 for (i = 0; i  n; i++) {
 @@ -300,6 +303,9 @@ unpack_ARGB1555(const void *src, GLfloat dst[][4], GLuint 
 n)
  static void
  unpack_ARGB1555_REV(const void *src, GLfloat dst[][4], GLuint n)
  {
 +   /* Warning: this function does not match the current Mesa definition
 +* of MESA_FORMAT_A1R5G5B5_UNORM.
 +*/
 const GLushort *s = ((const GLushort *) src);
 GLuint i;
 for (i = 0; i  n; i++) {
 @@ -2699,6 +2705,9 @@ unpack_ubyte_RGB565(const void *src, GLubyte dst[][4], 
 GLuint n)
  static void
  unpack_ubyte_RGB565_REV(const void *src, GLubyte dst[][4], GLuint n)
  {
 +   /* Warning: this function does not match the current Mesa definition
 +* of MESA_FORMAT_R5G6B5_UNORM.
 +*/
 const GLushort *s = ((const GLushort *) src);
 GLuint i;
 for (i = 0; i  n; i++) {
 @@ -2765,6 +2774,9 @@ unpack_ubyte_ARGB1555(const void *src, GLubyte 
 dst[][4], GLuint n)
  static void
  unpack_ubyte_ARGB1555_REV(const void *src, GLubyte dst[][4], GLuint n)
  {
 +   /* Warning: this function does not match the current Mesa definition
 +* of MESA_FORMAT_A1R5G5B5_UNORM.
 +*/
 const GLushort *s = ((const GLushort *) src);
 GLuint i;
 for (i = 0; i  n; i++) {
 --
 1.8.3.1

 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 02/13] mesa: add storage flags parameter to Driver.BufferData

2014-01-30 Thread Fredrik Höglund
On Friday 31 January 2014, Marek Olšák wrote:
 Thanks. I updated the patch here:
 
 http://cgit.freedesktop.org/~mareko/mesa/log/?h=buffer-storage
 
 Marek

Looks good to me.

Reviewed-by: Fredrik Höglund fred...@kde.org

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] i965: Add missing BRW_NEW_STATE_BASE_ADDRESS to scissor state atom.

2014-01-30 Thread Eric Anholt
Kenneth Graunke kenn...@whitecape.org writes:

 The pointer value is relative to the base address, so if we change the
 base address, we'd better re-emit this.

I see about 50 callers of brw_state_batch, but only about 8 that flag
BRW_NEW_STATE_BASE_ADDRESS (some of which, iirc, are things that must
be reemitted if is emitted, even if the SBAs don't change).  I guess I
could see converting them all to also flagging BRW_NEW_SBA, but I think
the BRW_NEW_BATCH they all have is sufficient.


pgp8Hwpj_Yt2Q.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 01/13] mesa: remove unused driver hook BindBuffer

2014-01-30 Thread Fredrik Höglund
On Thursday 30 January 2014, Marek Olšák wrote:
 Is it for all patches or just this patch?

Probably obvious by now, but just this patch :)

I reviewed most of them though.

Fredrik

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 06/13] mesa: allow buffers mapped with the persistent flag to be used by the GPU

2014-01-30 Thread Marek Olšák
You are right. We need to support at least 2 buffer mappings: one for
the user and the other one for internal purposes.

Marek

On Thu, Jan 30, 2014 at 11:33 PM, Fredrik Höglund fred...@kde.org wrote:
 On Thursday 30 January 2014, Chris Forbes wrote:
 Marek,

 I think there's an interaction with software primitive restart here.

 The primitive restart path maps the index buffer (and the indirect
 buffer, for indirect draws), and relies on these checks to guarantee
 that's possible.

 That may not be an issue for your driver, though -- I don't know.

 This is also an issue with display list compilation and PBO fallbacks,
 which is relevant for the gallium state tracker.

 I'm not sure how to best deal with it.  Maybe we need another driver
 hook that can create a private mapping of an already mapped buffer
 object.

 Fredrik

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] pipe-loader: Add support for render nodes v2

2014-01-30 Thread Jan Vesely
On Thu, 2014-01-30 at 15:52 -0500, Tom Stellard wrote:
 On Thu, Jan 30, 2014 at 01:55:40PM -0500, Jan Vesely wrote:
  Hi,
  
  are these patches the last thing necessary to get CL programs running
  without needing X permission? 
 
 You also need a 3.12 or newer kernel and you must enable render nodes
 ether by adding drm.rnodes=1 to you kernel command line arguments in
 grub, or by adding:
 options drm rnodes=1
 to a config file in /etc/modprobe.d/

turns out I wasn't in the video group,
sry for the noise.

these patches work OK.

regards,
Jan



 
 -Tom
 
  I tried to test them, but got:
  pci id for fd 3: 1002:675d, driver r600
  pci id for fd 3: 1002:675d, driver r600
  radeon: Failed to get PCI ID, error number -13
  
  which is kind of funny combination of messages.
  
  regards,
  Jan
  
  PS: $ ls /dev/dri/
  card0  controlD64  renderD128
  
  On Thu, 2014-01-30 at 11:34 -0500, Tom Stellard wrote:
   On Tue, Jan 28, 2014 at 03:04:00PM +0100, David Herrmann wrote:
Hi Tom

On Mon, Jan 27, 2014 at 5:13 PM, Tom Stellard t...@stellard.net wrote:
 From: Tom Stellard thomas.stell...@amd.com

 v2:
- Add missing call to pipe_loader_drm_release()
- Fix render node macros
- Drop render-node configure option

Patch looks fine to me, but I lack mesa-insights to really comment on
it. But I'd like to get a feedback whether there's still any open
issues with render-nodes. If not, I will fix the minor-allocation-race
and then try to make rnodes the default in 3.15.
   
   
   I am in favor of enabling rnodes by default for 3.15.  I haven't notice
   any problems with them so far.
   
   -Tom
   
Thanks
David

 ---

 For reference, version 1 of this patch:
 http://lists.freedesktop.org/archives/mesa-dev/2013-October/047296.html

  .../auxiliary/pipe-loader/pipe_loader_drm.c| 80 
 +-
  1 file changed, 77 insertions(+), 3 deletions(-)

 diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c 
 b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
 index 9484db8..7a1af91 100644
 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
 +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
 @@ -49,6 +49,11 @@
  #include util/u_dl.h
  #include util/u_debug.h

 +#define DRM_RENDER_NODE_DEV_NAME_FORMAT %s/renderD%d
 +#define DRM_RENDER_NODE_MAX_NODES 63
 +#define DRM_RENDER_NODE_MIN_MINOR 128
 +#define DRM_RENDER_NODE_MAX_MINOR (DRM_RENDER_NODE_MIN_MINOR + 
 DRM_RENDER_NODE_MAX_NODES)
 +
  struct pipe_loader_drm_device {
 struct pipe_loader_device base;
 struct util_dl_library *lib;
 @@ -152,18 +157,87 @@ open_drm_minor(int minor)
 return open(path, O_RDWR, 0);
  }

 +static int
 +open_drm_render_node_minor(int minor)
 +{
 +   char path[PATH_MAX];
 +   snprintf(path, sizeof(path), DRM_RENDER_NODE_DEV_NAME_FORMAT, 
 DRM_DIR_NAME,
 +minor);
 +   return open(path, O_RDWR, 0);
 +}
 +
  int
  pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev)
  {
 -   int i, j, fd;
 +   int i, k, fd, num_render_node_devs;
 +   int j = 0;
 +
 +   struct {
 +  unsigned vendor_id;
 +  unsigned chip_id;
 +   } render_node_devs[DRM_RENDER_NODE_MAX_NODES];
 +
 +   /* Look for render nodes first */
 +   for (i = DRM_RENDER_NODE_MIN_MINOR, j = 0;
 +i = DRM_RENDER_NODE_MAX_MINOR; i++) {
 +  fd = open_drm_render_node_minor(i);
 +  struct pipe_loader_device *dev;
 +  if (fd  0)
 + continue;

 -   for (i = 0, j = 0; i  DRM_MAX_MINOR; i++) {
 +  if (!pipe_loader_drm_probe_fd(dev, fd, false)) {
 + close(fd);
 + continue;
 +  }
 +
 +  render_node_devs[j].vendor_id = dev-u.pci.vendor_id;
 +  render_node_devs[j].chip_id = dev-u.pci.chip_id;
 +
 +  if (j  ndev) {
 + devs[j] = dev;
 +  } else {
 + close(fd);
 + dev-ops-release(dev);
 +  }
 +  j++;
 +   }
 +
 +   num_render_node_devs = j;
 +
 +   /* Next look for drm devices. */
 +   for (i = 0; i  DRM_MAX_MINOR; i++) {
 +  struct pipe_loader_device *dev;
 +  boolean duplicate = FALSE;
fd = open_drm_minor(i);
if (fd  0)
   continue;

 -  if (j = ndev || !pipe_loader_drm_probe_fd(devs[j], fd, true))
 +  if (!pipe_loader_drm_probe_fd(dev, fd, true)) {
   close(fd);
 + continue;
 +  }
 +
 +  /* Check to make sure we aren't already accessing this device 
 via
 +   * render nodes.
 +   */
 +  for (k = 0; k  num_render_node_devs; k++) {
 + if (dev-u.pci.vendor_id == 

Re: [Mesa-dev] [PATCH 09/13] r300g, r600g, radeonsi: add support for ARB_buffer_storage

2014-01-30 Thread Michel Dänzer
On Don, 2014-01-30 at 23:46 +0100, Fredrik Höglund wrote:
 On Thursday 30 January 2014, Marek Olšák wrote:
  From: Marek Olšák marek.ol...@amd.com
  
  All GTT memory mappings are coherent and therefore can be persistent.
 
 As we discussed on IRC, I think there should be a comment somewhere
 explaining that VRAM mappings are uncached, so the memory_barrier
 implementations don't need to do anything for those.

VRAM is mapped uncacheable by the CPU, but there is an HDP cache which
must be flushed to ensure coherency between the CPU and GPU. So I
suspect memory_barrier actually needs to flush the HDP cache for VRAM.

I'm wondering about GTT mappings on AGP as well. I think we're using CPU
write-combining for those, so we probably need to flush the
write-combining buffers?


-- 
Earthling Michel Dänzer|  http://www.amd.com
Libre software enthusiast  |Mesa and X developer

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 74251] Segfault in st_finalize_texture with Texture Buffer

2014-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=74251

--- Comment #6 from Ian Milligan ianml...@gmail.com ---
Created attachment 93095
  -- https://bugs.freedesktop.org/attachment.cgi?id=93095action=edit
Vertex shader using texture buffer.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 74251] Segfault in st_finalize_texture with Texture Buffer

2014-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=74251

--- Comment #7 from Ian Milligan ianml...@gmail.com ---
Created attachment 93096
  -- https://bugs.freedesktop.org/attachment.cgi?id=93096action=edit
Failing code.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 74251] Segfault in st_finalize_texture with Texture Buffer

2014-01-30 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=74251

--- Comment #8 from Ian Milligan ianml...@gmail.com ---
The segfault appears to occur when glClear is called while a vertex shader
expecting a texture buffer is loaded, but no texture is bound. This can be
reproduced simply by loading the attached vertex shader and calling glClear.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 02/25] r600g: move barrier and end_of_program bits from output to cf struct

2014-01-30 Thread Dave Airlie
On Thu, Jan 30, 2014 at 10:42 AM, Dave Airlie airl...@gmail.com wrote:
 From: Vadim Girlin vadimgir...@gmail.com

 Signed-off-by: Vadim Girlin vadimgir...@gmail.com
 Signed-off-by: Dave Airlie airl...@redhat.com

This commit has a missing line in the r600 case that causes a
regression, I'll fix it up.

Dave.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] Gallium/dri2: Fix dri2_dup_image

2014-01-30 Thread Michel Dänzer
On Don, 2014-01-30 at 16:10 +0100, Axel Davy wrote:
 dri2_dup_image was not copying the dri_format field.
 
 This was causing some bugs, for example:
 . we create an gbm_bo.
 . we get an EGLImage from the gbm_bo.
 . Bug: impossible to get again the gbm_bo from the EGLImage by importing. 
 (gbm dri2 backend)
 
 Signed-off-by: Axel Davy axel.d...@ens.fr
 ---
  src/gallium/state_trackers/dri/drm/dri2.c | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/src/gallium/state_trackers/dri/drm/dri2.c 
 b/src/gallium/state_trackers/dri/drm/dri2.c
 index 2a5b7b4..0589644 100644
 --- a/src/gallium/state_trackers/dri/drm/dri2.c
 +++ b/src/gallium/state_trackers/dri/drm/dri2.c
 @@ -777,6 +777,7 @@ dri2_dup_image(__DRIimage *image, void *loaderPrivate)
 pipe_resource_reference(img-texture, image-texture);
 img-level = image-level;
 img-layer = image-layer;
 +   img-dri_format = image-dri_format;
 /* This should be 0 for sub images, but dup is also used for base images. 
 */
 img-dri_components = image-dri_components;
 img-loader_private = loaderPrivate;

Reviewed-by: Michel Dänzer michel.daen...@amd.com

Do you have Git write access?


-- 
Earthling Michel Dänzer|  http://www.amd.com
Libre software enthusiast  |Mesa and X developer

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] r600g: move barrier and end_of_program bits from output to cf struct (v2)

2014-01-30 Thread Dave Airlie
From: Vadim Girlin vadimgir...@gmail.com

v2: fix regression on r600 NOP instructions.

Signed-off-by: Vadim Girlin vadimgir...@gmail.com
Signed-off-by: Dave Airlie airl...@redhat.com

Fix regression since eop moving
---
 src/gallium/drivers/r600/eg_asm.c  | 10 ++
 src/gallium/drivers/r600/r600_asm.c| 24 +---
 src/gallium/drivers/r600/r600_asm.h|  4 ++--
 src/gallium/drivers/r600/r600_shader.c | 26 +-
 4 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/src/gallium/drivers/r600/eg_asm.c 
b/src/gallium/drivers/r600/eg_asm.c
index fffc436..42e78c0 100644
--- a/src/gallium/drivers/r600/eg_asm.c
+++ b/src/gallium/drivers/r600/eg_asm.c
@@ -86,11 +86,11 @@ int eg_bytecode_cf_build(struct r600_bytecode *bc, struct 
r600_bytecode_cf *cf)

S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y(cf-output.swizzle_y) |

S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z(cf-output.swizzle_z) |

S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W(cf-output.swizzle_w) |
-   
S_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(cf-output.barrier) |
+   
S_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(cf-barrier) |

S_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(opcode);
 
if (bc-chip_class == EVERGREEN) /* no EOP on cayman */
-   bc-bytecode[id] |= 
S_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(cf-output.end_of_program);
+   bc-bytecode[id] |= 
S_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(cf-end_of_program);
id++;
} else if (cfop-flags  CF_STRM) {
/* MEM_STREAM instructions */
@@ -99,12 +99,12 @@ int eg_bytecode_cf_build(struct r600_bytecode *bc, struct 
r600_bytecode_cf *cf)

S_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE(cf-output.array_base) |

S_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(cf-output.type);
bc-bytecode[id] = 
S_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(cf-output.burst_count - 1) |
-   
S_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(cf-output.barrier) |
+   
S_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(cf-barrier) |

S_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(opcode) |

S_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK(cf-output.comp_mask) |

S_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE(cf-output.array_size);
if (bc-chip_class == EVERGREEN) /* no EOP on cayman */
-   bc-bytecode[id] |= 
S_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(cf-output.end_of_program);
+   bc-bytecode[id] |= 
S_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(cf-end_of_program);
id++;
} else {
/* branch, loop, call, return instructions */
@@ -118,6 +118,7 @@ int eg_bytecode_cf_build(struct r600_bytecode *bc, struct 
r600_bytecode_cf *cf)
return 0;
 }
 
+#if 0
 void eg_bytecode_export_read(struct r600_bytecode *bc,
struct r600_bytecode_output *output, uint32_t word0, uint32_t 
word1)
 {
@@ -138,3 +139,4 @@ void eg_bytecode_export_read(struct r600_bytecode *bc,
output-array_size = G_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE(word1);
output-comp_mask = G_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK(word1);
 }
+#endif
diff --git a/src/gallium/drivers/r600/r600_asm.c 
b/src/gallium/drivers/r600/r600_asm.c
index 86f79e2..7f7731c 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -193,7 +193,6 @@ int r600_bytecode_add_output(struct r600_bytecode *bc,
if ((output-gpr + output-burst_count) == 
bc-cf_last-output.gpr 
(output-array_base + output-burst_count) == 
bc-cf_last-output.array_base) {
 
-   bc-cf_last-output.end_of_program |= 
output-end_of_program;
bc-cf_last-op = bc-cf_last-output.op = output-op;
bc-cf_last-output.gpr = output-gpr;
bc-cf_last-output.array_base = output-array_base;
@@ -203,7 +202,6 @@ int r600_bytecode_add_output(struct r600_bytecode *bc,
} else if (output-gpr == (bc-cf_last-output.gpr + 
bc-cf_last-output.burst_count) 
output-array_base == (bc-cf_last-output.array_base + 
bc-cf_last-output.burst_count)) {
 
-   bc-cf_last-output.end_of_program |= 
output-end_of_program;
bc-cf_last-op = bc-cf_last-output.op = output-op;
bc-cf_last-output.burst_count += output-burst_count;
return 0;

[Mesa-dev] [PATCH] r600g: add support for geom shaders to r600/r700 chipsets

2014-01-30 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

This is my first attempt at enabling r600/r700 geometry shaders,
the basic tests pass on both my rv770 and my rv635,

It requires this kernel patch:
http://www.spinics.net/lists/dri-devel/msg52745.html

Signed-off-by: Dave Airlie airl...@redhat.com
---
 src/gallium/drivers/r600/r600_asm.c  |   2 +-
 src/gallium/drivers/r600/r600_pipe.c |  16 +-
 src/gallium/drivers/r600/r600_pipe.h |   3 +
 src/gallium/drivers/r600/r600_shader.c   |  26 ++-
 src/gallium/drivers/r600/r600_state.c| 264 +++
 src/gallium/drivers/r600/r600_state_common.c |   2 +-
 src/gallium/drivers/r600/r600d.h |  50 -
 7 files changed, 314 insertions(+), 49 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_asm.c 
b/src/gallium/drivers/r600/r600_asm.c
index e24789e..c420824 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -1535,7 +1535,7 @@ static int r600_bytecode_cf_build(struct r600_bytecode 
*bc, struct r600_bytecode
S_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(cf-barrier) |
S_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(opcode) |

S_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(cf-end_of_program);
-   } else if (cfop-flags  CF_STRM) {
+   } else if (cfop-flags  CF_MEM) {
bc-bytecode[id++] = 
S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(cf-output.gpr) |

S_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(cf-output.elem_size) |

S_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE(cf-output.array_base) |
diff --git a/src/gallium/drivers/r600/r600_pipe.c 
b/src/gallium/drivers/r600/r600_pipe.c
index 8050839..e28bce7 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -372,7 +372,12 @@ static int r600_get_param(struct pipe_screen* pscreen, 
enum pipe_cap param)
return 1;
 
case PIPE_CAP_GLSL_FEATURE_LEVEL:
-   return family = CHIP_CEDAR ? 330 : 140;
+   if (family = CHIP_CEDAR)
+  return 330;
+   /* pre-evergreen geom shaders need newer kernel */
+   if (rscreen-b.info.drm_minor = 37)
+  return 330;
+   return 140;
 
/* Supported except the original R600. */
case PIPE_CAP_INDEP_BLEND_ENABLE:
@@ -458,9 +463,12 @@ static int r600_get_shader_param(struct pipe_screen* 
pscreen, unsigned shader, e
case PIPE_SHADER_COMPUTE:
break;
case PIPE_SHADER_GEOMETRY:
-   if (rscreen-b.chip_class  EVERGREEN)
-   return 0;
-   break;
+   if (rscreen-b.family = CHIP_CEDAR)
+   break;
+   /* pre-evergreen geom shaders need newer kernel */
+   if (rscreen-b.info.drm_minor = 37)
+   break;
+   return 0;
default:
/* XXX: support tessellation on Evergreen */
return 0;
diff --git a/src/gallium/drivers/r600/r600_pipe.h 
b/src/gallium/drivers/r600/r600_pipe.h
index 2d2c79b..9f27a17 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -160,6 +160,7 @@ struct r600_sample_mask {
 struct r600_config_state {
struct r600_atom atom;
unsigned sq_gpr_resource_mgmt_1;
+   unsigned sq_gpr_resource_mgmt_2;
 };
 
 struct r600_stencil_ref
@@ -565,6 +566,8 @@ r600_create_sampler_view_custom(struct pipe_context *ctx,
 void r600_init_state_functions(struct r600_context *rctx);
 void r600_init_atom_start_cs(struct r600_context *rctx);
 void r600_update_ps_state(struct pipe_context *ctx, struct r600_pipe_shader 
*shader);
+void r600_update_es_state(struct pipe_context *ctx, struct r600_pipe_shader 
*shader);
+void r600_update_gs_state(struct pipe_context *ctx, struct r600_pipe_shader 
*shader);
 void r600_update_vs_state(struct pipe_context *ctx, struct r600_pipe_shader 
*shader);
 void *r600_create_db_flush_dsa(struct r600_context *rctx);
 void *r600_create_resolve_blend(struct r600_context *rctx);
diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 82d4d02..f419812 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -210,7 +210,8 @@ int r600_pipe_shader_create(struct pipe_context *ctx,
evergreen_update_gs_state(ctx, shader);
evergreen_update_vs_state(ctx, shader-gs_copy_shader);
} else {
-   assert(!not suported yet);
+   r600_update_gs_state(ctx, shader);
+   r600_update_vs_state(ctx, shader-gs_copy_shader);
}
break;
case TGSI_PROCESSOR_VERTEX:
@@ -220,7 +221,10 @@ int r600_pipe_shader_create(struct pipe_context *ctx,
else
  

[Mesa-dev] r600+700 geometry shader patch

2014-01-30 Thread Dave Airlie
I've lightly tested this, not piglit strength yet,
and it does require the kernel patch to work.

its also available in a branch in my repo r600-geom-shaders.

Dave.

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 10/13] gallium: the other drivers don't support ARB_buffer_storage

2014-01-30 Thread Roland Scheidegger
softpipe has tile caches though (for textures and render targets). I'm
not sure if they'd be flushed whenever needed or if that would even be a
problem.
As for llvmpipe, there's no caches there, I'm not sure if there could be
other problems.

Roland

Am 31.01.2014 00:44, schrieb Marek Olšák:
 I guess softpipe should be fine. I'm not sure about llvmpipe and its
 parallelism.
 
 Marek
 
 On Thu, Jan 30, 2014 at 11:55 PM, Fredrik Höglund fred...@kde.org wrote:
 On Thursday 30 January 2014, Marek Olšák wrote:
 From: Marek Olšák marek.ol...@amd.com

 ---
  src/gallium/drivers/freedreno/freedreno_screen.c | 1 +
  src/gallium/drivers/i915/i915_screen.c   | 1 +
  src/gallium/drivers/ilo/ilo_screen.c | 1 +
  src/gallium/drivers/llvmpipe/lp_screen.c | 1 +
  src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 1 +
  src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 1 +
  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 1 +
  src/gallium/drivers/softpipe/sp_screen.c | 1 +
  src/gallium/drivers/svga/svga_screen.c   | 1 +
  9 files changed, 9 insertions(+)

 diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c 
 b/src/gallium/drivers/freedreno/freedreno_screen.c
 index c10efd8..250570d 100644
 --- a/src/gallium/drivers/freedreno/freedreno_screen.c
 +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
 @@ -201,6 +201,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
   case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
   case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
  case PIPE_CAP_TGSI_VS_LAYER:
 +case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
   return 0;

   /* Stream output. */
 diff --git a/src/gallium/drivers/i915/i915_screen.c 
 b/src/gallium/drivers/i915/i915_screen.c
 index c9f2c35..7920b4f 100644
 --- a/src/gallium/drivers/i915/i915_screen.c
 +++ b/src/gallium/drivers/i915/i915_screen.c
 @@ -225,6 +225,7 @@ i915_get_param(struct pipe_screen *screen, enum 
 pipe_cap cap)
 case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
 case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;

 case PIPE_CAP_GLSL_FEATURE_LEVEL:
 diff --git a/src/gallium/drivers/ilo/ilo_screen.c 
 b/src/gallium/drivers/ilo/ilo_screen.c
 index 2c68fcd..c75195b 100644
 --- a/src/gallium/drivers/ilo/ilo_screen.c
 +++ b/src/gallium/drivers/ilo/ilo_screen.c
 @@ -430,6 +430,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap 
 param)
 case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
return true;
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;

 default:
 diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
 b/src/gallium/drivers/llvmpipe/lp_screen.c
 index 5643fbe..ed21401 100644
 --- a/src/gallium/drivers/llvmpipe/lp_screen.c
 +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
 @@ -231,6 +231,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum 
 pipe_cap param)
 case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_NATIVE;
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;
 }
 /* should only get here on unhandled cases */
 diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c 
 b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 index 787802d..3df6e64 100644
 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
 @@ -124,6 +124,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
 case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
 case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;
 case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
 case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
 diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c 
 b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
 index 2b6ec3a..333f0b1 100644
 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
 +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
 @@ -193,6 +193,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
 case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
 case PIPE_CAP_TGSI_VS_LAYER:
 +   case PIPE_CAP_BUFFER_TRANSFER_PERSISTENT_COHERENT:
return 0;
 default:
NOUVEAU_ERR(unknown PIPE_CAP %d\n, param);
 diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c 
 b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
 index 752d72b..b60740f 100644
 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
 +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
 @@ -171,6 +171,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum 
 pipe_cap param)
 case PIPE_CAP_ENDIANNESS:
return PIPE_ENDIAN_LITTLE;
 case 

[Mesa-dev] [PATCH] st/dri: Fix tests for no draw/read buffers in dri_make_current()

2014-01-30 Thread Michel Dänzer
From: Michel Dänzer michel.daen...@amd.com

Fixes piglit glx/GLX_ARB_create_context/current with no framebuffer.

Signed-off-by: Michel Dänzer michel.daen...@amd.com
---
 src/gallium/state_trackers/dri/common/dri_context.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/dri/common/dri_context.c 
b/src/gallium/state_trackers/dri/common/dri_context.c
index 988e28e..f6979a7 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -236,9 +236,9 @@ dri_make_current(__DRIcontext * cPriv,
 
++ctx-bind_count;
 
-   if (!driDrawPriv  !driReadPriv)
+   if (!draw  !read)
   return ctx-stapi-make_current(ctx-stapi, ctx-st, NULL, NULL);
-   else if (!driDrawPriv || !driReadPriv)
+   else if (!draw || !read)
   return GL_FALSE;
 
if (ctx-dPriv != driDrawPriv) {
-- 
1.8.5.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] r600g: fix CAYMAN geometry shader support

2014-01-30 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

cayman has a different end of program bit, so do that properly.

fixes hangs with geom shader tests on cayman.

Signed-off-by: Dave Airlie airl...@redhat.com
---
 src/gallium/drivers/r600/r600_shader.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index f419812..fb9f48b 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1369,8 +1369,12 @@ static int generate_gs_copy_shader(struct r600_context 
*rctx,
cf_pop-cf_addr = cf_pop-id + 2;
cf_pop-pop_count = 1;
 
-   r600_bytecode_add_cfinst(ctx.bc, CF_OP_NOP);
-   ctx.bc-cf_last-end_of_program = 1;
+if (ctx.bc-chip_class == CAYMAN)
+cm_bytecode_add_cf_end(ctx.bc);
+   else {
+   r600_bytecode_add_cfinst(ctx.bc, CF_OP_NOP);
+   ctx.bc-cf_last-end_of_program = 1;
+   }
 
gs-gs_copy_shader = cshader;
 
-- 
1.8.3.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev