For 1-2, 5-7: Reviewed-by: Marek Olšák <marek.ol...@amd.com>
Marek On Thu, Jan 19, 2017 at 3:05 PM, Philipp Zabel <p.za...@pengutronix.de> wrote: > Add resource_changed to the ddebug, rbug, and trace wrappers. Since it > is optional, there is no need to add it to noop. > > Signed-off-by: Philipp Zabel <p.za...@pengutronix.de> > Suggested-by: Nicolai Hähnle <nhaeh...@gmail.com> > --- > Changes since v4: > - Use SCR_INIT to initialize the resource_changed wrapper only if > resource_changed is implemented by the wrapped pipe_screen, add > SCR_INIT macros to the rbug and trace wrappers. > - Fix rbug_screen_resource_changed return value. > --- > src/gallium/drivers/ddebug/dd_screen.c | 10 ++++++++++ > src/gallium/drivers/rbug/rbug_screen.c | 14 ++++++++++++++ > src/gallium/drivers/trace/tr_screen.c | 23 +++++++++++++++++++++++ > 3 files changed, 47 insertions(+) > > diff --git a/src/gallium/drivers/ddebug/dd_screen.c > b/src/gallium/drivers/ddebug/dd_screen.c > index a0c0dd0..58e496a 100644 > --- a/src/gallium/drivers/ddebug/dd_screen.c > +++ b/src/gallium/drivers/ddebug/dd_screen.c > @@ -227,6 +227,15 @@ dd_screen_resource_from_user_memory(struct pipe_screen > *_screen, > } > > static void > +dd_screen_resource_changed(struct pipe_screen *_screen, > + struct pipe_resource *res) > +{ > + struct pipe_screen *screen = dd_screen(_screen)->screen; > + > + screen->resource_changed(screen, res); > +} > + > +static void > dd_screen_resource_destroy(struct pipe_screen *_screen, > struct pipe_resource *res) > { > @@ -385,6 +394,7 @@ ddebug_screen_create(struct pipe_screen *screen) > dscreen->base.resource_from_handle = dd_screen_resource_from_handle; > SCR_INIT(resource_from_user_memory); > dscreen->base.resource_get_handle = dd_screen_resource_get_handle; > + SCR_INIT(resource_changed); > dscreen->base.resource_destroy = dd_screen_resource_destroy; > SCR_INIT(flush_frontbuffer); > SCR_INIT(fence_reference); > diff --git a/src/gallium/drivers/rbug/rbug_screen.c > b/src/gallium/drivers/rbug/rbug_screen.c > index 3742c10..8fbbe73 100644 > --- a/src/gallium/drivers/rbug/rbug_screen.c > +++ b/src/gallium/drivers/rbug/rbug_screen.c > @@ -191,7 +191,17 @@ rbug_screen_resource_get_handle(struct pipe_screen > *_screen, > resource, handle, usage); > } > > +static void > +rbug_screen_resource_changed(struct pipe_screen *_screen, > + struct pipe_resource *_resource) > +{ > + struct rbug_screen *rb_screen = rbug_screen(_screen); > + struct rbug_resource *rb_resource = rbug_resource(_resource); > + struct pipe_screen *screen = rb_screen->screen; > + struct pipe_resource *resource = rb_resource->resource; > > + screen->resource_changed(screen, resource); > +} > > static void > rbug_screen_resource_destroy(struct pipe_screen *screen, > @@ -267,6 +277,9 @@ rbug_screen_create(struct pipe_screen *screen) > make_empty_list(&rb_screen->surfaces); > make_empty_list(&rb_screen->transfers); > > +#define SCR_INIT(_member) \ > + rb_screen->base._member = screen->_member ? rbug_screen_##_member : NULL > + > rb_screen->base.destroy = rbug_screen_destroy; > rb_screen->base.get_name = rbug_screen_get_name; > rb_screen->base.get_vendor = rbug_screen_get_vendor; > @@ -279,6 +292,7 @@ rbug_screen_create(struct pipe_screen *screen) > rb_screen->base.resource_create = rbug_screen_resource_create; > rb_screen->base.resource_from_handle = rbug_screen_resource_from_handle; > rb_screen->base.resource_get_handle = rbug_screen_resource_get_handle; > + SCR_INIT(resource_changed); > rb_screen->base.resource_destroy = rbug_screen_resource_destroy; > rb_screen->base.flush_frontbuffer = rbug_screen_flush_frontbuffer; > rb_screen->base.fence_reference = rbug_screen_fence_reference; > diff --git a/src/gallium/drivers/trace/tr_screen.c > b/src/gallium/drivers/trace/tr_screen.c > index 493725c..aaf2e26 100644 > --- a/src/gallium/drivers/trace/tr_screen.c > +++ b/src/gallium/drivers/trace/tr_screen.c > @@ -350,7 +350,26 @@ trace_screen_resource_get_handle(struct pipe_screen > *_screen, > resource, handle, usage); > } > > +static void > +trace_screen_resource_changed(struct pipe_screen *_screen, > + struct pipe_resource *_resource) > +{ > + struct trace_screen *tr_scr = trace_screen(_screen); > + struct trace_resource *tr_res = trace_resource(_resource); > + struct pipe_screen *screen = tr_scr->screen; > + struct pipe_resource *resource = tr_res->resource; > + > + assert(resource->screen == screen); > > + trace_dump_call_begin("pipe_screen", "resource_changed"); > + > + trace_dump_arg(ptr, screen); > + trace_dump_arg(ptr, resource); > + > + screen->resource_changed(screen, resource); > + > + trace_dump_call_end(); > +} > > static void > trace_screen_resource_destroy(struct pipe_screen *_screen, > @@ -499,6 +518,9 @@ trace_screen_create(struct pipe_screen *screen) > if (!tr_scr) > goto error2; > > +#define SCR_INIT(_member) \ > + tr_scr->base._member = screen->_member ? trace_screen_##_member : NULL > + > tr_scr->base.destroy = trace_screen_destroy; > tr_scr->base.get_name = trace_screen_get_name; > tr_scr->base.get_vendor = trace_screen_get_vendor; > @@ -513,6 +535,7 @@ trace_screen_create(struct pipe_screen *screen) > tr_scr->base.resource_create = trace_screen_resource_create; > tr_scr->base.resource_from_handle = trace_screen_resource_from_handle; > tr_scr->base.resource_get_handle = trace_screen_resource_get_handle; > + SCR_INIT(resource_changed); > tr_scr->base.resource_destroy = trace_screen_resource_destroy; > tr_scr->base.fence_reference = trace_screen_fence_reference; > tr_scr->base.fence_finish = trace_screen_fence_finish; > -- > 2.1.4 > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev