Re: [Mesa-dev] [PATCH v5 4/5] st/dri2: Implement DRI2bufferDamageExtension

2019-07-15 Thread Boris Brezillon
Hello Marek,

On Tue, 2 Jul 2019 20:09:23 +0200
Boris Brezillon  wrote:

> On Tue, 2 Jul 2019 13:21:31 -0400
> Marek Olšák  wrote:
> 
> > On Tue., Jul. 2, 2019, 09:50 Boris Brezillon,
> >  wrote:
> >   
> > > From: Daniel Stone 
> > >
> > > Add a pipe_screen->set_damage_region() hook to propagate
> > > set-damage-region requests to the driver, it's then up to the
> > > driver to decide what to do with this piece of information.
> > >
> > > If the hook is left unassigned, the buffer-damage extension is
> > > considered unsupported.
> > >
> > > Signed-off-by: Daniel Stone 
> > > Signed-off-by: Boris Brezillon 
> > > Reviewed-by: Alyssa Rosenzweig 
> > > ---
> > > Changes in v5:
> > > * Add Alyssa's R-b
> > > ---
> > >  src/gallium/include/pipe/p_screen.h   |  7 +++
> > >  src/gallium/state_trackers/dri/dri2.c | 22 ++
> > >  2 files changed, 29 insertions(+)
> > >
> > > diff --git a/src/gallium/include/pipe/p_screen.h
> > > b/src/gallium/include/pipe/p_screen.h
> > > index 3f9bad470950..8df12ee4f865 100644
> > > --- a/src/gallium/include/pipe/p_screen.h
> > > +++ b/src/gallium/include/pipe/p_screen.h
> > > @@ -464,6 +464,13 @@ struct pipe_screen {
> > > bool (*is_parallel_shader_compilation_finished)(struct
> > > pipe_screen *screen,
> > > void *shader,
> > > unsigned
> > > shader_type); +
> > > +   /**
> > > +* Set damage region.
> > >
> > 
> > Can you expand the comment to describe rects? The format of rects is
> > not obvious.  
> 
> Oops, will point to the KHR_partial_update() doc and explain what rects
> encode and how.
> This reminds me that we have a corner case (at least for tile-based
> GPUs): the dri implementation calls
> ->set_damage_region(screen, res, 0, NULL) to reset the damage region,  
> but in KHR_partial_update() spec this means "damage all". If we follow
> the spec that would imply existing FB content is dropped which in turn
> means users relying on buffer_age() (without partial_update()) to only
> update the region that have changed will stop working properly.
> 
> I see 2 options to solve this problem:
> 
> 1/ add a new ->reset_damage_region() hook that would be called by the
>dri implementation after each swap_buf() in replacement of the
>current ->set_damage_region(screen, res, 0, NULL). Reset in that
>case means we consider the damage region as "unknown" and force
>a "reload FB content in the local-tile buffer" for the whole
>resource instead of restricting it to the !damage region.
> 2/ deviate from the KHR_partial_update() semantic and reserve
>->set_damage_region(screen, res, 0, NULL) for the "reset damage  
>region" op. That means we'll have to convert actual
>KHR_partial_update(0, NULL) calls into
>->set_damage_region(screen, res, 1, full_res_rect) ones to reflect  
>the behavior described in the spec.

Any advice on how to solve this problem?

Regards,

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

[Mesa-dev] [PATCH] radv/gfx10: add missing conversions for 16-bit exports

2019-07-15 Thread Samuel Pitoiset
This fixes
dEQP-VK.spirv_assembly.instruction.graphics.16bit_storage.input_output_*

Found with RADV_DEBUG=checkir

Signed-off-by: Samuel Pitoiset 
---
 src/amd/vulkan/radv_nir_to_llvm.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/src/amd/vulkan/radv_nir_to_llvm.c 
b/src/amd/vulkan/radv_nir_to_llvm.c
index 339c9d93423..fa26a450a91 100644
--- a/src/amd/vulkan/radv_nir_to_llvm.c
+++ b/src/amd/vulkan/radv_nir_to_llvm.c
@@ -3691,6 +3691,13 @@ static void gfx10_ngg_gs_emit_epilogue_2(struct 
radv_shader_context *ctx)
gep_idx[2] = LLVMConstInt(ctx->ac.i32, out_idx, 
false);
tmp = LLVMBuildGEP(builder, vertexptr, gep_idx, 
3, "");
tmp = LLVMBuildLoad(builder, tmp, "");
+
+   LLVMTypeRef type = 
LLVMGetAllocatedType(ctx->abi.outputs[ac_llvm_reg_index_soa(i, j)]);
+   if (ac_get_type_size(type) == 2) {
+   tmp = LLVMBuildBitCast(ctx->ac.builder, 
tmp, ctx->ac.i32, "");
+   tmp = LLVMBuildTrunc(ctx->ac.builder, 
tmp, ctx->ac.i16, "");
+   }
+
outputs[noutput].values[j] = 
ac_to_float(&ctx->ac, tmp);
}
 
@@ -3771,6 +3778,8 @@ static void gfx10_ngg_gs_emit_vertex(struct 
radv_shader_context *ctx,
LLVMValueRef ptr = LLVMBuildGEP(builder, vertexptr, 
gep_idx, 3, "");
 
out_val = ac_to_integer(&ctx->ac, out_val);
+   out_val = LLVMBuildZExtOrBitCast(ctx->ac.builder, 
out_val, ctx->ac.i32, "");
+
LLVMBuildStore(builder, out_val, ptr);
}
}
-- 
2.22.0

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

[Mesa-dev] [Bug 111126] Build problem: meson build can not find wayland-scanner

2019-07-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=26

Andre Klapper  changed:

   What|Removed |Added

 Blocks|32  |

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

[Mesa-dev] [Bug 111130] Panfrost: add current status to docs/features.txt

2019-07-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=30

Andre Klapper  changed:

   What|Removed |Added

 Blocks|33  |

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

[Mesa-dev] [Bug 111123] Display issues AMD RAVEN Ryzen 5 3400G APU

2019-07-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=23

Michel Dänzer  changed:

   What|Removed |Added

Version|git |unspecified
   Assignee|mesa-dev@lists.freedesktop. |dri-devel@lists.freedesktop
   |org |.org
  Component|Mesa core   |DRM/AMDgpu
Product|Mesa|DRI
 CC||nicholas.kazlaus...@amd.com
 QA Contact|mesa-dev@lists.freedesktop. |
   |org |

--- Comment #1 from Michel Dänzer  ---
Please attach the full output of dmesg corresponding to the problem.

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

[Mesa-dev] [AppVeyor] mesa staging/19.1 #11875 failed

2019-07-15 Thread AppVeyor



Build mesa 11875 failed


Commit 17dc693590 by Eric Anholt on 5/13/2019 11:58 PM:

freedreno: Fix assertion failures in context setup in shader-db mode.\n\nCherry-picks a0d4d7febff56ec7f4a4396f7b893319958f97d3 upstream\n\nThe TTN path needs access to the screen to make the right decisions about\nlowering, but we didn't have pctx->screen set up at fdN_prog_init time.\n\nReviewed-by: Rob Clark \nTested-by: Eduardo Lima Mitev \nSigned-off-by: John Stultz 


Configure your notification preferences

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

[Mesa-dev] [AppVeyor] mesa staging/19.1 #11876 completed

2019-07-15 Thread AppVeyor


Build mesa 11876 completed



Commit 17dc693590 by Eric Anholt on 5/13/2019 11:58 PM:

freedreno: Fix assertion failures in context setup in shader-db mode.\n\nCherry-picks a0d4d7febff56ec7f4a4396f7b893319958f97d3 upstream\n\nThe TTN path needs access to the screen to make the right decisions about\nlowering, but we didn't have pctx->screen set up at fdN_prog_init time.\n\nReviewed-by: Rob Clark \nTested-by: Eduardo Lima Mitev \nSigned-off-by: John Stultz 


Configure your notification preferences

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

[Mesa-dev] [Bug 111126] Build problem: meson build can not find wayland-scanner

2019-07-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=26

Denis  changed:

   What|Removed |Added

 Status|NEW |NEEDINFO

--- Comment #1 from Denis  ---
Hi. How did you try to compile mesa exactly? Provide plz build script.

Also, provide output of
"/Depot/Temp/rbt/mesa-19.1.2/BUILD_DIRECTORY/meson-logs/meson-log.txt" - as I
remember similar issues with packages, it prints there exact "try" for the
package.

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

[Mesa-dev] [PATCH v6 3/5] egl/dri: Use __DRI2_BUFFER_DAMAGE extension for KHR_partial_update

2019-07-15 Thread Boris Brezillon
From: Harish Krupo 

Use the DRI2 interface callback to pass the damage rects to
the driver.

Signed-off-by: Harish Krupo 
Signed-off-by: Boris Brezillon 
Acked-by: Alyssa Rosenzweig 
Reviewed-by: Qiang Yu 
Tested-by: Qiang Yu 
---
Changes in v6:
* None

Changes in v5:
* Add Alyssa's a-b
* Update Arish email address
* s/__DRI2_DAMAGE/__DRI2_BUFFER_DAMAGE/
---
 src/egl/drivers/dri2/egl_dri2.c | 55 ++---
 src/egl/drivers/dri2/egl_dri2.h |  1 +
 2 files changed, 51 insertions(+), 5 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 3c33b2cf27f8..fcafcfd73c63 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -452,6 +452,7 @@ static const struct dri2_extension_match 
optional_core_extensions[] = {
{ __DRI2_NO_ERROR, 1, offsetof(struct dri2_egl_display, no_error) },
{ __DRI2_CONFIG_QUERY, 1, offsetof(struct dri2_egl_display, config) },
{ __DRI2_FENCE, 1, offsetof(struct dri2_egl_display, fence) },
+   { __DRI2_BUFFER_DAMAGE, 1, offsetof(struct dri2_egl_display, buffer_damage) 
},
{ __DRI2_RENDERER_QUERY, 1, offsetof(struct dri2_egl_display, 
rendererQuery) },
{ __DRI2_INTEROP, 1, offsetof(struct dri2_egl_display, interop) },
{ __DRI_IMAGE, 1, offsetof(struct dri2_egl_display, image) },
@@ -721,6 +722,9 @@ dri2_setup_screen(_EGLDisplay *disp)
 
if (dri2_dpy->flush_control)
   disp->Extensions.KHR_context_flush_control = EGL_TRUE;
+
+   if (dri2_dpy->buffer_damage && dri2_dpy->buffer_damage->set_damage_region)
+  disp->Extensions.KHR_partial_update = EGL_TRUE;
 }
 
 void
@@ -1658,11 +1662,22 @@ static EGLBoolean
 dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
 {
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+   __DRIdrawable *dri_drawable = dri2_dpy->vtbl->get_dri_drawable(surf);
_EGLContext *ctx = _eglGetCurrentContext();
+   EGLBoolean ret;
 
if (ctx && surf)
   dri2_surf_update_fence_fd(ctx, disp, surf);
-   return dri2_dpy->vtbl->swap_buffers(drv, disp, surf);
+   ret = dri2_dpy->vtbl->swap_buffers(drv, disp, surf);
+
+   /* SwapBuffers marks the end of the frame; reset the damage region for
+* use again next time.
+*/
+   if (ret && dri2_dpy->buffer_damage &&
+   dri2_dpy->buffer_damage->set_damage_region)
+  dri2_dpy->buffer_damage->set_damage_region(dri_drawable, 0, NULL);
+
+   return ret;
 }
 
 static EGLBoolean
@@ -1671,12 +1686,23 @@ dri2_swap_buffers_with_damage(_EGLDriver *drv, 
_EGLDisplay *disp,
   const EGLint *rects, EGLint n_rects)
 {
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+   __DRIdrawable *dri_drawable = dri2_dpy->vtbl->get_dri_drawable(surf);
_EGLContext *ctx = _eglGetCurrentContext();
+   EGLBoolean ret;
 
if (ctx && surf)
   dri2_surf_update_fence_fd(ctx, disp, surf);
-   return dri2_dpy->vtbl->swap_buffers_with_damage(drv, disp, surf,
-   rects, n_rects);
+   ret = dri2_dpy->vtbl->swap_buffers_with_damage(drv, disp, surf,
+  rects, n_rects);
+
+   /* SwapBuffers marks the end of the frame; reset the damage region for
+* use again next time.
+*/
+   if (ret && dri2_dpy->buffer_damage &&
+   dri2_dpy->buffer_damage->set_damage_region)
+  dri2_dpy->buffer_damage->set_damage_region(dri_drawable, 0, NULL);
+
+   return ret;
 }
 
 static EGLBoolean
@@ -1684,14 +1710,33 @@ dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay 
*disp, _EGLSurface *surf,
  EGLint numRects, const EGLint *rects)
 {
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
-   return dri2_dpy->vtbl->swap_buffers_region(drv, disp, surf, numRects, 
rects);
+   __DRIdrawable *dri_drawable = dri2_dpy->vtbl->get_dri_drawable(surf);
+   EGLBoolean ret;
+
+   ret = dri2_dpy->vtbl->swap_buffers_region(drv, disp, surf, numRects, rects);
+
+   /* SwapBuffers marks the end of the frame; reset the damage region for
+* use again next time.
+*/
+   if (ret && dri2_dpy->buffer_damage &&
+   dri2_dpy->buffer_damage->set_damage_region)
+  dri2_dpy->buffer_damage->set_damage_region(dri_drawable, 0, NULL);
+
+   return ret;
 }
 
 static EGLBoolean
 dri2_set_damage_region(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
EGLint *rects, EGLint n_rects)
 {
-   return false;
+   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+   __DRIdrawable *drawable = dri2_dpy->vtbl->get_dri_drawable(surf);
+
+   if (!dri2_dpy->buffer_damage || !dri2_dpy->buffer_damage->set_damage_region)
+  return EGL_FALSE;
+
+   dri2_dpy->buffer_damage->set_damage_region(drawable, n_rects, rects);
+   return EGL_TRUE;
 }
 
 static EGLBoolean
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 1d9fe3db625f..bff7435a658c 100644
--- a/src/egl/drivers/dri2/egl_

[Mesa-dev] [PATCH v6 0/5] EGL_KHR_partial_update support

2019-07-15 Thread Boris Brezillon
This is an attempt at resurrecting Daniel's MR [1] which was already
resurrecting Harish's EGL_KHR_partial_update series [2]. This version
implements Marek's suggestion to pass the set_damage_region() directly
to the gallium driver and let it decide how to handle the request. Some
drivers might just calculate the damage extent (as done in Daniel's
initial proposal and in the panfrost implementation), others might do
extra optimizations like trying to reduce the area we're supposed to
reload (only valid for tile-based rendering) even further.

This patch series has been tested with weston on panfrost. Note that
the panfrost implementation is rather simple (just limits the rendering
area to the damage extent and picks the biggest damage rect as the only
damage region) but we can improve it if we feel the need.

No big changes in this v6, just addressed Erik and Marek concerns
regarding the doc and the prototype of the gallium ->set_damage_region()
hook.

Regards,

Boris

[1]https://gitlab.freedesktop.org/mesa/mesa/merge_requests/227
[2]https://patchwork.freedesktop.org/series/45915/#rev2

Boris Brezillon (1):
  panfrost: Add support for KHR_partial_update()

Daniel Stone (2):
  dri_interface: add DRI2_BufferDamage interface
  st/dri2: Implement DRI2bufferDamageExtension

Harish Krupo (2):
  egl/android: Delete set_damage_region from egl dri vtbl
  egl/dri: Use __DRI2_BUFFER_DAMAGE extension for KHR_partial_update

 include/GL/internal/dri_interface.h | 43 ++
 src/egl/drivers/dri2/egl_dri2.c | 54 ++--
 src/egl/drivers/dri2/egl_dri2.h |  5 +-
 src/egl/drivers/dri2/egl_dri2_fallbacks.h   |  9 --
 src/egl/drivers/dri2/platform_android.c | 45 --
 src/egl/drivers/dri2/platform_device.c  |  1 -
 src/egl/drivers/dri2/platform_drm.c |  1 -
 src/egl/drivers/dri2/platform_surfaceless.c |  1 -
 src/egl/drivers/dri2/platform_wayland.c |  1 -
 src/egl/drivers/dri2/platform_x11.c |  2 -
 src/egl/drivers/dri2/platform_x11_dri3.c|  1 -
 src/gallium/drivers/panfrost/pan_blit.c | 10 +--
 src/gallium/drivers/panfrost/pan_context.c  | 63 +-
 src/gallium/drivers/panfrost/pan_job.c  | 11 +++
 src/gallium/drivers/panfrost/pan_job.h  |  5 ++
 src/gallium/drivers/panfrost/pan_resource.c | 91 +
 src/gallium/drivers/panfrost/pan_resource.h | 13 ++-
 src/gallium/drivers/panfrost/pan_screen.c   |  1 +
 src/gallium/include/pipe/p_screen.h | 17 
 src/gallium/state_trackers/dri/dri2.c   | 34 
 20 files changed, 331 insertions(+), 77 deletions(-)

-- 
2.21.0

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

[Mesa-dev] [PATCH v6 5/5] panfrost: Add support for KHR_partial_update()

2019-07-15 Thread Boris Brezillon
Implement ->set_damage_region() region to support partial updates.

This is a dummy implementation in that it does not try to merge
damage rects. It also does not deal with distinct regions and instead
pick the largest quad as the only damage rect and generate up to 4
reload rects out of it (the left/right/top/bottom regions surrounding
the biggest damage rect).

We also do not try to reduce the number of draws by passing all quad
vertices to the blit request (would require extending u_blitter)

Signed-off-by: Boris Brezillon 
Reviewed-by: Alyssa Rosenzweig 
---
Changes in v6:
* Add Alyssa's R-b
* Adapt the code to the ->set_damage_region() prototype change

Changes in v5:
* rename the second panfrost_blit_wallpaper() argument
* add extra comment to explain how the set_damage_region() logic works
* clarify why checking for negative box->{width,heigh} is not needed in
  panfrost_draw_wallpaper()
---
 src/gallium/drivers/panfrost/pan_blit.c | 10 +--
 src/gallium/drivers/panfrost/pan_context.c  | 63 +-
 src/gallium/drivers/panfrost/pan_job.c  | 11 +++
 src/gallium/drivers/panfrost/pan_job.h  |  5 ++
 src/gallium/drivers/panfrost/pan_resource.c | 91 +
 src/gallium/drivers/panfrost/pan_resource.h | 13 ++-
 src/gallium/drivers/panfrost/pan_screen.c   |  1 +
 7 files changed, 187 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_blit.c 
b/src/gallium/drivers/panfrost/pan_blit.c
index 35c8507eb8d8..1fa9eef572ea 100644
--- a/src/gallium/drivers/panfrost/pan_blit.c
+++ b/src/gallium/drivers/panfrost/pan_blit.c
@@ -103,7 +103,7 @@ panfrost_blit(struct pipe_context *pipe,
  */
 
 void
-panfrost_blit_wallpaper(struct panfrost_context *ctx)
+panfrost_blit_wallpaper(struct panfrost_context *ctx, struct pipe_box *box)
 {
 struct pipe_blit_info binfo = { };
 
@@ -116,11 +116,11 @@ panfrost_blit_wallpaper(struct panfrost_context *ctx)
 
 binfo.src.resource = binfo.dst.resource = 
ctx->pipe_framebuffer.cbufs[0]->texture;
 binfo.src.level = binfo.dst.level = level;
-binfo.src.box.x = binfo.dst.box.x = 0;
-binfo.src.box.y = binfo.dst.box.y = 0;
+binfo.src.box.x = binfo.dst.box.x = box->x;
+binfo.src.box.y = binfo.dst.box.y = box->y;
 binfo.src.box.z = binfo.dst.box.z = layer;
-binfo.src.box.width = binfo.dst.box.width = 
ctx->pipe_framebuffer.width;
-binfo.src.box.height = binfo.dst.box.height = 
ctx->pipe_framebuffer.height;
+binfo.src.box.width = binfo.dst.box.width = box->width;
+binfo.src.box.height = binfo.dst.box.height = box->height;
 binfo.src.box.depth = binfo.dst.box.depth = 1;
 
 binfo.src.format = binfo.dst.format = 
ctx->pipe_framebuffer.cbufs[0]->format;
diff --git a/src/gallium/drivers/panfrost/pan_context.c 
b/src/gallium/drivers/panfrost/pan_context.c
index 4bbf5230c6cf..4f3242163501 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1477,7 +1477,68 @@ panfrost_draw_wallpaper(struct pipe_context *pipe)
 struct panfrost_job *batch = panfrost_get_job_for_fbo(ctx);
 
 ctx->wallpaper_batch = batch;
-panfrost_blit_wallpaper(ctx);
+
+/* Clamp the rendering area to the damage extent. The
+ * KHR_partial_update() spec states that trying to render outside of
+ * the damage region is "undefined behavior", so we should be safe.
+ */
+panfrost_job_intersection_scissor(batch, rsrc->damage.extent.minx,
+  rsrc->damage.extent.miny,
+  rsrc->damage.extent.maxx,
+  rsrc->damage.extent.maxy);
+
+struct pipe_scissor_state damage;
+struct pipe_box rects[4];
+
+/* Clamp the damage box to the rendering area. */
+damage.minx = MAX2(batch->minx, rsrc->damage.biggest_rect.x);
+damage.miny = MAX2(batch->miny, rsrc->damage.biggest_rect.y);
+damage.maxx = MIN2(batch->maxx,
+   rsrc->damage.biggest_rect.x +
+   rsrc->damage.biggest_rect.width);
+damage.maxy = MIN2(batch->maxy,
+   rsrc->damage.biggest_rect.y +
+   rsrc->damage.biggest_rect.height);
+
+/* One damage rectangle means we can end up with at most 4 reload
+ * regions:
+ * 1: left region, only exists if damage.x > 0
+ * 2: right region, only exists if damage.x + damage.width < fb->width
+ * 3: top region, only exists if damage.y > 0. The intersection with
+ *the left and right regions are dropped
+ * 4: bottom region, only exists if damage.y + damage.height < 
fb->height.
+ *The intersection with the left and right regions are dropped
+ *
+ *
+ *| 

[Mesa-dev] [PATCH v6 4/5] st/dri2: Implement DRI2bufferDamageExtension

2019-07-15 Thread Boris Brezillon
From: Daniel Stone 

Add a pipe_screen->set_damage_region() hook to propagate
set-damage-region requests to the driver, it's then up to the driver to
decide what to do with this piece of information.

If the hook is left unassigned, the buffer-damage extension is
considered unsupported.

Signed-off-by: Daniel Stone 
Signed-off-by: Boris Brezillon 
Reviewed-by: Alyssa Rosenzweig 
---
Hello Qiang,

I intentionally dropped your R-b/T-b on this patch since the
->set_damage_region() prototype has changed. Feel free to add it back.

Regards,

Boris

Changes in v6:
* Pass pipe_box objects instead ints
* Document the set_damage_region() hook

Changes in v5:
* Add Alyssa's R-b
---
 src/gallium/include/pipe/p_screen.h   | 17 ++
 src/gallium/state_trackers/dri/dri2.c | 34 +++
 2 files changed, 51 insertions(+)

diff --git a/src/gallium/include/pipe/p_screen.h 
b/src/gallium/include/pipe/p_screen.h
index 3f9bad470950..11a6aa939124 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -464,6 +464,23 @@ struct pipe_screen {
bool (*is_parallel_shader_compilation_finished)(struct pipe_screen *screen,
void *shader,
unsigned shader_type);
+
+   /**
+* Set the damage region (called when KHR_partial_update() is invoked).
+* This function is passed an array of rectangles encoding the damage area.
+* rects are using the bottom-left origin convention.
+* nrects = 0 means 'reset the damage region'. What 'reset' implies is HW
+* specific. For tile-based renderers, the damage extent is typically set
+* to cover the whole resource with no damage rect (or a 0-size damage
+* rect). This way, the existing resource content is reloaded into the
+* local tile buffer for every tile thus making partial tile update
+* possible. For HW operating in immediate mode, this reset operation is
+* likely to be a NOOP.
+*/
+   void (*set_damage_region)(struct pipe_screen *screen,
+ struct pipe_resource *resource,
+ unsigned int nrects,
+ const struct pipe_box *rects);
 };
 
 
diff --git a/src/gallium/state_trackers/dri/dri2.c 
b/src/gallium/state_trackers/dri/dri2.c
index 5a7ec878bab0..5273b95cd5fb 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1807,6 +1807,35 @@ static const __DRI2interopExtension dri2InteropExtension 
= {
.export_object = dri2_interop_export_object
 };
 
+/**
+ * \brief the DRI2bufferDamageExtension set_damage_region method
+ */
+static void
+dri2_set_damage_region(__DRIdrawable *dPriv, unsigned int nrects, int *rects)
+{
+   struct dri_drawable *drawable = dri_drawable(dPriv);
+   struct pipe_resource *resource = 
drawable->textures[ST_ATTACHMENT_BACK_LEFT];
+   struct pipe_screen *screen = resource->screen;
+   struct pipe_box *boxes = NULL;
+
+   if (nrects) {
+  boxes = CALLOC(nrects, sizeof(*boxes));
+  assert(boxes);
+
+  for (unsigned int i = 0; i < nrects; i++) {
+ int *rect = &rects[i * 4];
+
+ u_box_2d(rect[0], rect[1], rect[2], rect[3], &boxes[i]);
+  }
+   }
+
+   screen->set_damage_region(screen, resource, nrects, boxes);
+}
+
+static __DRI2bufferDamageExtension dri2BufferDamageExtension = {
+   .base = { __DRI2_BUFFER_DAMAGE, 1 },
+};
+
 /**
  * \brief the DRI2ConfigQueryExtension configQueryb method
  */
@@ -1908,6 +1937,7 @@ static const __DRIextension *dri_screen_extensions[] = {
&dri2GalliumConfigQueryExtension.base,
&dri2ThrottleExtension.base,
&dri2FenceExtension.base,
+   &dri2BufferDamageExtension.base,
&dri2InteropExtension.base,
&dri2NoErrorExtension.base,
&driBlobExtension.base,
@@ -1923,6 +1953,7 @@ static const __DRIextension 
*dri_robust_screen_extensions[] = {
&dri2ThrottleExtension.base,
&dri2FenceExtension.base,
&dri2InteropExtension.base,
+   &dri2BufferDamageExtension.base,
&dri2Robustness.base,
&dri2NoErrorExtension.base,
&driBlobExtension.base,
@@ -1983,6 +2014,9 @@ dri2_init_screen(__DRIscreen * sPriv)
   }
}
 
+   if (pscreen->set_damage_region)
+  dri2BufferDamageExtension.set_damage_region = dri2_set_damage_region;
+
if (pscreen->get_param(pscreen, PIPE_CAP_DEVICE_RESET_STATUS_QUERY)) {
   sPriv->extensions = dri_robust_screen_extensions;
   screen->has_reset_status_query = true;
-- 
2.21.0

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

[Mesa-dev] [PATCH v6 2/5] dri_interface: add DRI2_BufferDamage interface

2019-07-15 Thread Boris Brezillon
From: Daniel Stone 

Add a new DRI2_BufferDamage interface to support the
EGL_KHR_partial_update extension, informing the driver of an overriding
scissor region for a particular drawable.

Based on a commit originally authored by:
Harish Krupo 
renamed extension, retargeted at DRI drawable instead of context,
rewritten description

Signed-off-by: Daniel Stone 
Signed-off-by: Boris Brezillon 
Acked-by: Alyssa Rosenzweig 
Reviewed-by: Qiang Yu 
Tested-by: Qiang Yu 
---
Changes in v6:
* Fix the doc

Changes in v5:
* Add Alyssa's a-b
* Add Daniel's SoB
---
 include/GL/internal/dri_interface.h | 43 +
 1 file changed, 43 insertions(+)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index af0ee9c56670..9f5bc7c569e6 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -85,6 +85,7 @@ typedef struct __DRI2throttleExtensionRec 
__DRI2throttleExtension;
 typedef struct __DRI2fenceExtensionRec  __DRI2fenceExtension;
 typedef struct __DRI2interopExtensionRec   __DRI2interopExtension;
 typedef struct __DRI2blobExtensionRec   __DRI2blobExtension;
+typedef struct __DRI2bufferDamageExtensionRec   __DRI2bufferDamageExtension;
 
 typedef struct __DRIimageLoaderExtensionRec __DRIimageLoaderExtension;
 typedef struct __DRIimageDriverExtensionRec __DRIimageDriverExtension;
@@ -488,6 +489,48 @@ struct __DRI2interopExtensionRec {
 struct mesa_glinterop_export_out *out);
 };
 
+
+/**
+ * Extension for limiting window system back buffer rendering to user-defined
+ * scissor region.
+ */
+
+#define __DRI2_BUFFER_DAMAGE "DRI2_BufferDamage"
+#define __DRI2_BUFFER_DAMAGE_VERSION 1
+
+struct __DRI2bufferDamageExtensionRec {
+   __DRIextension base;
+
+   /**
+* Provides an array of rectangles representing an overriding scissor region
+* for rendering operations performed to the specified drawable. These
+* rectangles do not replace client API scissor regions or draw
+* co-ordinates, but instead inform the driver of the overall bounds of all
+* operations which will be issued before the next flush.
+*
+* Any rendering operations writing pixels outside this region to the
+* drawable will have an undefined effect on the entire drawable.
+*
+* This entrypoint may only be called after the drawable has either been
+* newly created or flushed, and before any rendering operations which write
+* pixels to the drawable. Calling this entrypoint at any other time will
+* have an undefined effect on the entire drawable.
+*
+* Calling this entrypoint with @nrects 0 and @rects NULL will reset the
+* region to the buffer's full size. This entrypoint may be called once to
+* reset the region, followed by a second call with a populated region,
+* before a rendering call is made.
+*
+* Used to implement EGL_KHR_partial_update.
+*
+* \param drawable affected drawable
+* \param nrects   number of rectangles provided
+* \param rectsthe array of rectangles, lower-left origin
+*/
+   void (*set_damage_region)(__DRIdrawable *drawable, unsigned int nrects,
+ int *rects);
+};
+
 /*@}*/
 
 /**
-- 
2.21.0

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

[Mesa-dev] [PATCH v6 1/5] egl/android: Delete set_damage_region from egl dri vtbl

2019-07-15 Thread Boris Brezillon
From: Harish Krupo 

The intension of the KHR_partial_update was not to send the damage back
to the platform but to send the damage to the driver to ensure that the
following rendering could be restricted to those regions.
This patch removes the set_damage_region from the egl_dri vtbl and all
the platfrom_*.c files.
Then upcomming patches add a new dri2 interface for the drivers to
implement

Signed-off-by: Harish Krupo 
Reviewed-by: Daniel Stone 
Signed-off-by: Boris Brezillon 
Acked-by: Alyssa Rosenzweig 
Reviewed-by: Qiang Yu 
Tested-by: Qiang Yu 
---
Changes in v6:
* Fix Harish's email address

Changes in v5:
* Add Alyssa's a-b
---
 src/egl/drivers/dri2/egl_dri2.c |  3 +-
 src/egl/drivers/dri2/egl_dri2.h |  4 --
 src/egl/drivers/dri2/egl_dri2_fallbacks.h   |  9 -
 src/egl/drivers/dri2/platform_android.c | 45 -
 src/egl/drivers/dri2/platform_device.c  |  1 -
 src/egl/drivers/dri2/platform_drm.c |  1 -
 src/egl/drivers/dri2/platform_surfaceless.c |  1 -
 src/egl/drivers/dri2/platform_wayland.c |  1 -
 src/egl/drivers/dri2/platform_x11.c |  2 -
 src/egl/drivers/dri2/platform_x11_dri3.c|  1 -
 10 files changed, 1 insertion(+), 67 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index ee4faaab34f4..3c33b2cf27f8 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1691,8 +1691,7 @@ static EGLBoolean
 dri2_set_damage_region(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
EGLint *rects, EGLint n_rects)
 {
-   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
-   return dri2_dpy->vtbl->set_damage_region(drv, disp, surf, rects, n_rects);
+   return false;
 }
 
 static EGLBoolean
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index fa04e3bb616d..1d9fe3db625f 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -122,10 +122,6 @@ struct dri2_egl_display_vtbl {
   _EGLSurface *surface,
   const EGLint *rects, EGLint n_rects);
 
-   EGLBoolean (*set_damage_region)(_EGLDriver *drv, _EGLDisplay *disp,
-   _EGLSurface *surface,
-   const EGLint *rects, EGLint n_rects);
-
EGLBoolean (*swap_buffers_region)(_EGLDriver *drv, _EGLDisplay *disp,
  _EGLSurface *surf, EGLint numRects,
  const EGLint *rects);
diff --git a/src/egl/drivers/dri2/egl_dri2_fallbacks.h 
b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
index 6c2c4bbe595e..d975b7a8b130 100644
--- a/src/egl/drivers/dri2/egl_dri2_fallbacks.h
+++ b/src/egl/drivers/dri2/egl_dri2_fallbacks.h
@@ -62,7 +62,6 @@ dri2_fallback_swap_buffers_with_damage(_EGLDriver *drv, 
_EGLDisplay *disp,
   const EGLint *rects, EGLint n_rects)
 {
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
-   dri2_dpy->vtbl->set_damage_region(drv, disp, surf, rects, n_rects);
return dri2_dpy->vtbl->swap_buffers(drv, disp, surf);
 }
 
@@ -90,14 +89,6 @@ dri2_fallback_copy_buffers(_EGLDriver *drv, _EGLDisplay 
*disp,
return _eglError(EGL_BAD_NATIVE_PIXMAP, "no support for native pixmaps");
 }
 
-static inline EGLBoolean
-dri2_fallback_set_damage_region(_EGLDriver *drv, _EGLDisplay *disp,
-_EGLSurface *surf,
-const EGLint *rects, EGLint n_rects)
-{
-   return EGL_FALSE;
-}
-
 static inline EGLint
 dri2_fallback_query_buffer_age(_EGLDriver *drv, _EGLDisplay *disp,
_EGLSurface *surf)
diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index db6ba4a4b4d6..6ce04d250c8d 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -728,43 +728,6 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *draw)
return EGL_TRUE;
 }
 
-#if ANDROID_API_LEVEL >= 23
-static EGLBoolean
-droid_set_damage_region(_EGLDriver *drv,
-_EGLDisplay *disp,
-_EGLSurface *draw, const EGLint* rects, EGLint n_rects)
-{
-   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
-   struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
-   android_native_rect_t* droid_rects = NULL;
-   int ret;
-
-   if (n_rects == 0)
-  return EGL_TRUE;
-
-   droid_rects = malloc(n_rects * sizeof(android_native_rect_t));
-   if (droid_rects == NULL)
- return _eglError(EGL_BAD_ALLOC, "eglSetDamageRegionKHR");
-
-   for (EGLint num_drects = 0; num_drects < n_rects; num_drects++) {
-  EGLint i = num_drects * 4;
-  droid_rects[num_drects].left = rects[i];
-  droid_rects[num_drects].bottom = rects[i + 1];
-  droid_rects[num_drects].right = rects[i] + rect

Re: [Mesa-dev] [PATCH v5 4/5] st/dri2: Implement DRI2bufferDamageExtension

2019-07-15 Thread Boris Brezillon
On Mon, 15 Jul 2019 09:23:43 +0200
Boris Brezillon  wrote:

> Hello Marek,
> 
> On Tue, 2 Jul 2019 20:09:23 +0200
> Boris Brezillon  wrote:
> 
> > On Tue, 2 Jul 2019 13:21:31 -0400
> > Marek Olšák  wrote:
> >   
> > > On Tue., Jul. 2, 2019, 09:50 Boris Brezillon,
> > >  wrote:
> > > 
> > > > From: Daniel Stone 
> > > >
> > > > Add a pipe_screen->set_damage_region() hook to propagate
> > > > set-damage-region requests to the driver, it's then up to the
> > > > driver to decide what to do with this piece of information.
> > > >
> > > > If the hook is left unassigned, the buffer-damage extension is
> > > > considered unsupported.
> > > >
> > > > Signed-off-by: Daniel Stone 
> > > > Signed-off-by: Boris Brezillon 
> > > > Reviewed-by: Alyssa Rosenzweig 
> > > > ---
> > > > Changes in v5:
> > > > * Add Alyssa's R-b
> > > > ---
> > > >  src/gallium/include/pipe/p_screen.h   |  7 +++
> > > >  src/gallium/state_trackers/dri/dri2.c | 22 ++
> > > >  2 files changed, 29 insertions(+)
> > > >
> > > > diff --git a/src/gallium/include/pipe/p_screen.h
> > > > b/src/gallium/include/pipe/p_screen.h
> > > > index 3f9bad470950..8df12ee4f865 100644
> > > > --- a/src/gallium/include/pipe/p_screen.h
> > > > +++ b/src/gallium/include/pipe/p_screen.h
> > > > @@ -464,6 +464,13 @@ struct pipe_screen {
> > > > bool (*is_parallel_shader_compilation_finished)(struct
> > > > pipe_screen *screen,
> > > > void *shader,
> > > > unsigned
> > > > shader_type); +
> > > > +   /**
> > > > +* Set damage region.
> > > >  
> > > 
> > > Can you expand the comment to describe rects? The format of rects is
> > > not obvious.
> > 
> > Oops, will point to the KHR_partial_update() doc and explain what rects
> > encode and how.
> > This reminds me that we have a corner case (at least for tile-based
> > GPUs): the dri implementation calls  
> > ->set_damage_region(screen, res, 0, NULL) to reset the damage region,
> > but in KHR_partial_update() spec this means "damage all". If we follow
> > the spec that would imply existing FB content is dropped which in turn
> > means users relying on buffer_age() (without partial_update()) to only
> > update the region that have changed will stop working properly.
> > 
> > I see 2 options to solve this problem:
> > 
> > 1/ add a new ->reset_damage_region() hook that would be called by the
> >dri implementation after each swap_buf() in replacement of the
> >current ->set_damage_region(screen, res, 0, NULL). Reset in that
> >case means we consider the damage region as "unknown" and force
> >a "reload FB content in the local-tile buffer" for the whole
> >resource instead of restricting it to the !damage region.
> > 2/ deviate from the KHR_partial_update() semantic and reserve  
> >->set_damage_region(screen, res, 0, NULL) for the "reset damage
> >region" op. That means we'll have to convert actual
> >KHR_partial_update(0, NULL) calls into  
> >->set_damage_region(screen, res, 1, full_res_rect) ones to reflect
> >the behavior described in the spec.  
> 
> Any advice on how to solve this problem?

Decided to go for a 3rd option in my v6 which is to keep things as they
were and document that ->set_damage_region(0, NULL) should act as a
'reset damage region'. This is exactly how it's documented in the DRI2
extension, and I guess we can live the potential extra penalty when
the application calls KHR_partial_update(0, NULL) instead of
KHR_partial_update(1, full_res_rect).
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH] pipe-loader: use radeonsi for MM if amdgpu dri is used

2019-07-15 Thread Jeremy Newton
Thanks Marek and Michel, see the updated patch below:

The amdgpu dri is used for the closed source AMD driver. Since this driver
does not implement multimedia, we fall back to radeonsi in mesa to do
multimedia. This corrects the Gallium driver name for when it is set to
amdgpu.

This will allow dropping the amdgpu-pro specific GBM implementation in
favour of Mesa's libgbm.

Signed-off-by: Jeremy Newton 
Signed-off-by: Marek Olšák 
Reviewed-by: Michel Dänzer 
---
 src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c 
b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index 960d63b2c31..6e889539c92 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -194,6 +194,11 @@ pipe_loader_drm_probe_fd_nodup(struct pipe_loader_device 
**dev, int fd)
if (!ddev->base.driver_name)
   goto fail;
 
+   if (strcmp(ddev->base.driver_name, "amdgpu") == 0) {
+  FREE(ddev->base.driver_name);
+  ddev->base.driver_name = strdup("radeonsi");
+   }
+
struct util_dl_library **plib = NULL;
 #ifndef GALLIUM_STATIC_TARGETS
plib = &ddev->lib;
-- 
2.20.1

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

Re: [Mesa-dev] [PATCH] pipe-loader: use radeonsi for MM if amdgpu dri is used

2019-07-15 Thread Michel Dänzer
On 2019-07-15 3:58 p.m., Jeremy Newton wrote:
> Thanks Marek and Michel, see the updated patch below:

FYI, this kind of commentary should be after the --- line, or it will be
included as part of the Git commit log by tools like "git am".


> The amdgpu dri is used for the closed source AMD driver. Since this driver
> does not implement multimedia, we fall back to radeonsi in mesa to do
> multimedia. This corrects the Gallium driver name for when it is set to
> amdgpu.
> 
> This will allow dropping the amdgpu-pro specific GBM implementation in
> favour of Mesa's libgbm.
> 
> Signed-off-by: Jeremy Newton 
> Signed-off-by: Marek Olšák 
> Reviewed-by: Michel Dänzer 
> ---
>  src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c 
> b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> index 960d63b2c31..6e889539c92 100644
> --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> @@ -194,6 +194,11 @@ pipe_loader_drm_probe_fd_nodup(struct pipe_loader_device 
> **dev, int fd)
> if (!ddev->base.driver_name)
>goto fail;
>  
> +   if (strcmp(ddev->base.driver_name, "amdgpu") == 0) {
> +  FREE(ddev->base.driver_name);
> +  ddev->base.driver_name = strdup("radeonsi");
> +   }
> +
> struct util_dl_library **plib = NULL;
>  #ifndef GALLIUM_STATIC_TARGETS
> plib = &ddev->lib;
> 


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

Re: [Mesa-dev] [PATCH] pipe-loader: use radeonsi for MM if amdgpu dri is used

2019-07-15 Thread Jeremy Newton
Sorry about that, I've only used git email maybe three times in my life :)

On Mon, Jul 15, 2019 at 10:00 AM Jeremy Newton  wrote:

> Thanks Marek and Michel, see the updated patch below:
>
> The amdgpu dri is used for the closed source AMD driver. Since this driver
> does not implement multimedia, we fall back to radeonsi in mesa to do
> multimedia. This corrects the Gallium driver name for when it is set to
> amdgpu.
>
> This will allow dropping the amdgpu-pro specific GBM implementation in
> favour of Mesa's libgbm.
>
> Signed-off-by: Jeremy Newton 
> Signed-off-by: Marek Olšák 
> Reviewed-by: Michel Dänzer 
> ---
>  src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> index 960d63b2c31..6e889539c92 100644
> --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> @@ -194,6 +194,11 @@ pipe_loader_drm_probe_fd_nodup(struct
> pipe_loader_device **dev, int fd)
> if (!ddev->base.driver_name)
>goto fail;
>
> +   if (strcmp(ddev->base.driver_name, "amdgpu") == 0) {
> +  FREE(ddev->base.driver_name);
> +  ddev->base.driver_name = strdup("radeonsi");
> +   }
> +
> struct util_dl_library **plib = NULL;
>  #ifndef GALLIUM_STATIC_TARGETS
> plib = &ddev->lib;
> --
> 2.20.1
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] pipe-loader: use radeonsi for MM if amdgpu dri is used

2019-07-15 Thread Michel Dänzer
On 2019-07-15 4:11 p.m., Newton, Jeremy wrote:
> Sorry about that, I've only used git email maybe three times in my life :)

Nothing to apologize for, everybody has to learn that kind of thing. :)


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

Re: [Mesa-dev] [PATCH] pipe-loader: use radeonsi for MM if amdgpu dri is used

2019-07-15 Thread Eric Engestrom


On 2019-07-15 at 16:01, Jeremy Newton  wrote:
> Thanks Marek and Michel, see the updated patch below:
> 
> The amdgpu dri is used for the closed source AMD driver. Since this driver
> does not implement multimedia, we fall back to radeonsi in mesa to do
> multimedia. This corrects the Gallium driver name for when it is set to
> amdgpu.
> 
> This will allow dropping the amdgpu-pro specific GBM implementation in
> favour of Mesa's libgbm.
> 
> Signed-off-by: Jeremy Newton 
> Signed-off-by: Marek Olšák 
> Reviewed-by: Michel Dänzer 

All the tools expect valid email addresses; could you please fix those?

> ---
>  src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c 
> b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> index 960d63b2c31..6e889539c92 100644
> --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
> @@ -194,6 +194,11 @@ pipe_loader_drm_probe_fd_nodup(struct 
> pipe_loader_device **dev, int fd)
> if (!ddev->base.driver_name)
>goto fail;
>  
> +   if (strcmp(ddev->base.driver_name, "amdgpu") == 0) {
> +  FREE(ddev->base.driver_name);
> +  ddev->base.driver_name = strdup("radeonsi");
> +   }
> +
> struct util_dl_library **plib = NULL;
>  #ifndef GALLIUM_STATIC_TARGETS
> plib = &ddev->lib;
> -- 
> 2.20.1
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [Bug 109615] >=19.0.0 fails u_format_test on ppc64

2019-07-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=109615

erhar...@mailbox.org changed:

   What|Removed |Added

Summary|19.0.0_rc4 fails|>=19.0.0 fails
   |u_format_test on ppc64  |u_format_test on ppc64

--- Comment #9 from erhar...@mailbox.org ---
Stills fails in 19.0.8 and 19.1.2:
47/50 mesa:gallium / u_format_testFAIL 0.09 s (exit status 1)

Additionally failing in 19.1.2:
25/50 mesa:compiler+nir / nir_varsFAIL 0.57 s (killed by signal
6 SIGABRT)

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

[Mesa-dev] [PATCH] radv/gfx10: enable OC_LDS_EN for NGG GS if the ES stage is TES

2019-07-15 Thread Samuel Pitoiset
Signed-off-by: Samuel Pitoiset 
---
 src/amd/vulkan/radv_shader.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index f6b0297d4a3..1e9399de193 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -826,7 +826,8 @@ static void radv_postprocess_config(const struct 
radv_physical_device *pdevice,
config_out->rsrc1 |= 
S_00B228_GS_VGPR_COMP_CNT(gs_vgpr_comp_cnt) |
 S_00B228_WGP_MODE(1);
config_out->rsrc2 |= 
S_00B22C_ES_VGPR_COMP_CNT(es_vgpr_comp_cnt) |
-S_00B22C_LDS_SIZE(config_in->lds_size);
+S_00B22C_LDS_SIZE(config_in->lds_size) |
+S_00B22C_OC_LDS_EN(es_stage == 
MESA_SHADER_TESS_EVAL);
} else if (pdevice->rad_info.chip_class >= GFX9 &&
   stage == MESA_SHADER_GEOMETRY) {
unsigned es_type = info->gs.es_type;
-- 
2.22.0

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

[Mesa-dev] [Bug 110663] threads_posix.h:96: undefined reference to `pthread_once'

2019-07-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=110663

Vinson Lee  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #3 from Vinson Lee  ---
commit 730ceeddb557cec08a502e82b7faeb689bc91d2a
Author: Vinson Lee 
Date:   Thu Jun 13 15:08:27 2019 -0700

meson: Add dep_thread dependency.

Fix this build error on Ubuntu 18.04.

/usr/bin/ld: src/util/libmesa_util.a(u_cpu_detect.c.o): undefined reference
to symbol 'pthread_once@@GLIBC_2.2.5'

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110663
Suggested-by: Eric Engestrom 
Signed-off-by: Vinson Lee 
Reviewed-by: Eric Anholt 
Acked-by: Eric Engestrom 

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

Re: [Mesa-dev] [PATCH] radv/gfx10: enable OC_LDS_EN for NGG GS if the ES stage is TES

2019-07-15 Thread Bas Nieuwenhuizen
r-b

On Mon, Jul 15, 2019 at 6:46 PM Samuel Pitoiset
 wrote:
>
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/amd/vulkan/radv_shader.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
> index f6b0297d4a3..1e9399de193 100644
> --- a/src/amd/vulkan/radv_shader.c
> +++ b/src/amd/vulkan/radv_shader.c
> @@ -826,7 +826,8 @@ static void radv_postprocess_config(const struct 
> radv_physical_device *pdevice,
> config_out->rsrc1 |= 
> S_00B228_GS_VGPR_COMP_CNT(gs_vgpr_comp_cnt) |
>  S_00B228_WGP_MODE(1);
> config_out->rsrc2 |= 
> S_00B22C_ES_VGPR_COMP_CNT(es_vgpr_comp_cnt) |
> -S_00B22C_LDS_SIZE(config_in->lds_size);
> +S_00B22C_LDS_SIZE(config_in->lds_size) |
> +S_00B22C_OC_LDS_EN(es_stage == 
> MESA_SHADER_TESS_EVAL);
> } else if (pdevice->rad_info.chip_class >= GFX9 &&
>stage == MESA_SHADER_GEOMETRY) {
> unsigned es_type = info->gs.es_type;
> --
> 2.22.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [Bug 103748] [softpipe] pigilt arb_internalformat_query2-image-texture regression

2019-07-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103748

Mark Janes  changed:

   What|Removed |Added

   Keywords|regression  |

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

[Mesa-dev] [Bug 102122] [softpipe] piglit fdo10370 regression

2019-07-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102122

Mark Janes  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WORKSFORME

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

Re: [Mesa-dev] [PATCH] pipe-loader: use radeonsi for MM if amdgpu dri is used

2019-07-15 Thread Christian König

Am 15.07.19 um 16:15 schrieb Michel Dänzer:

On 2019-07-15 4:11 p.m., Newton, Jeremy wrote:

Sorry about that, I've only used git email maybe three times in my life :)

Nothing to apologize for, everybody has to learn that kind of thing. :)


To be honest even after more than a decade I still get this wrong from 
time to time.


So really don't worry about stuff like that :)

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

Re: [Mesa-dev] [PATCH] radv/gfx10: add missing conversions for 16-bit exports

2019-07-15 Thread Bas Nieuwenhuizen
On Mon, Jul 15, 2019, 10:45 AM Samuel Pitoiset 
wrote:

> This fixes
> dEQP-VK.spirv_assembly.instruction.graphics.16bit_storage.input_output_*
>
> Found with RADV_DEBUG=checkir
>
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/amd/vulkan/radv_nir_to_llvm.c | 9 +
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/amd/vulkan/radv_nir_to_llvm.c
> b/src/amd/vulkan/radv_nir_to_llvm.c
> index 339c9d93423..fa26a450a91 100644
> --- a/src/amd/vulkan/radv_nir_to_llvm.c
> +++ b/src/amd/vulkan/radv_nir_to_llvm.c
> @@ -3691,6 +3691,13 @@ static void gfx10_ngg_gs_emit_epilogue_2(struct
> radv_shader_context *ctx)
> gep_idx[2] = LLVMConstInt(ctx->ac.i32,
> out_idx, false);
> tmp = LLVMBuildGEP(builder, vertexptr,
> gep_idx, 3, "");
> tmp = LLVMBuildLoad(builder, tmp, "");
> +
> +   LLVMTypeRef type =
> LLVMGetAllocatedType(ctx->abi.outputs[ac_llvm_reg_index_soa(i, j)]);
> +   if (ac_get_type_size(type) == 2) {
> +   tmp =
> LLVMBuildBitCast(ctx->ac.builder, tmp, ctx->ac.i32, "");
>

Can we use ac_to_integer here? That way we don't need to care about
floatness.

+   tmp =
> LLVMBuildTrunc(ctx->ac.builder, tmp, ctx->ac.i16, "");
> +   }
> +
> outputs[noutput].values[j] =
> ac_to_float(&ctx->ac, tmp);
> }
>
> @@ -3771,6 +3778,8 @@ static void gfx10_ngg_gs_emit_vertex(struct
> radv_shader_context *ctx,
> LLVMValueRef ptr = LLVMBuildGEP(builder,
> vertexptr, gep_idx, 3, "");
>
> out_val = ac_to_integer(&ctx->ac, out_val);
> +   out_val = LLVMBuildZExtOrBitCast(ctx->ac.builder,
> out_val, ctx->ac.i32, "");
> +
> LLVMBuildStore(builder, out_val, ptr);
> }
> }
> --
> 2.22.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] radv/gfx10: add missing conversions for 16-bit exports

2019-07-15 Thread Bas Nieuwenhuizen
And R-b after suggestion

On Mon, Jul 15, 2019, 11:22 PM Bas Nieuwenhuizen 
wrote:

>
>
> On Mon, Jul 15, 2019, 10:45 AM Samuel Pitoiset 
> wrote:
>
>> This fixes
>> dEQP-VK.spirv_assembly.instruction.graphics.16bit_storage.input_output_*
>>
>> Found with RADV_DEBUG=checkir
>>
>> Signed-off-by: Samuel Pitoiset 
>> ---
>>  src/amd/vulkan/radv_nir_to_llvm.c | 9 +
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/src/amd/vulkan/radv_nir_to_llvm.c
>> b/src/amd/vulkan/radv_nir_to_llvm.c
>> index 339c9d93423..fa26a450a91 100644
>> --- a/src/amd/vulkan/radv_nir_to_llvm.c
>> +++ b/src/amd/vulkan/radv_nir_to_llvm.c
>> @@ -3691,6 +3691,13 @@ static void gfx10_ngg_gs_emit_epilogue_2(struct
>> radv_shader_context *ctx)
>> gep_idx[2] = LLVMConstInt(ctx->ac.i32,
>> out_idx, false);
>> tmp = LLVMBuildGEP(builder, vertexptr,
>> gep_idx, 3, "");
>> tmp = LLVMBuildLoad(builder, tmp, "");
>> +
>> +   LLVMTypeRef type =
>> LLVMGetAllocatedType(ctx->abi.outputs[ac_llvm_reg_index_soa(i, j)]);
>> +   if (ac_get_type_size(type) == 2) {
>> +   tmp =
>> LLVMBuildBitCast(ctx->ac.builder, tmp, ctx->ac.i32, "");
>>
>
> Can we use ac_to_integer here? That way we don't need to care about
> floatness.
>
> +   tmp =
>> LLVMBuildTrunc(ctx->ac.builder, tmp, ctx->ac.i16, "");
>> +   }
>> +
>> outputs[noutput].values[j] =
>> ac_to_float(&ctx->ac, tmp);
>> }
>>
>> @@ -3771,6 +3778,8 @@ static void gfx10_ngg_gs_emit_vertex(struct
>> radv_shader_context *ctx,
>> LLVMValueRef ptr = LLVMBuildGEP(builder,
>> vertexptr, gep_idx, 3, "");
>>
>> out_val = ac_to_integer(&ctx->ac, out_val);
>> +   out_val = LLVMBuildZExtOrBitCast(ctx->ac.builder,
>> out_val, ctx->ac.i32, "");
>> +
>> LLVMBuildStore(builder, out_val, ptr);
>> }
>> }
>> --
>> 2.22.0
>>
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Re: [Mesa-dev] [PATCH] radv: remove unused code in radv_export_param()

2019-07-15 Thread Bas Nieuwenhuizen
R-b

On Mon, Jul 15, 2019, 8:49 AM Samuel Pitoiset 
wrote:

> It was hack for geometry shaders.
>
> Signed-off-by: Samuel Pitoiset 
> ---
>  src/amd/vulkan/radv_nir_to_llvm.c | 16 +---
>  1 file changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_nir_to_llvm.c
> b/src/amd/vulkan/radv_nir_to_llvm.c
> index 00c7df8574b..a5eb8404108 100644
> --- a/src/amd/vulkan/radv_nir_to_llvm.c
> +++ b/src/amd/vulkan/radv_nir_to_llvm.c
> @@ -2593,21 +2593,7 @@ radv_export_param(struct radv_shader_context *ctx,
> unsigned index,
>  static LLVMValueRef
>  radv_load_output(struct radv_shader_context *ctx, unsigned index,
> unsigned chan)
>  {
> -   LLVMValueRef output;
> -
> -   if (ctx->vertexptr) {
> -   LLVMValueRef gep_idx[3] = {
> -   ctx->ac.i32_0, /* implicit C-style array */
> -   ctx->ac.i32_0, /* second value of struct */
> -   ctx->ac.i32_1, /* stream 1: source data index */
> -   };
> -
> -   gep_idx[2] = LLVMConstInt(ctx->ac.i32,
> ac_llvm_reg_index_soa(index, chan), false);
> -   output = LLVMBuildGEP(ctx->ac.builder, ctx->vertexptr,
> gep_idx, 3, "");
> -   } else {
> -   output = ctx->abi.outputs[ac_llvm_reg_index_soa(index,
> chan)];
> -   }
> -
> +   LLVMValueRef output =
> ctx->abi.outputs[ac_llvm_reg_index_soa(index, chan)];
> return LLVMBuildLoad(ctx->ac.builder, output, "");
>  }
>
> --
> 2.22.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [Bug 111141] [REGRESSION] [BISECTED] [DXVK] 1-bit booleans and Elite Dangerous shader mis-optimization

2019-07-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=41

Bug ID: 41
   Summary: [REGRESSION] [BISECTED] [DXVK] 1-bit booleans and
Elite Dangerous shader mis-optimization
   Product: Mesa
   Version: 19.0
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Mesa core
  Assignee: mesa-dev@lists.freedesktop.org
  Reporter: s_j_newb...@yahoo.co.uk
QA Contact: mesa-dev@lists.freedesktop.org

I've bisected a shader induced corruption issue to:

3b3081479163475f25b908008250d83c31716c34
nir/algebraic: Optimize 1-bit Booleans 

Everything renders normally prior to this commit, afterwards some textures
appear "posterized" and ambiently lit areas are highlighted in the wrong
colours.

I'll attach screenshots tomorrow.

I will provide any information on request/direction.

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

[Mesa-dev] [PATCH] radv/gfx10: don't set array pitch field on images

2019-07-15 Thread Dave Airlie
From: Dave Airlie 

Setting this seems to be broken, amdvlk only sets it for quilted
textures which I'm not sure what those are.

Fixes: dEQP-VK.glsl.texture_functions.query.texturesize*3d*
---
 src/amd/vulkan/radv_image.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
index ccbec36849e..66a948fde4a 100644
--- a/src/amd/vulkan/radv_image.c
+++ b/src/amd/vulkan/radv_image.c
@@ -682,7 +682,7 @@ gfx10_make_texture_descriptor(struct radv_device *device,
 */
state[4] = S_00A010_DEPTH(type == V_008F1C_SQ_RSRC_IMG_3D ? depth - 1 : 
last_layer) |
   S_00A010_BASE_ARRAY(first_layer);
-   state[5] = S_00A014_ARRAY_PITCH(!!(type == V_008F1C_SQ_RSRC_IMG_3D)) |
+   state[5] = S_00A014_ARRAY_PITCH(0) |
   S_00A014_MAX_MIP(image->info.samples > 1 ?
util_logbase2(image->info.samples) :
image->info.levels - 1) |
-- 
2.17.1

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

Re: [Mesa-dev] [PATCH] radv/gfx10: don't set array pitch field on images

2019-07-15 Thread Bas Nieuwenhuizen
r-b

On Tue, Jul 16, 2019 at 1:25 AM Dave Airlie  wrote:
>
> From: Dave Airlie 
>
> Setting this seems to be broken, amdvlk only sets it for quilted
> textures which I'm not sure what those are.
>
> Fixes: dEQP-VK.glsl.texture_functions.query.texturesize*3d*
> ---
>  src/amd/vulkan/radv_image.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
> index ccbec36849e..66a948fde4a 100644
> --- a/src/amd/vulkan/radv_image.c
> +++ b/src/amd/vulkan/radv_image.c
> @@ -682,7 +682,7 @@ gfx10_make_texture_descriptor(struct radv_device *device,
>  */
> state[4] = S_00A010_DEPTH(type == V_008F1C_SQ_RSRC_IMG_3D ? depth - 1 
> : last_layer) |
>S_00A010_BASE_ARRAY(first_layer);
> -   state[5] = S_00A014_ARRAY_PITCH(!!(type == V_008F1C_SQ_RSRC_IMG_3D)) |
> +   state[5] = S_00A014_ARRAY_PITCH(0) |
>S_00A014_MAX_MIP(image->info.samples > 1 ?
> util_logbase2(image->info.samples) :
> image->info.levels - 1) |
> --
> 2.17.1
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [Bug 108596] [RADV] Implement a HUD for monitoring GPU/CPU loads, FPS, temperature and more

2019-07-15 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108596

Shmerl  changed:

   What|Removed |Added

 CC||shtetl...@gmail.com

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

[Mesa-dev] [PATCH] radv/gfx10: set the pgm rsrc3/4 regs using index sh reg set

2019-07-15 Thread Dave Airlie
From: Dave Airlie 

This is ported from AMDVLK, it's probably not requires unless
we want to use "real time queues", but it might be nice to just have
in place.
---
 src/amd/common/sid.h   |  1 +
 src/amd/vulkan/radv_cs.h   | 18 +++
 src/amd/vulkan/si_cmd_buffer.c | 42 +++---
 3 files changed, 42 insertions(+), 19 deletions(-)

diff --git a/src/amd/common/sid.h b/src/amd/common/sid.h
index d464b6a110e..0b996e54884 100644
--- a/src/amd/common/sid.h
+++ b/src/amd/common/sid.h
@@ -196,6 +196,7 @@
 #define PKT3_INCREMENT_CE_COUNTER  0x84
 #define PKT3_INCREMENT_DE_COUNTER  0x85
 #define PKT3_WAIT_ON_CE_COUNTER0x86
+#define PKT3_SET_SH_REG_INDEX  0x9B
 #define PKT3_LOAD_CONTEXT_REG  0x9F /* new for VI */
 
 #define PKT_TYPE_S(x)   (((unsigned)(x) & 0x3) << 30)
diff --git a/src/amd/vulkan/radv_cs.h b/src/amd/vulkan/radv_cs.h
index eb1aedb0327..d21acba7e8e 100644
--- a/src/amd/vulkan/radv_cs.h
+++ b/src/amd/vulkan/radv_cs.h
@@ -97,6 +97,24 @@ static inline void radeon_set_sh_reg(struct radeon_cmdbuf 
*cs, unsigned reg, uns
radeon_emit(cs, value);
 }
 
+static inline void radeon_set_sh_reg_idx(const struct radv_physical_device 
*pdevice,
+struct radeon_cmdbuf *cs,
+unsigned reg, unsigned idx,
+unsigned value)
+{
+   assert(reg >= SI_SH_REG_OFFSET && reg < SI_SH_REG_END);
+   assert(cs->cdw + 3 <= cs->max_dw);
+   assert(idx);
+
+   unsigned opcode = PKT3_SET_SH_REG_INDEX;
+   if (pdevice->rad_info.chip_class < GFX10)
+   opcode = PKT3_SET_SH_REG;
+
+   radeon_emit(cs, PKT3(opcode, 1, 0));
+   radeon_emit(cs, (reg - SI_SH_REG_OFFSET) >> 2 | (idx << 28));
+   radeon_emit(cs, value);
+}
+
 static inline void radeon_set_uconfig_reg_seq(struct radeon_cmdbuf *cs, 
unsigned reg, unsigned num)
 {
assert(reg >= CIK_UCONFIG_REG_OFFSET && reg < CIK_UCONFIG_REG_END);
diff --git a/src/amd/vulkan/si_cmd_buffer.c b/src/amd/vulkan/si_cmd_buffer.c
index a832dbd89eb..f789cdd1ce6 100644
--- a/src/amd/vulkan/si_cmd_buffer.c
+++ b/src/amd/vulkan/si_cmd_buffer.c
@@ -262,20 +262,24 @@ si_emit_graphics(struct radv_physical_device 
*physical_device,
if (physical_device->rad_info.chip_class >= GFX7) {
if (physical_device->rad_info.chip_class >= GFX10) {
/* Logical CUs 16 - 31 */
-   radeon_set_sh_reg(cs, R_00B404_SPI_SHADER_PGM_RSRC4_HS,
- S_00B404_CU_EN(0x));
-   radeon_set_sh_reg(cs, R_00B204_SPI_SHADER_PGM_RSRC4_GS,
- S_00B204_CU_EN(0x) |
- 
S_00B204_SPI_SHADER_LATE_ALLOC_GS_GFX10(0));
-   radeon_set_sh_reg(cs, R_00B104_SPI_SHADER_PGM_RSRC4_VS,
- S_00B104_CU_EN(0x));
-   radeon_set_sh_reg(cs, R_00B004_SPI_SHADER_PGM_RSRC4_PS,
- S_00B004_CU_EN(0x));
+   radeon_set_sh_reg_idx(physical_device,
+ cs, 
R_00B404_SPI_SHADER_PGM_RSRC4_HS,
+ 3, S_00B404_CU_EN(0x));
+   radeon_set_sh_reg_idx(physical_device,
+ cs, 
R_00B204_SPI_SHADER_PGM_RSRC4_GS,
+ 3, S_00B204_CU_EN(0x) |
+ 
S_00B204_SPI_SHADER_LATE_ALLOC_GS_GFX10(0));
+   radeon_set_sh_reg_idx(physical_device,
+ cs, 
R_00B104_SPI_SHADER_PGM_RSRC4_VS,
+ 3, S_00B104_CU_EN(0x));
+   radeon_set_sh_reg_idx(physical_device,
+ cs, 
R_00B004_SPI_SHADER_PGM_RSRC4_PS,
+ 3, S_00B004_CU_EN(0x));
}
 
if (physical_device->rad_info.chip_class >= GFX9) {
-   radeon_set_sh_reg(cs, R_00B41C_SPI_SHADER_PGM_RSRC3_HS,
- S_00B41C_CU_EN(0x) | 
S_00B41C_WAVE_LIMIT(0x3F));
+   radeon_set_sh_reg_idx(physical_device, cs, 
R_00B41C_SPI_SHADER_PGM_RSRC3_HS,
+ 3, S_00B41C_CU_EN(0x) | 
S_00B41C_WAVE_LIMIT(0x3F));
} else {
radeon_set_sh_reg(cs, R_00B51C_SPI_SHADER_PGM_RSRC3_LS,
  S_00B51C_CU_EN(0x) | 
S_00B51C_WAVE_LIMIT(0x3F));
@@ -291,8 +295,8 @@ si_emit_graphics(struct radv_physical_device 
*physical_device,
 

[Mesa-dev] [PATCH] radv: fix gathering clip/cull distance masks for GS

2019-07-15 Thread Samuel Pitoiset
For NGG, the driver relies on the VS outinfo struct.

This fixes
dEQP-VK.clipping.user_defined.clip_*_vert_tess_geom_*

Signed-off-by: Samuel Pitoiset 
---
 src/amd/vulkan/radv_nir_to_llvm.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/amd/vulkan/radv_nir_to_llvm.c 
b/src/amd/vulkan/radv_nir_to_llvm.c
index 76d784b3374..b890ce56f16 100644
--- a/src/amd/vulkan/radv_nir_to_llvm.c
+++ b/src/amd/vulkan/radv_nir_to_llvm.c
@@ -2407,6 +2407,11 @@ scan_shader_output_decl(struct radv_shader_context *ctx,
ctx->shader_info->tes.outinfo.cull_dist_mask = 
(1 << shader->info.cull_distance_array_size) - 1;
ctx->shader_info->tes.outinfo.cull_dist_mask 
<<= shader->info.clip_distance_array_size;
}
+   if (stage == MESA_SHADER_GEOMETRY) {
+   ctx->shader_info->vs.outinfo.clip_dist_mask = 
(1 << shader->info.clip_distance_array_size) - 1;
+   ctx->shader_info->vs.outinfo.cull_dist_mask = 
(1 << shader->info.cull_distance_array_size) - 1;
+   ctx->shader_info->vs.outinfo.cull_dist_mask <<= 
shader->info.clip_distance_array_size;
+   }
}
}
 
-- 
2.22.0

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