summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Davy <axel.davy@ens.fr>2014-11-24 22:40:04 +0100
committerAxel Davy <axel.davy@ens.fr>2014-12-03 16:39:23 +0100
commit3e48791aea6cb1e21c951360e8d2cbbb27add251 (patch)
tree0ad4213811131e1e7bbd3cd4f137bd54ab5a03c4
parent79f9a106b90bab7ff305b5f92cb8501d66c497ea (diff)
st/nine: Queries: remove dummy queries
Applications are supposed to call CreateQuery with a NULL ppQuery to know if the query is supported. We supported that. However when ppQuery was not NULL, we were accepting to create the query and were creating a dummy query even when the query is not supported. Wine has different behaviour. This patch drops the dummy queries support and matches wine behaviour. Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: David Heidelberg <david@ixit.cz> Signed-off-by: Axel Davy <axel.davy@ens.fr>
-rw-r--r--src/gallium/state_trackers/nine/device9.c5
-rw-r--r--src/gallium/state_trackers/nine/query9.c101
2 files changed, 12 insertions, 94 deletions
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index d48f47d5bd4..c16f7284799 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -3359,8 +3359,9 @@ NineDevice9_CreateQuery( struct NineDevice9 *This,
DBG("This=%p Type=%d ppQuery=%p\n", This, Type, ppQuery);
- if (!ppQuery)
- return nine_is_query_supported(Type);
+ hr = nine_is_query_supported(Type);
+ if (!ppQuery || hr != D3D_OK)
+ return hr;
hr = NineQuery9_new(This, &query, Type);
if (FAILED(hr))
diff --git a/src/gallium/state_trackers/nine/query9.c b/src/gallium/state_trackers/nine/query9.c
index 39c44352700..0cb3d2eac82 100644
--- a/src/gallium/state_trackers/nine/query9.c
+++ b/src/gallium/state_trackers/nine/query9.c
@@ -54,29 +54,18 @@ d3dquerytype_to_pipe_query(D3DQUERYTYPE type)
}
}
-#define GET_DATA_SIZE_CASE9(a) case D3DQUERYTYPE_##a: return sizeof(D3DDEVINFO_D3D9##a)
-#define GET_DATA_SIZE_CASE1(a) case D3DQUERYTYPE_##a: return sizeof(D3DDEVINFO_##a)
#define GET_DATA_SIZE_CASE2(a, b) case D3DQUERYTYPE_##a: return sizeof(D3DDEVINFO_##b)
#define GET_DATA_SIZE_CASET(a, b) case D3DQUERYTYPE_##a: return sizeof(b)
static INLINE DWORD
nine_query_result_size(D3DQUERYTYPE type)
{
switch (type) {
- GET_DATA_SIZE_CASE1(VCACHE);
- GET_DATA_SIZE_CASE1(RESOURCEMANAGER);
GET_DATA_SIZE_CASE2(VERTEXSTATS, D3DVERTEXSTATS);
GET_DATA_SIZE_CASET(EVENT, BOOL);
GET_DATA_SIZE_CASET(OCCLUSION, DWORD);
GET_DATA_SIZE_CASET(TIMESTAMP, UINT64);
GET_DATA_SIZE_CASET(TIMESTAMPDISJOINT, BOOL);
GET_DATA_SIZE_CASET(TIMESTAMPFREQ, UINT64);
- GET_DATA_SIZE_CASE9(PIPELINETIMINGS);
- GET_DATA_SIZE_CASE9(INTERFACETIMINGS);
- GET_DATA_SIZE_CASE2(VERTEXTIMINGS, D3D9STAGETIMINGS);
- GET_DATA_SIZE_CASE2(PIXELTIMINGS, D3D9STAGETIMINGS);
- GET_DATA_SIZE_CASE9(BANDWIDTHTIMINGS);
- GET_DATA_SIZE_CASE9(CACHEUTILIZATION);
- /* GET_DATA_SIZE_CASE1(MEMORYPRESSURE); Win7 only */
default:
assert(0);
return 0;
@@ -123,8 +112,7 @@ NineQuery9_ctor( struct NineQuery9 *This,
if (!This->pq)
return E_OUTOFMEMORY;
} else {
- DBG("Returning dummy NineQuery9 for %s.\n",
- nine_D3DQUERYTYPE_to_str(Type));
+ assert(0); /* we have checked this case before */
}
This->instant =
@@ -178,11 +166,6 @@ NineQuery9_Issue( struct NineQuery9 *This,
(dwIssueFlags == 0) ||
(dwIssueFlags == D3DISSUE_END), D3DERR_INVALIDCALL);
- if (!This->pq) {
- DBG("Issued dummy query.\n");
- return D3D_OK;
- }
-
if (dwIssueFlags == D3DISSUE_BEGIN) {
if (This->state == NINE_QUERY_STATE_RUNNING) {
pipe->end_query(pipe, This->pq);
@@ -201,13 +184,6 @@ NineQuery9_Issue( struct NineQuery9 *This,
union nine_query_result
{
D3DDEVINFO_D3DVERTEXSTATS vertexstats;
- D3DDEVINFO_D3D9BANDWIDTHTIMINGS bandwidth;
- D3DDEVINFO_VCACHE vcache;
- D3DDEVINFO_RESOURCEMANAGER rm;
- D3DDEVINFO_D3D9PIPELINETIMINGS pipe;
- D3DDEVINFO_D3D9STAGETIMINGS stage;
- D3DDEVINFO_D3D9INTERFACETIMINGS iface;
- D3DDEVINFO_D3D9CACHEUTILIZATION cacheu;
DWORD dw;
BOOL b;
UINT64 u64;
@@ -220,7 +196,7 @@ NineQuery9_GetData( struct NineQuery9 *This,
DWORD dwGetDataFlags )
{
struct pipe_context *pipe = This->base.device->pipe;
- boolean ok = !This->pq;
+ boolean ok;
unsigned i;
union pipe_query_result presult;
union nine_query_result nresult;
@@ -233,25 +209,19 @@ NineQuery9_GetData( struct NineQuery9 *This,
user_assert(dwGetDataFlags == 0 ||
dwGetDataFlags == D3DGETDATA_FLUSH, D3DERR_INVALIDCALL);
- if (!This->pq) {
- DBG("No pipe query available.\n");
- if (!dwSize)
- return S_OK;
- }
if (This->state == NINE_QUERY_STATE_FRESH)
return S_OK;
+ ok = pipe->get_query_result(pipe, This->pq, FALSE, &presult);
if (!ok) {
- ok = pipe->get_query_result(pipe, This->pq, FALSE, &presult);
- if (!ok) {
- if (dwGetDataFlags) {
- if (This->state != NINE_QUERY_STATE_FLUSHED)
- pipe->flush(pipe, NULL, 0);
- This->state = NINE_QUERY_STATE_FLUSHED;
- }
- return S_FALSE;
+ if (dwGetDataFlags) {
+ if (This->state != NINE_QUERY_STATE_FLUSHED)
+ pipe->flush(pipe, NULL, 0);
+ This->state = NINE_QUERY_STATE_FLUSHED;
}
+ return S_FALSE;
}
+
if (!dwSize)
return S_OK;
@@ -277,59 +247,6 @@ NineQuery9_GetData( struct NineQuery9 *This,
nresult.vertexstats.NumExtraClippingTriangles =
presult.pipeline_statistics.c_primitives;
break;
- /* Thse might be doable with driver-specific queries; dummy for now. */
- case D3DQUERYTYPE_BANDWIDTHTIMINGS:
- nresult.bandwidth.MaxBandwidthUtilized = 1.0f;
- nresult.bandwidth.FrontEndUploadMemoryUtilizedPercent = 0.5f;
- nresult.bandwidth.VertexRateUtilizedPercent = 0.75f;
- nresult.bandwidth.TriangleSetupRateUtilizedPercent = 0.75f;
- nresult.bandwidth.FillRateUtilizedPercent = 1.0f;
- break;
- case D3DQUERYTYPE_VERTEXTIMINGS:
- case D3DQUERYTYPE_PIXELTIMINGS:
- nresult.stage.MemoryProcessingPercent = 0.5f;
- nresult.stage.ComputationProcessingPercent = 0.5f;
- break;
- case D3DQUERYTYPE_VCACHE:
- /* Are we supposed to fill this in ? */
- nresult.vcache.Pattern = MAKEFOURCC('C', 'A', 'C', 'H');
- nresult.vcache.OptMethod = 1;
- nresult.vcache.CacheSize = 32 << 10;
- nresult.vcache.MagicNumber = 0xdeadcafe;
- break;
- case D3DQUERYTYPE_RESOURCEMANAGER:
- /* We could record some of these in the device ... */
- for (i = 0; i < D3DRTYPECOUNT; ++i) {
- nresult.rm.stats[i].bThrashing = FALSE;
- nresult.rm.stats[i].ApproxBytesDownloaded = 0;
- nresult.rm.stats[i].NumEvicts = 0;
- nresult.rm.stats[i].NumVidCreates = 0;
- nresult.rm.stats[i].LastPri = 0;
- nresult.rm.stats[i].NumUsed = 1;
- nresult.rm.stats[i].NumUsedInVidMem = 1;
- nresult.rm.stats[i].WorkingSet = 1;
- nresult.rm.stats[i].WorkingSetBytes = 1 << 20;
- nresult.rm.stats[i].TotalManaged = 1;
- nresult.rm.stats[i].TotalBytes = 1 << 20;
- }
- break;
- case D3DQUERYTYPE_PIPELINETIMINGS:
- nresult.pipe.VertexProcessingTimePercent = 0.4f;
- nresult.pipe.PixelProcessingTimePercent = 0.4f;
- nresult.pipe.OtherGPUProcessingTimePercent = 0.15f;
- nresult.pipe.GPUIdleTimePercent = 0.05f;
- break;
- case D3DQUERYTYPE_INTERFACETIMINGS:
- nresult.iface.WaitingForGPUToUseApplicationResourceTimePercent = 0.0f;
- nresult.iface.WaitingForGPUToAcceptMoreCommandsTimePercent = 0.0f;
- nresult.iface.WaitingForGPUToStayWithinLatencyTimePercent = 0.0f;
- nresult.iface.WaitingForGPUExclusiveResourceTimePercent = 0.0f;
- nresult.iface.WaitingForGPUOtherTimePercent = 0.0f;
- break;
- case D3DQUERYTYPE_CACHEUTILIZATION:
- nresult.cacheu.TextureCacheHitRate = 0.9f;
- nresult.cacheu.PostTransformVertexCacheHitRate = 0.3f;
- break;
default:
assert(0);
break;