summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2012-10-05 17:01:46 -0400
committerAdam Jackson <ajax@redhat.com>2012-10-05 17:01:46 -0400
commit9c32f7f3f15db34e02b38d406af686cde8f211f5 (patch)
tree922564878e845df7304f366dbe24cb7890771261
parent7f9d78d8ffb1a312f9b3d69c05323f601571e162 (diff)
dix: Tune dixLookupResourceByType for successricer-tuning
Same idea as 8f9bdfd293ad8e45755efe8d764b4dcc2a724f51. If the supplied type is bogus (and it never is) then the resource lookup is destined to fail anyway, so just move the check into the failure path. before after Operation --------- ------------------ ----------------- 1081812.1 1077437.7 ( 1.00) PutImage 10x10 square 1807766.4 1843752.2 ( 1.02) ShmPutImage 10x10 square 2807919.7 2969501.4 ( 1.06) Change graphics context Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r--dix/resource.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/dix/resource.c b/dix/resource.c
index 2aafa343c..3fd488ef8 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -1188,8 +1188,6 @@ dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype,
ResourcePtr res = NULL;
*result = NULL;
- if ((rtype & TypeMask) > lastResourceType)
- return BadImplementation;
if ((cid < MAXCLIENTS) && clientTable[cid].buckets) {
res = clientTable[cid].resources[HashResourceID(id, clientTable[cid].hashsize)];
@@ -1198,8 +1196,11 @@ dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype,
if (res->id == id && res->type == rtype)
break;
}
- if (!res)
+ if (!res) {
+ if ((rtype & TypeMask) > lastResourceType)
+ return BadImplementation;
return resourceTypes[rtype & TypeMask].errorValue;
+ }
if (client) {
client->errorValue = id;