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

Ilia Mirkin imirkin at alum.mit.edu
Fri Nov 21 22:14:19 PST 2014

On Sat, Nov 22, 2014 at 12:57 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> On Sat, Nov 22, 2014 at 12:44 AM, John Ettedgui <john.ettedgui at gmail.com> wrote:
>> On Fri Nov 21 2014 at 7:50:03 PM Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>>> What's the actual problem?
>> If you mean in-game, a blocking black screen, the game wants to display
>> something but is unable to and keeps trying pretty much forever.
> I meant at the API level. i.e. what is the API call sequence leading
> to the problem, what is being returned, and what ought to be getting
> returned.
>>> If there's no begin, then a new query would
>>> remain marked as FRESH.
>> This is not my understanding of the Query on msdn:
>> http://msdn.microsoft.com/en-us/library/windows/desktop/bb147308%28v=vs.85%29.aspx
>> As you can see on the 1st diagram, we have either cases:
>> Signaled State moved to Building State on D3DISSUE_BEGIN and then to Issued
>> State on D3DISSUE_END (this part worked fine before).
>> Then we have Signaled Sated moved to Issued State on D3DISSUE_END, that's
>> the part I believe was not working before this patch.
> These are hidden states, and query9.c does not implement them
> directly. What's the actual API call sequence, and what is being
> wrongly returned?
>> Of course all of that is based on me thinking FRESH is nine's version of
>> Signaled.
> From my read of the code, FRESH is a newly constructed query, ENDED is
> when pipe->end_query was issued. All the state usage is entirely
> contained in query9.c -- take a look at it. However this is purely an
> implementation detail. At the end of the day, some API call is made
> and it's not returning the expected data. It's not clear from the
> commit log as to what you believe the issue is.
>>> Should _GetData 0 out the result in that case
>>> perhaps instead of insta-returning?
>> You are correct that this is the exact reason why I made the change.
>> In my game, GetData kept getting called, and kept returning no data because
>> of the State the Queue was in (in its current implementation).
>> What do you mean by "0 out the result" though?
> memset(pData, 0, dwSize) in GetData if This->state == FRESH.

Oh, I think i see the problem.

In GetData:

    user_assert(This->state != NINE_QUERY_STATE_RUNNING, D3DERR_INVALIDCALL);

should be

  user_assert(This->state != ... || This->state |= FRESH, D3DERR_INVALIDCALL)

This will allow someone to call GetData without first having done an
Issue() but... meh. 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...

And then you'd remove the explicit FRESH handling in GetData since you
can't get there due to the user_assert.


More information about the mesa-dev mailing list