[Mesa-dev] [PATCH 4/9] panfrost: Bail out early when new and current FB states are equal

2019-08-02 Thread Boris Brezillon
If the current FB matches the new one there's nothing to be done in panfrost_set_framebuffer_state(). By bailing out early in that case we avoid emitting new FB descriptors (the old ones are still valid). Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_context.c | 4 ++

[Mesa-dev] [PATCH 1/9] panfrost: Get rid of ctx->job

2019-08-02 Thread Boris Brezillon
This field is never set to anything but NULL, which means the test done in panfrost_free_job() and panfrost_get_job_for_fbo() will always evaluate to false. Let's get rid of this field. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_context.h | 3 +-- src/gallium/dr

[Mesa-dev] [PATCH 8/9] panfrost: Handle the bo == NULL case in panfrost_bo_[un]reference()

2019-08-02 Thread Boris Brezillon
Allows us to pass BOs without checking if they're NULL or not. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_resource.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/pan

Re: [Mesa-dev] [PATCH 2/9] panfrost: Remove job from ctx->jobs at submission time

2019-08-02 Thread Boris Brezillon
ready has a job running would actually get the old job object and might start messing up with it. Not sure that's what we want. > > On Fri, Aug 02, 2019 at 12:12:50PM +0200, Boris Brezillon wrote: > > This guarantees that new draws targetting the same framebuffer will > > get

Re: [Mesa-dev] [PATCH 8/9] panfrost: Handle the bo == NULL case in panfrost_bo_[un]reference()

2019-08-02 Thread Boris Brezillon
_free_job(). Don't know having a NULL polygon_list is valid case (I guess that's possible for a job that does not involve the tiler) but I was facing this problem when running the deqp testsuite. > > On Fri, Aug 02, 2019 at 12:12:56PM +0200, Boris Brezillon wrote: > > Allows us

Re: [Mesa-dev] [PATCH 1/9] panfrost: Get rid of ctx->job

2019-08-02 Thread Boris Brezillon
ething we want to have to avoid the search into the hash table? If we do that, we should at least check that the keys match before returning the current job. > > On Fri, Aug 02, 2019 at 12:12:49PM +0200, Boris Brezillon wrote: > > This field is never set to anything but N

Re: [Mesa-dev] [PATCH 6/9] panfrost: Don't emit a new FB desc when setting a new FB state

