Mesa (master): i965/bufmgr: Set bo->idle after waiting.

2017-08-08 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: a1c9a6da18b3fdb094804d1fa2529024261ed265
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a1c9a6da18b3fdb094804d1fa2529024261ed265

Author: Kenneth Graunke 
Date:   Wed Aug  2 18:06:05 2017 -0700

i965/bufmgr: Set bo->idle after waiting.

After a successful wait, we know the buffer ought to be idle.

Chris points out that: "The only caveat here is that bo is global, and
we have a very unlikely (and probably unnoticeable) race condition with
multiple contexts."

Reviewed-by: Chris Wilson 

---

 src/mesa/drivers/dri/i965/brw_bufmgr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c 
b/src/mesa/drivers/dri/i965/brw_bufmgr.c
index e1036f25a4..0a5830da53 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
@@ -1018,6 +1018,8 @@ brw_bo_wait(struct brw_bo *bo, int64_t timeout_ns)
if (ret == -1)
   return -errno;
 
+   bo->idle = true;
+
return ret;
 }
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Get rid of KSP_ro

2017-08-08 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 2a0b3c781c3a96d843ea39472a6356eee2364301
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a0b3c781c3a96d843ea39472a6356eee2364301

Author: Kenneth Graunke 
Date:   Thu Aug  3 00:33:47 2017 -0700

i965: Get rid of KSP_ro

The GPU reads the shader kernel from the program cache BO.  It never
writes it, so using a read-write BO reference makes no sense.

Just make KSP read-only, and drop KSP_ro.

Reviewed-by: Chris Wilson 

---

 src/mesa/drivers/dri/i965/genX_state_upload.c | 19 ---
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c 
b/src/mesa/drivers/dri/i965/genX_state_upload.c
index 03f3360ac5..b5f94c833c 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -151,12 +151,6 @@ vertex_bo(struct brw_bo *bo, uint32_t offset)
 static inline struct brw_address
 KSP(struct brw_context *brw, uint32_t offset)
 {
-   return instruction_bo(brw->cache.bo, offset);
-}
-
-static inline struct brw_address
-KSP_ro(struct brw_context *brw, uint32_t offset)
-{
return instruction_ro_bo(brw->cache.bo, offset);
 }
 #else
@@ -165,9 +159,6 @@ KSP(struct brw_context *brw, uint32_t offset)
 {
return offset;
 }
-
-#define KSP_ro KSP
-
 #endif
 
 #include "genxml/genX_pack.h"
@@ -1267,7 +1258,7 @@ genX(upload_clip_state)(struct brw_context *brw)
 
ctx->NewDriverState |= BRW_NEW_GEN4_UNIT_STATE;
brw_state_emit(brw, GENX(CLIP_STATE), 32, >clip.state_offset, clip) {
-  clip.KernelStartPointer = KSP_ro(brw, brw->clip.prog_offset);
+  clip.KernelStartPointer = KSP(brw, brw->clip.prog_offset);
   clip.GRFRegisterCount =
  DIV_ROUND_UP(brw->clip.prog_data->total_grf, 16) - 1;
   clip.FloatingPointMode = FLOATING_POINT_MODE_Alternate;
@@ -1507,7 +1498,7 @@ genX(upload_sf)(struct brw_context *brw)
ctx->NewDriverState |= BRW_NEW_GEN4_UNIT_STATE;
 
brw_state_emit(brw, GENX(SF_STATE), 64, >sf.state_offset, sf) {
-  sf.KernelStartPointer = KSP_ro(brw, brw->sf.prog_offset);
+  sf.KernelStartPointer = KSP(brw, brw->sf.prog_offset);
   sf.FloatingPointMode = FLOATING_POINT_MODE_Alternate;
   sf.GRFRegisterCount = DIV_ROUND_UP(sf_prog_data->total_grf, 16) - 1;
   sf.DispatchGRFStartRegisterForURBData = 3;
@@ -1863,15 +1854,13 @@ genX(upload_wm)(struct brw_context *brw)
  wm_prog_data->base.dispatch_grf_start_reg;
   if (GEN_GEN == 6 ||
   wm_prog_data->dispatch_8 || wm_prog_data->dispatch_16) {
- wm.KernelStartPointer0 = KSP_ro(brw,
- stage_state->prog_offset);
+ wm.KernelStartPointer0 = KSP(brw, stage_state->prog_offset);
   }
 
 #if GEN_GEN >= 5
   if (GEN_GEN == 6 || wm_prog_data->prog_offset_2) {
  wm.KernelStartPointer2 =
-KSP_ro(brw, stage_state->prog_offset +
-   wm_prog_data->prog_offset_2);
+KSP(brw, stage_state->prog_offset + wm_prog_data->prog_offset_2);
   }
 #endif
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Don't use ggtt_bo for Gen8+ streamout offset buffer.

2017-08-08 Thread Kenneth Graunke
Module: Mesa
Branch: master
Commit: 58a4fc2b00e7aa2ffb9f30159150ab7587a8cfce
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=58a4fc2b00e7aa2ffb9f30159150ab7587a8cfce

Author: Kenneth Graunke 
Date:   Thu Aug  3 00:41:37 2017 -0700

i965: Don't use ggtt_bo for Gen8+ streamout offset buffer.

RELOC_NEEDS_GGTT is only meaningful on Sandybridge - it's skipped on
other generations - so this has no purpose.  Just use rw_bo().

Reviewed-by: Chris Wilson 

---

 src/mesa/drivers/dri/i965/genX_state_upload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/genX_state_upload.c 
b/src/mesa/drivers/dri/i965/genX_state_upload.c
index cc521a7487..17fa1ce8fe 100644
--- a/src/mesa/drivers/dri/i965/genX_state_upload.c
+++ b/src/mesa/drivers/dri/i965/genX_state_upload.c
@@ -3638,7 +3638,7 @@ genX(upload_3dstate_so_buffers)(struct brw_context *brw)
 
  sob.SurfaceSize = MAX2(xfb_obj->Size[i] / 4, 1) - 1;
  sob.StreamOutputBufferOffsetAddress =
-ggtt_bo(brw_obj->offset_bo, i * sizeof(uint32_t));
+rw_bo(brw_obj->offset_bo, i * sizeof(uint32_t));
 
  if (brw_obj->zero_offsets) {
 /* Zero out the offset and write that to offset_bo */

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): i965: Only call create_for_planar_image for multiple planes

2017-08-08 Thread Daniel Stone
Module: Mesa
Branch: master
Commit: be0e13e49f0709b59cdf0f8618bac156bd8f3efd
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=be0e13e49f0709b59cdf0f8618bac156bd8f3efd

Author: Jason Ekstrand 
Date:   Mon Jul 31 13:33:45 2017 -0700

i965: Only call create_for_planar_image for multiple planes

Before, we ended up always calling miptree_create_for_planar_image in
almost all cases because most images have image->planar_format != NULL.
This commit makes us only take that path if we have a multi-planar
format.

Reviewed-by: Daniel Stone 

---

 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 61a9c0c662..7194111721 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -885,12 +885,15 @@ intel_miptree_create_for_dri_image(struct brw_context 
*brw,
enum isl_colorspace colorspace,
bool is_winsys_image)
 {
-   if (image->planar_format && image->planar_format->nplanes > 0) {
+   if (image->planar_format && image->planar_format->nplanes > 1) {
   assert(colorspace == ISL_COLORSPACE_NONE ||
  colorspace == ISL_COLORSPACE_YUV);
   return miptree_create_for_planar_image(brw, image, target);
}
 
+   if (image->planar_format)
+  assert(image->planar_format->planes[0].dri_format == image->dri_format);
+
mesa_format format = image->format;
switch (colorspace) {
case ISL_COLORSPACE_NONE:

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): egl/dri2: refactor dri2_query_surface, swrastGetDrawableInfo

2017-08-08 Thread Tapani Pälli
Module: Mesa
Branch: master
Commit: b65a91e5821e3db4baad06d1fa13f02845c06b9d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b65a91e5821e3db4baad06d1fa13f02845c06b9d

Author: Tapani Pälli 
Date:   Tue Aug  8 10:52:26 2017 +0300

egl/dri2: refactor dri2_query_surface, swrastGetDrawableInfo

Currently swrastGetDrawableInfo always initializes w and h, patch
refactors function as x11_get_drawable_info that returns success and
sets the values only if no error happened. Add swrastGetDrawableInfo
wrapper function as expected by DRI extension.

v2: init w,y,w,h in swrastGetDrawableInfo (Eric)

Signed-off-by: Tapani Pälli 
Reported-by: Emil Velikov 
Reviewed-by: Eric Engestrom 
Reviewed-by: Emil Velikov 

---

 src/egl/drivers/dri2/platform_x11.c | 25 ++---
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_x11.c 
b/src/egl/drivers/dri2/platform_x11.c
index 4ce819f1c9..4610ec579f 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -99,8 +99,8 @@ swrastDestroyDrawable(struct dri2_egl_display * dri2_dpy,
xcb_free_gc(dri2_dpy->conn, dri2_surf->swapgc);
 }
 
-static void
-swrastGetDrawableInfo(__DRIdrawable * draw,
+static bool
+x11_get_drawable_info(__DRIdrawable * draw,
   int *x, int *y, int *w, int *h,
   void *loaderPrivate)
 {
@@ -110,14 +110,15 @@ swrastGetDrawableInfo(__DRIdrawable * draw,
xcb_get_geometry_cookie_t cookie;
xcb_get_geometry_reply_t *reply;
xcb_generic_error_t *error;
+   bool ret;
 
-   *x = *y = *w = *h = 0;
cookie = xcb_get_geometry (dri2_dpy->conn, dri2_surf->drawable);
reply = xcb_get_geometry_reply (dri2_dpy->conn, cookie, );
if (reply == NULL)
-  return;
+  return false;
 
if (error != NULL) {
+  ret = false;
   _eglLog(_EGL_WARNING, "error in xcb_get_geometry");
   free(error);
} else {
@@ -125,8 +126,19 @@ swrastGetDrawableInfo(__DRIdrawable * draw,
   *y = reply->y;
   *w = reply->width;
   *h = reply->height;
+  ret = true;
}
free(reply);
+   return ret;
+}
+
+static void
+swrastGetDrawableInfo(__DRIdrawable * draw,
+  int *x, int *y, int *w, int *h,
+  void *loaderPrivate)
+{
+   *x = *y = *w = *h = 0;
+   x11_get_drawable_info(draw, x, y, w, h, loaderPrivate);
 }
 
 static void
@@ -412,15 +424,14 @@ dri2_query_surface(_EGLDriver *drv, _EGLDisplay *dpy,
 {
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
-   int x, y, w = -1, h = -1;
+   int x, y, w, h;
 
__DRIdrawable *drawable = dri2_dpy->vtbl->get_dri_drawable(surf);
 
switch (attribute) {
case EGL_WIDTH:
case EGL_HEIGHT:
-  swrastGetDrawableInfo(drawable, , , , , dri2_surf);
-  if (w != -1 && h != -1) {
+  if (x11_get_drawable_info(drawable, , , , , dri2_surf)) {
  surf->Width = w;
  surf->Height = h;
   }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): ac/nir: fix saturate emission

2017-08-08 Thread Connor Abbott
Module: Mesa
Branch: master
Commit: c12c2e40a36f707f733c0d6ad90160472b7a3cf6
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c12c2e40a36f707f733c0d6ad90160472b7a3cf6

Author: Connor Abbott 
Date:   Mon Aug  7 15:56:50 2017 -0700

ac/nir: fix saturate emission

The .f32 was already getting added by emit_intrin_2f_param(). Noticed
when enabling LLVM module verification.

Reviewed-by: Bas Nieuwenhuizen 

---

 src/amd/common/ac_nir_to_llvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 3abf40102c..17bfe5b96f 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -5272,8 +5272,8 @@ static LLVMValueRef
 emit_float_saturate(struct ac_llvm_context *ctx, LLVMValueRef v, float lo, 
float hi)
 {
v = to_float(ctx, v);
-   v = emit_intrin_2f_param(ctx, "llvm.maxnum.f32", ctx->f32, v, 
LLVMConstReal(ctx->f32, lo));
-   return emit_intrin_2f_param(ctx, "llvm.minnum.f32", ctx->f32, v, 
LLVMConstReal(ctx->f32, hi));
+   v = emit_intrin_2f_param(ctx, "llvm.maxnum", ctx->f32, v, 
LLVMConstReal(ctx->f32, lo));
+   return emit_intrin_2f_param(ctx, "llvm.minnum", ctx->f32, v, 
LLVMConstReal(ctx->f32, hi));
 }
 
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit