[Mesa-dev] [PATCH 3/4] nine: handle D3DISSUE_END without previous D3DISSUE_BEGIN

Ilia Mirkin imirkin at alum.mit.edu
Fri Nov 21 22:36:29 PST 2014

On Sat, Nov 22, 2014 at 1:28 AM, John Ettedgui <john.ettedgui at gmail.com> wrote:
> On Fri Nov 21 2014 at 10:14:19 PM Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>> Oh, I think i see the problem.
>> In GetData:
>>     user_assert(This->state != NINE_QUERY_STATE_RUNNING,
>> should be
>>   user_assert(This->state != ... || This->state |= FRESH,
>> This will allow someone to call GetData without first having done an
>> Issue() but... meh.
> Not saying your idea is wrong but Issue was called before GetData in my
> case.
> It was just called on D3DISSUE_END, with no call on D3DISSUE_BEGIN.

Right, I figured as much. My point is that doing what I'm proposing
there would allow such usage even though it is illegal based on the
API description.

>> You could alternatively rejigger the state
>> variables, but that seems excessive.
>> Actually.... perhaps it's supposed to actually call ->end_query()
>> unconditionally in ->Issue even though it hasn't called
>> ->begin_query()? That might make even more sense...
> I thought about that as well, though I thought that end_query() would
> require a begin_query() first (though issue does not so maybe...)

It requires a begin_query for some but not all queries.

Perhaps the code should read like

    } else {
        if (This->state != NINE_QUERY_STATE_RUNNING)
            pipe->begin_query(pipe, This->pq);
        pipe->end_query(pipe, This->pq);
        This->state = NINE_QUERY_STATE_ENDED;

This seems like it would also take care of the Ended -> Ended
transition which is supposed to restart the query.

More information about the mesa-dev mailing list