2019-08-02 Thread Boris Brezillon
his patch series is not the right time to focus on pipelined > performance (though I'd love if somebody gave it some love at some > point). But I do want to caution from a code smell that will make > whoever that someone is -- quite possibly you! -- quite grumpy when they > wo

[Mesa-dev] [PATCH v2 1/9] panfrost: Make ctx->job useful

2019-08-02 Thread Boris Brezillon
in the ->set_framebuffer_state() path. While at it, add extra assert()s to make sure ctx->job is consistent. Fixes: 59c9623d0a75 ("panfrost: Import job data structures from v3d") Signed-off-by: Boris Brezillon Changes in v2: * New patch (suggested by Alyssa) --- src/galli

[Mesa-dev] [PATCH v2 7/9] panfrost: Get rid of the skippable param in attach_vt_framebuffer()

2019-08-02 Thread Boris Brezillon
The only user of this function always passes true. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig --- Changes in v2: * Add Alyssa's R-b --- src/gallium/drivers/panfrost/pan_context.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/dr

[Mesa-dev] [PATCH v2 0/9] panfrost: Allocate the polygon lists on-demand

2019-08-02 Thread Boris Brezillon
ful (to limit the number of hash lookups). Regards, Boris Alyssa Rosenzweig (1): panfrost: Allocate polygon lists on-demand Boris Brezillon (8): panfrost: Make ctx->job useful panfrost: Remove job from ctx->jobs at submission time panfrost: Delay FB descriptor allocation panfr

[Mesa-dev] [PATCH v2 4/9] panfrost: Bail out early when new and current FB states are equal

2019-08-02 Thread Boris Brezillon
If the current FB matches the new one there's nothing to be done in panfrost_set_framebuffer_state(). By bailing out early in that case we avoid emitting new FB descriptors (the old ones are still valid). Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig --- Changes in v2:

[Mesa-dev] [PATCH v2 6/9] panfrost: Don't emit a new FB desc when setting a new FB state

2019-08-02 Thread Boris Brezillon
The FB desc will be emitted/attached on the first draw targetting this new FB. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig --- Changes in v2: * Add Alyssa's R-b --- src/gallium/drivers/panfrost/pan_context.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-)

[Mesa-dev] [PATCH v2 8/9] panfrost: Handle the bo == NULL case in panfrost_bo_[un]reference()

2019-08-02 Thread Boris Brezillon
Allows us to pass BOs without checking if they're NULL or not. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig --- Changes in v2: * Add Alyssa's R-b --- src/gallium/drivers/panfrost/pan_resource.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff -

[Mesa-dev] [PATCH v2 3/9] panfrost: Delay FB descriptor allocation

2019-08-02 Thread Boris Brezillon
No need to emit SFBD/MFBD at frame invalidation. They can be emitted when the framebuffer is attached, which saves us a potential FB desc re-allocation if a new FB is bound after the swap. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig --- Changes in v2: * Add Alyssa'

[Mesa-dev] [PATCH v2 5/9] panfrost: Bail out early when doing a wallpaper blit

2019-08-02 Thread Boris Brezillon
py the new state into ctx->pipe_framebuffer and exit the function. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig --- Changes in v2: * Add Alyssa's R-b --- src/gallium/drivers/panfrost/pan_context.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-)

[Mesa-dev] [PATCH v2 2/9] panfrost: Remove job from ctx->jobs at submission time

2019-08-02 Thread Boris Brezillon
This guarantees that new draws targetting the same framebuffer will get a new job instance. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig --- Changes in v2: * Add Alyssa's R-b --- src/gallium/drivers/panfrost/pan_job.c | 8 1 file changed, 8 insertions(+) diff --

[Mesa-dev] [PATCH v2 9/9] panfrost: Allocate polygon lists on-demand

2019-08-02 Thread Boris Brezillon
Signed-off-by: Boris Brezillon --- Changes in v2: * None --- src/gallium/drivers/panfrost/pan_context.c| 8 ++- src/gallium/drivers/panfrost/pan_context.h| 1 - src/gallium/drivers/panfrost/pan_drm.c| 2 +- src/gallium/drivers/panfrost/pan_job.c| 24 +

Re: [Mesa-dev] [PATCH v2 1/9] panfrost: Make ctx->job useful

2019-08-08 Thread Boris Brezillon
duced by a previous commit. But it does not necessarily means "backport to stable" in mind. > > On Thu, Aug 08, 2019 at 11:46:43AM +0200, Juan A. Suarez Romero wrote: > > On Fri, 2019-08-02 at 19:18 +0200, Boris Brezillon wrote: > > > ctx->job is supposed to se

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

2019-08-12 Thread Boris Brezillon
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 v7: * None Changes in v6: * Fix the doc Changes in v5: * Add Alyssa's a-b * Add Daniel's SoB ---

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

2019-08-12 Thread Boris Brezillon
Signed-off-by: Daniel Stone Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig --- Changes in v7: * Add a missing FREE() in dri2_set_damage_region() (Reported by Qiang) Changes in v6: * Pass pipe_box objects instead ints * Document the set_damage_region() hook Changes in v5: * Add Al

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

2019-08-12 Thread Boris Brezillon
ssing FREE(boxes) call in dri2_set_damage_region() and fixed an alignment issue in the panfrost driver. Regards, Boris [1]https://gitlab.freedesktop.org/mesa/mesa/merge_requests/227 [2]https://patchwork.freedesktop.org/series/45915/#rev2 *** BLURB HERE *** Boris Brezillon (1): panfrost: Add suppo

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

2019-08-12 Thread Boris Brezillon
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 v7: * Move

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

2019-08-12 Thread Boris Brezillon
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 v7: * None Changes in v6

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

2019-08-12 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 v7: * None Changes in v6: * None Changes in v5: * Add

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

2019-08-12 Thread Boris Brezillon
On Tue, 6 Aug 2019 15:49:14 +0800 Qiang Yu wrote: > > > > Erik, Qiang, Marek, > > > > Any comment on this v5. Should I send a v6 adding the missing FREE() > > call. Anything else you'd like me to change? > > > Hi Boris, > > There's no other change from my side. Use v5 way is just my suggestion

Re: [Mesa-dev] [PATCH v7 0/5] EGL_KHR_partial_update support

2019-08-13 Thread Boris Brezillon
On Mon, 12 Aug 2019 12:07:03 +0200 Boris Brezillon wrote: > 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() d

Re: [Mesa-dev] [PATCH 1/9] panfrost: Implement callbacks for PRIMITIVES queries

2019-08-13 Thread Boris Brezillon
On Fri, 9 Aug 2019 13:00:44 -0700 Alyssa Rosenzweig wrote: > We're just going to compute them in the driver but let's get the > structures setup to handle them. Implementation from v3d. > > Signed-off-by: Alyssa Rosenzweig The whole patchset is Reviewed-by: Boris Br

[Mesa-dev] [PATCH] panfrost: Kill a useless NULL test in panfrost_job_submit()

2019-08-13 Thread Boris Brezillon
The !job test is done after dereferencing the job pointer, which means it's either always false or we have a NULL pointer exception. Replace that test by an assert() at the beginning of the function. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_job.c | 4 +--- 1

[Mesa-dev] [PATCH 1/2] panfrost: Don't use mir_foreach_instr_in_block_safe() when not needed

2019-08-13 Thread Boris Brezillon
mir_foreach_instr_in_block_safe() is only needed if the caller intend to remove the current item from the list. Downgrade to mir_foreach_instr_in_block() when this is not the case. Signed-off-by: Boris Brezillon --- src/panfrost/midgard/midgard_compile.c | 2 +- src/panfrost/midgard

[Mesa-dev] [PATCH 2/2] panfrost: Implement custom block/instruction iterators

2019-08-13 Thread Boris Brezillon
instruction by something else). Let's implement our own iterators (still based on the existing list helpers) to address this limitation. Signed-off-by: Boris Brezillon --- src/panfrost/midgard/compiler.h | 75 ++- src/panfrost/midgard/midgard_compile.c| 2 +-

Re: [Mesa-dev] [PATCH 2/2] panfrost: Implement custom block/instruction iterators

2019-08-13 Thread Boris Brezillon
On Tue, 13 Aug 2019 12:59:03 -0700 Alyssa Rosenzweig wrote: > Could you explain a little bit more why this is neded? What do these > helpers do that the generic list.h helpers can't? The _safe attribute in generic helpers is just about handling the case where the current item is removed from the

Re: [Mesa-dev] [PATCH 1/2] panfrost: Don't use mir_foreach_instr_in_block_safe() when not needed

2019-08-13 Thread Boris Brezillon
On Tue, 13 Aug 2019 12:55:57 -0700 Alyssa Rosenzweig wrote: > > +++ b/src/panfrost/midgard/midgard_opt_perspective.c > > @@ -71,7 +71,7 @@ midgard_opt_combine_projection(compiler_context *ctx, > > midgard_block *block) > > unsigned frcp_component = 0; > > unsign

Re: [Mesa-dev] [PATCH 2/2] panfrost: Implement custom block/instruction iterators

2019-08-13 Thread Boris Brezillon
On Tue, 13 Aug 2019 22:25:49 +0200 Boris Brezillon wrote: > On Tue, 13 Aug 2019 12:59:03 -0700 > Alyssa Rosenzweig wrote: > > > Could you explain a little bit more why this is neded? What do these > > helpers do that the generic list.h helpers can't? > >

[Mesa-dev] [PATCH 3/5] panfrost: Fix a list_assert() in schedule_block()

2019-08-27 Thread Boris Brezillon
list_for_each_entry() does not allow modifying the current item pointer. Let's rework the skip-instructions logic in schedule_block() to not break this rule. Signed-off-by: Boris Brezillon --- src/panfrost/midgard/midgard_schedule.c | 8 1 file changed, 4 insertions(+), 4 dele

[Mesa-dev] [PATCH 1/5] panfrost: Free the instruction object in mir_remove_instruction()

2019-08-27 Thread Boris Brezillon
To avoid memory leaks. Signed-off-by: Boris Brezillon --- src/panfrost/midgard/compiler.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index 099d108142b1..f9ba31b5959d 100644 --- a/src/panfrost/midgard/compiler.h +++ b/src

[Mesa-dev] [PATCH 5/5] panfrost: Make sure bundle.instructions[] contains valid instructions

2019-08-27 Thread Boris Brezillon
Add an assert() in schedule_bundle() to make sure all instruction pointers in bundle.instructions[] are valid. Signed-off-by: Boris Brezillon --- src/panfrost/midgard/midgard_schedule.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost

[Mesa-dev] [PATCH 4/5] panfrost: Rework midgard_pair_load_store() to kill the nested foreach loop

2019-08-27 Thread Boris Brezillon
loop and rework the code so that the removed instruction is always the current one (which is what the list_for_each_entry_safe() API was initially designed for). While at it, we also get rid of the unecessary insert(ins)/remove(ins) dance by simply moving the instruction around. Signed-off-by:

[Mesa-dev] [PATCH 2/5] panfrost: Free all block/instruction objects before leaving midgard_compile_shader_nir()

2019-08-27 Thread Boris Brezillon
Right now we're leaking all block and instruction objects allocated by the compiler. Let's clean things up before leaving midgard_compile_shader_nir(). Signed-off-by: Boris Brezillon --- src/panfrost/midgard/compiler.h| 12 src/panfrost/midgard/midgard_compile.c |

Re: [Mesa-dev] [PATCH 1/2] panfrost: Don't use mir_foreach_instr_in_block_safe() when not needed

2019-08-27 Thread Boris Brezillon
On Tue, 13 Aug 2019 15:30:20 -0700 Alyssa Rosenzweig wrote: > > I don't see any remove_ins()/insert_before() call in there. Do you see > > any reason for using the _safe() variant here? > > Er, I think I meant the outer loop, which has a remove/insert pair at > the bottom to change the current

Re: [Mesa-dev] [PATCH 3/5] panfrost: Fix a list_assert() in schedule_block()

2019-08-27 Thread Boris Brezillon
On Tue, 27 Aug 2019 12:36:42 +0200 Boris Brezillon wrote: > list_for_each_entry() does not allow modifying the current item pointer. > Let's rework the skip-instructions logic in schedule_block() to not > break this rule. > > Signed-off-by: Boris Brezillon > ---

Re: [Mesa-dev] [PATCH 1/5] panfrost: Free the instruction object in mir_remove_instruction()

2019-08-27 Thread Boris Brezillon
problem as part of this full-rewrite then ;-). > > On Tue, Aug 27, 2019 at 12:36:40PM +0200, Boris Brezillon wrote: > > To avoid memory leaks. > > > > Signed-off-by: Boris Brezillon > > --- > > src/panfrost/midgard/compiler.h | 1 + > > 1 file change

Re: [Mesa-dev] [PATCH 1/2] panfrost: Don't use mir_foreach_instr_in_block_safe() when not needed

2019-08-27 Thread Boris Brezillon
On Tue, 27 Aug 2019 07:25:03 -0700 Alyssa Rosenzweig wrote: > Assuming it passes CI, feel free to apply it :) I guess that stands for a R-b :-). > > On Tue, Aug 27, 2019 at 12:40:08PM +0200, Boris Brezillon wrote: > > On Tue, 13 Aug 2019 15:30:20 -0700 > > Aly

[Mesa-dev] [PATCH] panfrost: Use ralloc() to allocate instructions to avoid leaking those objs

2019-08-28 Thread Boris Brezillon
Instructions attached to blocks are never explicitly freed. Let's use ralloc() to attach those objects to the compiler context so that they are automatically freed when the ctx object is freed. Signed-off-by: Boris Brezillon --- src/panfrost/midgard/compiler.h

Re: [Mesa-dev] [PATCH] panfrost: Use ralloc() to allocate instructions to avoid leaking those objs

2019-08-28 Thread Boris Brezillon
On Wed, 28 Aug 2019 07:08:18 -0700 Alyssa Rosenzweig wrote: > Looks good, r-b. > > Is it tested? Tested locally, and CI is green (this time I made sure the tests were actually run). Sorry again for introducing a regression with the other patch. ___ me

[Mesa-dev] [PATCH] panfrost: Reset the damage area on imported resources

2019-08-28 Thread Boris Brezillon
Reset the damage area in the resource_from_handle() path (as done in panfrost_resource_create()). Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_resource.c | 23 +++-- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers

Re: [Mesa-dev] [PATCH] panfrost: Reset the damage area on imported resources

2019-08-28 Thread Boris Brezillon
3:15PM +0200, Boris Brezillon wrote: > > Reset the damage area in the resource_from_handle() path (as done in > > panfrost_resource_create()). > > > > Signed-off-by: Boris Brezillon > > --- > > src/gallium/drivers/panfrost/pan_resource.c | 23 +++---

[Mesa-dev] [PATCH RFC 2/2] dri: Pass a __DRIcontext to ->set_damage_region()

2019-08-29 Thread Boris Brezillon
So we can call st_validate_state() from dri2_set_damage_region() in order to update the BACK_LEFT attachement before using it. If we don't do that, the resource passed to pipe_screen->set_damage_region() might be wrong. Signed-off-by: Boris Brezillon --- Hi, I honestly don't know i

[Mesa-dev] [PATCH RFC 1/2] dri: Let drivers reset the damage region

2019-08-29 Thread Boris Brezillon
only gallium driver implementing ->set_damage_region() is patched accordingly. Signed-off-by: Boris Brezillon --- include/GL/internal/dri_interface.h | 4 src/egl/drivers/dri2/egl_dri2.c | 24 - src/gallium/drivers/panfrost/pan_context.c | 14 +

Re: [Mesa-dev] [PATCH] panfrost: Jobs must be per context, not per screen

2019-08-29 Thread Boris Brezillon
On Thu, 29 Aug 2019 14:51:52 +0200 Rohan Garg wrote: > Jobs _must_ only be shared across the same context, having > the last_job tracked in a screen causes use-after-free issues > and memory corruptions. You should probably also mention that transient-pool and bo-cache related fields should be p

Re: [Mesa-dev] [PATCH] panfrost: Remove unused variable from panfrost_drm_submit_vs_fs_job

2019-08-29 Thread Boris Brezillon
On Thu, 29 Aug 2019 14:53:10 +0200 Rohan Garg wrote: > is_scanout is not used anywhere and can be inferred within > panfrost_drm_submit_vs_fs_job if required. Signed-off-by tag is missing. Looks good otherwise. Reviewed-by: Boris Brezillon > --- > src/gallium/drivers/panfro

Re: [Mesa-dev] [PATCH RFC 1/2] dri: Let drivers reset the damage region

2019-08-29 Thread Boris Brezillon
On Thu, 29 Aug 2019 13:54:15 +0200 Boris Brezillon wrote: > dri2_set_damage_region() must call st_validate_state(UPDATE_FRAMEBUFFER) > to make sure the BACK_LEFT attachment is up-to-date. > Problem is, dri2_swap_buffers_xxx() functions are actually targeting > the old backbuffer wh

Re: [Mesa-dev] [PATCH] panfrost: Remove unused variable from panfrost_drm_submit_vs_fs_job

2019-08-29 Thread Boris Brezillon
On Thu, 29 Aug 2019 15:31:31 +0200 Rohan Garg wrote: > On jueves, 29 de agosto de 2019 15:07:08 (CEST) Boris Brezillon wrote: > > On Thu, 29 Aug 2019 14:53:10 +0200 > > > > Rohan Garg wrote: > > > is_scanout is not used anywhere and can be inferred within >

[Mesa-dev] [PATCH 1/4] panfrost: Add transient BOs to job batches

2019-08-30 Thread Boris Brezillon
ol is never shrinked, and even if it was, we still control the lifetime of the job, so there's no reason for this BO to be freed before the GPU is done executing the batch. But it still make sense to add the BO for debugging purpose. Signed-off-by: Boris Brezillon --- src/gallium/driver

[Mesa-dev] [PATCH 4/4] panfrost: Stop passing a ctx to functions being passed a batch

2019-08-30 Thread Boris Brezillon
The context can be retrieved from batch->ctx. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_context.c | 6 +++--- src/gallium/drivers/panfrost/pan_drm.c | 2 +- src/gallium/drivers/panfrost/pan_job.c | 24 ++ src/gallium/drivers/panfr

[Mesa-dev] [PATCH 0/4] panfrost: Random cleanups

2019-08-30 Thread Boris Brezillon
about shrinking the number of args passed to some functions when information can be retrieved from other args. Regards, Boris Boris Brezillon (4): panfrost: Add transient BOs to job batches panfrost: s/job/batch/ panfrost: Pass a batch to panfrost_drm_submit_vs_fs_batch() panfrost: Stop p

[Mesa-dev] [PATCH 3/4] panfrost: Pass a batch to panfrost_drm_submit_vs_fs_batch()

2019-08-30 Thread Boris Brezillon
Given the function name it makes more sense to pass it a job batch directly. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_drm.c| 13 ++--- src/gallium/drivers/panfrost/pan_job.c| 2 +- src/gallium/drivers/panfrost/pan_screen.h | 2 +- 3 files changed, 8

[Mesa-dev] [PATCH 2/4] panfrost: s/job/batch/

2019-08-30 Thread Boris Brezillon
What we currently call a job is actually a batch containing several jobs all attached to a rendering operation targeting a specific FBO. Let's rename structs, functions, variables and fields to reflect this fact. Suggested-by: Alyssa Rosenzweig Signed-off-by: Boris Brezillon --- src/ga

Re: [Mesa-dev] [PATCH RFC 2/2] dri: Pass a __DRIcontext to ->set_damage_region()

2019-08-30 Thread Boris Brezillon
On Fri, 30 Aug 2019 18:43:59 +0200 Michel Dänzer wrote: > On 2019-08-29 1:54 p.m., Boris Brezillon wrote: > > So we can call st_validate_state() from dri2_set_damage_region() in > > order to update the BACK_LEFT attachement before using it. If we don't > > do th

Re: [Mesa-dev] [PATCH RFC 2/2] dri: Pass a __DRIcontext to ->set_damage_region()

2019-08-30 Thread Boris Brezillon
On Fri, 30 Aug 2019 18:56:52 +0200 Michel Dänzer wrote: > On 2019-08-30 6:52 p.m., Boris Brezillon wrote: > > On Fri, 30 Aug 2019 18:43:59 +0200 > > Michel Dänzer wrote: > > > >>> diff --git a/include/GL/internal/dri_interface.h > >>> b/in

Re: [Mesa-dev] [PATCH v2 1/2] panfrost: Jobs must be per context, not per screen

2019-08-30 Thread Boris Brezillon
On Fri, 30 Aug 2019 18:00:12 +0200 Rohan Garg wrote: > Jobs _must_ only be shared across the same context, having > the last_job tracked in a screen causes use-after-free issues > and memory corruptions. > > Signed-off-by: Rohan Garg Reviewed-by: Boris Brezillon > --- >

Re: [Mesa-dev] [PATCH v2 2/2] panfrost: protect access to shared bo cache and transient pool

2019-08-30 Thread Boris Brezillon
the screen (loaning them out to the batch). Dynamic array > * container of panfrost_bo */ > @@ -113,6 +115,8 @@ struct panfrost_screen { > /* Set of free transient BOs */ > BITSET_DECLARE(free_transient, MAX_TRANSIENT_SLABS); > > + pthread_

Re: [Mesa-dev] [PATCH 2/4] panfrost: s/job/batch/

2019-08-30 Thread Boris Brezillon
On Fri, 30 Aug 2019 10:35:57 -0700 Alyssa Rosenzweig wrote: > > +struct panfrost_job_batch *batch = > > panfrost_job_get_batch_for_fbo(ctx); > > This is verbose. Could we do across this patch: > > s/panfrost_job_batch/panfrost_batch/g > s/panfrost_job_get_batch_for_fbo/panfrost_get_b

[Mesa-dev] [PATCH v2 3/3] panfrost: Stop passing a ctx to functions being passed a batch

2019-08-31 Thread Boris Brezillon
The context can be retrieved from batch->ctx. Signed-off-by: Boris Brezillon --- Changes in v2: * s/panfrost_job_get_batch_for_fbo/panfrost_get_batch_for_fbo/ * s/panfrost_job_batch/panfrost_batch/g --- src/gallium/drivers/panfrost/pan_context.c | 6 +++--- src/gallium/drivers/panfr

[Mesa-dev] [PATCH v2 2/3] panfrost: Pass a batch to panfrost_drm_submit_vs_fs_batch()

2019-08-31 Thread Boris Brezillon
Given the function name it makes more sense to pass it a job batch directly. Signed-off-by: Boris Brezillon --- Changes in v2: * s/panfrost_job_get_batch_for_fbo/panfrost_get_batch_for_fbo/ * s/panfrost_job_batch/panfrost_batch/g --- src/gallium/drivers/panfrost/pan_drm.c| 13

[Mesa-dev] [PATCH v2 1/3] panfrost: s/job/batch/

2019-08-31 Thread Boris Brezillon
What we currently call a job is actually a batch containing several jobs all attached to a rendering operation targeting a specific FBO. Let's rename structs, functions, variables and fields to reflect this fact. Suggested-by: Alyssa Rosenzweig Signed-off-by: Boris Brezillon --- Changes

[Mesa-dev] [PATCH] panfrost: Make transient allocation rely on the BO cache

2019-08-31 Thread Boris Brezillon
Right now, the transient memory allocator implements its own BO caching mechanism, which is not really needed since we already have a generic BO cache. Let's simplify things a bit. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_allocate.c | 80 -

Re: [Mesa-dev] [PATCH v2 3/3] panfrost: Stop passing a ctx to functions being passed a batch

2019-08-31 Thread Boris Brezillon
On Sat, 31 Aug 2019 17:12:33 +0100 Daniel Stone wrote: > Hi Boris, > > On Sat, 31 Aug 2019 at 08:53, Boris Brezillon > wrote: > > @@ -123,8 +123,7 @@ struct panfrost_batch * > > panfrost_job_create_batch(struct panfrost_context *ctx); > > > > void

Re: [Mesa-dev] [PATCH] panfrost: Make transient allocation rely on the BO cache

2019-08-31 Thread Boris Brezillon
On Sat, 31 Aug 2019 17:10:47 +0100 Daniel Stone wrote: > Hi Boris, > > On Sat, 31 Aug 2019 at 11:47, Boris Brezillon > wrote: > > Right now, the transient memory allocator implements its own BO caching > > mechanism, which is not really needed since we already hav

Re: [Mesa-dev] [PATCH] panfrost: Make transient allocation rely on the BO cache

2019-08-31 Thread Boris Brezillon
On Sat, 31 Aug 2019 19:21:04 +0200 Boris Brezillon wrote: > On Sat, 31 Aug 2019 17:10:47 +0100 > Daniel Stone wrote: > > > Hi Boris, > > > > On Sat, 31 Aug 2019 at 11:47, Boris Brezillon > > wrote: > > > Right now, the transient memo

Re: [Mesa-dev] [PATCH v2 2/2] panfrost: protect access to shared bo cache and transient pool

2019-08-31 Thread Boris Brezillon
On Sat, 31 Aug 2019 17:06:30 +0100 Daniel Stone wrote: > Hi Rohan, > > On Fri, 30 Aug 2019 at 17:00, Rohan Garg wrote: > > Both the BO cache and the transient pool are shared across > > context's. Protect access to these with mutexes. > > These fixes seem right to me, and (minus the issues B

[Mesa-dev] [PATCH v3 00/25] panfrost: Rework the batch pipelining logic

2019-09-05 Thread Boris Brezillon
implementation. Regards, Boris Boris Brezillon (25): panfrost: s/job/batch/ panfrost: Pass a batch to panfrost_drm_submit_vs_fs_batch() panfrost: Stop passing a ctx to functions being passed a batch panfrost: Make transient allocation rely on the BO cache panfrost: Convert ctx->{scratch

[Mesa-dev] [PATCH v3 01/25] panfrost: s/job/batch/

2019-09-05 Thread Boris Brezillon
What we currently call a job is actually a batch containing several jobs all attached to a rendering operation targeting a specific FBO. Let's rename structs, functions, variables and fields to reflect this fact. Suggested-by: Alyssa Rosenzweig Signed-off-by: Boris Brezillon --- Changes

[Mesa-dev] [PATCH v3 02/25] panfrost: Pass a batch to panfrost_drm_submit_vs_fs_batch()

2019-09-05 Thread Boris Brezillon
Given the function name it makes more sense to pass it a job batch directly. Signed-off-by: Boris Brezillon Alyssa Rosenzweig Reviewed-by: Daniel Stone --- Changes in v3: * Collect R-bs Changes in v2: * s/panfrost_job_get_batch_for_fbo/panfrost_get_batch_for_fbo/ * s/panfrost_job_batch

[Mesa-dev] [PATCH v3 03/25] panfrost: Stop passing a ctx to functions being passed a batch

2019-09-05 Thread Boris Brezillon
The context can be retrieved from batch->ctx. Signed-off-by: Boris Brezillon Alyssa Rosenzweig Reviewed-by: Daniel Stone --- Changes in v3: * Collect R-bs Changes in v2: * s/panfrost_job_get_batch_for_fbo/panfrost_get_batch_for_fbo/ * s/panfrost_job_batch/panfrost_batch/g --- src/gall

[Mesa-dev] [PATCH v3 11/25] panfrost: Use a pipe_framebuffer_state as the batch key

2019-09-05 Thread Boris Brezillon
This way we have all the fb_state information directly attached to a batch and can pass only the batch to functions emitting CMDs, which is needed if we want to be able to queue CMDs to a batch that's not currently bound to the context. Signed-off-by: Boris Brezillon --- src/gallium/dr

[Mesa-dev] [PATCH v3 10/25] panfrost: Make sure the BO is 'ready' when picked from the cache

2019-09-05 Thread Boris Brezillon
This is needed if we want to free the panfrost_batch object at submit time in order to not have to GC the batch on the next job submission. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_bo.c | 68 ++- src/gallium/drivers/panfrost/pan_bo.h | 2 + 2

[Mesa-dev] [PATCH v3 05/25] panfrost: Convert ctx->{scratchpad, tiler_heap, tiler_dummy} to plain BOs

2019-09-05 Thread Boris Brezillon
ctx->{scratchpad,tiler_heap,tiler_dummy} are allocated using panfrost_drm_allocate_slab() but they never any of the SLAB-based allocation logic. Let's convert those fields to plain BOs. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_contex

[Mesa-dev] [PATCH v3 06/25] panfrost: Get rid of unused panfrost_context fields

2019-09-05 Thread Boris Brezillon
Some fields in panfrost_context are unused (probably leftovers from previous refactor). Let's get rid of them. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_context.h | 4 1 file changed, 4 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_context.h

[Mesa-dev] [PATCH v3 04/25] panfrost: Make transient allocation rely on the BO cache

2019-09-05 Thread Boris Brezillon
Right now, the transient memory allocator implements its own BO caching mechanism, which is not really needed since we already have a generic BO cache. Let's simplify things a bit. Signed-off-by: Boris Brezillon Alyssa Rosenzweig --- Changes in v3: * Collect R-b Changes in v2: * None ---

[Mesa-dev] [PATCH v3 08/25] panfrost: Rename pan_bo_cache.c into pan_bo.c

2019-09-05 Thread Boris Brezillon
So we can move all the BO logic into this file instead of having it spread over pan_resource.c, pan_drm.c and pan_bo_cache.c. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/meson.build | 2 +- src/gallium/drivers/panfrost/{pan_bo_cache.c => pan_bo.c} | 0

[Mesa-dev] [PATCH v3 12/25] panfrost: Get rid of the unused 'flush jobs accessing res' infra

2019-09-05 Thread Boris Brezillon
Will be replaced by something similar but using a BOs as keys instead of resources. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_context.h | 3 -- src/gallium/drivers/panfrost/pan_job.c | 38 -- src/gallium/drivers/panfrost/pan_job.h | 8

[Mesa-dev] [PATCH v3 07/25] panfrost: Get rid of the now unused SLAB allocator

2019-09-05 Thread Boris Brezillon
The last users have been converted to use plain BOs. Let's get rid of this abstraction. We can always consider adding it back if we need it at some point. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_allocate.h | 13 src/gallium/drivers/panfrost/pan_

[Mesa-dev] [PATCH v3 13/25] panfrost: Allow testing if a specific batch is targeting a scanout FB

2019-09-05 Thread Boris Brezillon
Rename panfrost_is_scanout() into panfrost_batch_is_scanout(), pass it a batch instead of a context and move the code to pan_job.c. With this in place, we can now test if a batch is targeting a scanout FB even if this batch is not bound to the context. Signed-off-by: Boris Brezillon --- src

[Mesa-dev] [PATCH v3 09/25] panfrost: Rework the panfrost_bo API

2019-09-05 Thread Boris Brezillon
ted functions are prefixed with panfrost_bo_) * release functions are no longer exposed, existing users are converted to use panfrost_bo_unreference() instead Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_allocate.c | 5 +- src/gallium/drivers/panfrost/pan_allocate.h |

[Mesa-dev] [PATCH v3 24/25] panfrost: Support batch pipelining

2019-09-05 Thread Boris Brezillon
-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_compute.c | 2 +- src/gallium/drivers/panfrost/pan_context.c | 145 +--- src/gallium/drivers/panfrost/pan_job.c | 15 +- src/gallium/drivers/panfrost/pan_resource.c | 26 ++-- 4 files changed, 115 insertions

[Mesa-dev] [PATCH v3 22/25] panfrost: Delay payloads[].offset_start initialization

2019-09-05 Thread Boris Brezillon
panfrost_draw_vbo() Might call the primeconvert/without_prim_restart helpers which will enter the ->draw_vbo() again. Let's delay payloads[].offset_start initialization so we don't initialize them twice. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_context.c

[Mesa-dev] [PATCH v3 15/25] panfrost: Move the batch submission logic to panfrost_batch_submit()

2019-09-05 Thread Boris Brezillon
e it by an unconditional wait at the end of panfrost_batch_submit(). A new pipeline logic will be introduced later on. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_context.c | 145 + src/gallium/drivers/panfrost/pan_context.h | 9 +- src/gallium/driver

[Mesa-dev] [PATCH v3 17/25] panfrost: Pass a batch to functions emitting FB descs

2019-09-05 Thread Boris Brezillon
So we can emit such jobs to a batch that's not currently bound to the context. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_context.c | 36 ++--- src/gallium/drivers/panfrost/pan_context.h | 10 +++--- src/gallium/drivers/panfrost/pan_drm.c

[Mesa-dev] [PATCH v3 19/25] panfrost: Pass a batch to panfrost_set_value_job()

2019-09-05 Thread Boris Brezillon
So we can emit SET_VALUE jobs for a batch that's not currently bound to the context. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_scoreboard.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_scoreboard.c

[Mesa-dev] [PATCH v3 16/25] panfrost: Pass a batch to panfrost_{allocate, upload}_transient()

2019-09-05 Thread Boris Brezillon
ff-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_allocate.c | 10 ++-- src/gallium/drivers/panfrost/pan_allocate.h | 7 +-- src/gallium/drivers/panfrost/pan_compute.c| 10 ++-- src/gallium/drivers/panfrost/pan_context.c| 51 +++ src/gallium/drivers/pan

[Mesa-dev] [PATCH v3 18/25] panfrost: Use ctx->wallpaper_batch in panfrost_blit_wallpaper()

2019-09-05 Thread Boris Brezillon
We'll soon be able to flush a batch that's not currently bound to the context, which means ctx->pipe_framebuffer will not necessarily be the FBO targeted by the wallpaper draw. Let's prepare for this case and use ctx->wallpaper_batch in panfrost_blit_wallpaper(). Signed-of

[Mesa-dev] [PATCH v3 20/25] panfrost: Prepare things to avoid flushes on FB switch

2019-09-05 Thread Boris Brezillon
-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_context.c | 17 + src/gallium/drivers/panfrost/pan_job.h | 3 +++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c in

[Mesa-dev] [PATCH v3 23/25] panfrost: Remove uneeded add_bo() in initialize_surface()

2019-09-05 Thread Boris Brezillon
Should already be added in panfrost_draw_vbo() and panfrost_clear(), no need to add it here too. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_fragment.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_fragment.c b/src/gallium

[Mesa-dev] [PATCH v3 21/25] panfrost: Add new helpers to describe job depencencies on BOs

2019-09-05 Thread Boris Brezillon
backed by BOs, and given we might want to describe dependencies on BOs that are not exposed as resources, we decided to use BOs as keys on our hash tables. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_allocate.c | 2 +- src/gallium/drivers/panfrost/pan_blend_cso.c | 2

[Mesa-dev] [PATCH v3 14/25] panfrost: Move the fence creation in panfrost_flush()

2019-09-05 Thread Boris Brezillon
panfrost_flush() is about to be reworked to flush all pending batches, but we want the fence to block on the last one. Let's move the fence creation logic in panfrost_flush() to prepare for this situation. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/pan_context.c

[Mesa-dev] [PATCH v3 25/25] panfrost/ci: New tests are passing

2019-09-05 Thread Boris Brezillon
All dEQP-GLES2.functional.fbo.render.texsubimage.* tests are now passing. Signed-off-by: Boris Brezillon --- src/gallium/drivers/panfrost/ci/expected-failures.txt | 4 1 file changed, 4 deletions(-) diff --git a/src/gallium/drivers/panfrost/ci/expected-failures.txt b/src/gallium/drivers

Re: [Mesa-dev] [PATCH v3 09/25] panfrost: Rework the panfrost_bo API

2019-09-05 Thread Boris Brezillon
On Thu, 5 Sep 2019 16:31:04 -0400 Alyssa Rosenzweig wrote: > > +static struct panfrost_bo * > > +panfrost_bo_alloc(struct panfrost_screen *screen, size_t size, > > + uint32_t flags) > > +{ > ... > > +ret = drmIoctl(screen->fd, DRM_IOCTL_PANFROST_CREATE_BO, > > &create_

Re: [Mesa-dev] [PATCH v3 10/25] panfrost: Make sure the BO is 'ready' when picked from the cache

2019-09-05 Thread Boris Brezillon
On Thu, 5 Sep 2019 16:43:23 -0400 Alyssa Rosenzweig wrote: > > +bool > > +panfrost_bo_wait(struct panfrost_bo *bo, int64_t timeout_ns) > > +{ > > +struct drm_panfrost_wait_bo req = { > > +.handle = bo->gem_handle, > > + .timeout_ns = timeout_ns, > > +}; >

Re: [Mesa-dev] [PATCH v3 23/25] panfrost: Remove uneeded add_bo() in initialize_surface()

2019-09-05 Thread Boris Brezillon
On Thu, 5 Sep 2019 19:28:04 -0400 Alyssa Rosenzweig wrote: > Ah, ignore my previous comment. Could we squash this into the patch that > added the PAN_SHARED_BO_RW define? Absolutely (I don't know why I did that separately). > > On Thu, Sep 05, 2019 at 09:41:48PM +0200, Bori

Re: [Mesa-dev] [PATCH v3 21/25] panfrost: Add new helpers to describe job depencencies on BOs

2019-09-06 Thread Boris Brezillon
On Thu, 5 Sep 2019 19:26:45 -0400 Alyssa Rosenzweig wrote: > > --- a/src/gallium/drivers/panfrost/pan_fragment.c > > +++ b/src/gallium/drivers/panfrost/pan_fragment.c > > @@ -44,7 +44,7 @@ panfrost_initialize_surface( > > rsrc->slices[level].initialized = true; > > > > assert(

<    1   2   3   4   >