[Mesa-dev] [PATCH 07/10] i965: Unify query object BO reallocation code.

Eric Anholt eric at anholt.net
Thu Feb 28 09:42:25 PST 2013


Kenneth Graunke <kenneth at whitecape.org> writes:

> If we haven't allocated a BO yet, we need to do that.  Or, if there
> isn't enough room to write another pair of values, we need to gather up
> the existing results and start a new one.  This is simple enough.
>
> However, the old code was awkwardly split into two blocks, with a
> write_depth_count() placed in the middle.  The new depth count isn't
> relevant to gathering the old BO's data, so that can go after the
> reallocation is done.  With the two blocks adjacent, we can merge them.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_queryobj.c | 21 ++++++++++-----------
>  1 file changed, 10 insertions(+), 11 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c
> index 9a366c3..064c8eb 100644
> --- a/src/mesa/drivers/dri/i965/brw_queryobj.c
> +++ b/src/mesa/drivers/dri/i965/brw_queryobj.c
> @@ -532,10 +532,19 @@ brw_emit_query_begin(struct brw_context *brw)
>      */
>     if (brw->query.bo == NULL ||
>         query->last_index * 2 + 1 >= 4096 / sizeof(uint64_t)) {
> +
> +      if (query->bo != NULL) {
> +         /* The old query BO did not have enough space, so we allocated a new
> +          * one.  Gather the results so far (adding up the differences) and
> +          * release the old BO.
> +          */
> +	 brw_queryobj_get_results(ctx, query);

Take this opportunity to nuke an indentation tab? :)

Other than that, reviewed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130228/5d1f618f/attachment.pgp>


More information about the mesa-dev mailing list