Re: [Mesa-dev] [PATCH automake] Support LLVM = 3.2 on radeonsi and opencl.

2012-12-21 Thread Johannes Obermayr
Am Freitag, 21. Dezember 2012, 10:58:53 schrieb Mike Lothian:
 Should the warning be updated to say you can now use llvm svn master with
 --enable-experimental-targets=R600?

Nope. Tom's git repository contains the stable branch (3.2) of LLVM and what I 
can see most of the work is based on AMDGPU (because it is git) before it will 
be pushed to R600 on LLVM svn trunk.

IMHO changing the development model will cause a change of the warning message.

 On 20 Dec 2012 19:58, Johannes Obermayr johannesoberm...@gmx.de wrote:
 
  ---
  Because Tom's LLVM 3.2 git repository uses AMDGPU and LLVM 3.3 trunk uses
  R600 we must adapt Mesa a bit to support both.
 
  This patch works only for automake branch because it requires
  LLVM_VERSION_INT from:
 
  http://cgit.freedesktop.org/~mattst88/mesa/commit/?h=automake-gallium6id=b772e110a2d744e782114859d475d109862a672d
 
  Clover tested with LLVM trunk and opencl-example/run_tests.sh on AMD
  Fusion (ASUS E35M1-I Deluxe) by me.
  ---
   configure.ac|   11 ++-
   src/gallium/drivers/radeon/radeon_llvm_emit.cpp |7 +++
   2 Dateien geändert, 13 Zeilen hinzugefügt(+), 5 Zeilen entfernt(-)
 
  diff --git a/configure.ac b/configure.ac
  index 03e96c7..13f6127 100644
  --- a/configure.ac
  +++ b/configure.ac
  @@ -1779,22 +1779,23 @@ gallium_require_drm_loader() {
   radeon_llvm_check() {
   LLVM_REQUIRED_VERSION_MAJOR=3
   LLVM_REQUIRED_VERSION_MINOR=2
  -LLVM_AVAILABLE_VERSION_MAJOR=`echo $LLVM_VERSION | cut -d. -f1`
  -LLVM_AVAILABLE_VERSION_MINOR=`echo $LLVM_VERSION | cut -d. -f2`
  -if test $LLVM_AVAILABLE_VERSION_MAJOR -lt
  $LLVM_REQUIRED_VERSION_MAJOR -o [ $LLVM_AVAILABLE_VERSION_MAJOR -eq
  $LLVM_REQUIRED_VERSION_MAJOR -a $LLVM_AVAILABLE_VERSION_MINOR -lt
  $LLVM_REQUIRED_VERSION_MINOR ] ; then
  +if test $LLVM_VERSION_INT -lt
  ${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}; then
   AC_MSG_ERROR([LLVM
  $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer with
  AMDGPU target enabled is required.
To use the r600/radeonsi LLVM backend, you need to
  fetch the LLVM source from:
git://people.freedesktop.org/~tstellar/llvm master
and build with --enable-experimental-targets=AMDGPU])
   fi
  -if test true  $LLVM_CONFIG --targets-built | grep -qv '\AMDGPU\'
  ; then
  +if test true  llvm-config --targets-built | grep -v -e '\AMDGPU\'
  -e '\R600\' /dev/null; then
   AC_MSG_ERROR([LLVM AMDGPU Target not enabled.
 To use the r600/radeonsi LLVM backend, you need to
  fetch the LLVM source from:
 git://people.freedesktop.org/~tstellar/llvm master
 and build with
  --enable-experimental-targets=AMDGPU])
   fi
   AC_MSG_WARN([Please ensure you use the latest llvm tree from git://
  people.freedesktop.org/~tstellar/llvm master before submitting a bug])
  -if test x$LLVM_VERSION = x3.2; then
  +if test $LLVM_VERSION_INT -ge 303; then
  +LLVM_LIBS=$LLVM_LIBS `$LLVM_CONFIG --libs r600`
  +fi
  +if test $LLVM_VERSION_INT -eq 302; then
   LLVM_LIBS=$LLVM_LIBS `$LLVM_CONFIG --libs amdgpu`
   fi
   }
  diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
  b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
  index 21661a0..3ffd997 100644
  --- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
  +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
  @@ -89,10 +89,17 @@ radeon_llvm_compile(LLVMModuleRef M, unsigned char **
  bytes,
 
  Triple AMDGPUTriple(sys::getDefaultTargetTriple());
 
  +#if HAVE_LLVM == 0x0302
  LLVMInitializeAMDGPUTargetInfo();
  LLVMInitializeAMDGPUTarget();
  LLVMInitializeAMDGPUTargetMC();
  LLVMInitializeAMDGPUAsmPrinter();
  +#else
  +   LLVMInitializeR600TargetInfo();
  +   LLVMInitializeR600Target();
  +   LLVMInitializeR600TargetMC();
  +   LLVMInitializeR600AsmPrinter();
  +#endif
 
  std::string err;
  const Target * AMDGPUTarget = TargetRegistry::lookupTarget(r600,
  err);
  --
  1.7.10.4
 
  ___
  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] [RFC] Merge automake branch

2012-12-21 Thread Michel Dänzer
On Fre, 2012-12-21 at 06:31 +0100, Johannes Obermayr wrote: 
 
 Please pull the code from:
 git://github.com/jobermayr/mesa.git  branch: master
 
 To view it online:
 https://github.com/jobermayr/mesa
 
 Following changes since automake-gallium6:
 - link shared libgallium against some LLVM libs
 - drivers/radeon must be build shared to fix egl_gallium.so on r600/radeonsi 
 builds
 - radeonsi and clover/opencl can be built against LLVM 3.3 trunk
 - merged some commits
 - based on current git master

Sounds good. Sorry to be the bearer of bad news again, but it fails to
build --with-llvm-shared-libs:

make[4]: Entering directory 
`/home/daenzer/src/mesa-git/mesa/src/gallium/auxiliary'
make[4]: *** No rule to make target `-lLLVM-3.2svn', needed by 
`libgallium9.1.0.la'.  Stop.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast |  Debian, X and DRI developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] gallium: extend pipe_context::flush for it to accept an END_OF_FRAME flag

2012-12-21 Thread Marek Olšák
Usage with pipe_context:
  pipe-flush(pipe, NULL, PIPE_FLUSH_END_OF_FRAME);

Usage with st_context_iface:
  st-flush(st, ST_FLUSH_END_OF_FRAME, NULL);

The flag is only a hint for drivers. Radeon will use it for buffer eviction
heuristics in the kernel (e.g. for queries like how many frames have passed
since a buffer was used).

The flag is currently only generated by st/dri on SwapBuffers.
---
 src/gallium/drivers/galahad/glhd_context.c|6 +++---
 src/gallium/drivers/i915/i915_flush.c |3 ++-
 src/gallium/drivers/i915/i915_resource_texture.c  |4 ++--
 src/gallium/drivers/identity/id_context.c |6 +++---
 src/gallium/drivers/llvmpipe/lp_context.c |3 ++-
 src/gallium/drivers/noop/noop_pipe.c  |3 ++-
 src/gallium/drivers/nv30/nv30_context.c   |3 ++-
 src/gallium/drivers/nv50/nv50_context.c   |3 ++-
 src/gallium/drivers/nvc0/nvc0_context.c   |3 ++-
 src/gallium/drivers/r300/r300_flush.c |3 ++-
 src/gallium/drivers/r600/r600_pipe.c  |3 ++-
 src/gallium/drivers/radeonsi/radeonsi_pipe.c  |3 ++-
 src/gallium/drivers/rbug/rbug_context.c   |6 +++---
 src/gallium/drivers/rbug/rbug_core.c  |2 +-
 src/gallium/drivers/softpipe/sp_flush.c   |5 +++--
 src/gallium/drivers/softpipe/sp_flush.h   |5 +++--
 src/gallium/drivers/svga/svga_pipe_flush.c|3 ++-
 src/gallium/drivers/trace/tr_context.c|6 --
 src/gallium/include/pipe/p_context.h  |6 --
 src/gallium/include/pipe/p_defines.h  |6 ++
 src/gallium/include/state_tracker/st_api.h|1 +
 src/gallium/state_trackers/clover/core/queue.cpp  |2 +-
 src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp |2 +-
 src/gallium/state_trackers/dri/common/dri_drawable.c  |2 ++
 src/gallium/state_trackers/dri/drm/dri2.c |2 +-
 src/gallium/state_trackers/egl/android/native_android.cpp |2 +-
 src/gallium/state_trackers/egl/common/native_helper.c |4 ++--
 src/gallium/state_trackers/vdpau/presentation.c   |2 +-
 src/gallium/state_trackers/vdpau/surface.c|2 +-
 src/gallium/state_trackers/vega/api_context.c |4 ++--
 src/gallium/state_trackers/vega/vg_manager.c  |8 +++-
 src/gallium/state_trackers/xa/xa_composite.c  |2 +-
 src/gallium/state_trackers/xa/xa_context.c|8 
 src/gallium/state_trackers/xa/xa_tracker.c|2 +-
 src/gallium/state_trackers/xa/xa_yuv.c|2 +-
 src/gallium/state_trackers/xorg/xorg_crtc.c   |2 +-
 src/gallium/state_trackers/xorg/xorg_dri2.c   |4 ++--
 src/gallium/state_trackers/xorg/xorg_driver.c |2 +-
 src/gallium/state_trackers/xorg/xorg_exa.c|2 +-
 src/gallium/state_trackers/xvmc/surface.c |2 +-
 src/gallium/tests/graw/clear.c|2 +-
 src/gallium/tests/graw/fs-fragcoord.c |2 +-
 src/gallium/tests/graw/fs-frontface.c |2 +-
 src/gallium/tests/graw/fs-test.c  |2 +-
 src/gallium/tests/graw/fs-write-z.c   |2 +-
 src/gallium/tests/graw/gs-test.c  |2 +-
 src/gallium/tests/graw/occlusion-query.c  |2 +-
 src/gallium/tests/graw/quad-sample.c  |2 +-
 src/gallium/tests/graw/quad-tex.c |2 +-
 src/gallium/tests/graw/shader-leak.c  |2 +-
 src/gallium/tests/graw/tex-srgb.c |2 +-
 src/gallium/tests/graw/tex-swizzle.c  |2 +-
 src/gallium/tests/graw/tri-gs.c   |2 +-
 src/gallium/tests/graw/tri-instanced.c|2 +-
 src/gallium/tests/graw/tri.c  |2 +-
 src/gallium/tests/graw/vs-test.c  |2 +-
 src/gallium/tests/trivial/quad-tex.c  |2 +-
 src/gallium/tests/trivial/tri.c   |2 +-
 src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c |2 +-
 src/mesa/state_tracker/st_cb_flush.c  |   11 ++-
 src/mesa/state_tracker/st_cb_flush.h  |3 ++-
 src/mesa/state_tracker/st_cb_syncobj.c|2 +-
 src/mesa/state_tracker/st_manager.c   |8 +++-
 63 files changed, 120 insertions(+), 81 deletions(-)

diff --git a/src/gallium/drivers/galahad/glhd_context.c 
b/src/gallium/drivers/galahad/glhd_context.c
index 

[Mesa-dev] [PATCH 2/2] gallium/radeon: send the END_OF_FRAME flag to the DRM

2012-12-21 Thread Marek Olšák
---
 src/gallium/drivers/r300/r300_flush.c |4 +++-
 src/gallium/drivers/r600/r600_pipe.c  |3 ++-
 src/gallium/drivers/radeonsi/radeonsi_pipe.c  |3 ++-
 src/gallium/winsys/radeon/drm/radeon_drm_cs.c |   10 --
 src/gallium/winsys/radeon/drm/radeon_winsys.h |1 +
 5 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_flush.c 
b/src/gallium/drivers/r300/r300_flush.c
index 978a5d9..6d51ee5 100644
--- a/src/gallium/drivers/r300/r300_flush.c
+++ b/src/gallium/drivers/r300/r300_flush.c
@@ -136,7 +136,9 @@ static void r300_flush_wrapped(struct pipe_context *pipe,
struct pipe_fence_handle **fence,
enum pipe_flush_flags flags)
 {
-r300_flush(pipe, 0, fence);
+r300_flush(pipe,
+   flags  PIPE_FLUSH_END_OF_FRAME ? RADEON_FLUSH_END_OF_FRAME : 0,
+   fence);
 }
 
 void r300_init_flush_functions(struct r300_context* r300)
diff --git a/src/gallium/drivers/r600/r600_pipe.c 
b/src/gallium/drivers/r600/r600_pipe.c
index ce01c4c..a571a54 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -146,7 +146,8 @@ static void r600_flush_from_st(struct pipe_context *ctx,
   struct pipe_fence_handle **fence,
   enum pipe_flush_flags flags)
 {
-   r600_flush(ctx, fence, 0);
+   r600_flush(ctx, fence,
+  flags  PIPE_FLUSH_END_OF_FRAME ? RADEON_FLUSH_END_OF_FRAME 
: 0);
 }
 
 static void r600_flush_from_winsys(void *ctx, unsigned flags)
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.c 
b/src/gallium/drivers/radeonsi/radeonsi_pipe.c
index f3ebe40..53edcc2 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.c
@@ -161,7 +161,8 @@ static void r600_flush_from_st(struct pipe_context *ctx,
   struct pipe_fence_handle **fence,
enum pipe_flush_flags flags)
 {
-   radeonsi_flush(ctx, fence, 0);
+   radeonsi_flush(ctx, fence,
+   flags  PIPE_FLUSH_END_OF_FRAME ? 
RADEON_FLUSH_END_OF_FRAME : 0);
 }
 
 static void r600_flush_from_winsys(void *ctx, unsigned flags)
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c 
b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
index c6498ef..8088fba 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
@@ -81,8 +81,6 @@
 
 /* The first dword of RADEON_CHUNK_ID_FLAGS is a uint32 of these flags: */
 #define RADEON_CS_KEEP_TILING_FLAGS 0x01
-
-
 #endif
 
 #ifndef RADEON_CS_USE_VM
@@ -92,6 +90,10 @@
 #define RADEON_CS_RING_COMPUTE  1
 #endif
 
+#ifndef RADEON_CS_END_OF_FRAME
+#define RADEON_CS_END_OF_FRAME  0x04
+#endif
+
 
 #define RELOC_DWORDS (sizeof(struct drm_radeon_cs_reloc) / sizeof(uint32_t))
 
@@ -470,6 +472,10 @@ static void radeon_drm_cs_flush(struct radeon_winsys_cs 
*rcs, unsigned flags)
 cs-cst-flags[0] |= RADEON_CS_USE_VM;
 cs-cst-cs.num_chunks = 3;
 }
+if (flags  RADEON_FLUSH_END_OF_FRAME) {
+cs-cst-flags[0] |= RADEON_CS_END_OF_FRAME;
+cs-cst-cs.num_chunks = 3;
+}
 if (flags  RADEON_FLUSH_COMPUTE) {
 cs-cst-flags[1] = RADEON_CS_RING_COMPUTE;
 cs-cst-cs.num_chunks = 3;
diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h 
b/src/gallium/winsys/radeon/drm/radeon_winsys.h
index b7eac3c..5bcbf8d 100644
--- a/src/gallium/winsys/radeon/drm/radeon_winsys.h
+++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h
@@ -48,6 +48,7 @@
 #define RADEON_FLUSH_ASYNC (1  0)
 #define RADEON_FLUSH_KEEP_TILING_FLAGS (1  1) /* needs DRM 2.12.0 */
 #define RADEON_FLUSH_COMPUTE   (1  2)
+#define RADEON_FLUSH_END_OF_FRAME   (1  3)
 
 /* Tiling flags. */
 enum radeon_bo_layout {
-- 
1.7.10.4

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


Re: [Mesa-dev] [PATCH 1/2] Make IsTransformFeedback() return false before BindTransformFeedback()

2012-12-21 Thread Jordan Justen
Series Reviewed-by: Jordan Justen jordan.l.jus...@intel.com

On Thu, Dec 20, 2012 at 7:47 PM, Matt Turner matts...@gmail.com wrote:
 The GL 4.3 an ES 3.0 specs say

A transform feedback object is created by binding a name returned by
GenTransformFeedbacks with the command
   void BindTransformFeedback( enum target, uint id );

 Fixes arb_transform_feedback2-istransformfeedback and part of
 es3conform's CoverageES30.test.
 ---
  src/mesa/main/mtypes.h|1 +
  src/mesa/main/transformfeedback.c |   13 ++---
  2 files changed, 11 insertions(+), 3 deletions(-)

 diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
 index 6fde421..9e7c47a 100644
 --- a/src/mesa/main/mtypes.h
 +++ b/src/mesa/main/mtypes.h
 @@ -1818,6 +1818,7 @@ struct gl_transform_feedback_object
 GLboolean Paused;  /** Is transform feedback paused? */
 GLboolean EndedAnytime; /** Has EndTransformFeedback been called
  at least once? */
 +   GLboolean EverBound; /** Has this object been bound? */

 /** The feedback buffers */
 GLuint BufferNames[MAX_FEEDBACK_BUFFERS];
 diff --git a/src/mesa/main/transformfeedback.c 
 b/src/mesa/main/transformfeedback.c
 index 22060c3..6f5873c 100644
 --- a/src/mesa/main/transformfeedback.c
 +++ b/src/mesa/main/transformfeedback.c
 @@ -79,6 +79,7 @@ reference_transform_feedback_object(struct 
 gl_transform_feedback_object **ptr,
}
else {
   obj-RefCount++;
 + obj-EverBound = GL_TRUE;
   *ptr = obj;
}
 }
 @@ -177,6 +178,7 @@ new_transform_feedback(struct gl_context *ctx, GLuint 
 name)
 if (obj) {
obj-Name = name;
obj-RefCount = 1;
 +  obj-EverBound = GL_FALSE;
 }
 return obj;
  }
 @@ -708,14 +710,19 @@ _mesa_GenTransformFeedbacks(GLsizei n, GLuint *names)
  GLboolean GLAPIENTRY
  _mesa_IsTransformFeedback(GLuint name)
  {
 +   struct gl_transform_feedback_object *obj;
 GET_CURRENT_CONTEXT(ctx);

 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);

 -   if (name  _mesa_lookup_transform_feedback_object(ctx, name))
 -  return GL_TRUE;
 -   else
 +   if (name == 0)
 +  return GL_FALSE;
 +
 +   obj = _mesa_lookup_transform_feedback_object(ctx, name);
 +   if (obj == NULL)
return GL_FALSE;
 +
 +   return obj-EverBound;
  }


 --
 1.7.8.6

 ___
 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 1/3] i965: Fix hiz resolves getting stomped by depth offset validation.

2012-12-21 Thread Jordan Justen
Series Reviewed-by: Jordan Justen jordan.l.jus...@intel.com

On Tue, Dec 18, 2012 at 3:03 PM, Eric Anholt e...@anholt.net wrote:
 Fixes all the remaining non-Z32F_S8 depthstencil-render-miplevels
 tests in piglit.

 ---

 This causes the other Z32F change in the series I sent out earlier
 today to result in all depthstencil-render-miplevels tests passing.
 My plan is to push this series before that one.

  src/mesa/drivers/dri/i965/brw_draw.c |   10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)

 diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
 b/src/mesa/drivers/dri/i965/brw_draw.c
 index cb8e682..faa29d1 100644
 --- a/src/mesa/drivers/dri/i965/brw_draw.c
 +++ b/src/mesa/drivers/dri/i965/brw_draw.c
 @@ -436,17 +436,17 @@ static bool brw_try_draw_prims( struct gl_context *ctx,

 intel_prepare_render(intel);

 +   /* This workaround has to happen outside of brw_state_upload() because it
 +* may flush the batchbuffer for a blit, affecting the state flags.
 +*/
 +   brw_workaround_depthstencil_alignment(brw);
 +
 /* Resolves must occur after updating renderbuffers, updating context 
 state,
  * and finalizing textures but before setting up any hardware state for
  * this draw call.
  */
 brw_predraw_resolve_buffers(brw);

 -   /* This workaround has to happen outside of brw_state_upload() because it
 -* may flush the batchbuffer for a blit, affecting the state flags.
 -*/
 -   brw_workaround_depthstencil_alignment(brw);
 -
 /* Bind all inputs, derive varying and size information:
  */
 brw_merge_inputs( brw, arrays );
 --
 1.7.10.4

 ___
 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 58548] [swrast] SIGSEGV src/mesa/swrast/s_texfetch.c:100

2012-12-21 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=58548

--- Comment #2 from Brian Paul brian.e.p...@gmail.com ---
Patch posted for review.  I don't know how I missed this.  I'm positive I ran
that piglit test earlier.

-- 
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] [V3 PATCH 6/6] mesa: Add support to allow blitting to multiple color draw buffers

2012-12-21 Thread Brian Paul
On Fri, Dec 21, 2012 at 1:47 PM, Anuj Phogat anuj.pho...@gmail.com wrote:
 Changes in fbobject.c fix a case when blitting to a framebuffer with
 renderbuffers/textures attached to GL_COLOR_ATTACHMENT{i} (where i!=0).
 Earlier it skips color blitting if nothing is found attached to
 GL_COLOR_ATTACHMENT0.

 Changes in swrast/s_blit.c fix a blitting case when drawAttachment-Texture
  == readAttachment-Texture. This caused an assertion failure in
 intel_miptree_attach_map() with gles3 conformance test case:
 framebuffer_blit_functionality_minifying_blit
 Number of changes in this file look scary. But most of them are caused by
 introducing a big for loop to support rendering to multiple color
 draw buffers.

 V2: Fixed a case when number of draw buffer attachments are zero.
 V3: Do compatible_color_datatypes() check for all the  draw renderbuffers
 in fbobject.c. Put a for loop in blit_nearest() and blit_linear()
 functions in swrast/s_blit.c to support blitting to multiple color
 draw buffers.

 Signed-off-by: Anuj Phogat anuj.pho...@gmail.com
 ---
  src/mesa/main/fbobject.c |   30 ++-
  src/mesa/swrast/s_blit.c |  559 -
  2 files changed, 320 insertions(+), 269 deletions(-)

 diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
 index 517bf13..fed0d61 100644
 --- a/src/mesa/main/fbobject.c
 +++ b/src/mesa/main/fbobject.c
 @@ -2843,8 +2843,10 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint 
 srcX1, GLint srcY1,

 /* get color read/draw renderbuffers */
 if (mask  GL_COLOR_BUFFER_BIT) {
 +  const  GLuint numColorDrawBuffers =
 + ctx-DrawBuffer-_NumColorDrawBuffers;
colorReadRb = readFb-_ColorReadBuffer;
 -  colorDrawRb = drawFb-_ColorDrawBuffers[0];
 +  colorDrawRb = NULL;

/* From the EXT_framebuffer_object spec:
 *
 @@ -2852,15 +2854,27 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint 
 srcX1, GLint srcY1,
 * the read and draw framebuffers, the corresponding bit is 
 silently
 * ignored.
 */
 -  if ((colorReadRb == NULL) || (colorDrawRb == NULL)) {
 -colorReadRb = colorDrawRb = NULL;
 +  if (colorReadRb == NULL) {
  mask = ~GL_COLOR_BUFFER_BIT;
}
 -  else if (!compatible_color_datatypes(colorReadRb-Format,
 -   colorDrawRb-Format)) {
 - _mesa_error(ctx, GL_INVALID_OPERATION,
 - glBlitFramebufferEXT(color buffer datatypes 
 mismatch));
 - return;
 +  else {
 + for (int i = 0; i  numColorDrawBuffers; i++) {

Declaring 'int i' in the loop will not compile with MSVC.  And it
should probably be unsigned.


 +if (ctx-DrawBuffer-_ColorDrawBuffers[i] == NULL)
 +  continue;
 +   colorDrawRb = ctx-DrawBuffer-_ColorDrawBuffers[i];
 +
 +if (!compatible_color_datatypes(colorReadRb-Format,
 +colorDrawRb-Format)) {
 +   _mesa_error(ctx, GL_INVALID_OPERATION,
 +   glBlitFramebufferEXT(color buffer datatypes 
 mismatch));
 +   return;
 +}
 + }
 +  }
 +
 +  if (colorDrawRb == NULL) {
 +colorReadRb = NULL;
 +mask = ~GL_COLOR_BUFFER_BIT;
}
 }
 else {
 diff --git a/src/mesa/swrast/s_blit.c b/src/mesa/swrast/s_blit.c
 index b0c56a4..4943be9 100644
 --- a/src/mesa/swrast/s_blit.c
 +++ b/src/mesa/swrast/s_blit.c
 @@ -111,6 +111,10 @@ blit_nearest(struct gl_context *ctx,
   GLbitfield buffer)
  {
 struct gl_renderbuffer *readRb, *drawRb;
 +   struct gl_renderbuffer_attachment *readAtt, *drawAtt;
 +   struct gl_framebuffer *readFb = ctx-ReadBuffer;
 +   struct gl_framebuffer *drawFb = ctx-DrawBuffer;
 +   GLint NumDrawBuffers = 0;

 const GLint srcWidth = ABS(srcX1 - srcX0);
 const GLint dstWidth = ABS(dstX1 - dstX0);
 @@ -146,21 +150,16 @@ blit_nearest(struct gl_context *ctx,

 switch (buffer) {
 case GL_COLOR_BUFFER_BIT:
 -  readRb = ctx-ReadBuffer-_ColorReadBuffer;
 -  drawRb = ctx-DrawBuffer-_ColorDrawBuffers[0];
 -
 -  if (readRb-Format == drawRb-Format) {
 -mode = DIRECT;
 -pixelSize = _mesa_get_format_bytes(readRb-Format);
 -  } else {
 -mode = UNPACK_RGBA_FLOAT;
 -pixelSize = 16;
 -  }
 -
 +  readAtt = readFb-Attachment[readFb-_ColorReadBufferIndex];
 +  readRb = readFb-_ColorReadBuffer;
 +  NumDrawBuffers = drawFb-_NumColorDrawBuffers;
break;
 case GL_DEPTH_BUFFER_BIT:
 -  readRb = ctx-ReadBuffer-Attachment[BUFFER_DEPTH].Renderbuffer;
 -  drawRb = ctx-DrawBuffer-Attachment[BUFFER_DEPTH].Renderbuffer;
 +  readAtt = readFb-Attachment[BUFFER_DEPTH];
 +  drawAtt = drawFb-Attachment[BUFFER_DEPTH];
 +  readRb = readAtt-Renderbuffer;
 +  drawRb = drawAtt-Renderbuffer;
 +  NumDrawBuffers = 1;

/* Note that for 

Re: [Mesa-dev] [PATCH 1/2] Make IsTransformFeedback() return false before BindTransformFeedback()

2012-12-21 Thread Kenneth Graunke

On 12/20/2012 07:47 PM, Matt Turner wrote:

The GL 4.3 an ES 3.0 specs say

A transform feedback object is created by binding a name returned by
GenTransformFeedbacks with the command
   void BindTransformFeedback( enum target, uint id );

Fixes arb_transform_feedback2-istransformfeedback and part of
es3conform's CoverageES30.test.


Both are:
Reviewed-by: Kenneth Graunke kenn...@whitecape.org

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


Re: [Mesa-dev] [RFC] Merge automake branch

2012-12-21 Thread Johannes Obermayr
Am Freitag, 21. Dezember 2012, 16:48:59 schrieb Michel Dänzer:
 On Fre, 2012-12-21 at 06:31 +0100, Johannes Obermayr wrote: 
  
  Please pull the code from:
  git://github.com/jobermayr/mesa.git  branch: master
  
  To view it online:
  https://github.com/jobermayr/mesa
  
  Following changes since automake-gallium6:
  - link shared libgallium against some LLVM libs
  - drivers/radeon must be build shared to fix egl_gallium.so on 
  r600/radeonsi builds
  - radeonsi and clover/opencl can be built against LLVM 3.3 trunk
  - merged some commits
  - based on current git master
 
 Sounds good. Sorry to be the bearer of bad news again, but it fails to
 build --with-llvm-shared-libs:
 
 make[4]: Entering directory 
 `/home/daenzer/src/mesa-git/mesa/src/gallium/auxiliary'
 make[4]: *** No rule to make target `-lLLVM-3.2svn', needed by 
 `libgallium9.1.0.la'.  Stop.
 

Rebased automake branch.

Following improvements:

- add $(LLVM_LDFLAGS) to libgallium@VERSION@_la_LDFLAGS to find -lLLVM-3.2svn 
in a non-default dir (should solve Michel's issue)

- build libdricore@VERSION@ '-shared -avoid-version' to fit 
libllvmradeon@VERSION@ and libgallium@VERSION@
- add '-Wl,--no-undefined' and libglapi for TLS builds to solve a undefined 
symbol

- targets/pipe-loader will be build just once if --enable-gallium-gbm and 
--enable-opencl (gbm completely missed it in automake branch)
- finally removed now unnecessary compatibilty for old build system


I am looking forward to get another to solve setback from Michel :-)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [V3 PATCH 6/6] mesa: Add support to allow blitting to multiple color draw buffers

2012-12-21 Thread Anuj Phogat
On Fri, Dec 21, 2012 at 1:00 PM, Brian Paul brian.e.p...@gmail.com wrote:

 On Fri, Dec 21, 2012 at 1:47 PM, Anuj Phogat anuj.pho...@gmail.com wrote:
  Changes in fbobject.c fix a case when blitting to a framebuffer with
  renderbuffers/textures attached to GL_COLOR_ATTACHMENT{i} (where i!=0).
  Earlier it skips color blitting if nothing is found attached to
  GL_COLOR_ATTACHMENT0.
 
  Changes in swrast/s_blit.c fix a blitting case when drawAttachment-Texture
   == readAttachment-Texture. This caused an assertion failure in
  intel_miptree_attach_map() with gles3 conformance test case:
  framebuffer_blit_functionality_minifying_blit
  Number of changes in this file look scary. But most of them are caused by
  introducing a big for loop to support rendering to multiple color
  draw buffers.
 
  V2: Fixed a case when number of draw buffer attachments are zero.
  V3: Do compatible_color_datatypes() check for all the  draw renderbuffers
  in fbobject.c. Put a for loop in blit_nearest() and blit_linear()
  functions in swrast/s_blit.c to support blitting to multiple color
  draw buffers.
 
  Signed-off-by: Anuj Phogat anuj.pho...@gmail.com
  ---
   src/mesa/main/fbobject.c |   30 ++-
   src/mesa/swrast/s_blit.c |  559 
  -
   2 files changed, 320 insertions(+), 269 deletions(-)
 
  diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
  index 517bf13..fed0d61 100644
  --- a/src/mesa/main/fbobject.c
  +++ b/src/mesa/main/fbobject.c
  @@ -2843,8 +2843,10 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, 
  GLint srcX1, GLint srcY1,
 
  /* get color read/draw renderbuffers */
  if (mask  GL_COLOR_BUFFER_BIT) {
  +  const  GLuint numColorDrawBuffers =
  + ctx-DrawBuffer-_NumColorDrawBuffers;
 colorReadRb = readFb-_ColorReadBuffer;
  -  colorDrawRb = drawFb-_ColorDrawBuffers[0];
  +  colorDrawRb = NULL;
 
 /* From the EXT_framebuffer_object spec:
  *
  @@ -2852,15 +2854,27 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, 
  GLint srcX1, GLint srcY1,
  * the read and draw framebuffers, the corresponding bit is 
  silently
  * ignored.
  */
  -  if ((colorReadRb == NULL) || (colorDrawRb == NULL)) {
  -colorReadRb = colorDrawRb = NULL;
  +  if (colorReadRb == NULL) {
   mask = ~GL_COLOR_BUFFER_BIT;
 }
  -  else if (!compatible_color_datatypes(colorReadRb-Format,
  -   colorDrawRb-Format)) {
  - _mesa_error(ctx, GL_INVALID_OPERATION,
  - glBlitFramebufferEXT(color buffer datatypes 
  mismatch));
  - return;
  +  else {
  + for (int i = 0; i  numColorDrawBuffers; i++) {

 Declaring 'int i' in the loop will not compile with MSVC.  And it
 should probably be unsigned.
Yeah, I always forget about MSVC compilation issues with such
declarations. I'll take care of them before pushing the patches in
this series.

  +if (ctx-DrawBuffer-_ColorDrawBuffers[i] == NULL)
  +  continue;
  +   colorDrawRb = ctx-DrawBuffer-_ColorDrawBuffers[i];
  +
  +if (!compatible_color_datatypes(colorReadRb-Format,
  +colorDrawRb-Format)) {
  +   _mesa_error(ctx, GL_INVALID_OPERATION,
  +   glBlitFramebufferEXT(color buffer datatypes 
  mismatch));
  +   return;
  +}
  + }
  +  }
  +
  +  if (colorDrawRb == NULL) {
  +colorReadRb = NULL;
  +mask = ~GL_COLOR_BUFFER_BIT;
 }
  }
  else {
  diff --git a/src/mesa/swrast/s_blit.c b/src/mesa/swrast/s_blit.c
  index b0c56a4..4943be9 100644
  --- a/src/mesa/swrast/s_blit.c
  +++ b/src/mesa/swrast/s_blit.c
  @@ -111,6 +111,10 @@ blit_nearest(struct gl_context *ctx,
GLbitfield buffer)
   {
  struct gl_renderbuffer *readRb, *drawRb;
  +   struct gl_renderbuffer_attachment *readAtt, *drawAtt;
  +   struct gl_framebuffer *readFb = ctx-ReadBuffer;
  +   struct gl_framebuffer *drawFb = ctx-DrawBuffer;
  +   GLint NumDrawBuffers = 0;
 
  const GLint srcWidth = ABS(srcX1 - srcX0);
  const GLint dstWidth = ABS(dstX1 - dstX0);
  @@ -146,21 +150,16 @@ blit_nearest(struct gl_context *ctx,
 
  switch (buffer) {
  case GL_COLOR_BUFFER_BIT:
  -  readRb = ctx-ReadBuffer-_ColorReadBuffer;
  -  drawRb = ctx-DrawBuffer-_ColorDrawBuffers[0];
  -
  -  if (readRb-Format == drawRb-Format) {
  -mode = DIRECT;
  -pixelSize = _mesa_get_format_bytes(readRb-Format);
  -  } else {
  -mode = UNPACK_RGBA_FLOAT;
  -pixelSize = 16;
  -  }
  -
  +  readAtt = readFb-Attachment[readFb-_ColorReadBufferIndex];
  +  readRb = readFb-_ColorReadBuffer;
  +  NumDrawBuffers = drawFb-_NumColorDrawBuffers;
 break;
  case GL_DEPTH_BUFFER_BIT:
  -  readRb = 

Re: [Mesa-dev] [RFC] Merge automake branch

2012-12-21 Thread Johannes Obermayr
Am Samstag, 22. Dezember 2012, 00:31:16 schrieb Michel Dänzer:
 On Fre, 2012-12-21 at 22:43 +0100, Johannes Obermayr wrote: 
  Am Freitag, 21. Dezember 2012, 16:48:59 schrieb Michel Dänzer:
   On Fre, 2012-12-21 at 06:31 +0100, Johannes Obermayr wrote: 

Please pull the code from:
git://github.com/jobermayr/mesa.git  branch: master

To view it online:
https://github.com/jobermayr/mesa

Following changes since automake-gallium6:
- link shared libgallium against some LLVM libs
- drivers/radeon must be build shared to fix egl_gallium.so on 
r600/radeonsi builds
- radeonsi and clover/opencl can be built against LLVM 3.3 trunk
- merged some commits
- based on current git master
   
   Sounds good. Sorry to be the bearer of bad news again, but it fails to
   build --with-llvm-shared-libs:
   
   make[4]: Entering directory 
   `/home/daenzer/src/mesa-git/mesa/src/gallium/auxiliary'
   make[4]: *** No rule to make target `-lLLVM-3.2svn', needed by 
   `libgallium9.1.0.la'.  Stop.
   
  
  Rebased automake branch.
  
  Following improvements:
  
  - add $(LLVM_LDFLAGS) to libgallium@VERSION@_la_LDFLAGS to find
  -lLLVM-3.2svn in a non-default dir (should solve Michel's issue)
 
 libgallium builds now, thanks.
 
 
  I am looking forward to get another to solve setback from Michel :-)
 
 libllvmradeon fails to build with hundreds of unresolved LLVM symbols,
 see below.
 
 
   CXXLD  libllvmradeon9.1.0.la
snip

rebased again:
Added $(LLVM_LDFLAGS) to libllvmradeon@VERSION@_la_LDFLAGS - maybe enough

Additionally added $(LLVM_LIBS), $(DLOPEN_LIBS) and $(CLOCK_LIB) to 
libllvmradeon@VERSION@_la_LIBADD
- Please try whether these are really needed. My OBS build host can resolve 
them itself.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [RFC] Merge automake branch

2012-12-21 Thread Michel Dänzer
On Sam, 2012-12-22 at 01:06 +0100, Johannes Obermayr wrote: 
 Am Samstag, 22. Dezember 2012, 00:31:16 schrieb Michel Dänzer:
  On Fre, 2012-12-21 at 22:43 +0100, Johannes Obermayr wrote: 
   Am Freitag, 21. Dezember 2012, 16:48:59 schrieb Michel Dänzer:
On Fre, 2012-12-21 at 06:31 +0100, Johannes Obermayr wrote: 
 
 Please pull the code from:
 git://github.com/jobermayr/mesa.git  branch: master
 
 To view it online:
 https://github.com/jobermayr/mesa
 
 Following changes since automake-gallium6:
 - link shared libgallium against some LLVM libs
 - drivers/radeon must be build shared to fix egl_gallium.so on 
 r600/radeonsi builds
 - radeonsi and clover/opencl can be built against LLVM 3.3 trunk
 - merged some commits
 - based on current git master

Sounds good. Sorry to be the bearer of bad news again, but it fails to
build --with-llvm-shared-libs:

make[4]: Entering directory 
`/home/daenzer/src/mesa-git/mesa/src/gallium/auxiliary'
make[4]: *** No rule to make target `-lLLVM-3.2svn', needed by 
`libgallium9.1.0.la'.  Stop.

   
   Rebased automake branch.
   
   Following improvements:
   
   - add $(LLVM_LDFLAGS) to libgallium@VERSION@_la_LDFLAGS to find
   -lLLVM-3.2svn in a non-default dir (should solve Michel's issue)
  
  libgallium builds now, thanks.
  
  
   I am looking forward to get another to solve setback from Michel :-)
  
  libllvmradeon fails to build with hundreds of unresolved LLVM symbols,
  see below.
  
  
CXXLD  libllvmradeon9.1.0.la
 snip
 
 rebased again:
 Added $(LLVM_LDFLAGS) to libllvmradeon@VERSION@_la_LDFLAGS - maybe enough
 
 Additionally added $(LLVM_LIBS), $(DLOPEN_LIBS) and $(CLOCK_LIB) to 
 libllvmradeon@VERSION@_la_LIBADD
 - Please try whether these are really needed.

$(LLVM_LIBS) and $(CLOCK_LIB) are needed for me, $(DLOPEN_LIBS) isn't.


Thanks,


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast |  Debian, X and DRI developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev