aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/include/resource.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-04-20 17:39:30 +0200
committermarha <marha@users.sourceforge.net>2012-04-20 17:39:30 +0200
commitae228baa2cfe88bd7c7de40d5038ad2cc1ecffa4 (patch)
treeb18ae337e913f36a95f97530f6a792e9366a393c /xorg-server/include/resource.h
parent4207bc7b2972aed9a45756fae8c48957d323fa21 (diff)
parent0e3699334faf92f508b6c187a261548b656b0dd3 (diff)
downloadvcxsrv-ae228baa2cfe88bd7c7de40d5038ad2cc1ecffa4.tar.gz
vcxsrv-ae228baa2cfe88bd7c7de40d5038ad2cc1ecffa4.tar.bz2
vcxsrv-ae228baa2cfe88bd7c7de40d5038ad2cc1ecffa4.zip
Merge remote-tracking branch 'origin/released'
Conflicts: xorg-server/dix/dispatch.c xorg-server/dix/resource.c
Diffstat (limited to 'xorg-server/include/resource.h')
-rw-r--r--xorg-server/include/resource.h58
1 files changed, 57 insertions, 1 deletions
diff --git a/xorg-server/include/resource.h b/xorg-server/include/resource.h
index f2f23768b..224e9bb18 100644
--- a/xorg-server/include/resource.h
+++ b/xorg-server/include/resource.h
@@ -152,12 +152,46 @@ typedef Bool (*FindComplexResType) (pointer /*value */ ,
XID /*id */ ,
pointer /*cdata */ );
+/* Structure for estimating resource memory usage. Memory usage
+ * consists of space allocated for the resource itself and of
+ * references to other resources. Currently the most important use for
+ * this structure is to estimate pixmap usage of different resources
+ * more accurately. */
+typedef struct {
+ /* Size of resource itself. Zero if not implemented. */
+ unsigned long resourceSize;
+ /* Size attributed to pixmap references from the resource. */
+ unsigned long pixmapRefSize;
+ /* Number of references to this resource; typically 1 */
+ unsigned long refCnt;
+} ResourceSizeRec, *ResourceSizePtr;
+
+typedef void (*SizeType)(pointer /*value*/,
+ XID /*id*/,
+ ResourceSizePtr /*size*/);
+
extern _X_EXPORT RESTYPE CreateNewResourceType(DeleteType /*deleteFunc */ ,
const char * /*name */ );
+typedef void (*FindTypeSubResources)(pointer /* value */,
+ FindAllRes /* func */,
+ pointer /* cdata */);
+
extern _X_EXPORT void SetResourceTypeErrorValue(RESTYPE /*type */ ,
int /*errorValue */ );
+extern _X_EXPORT SizeType GetResourceTypeSizeFunc(
+ RESTYPE /*type*/);
+
+extern _X_EXPORT void SetResourceTypeFindSubResFunc(
+ RESTYPE /*type*/, FindTypeSubResources /*findFunc*/);
+
+extern _X_EXPORT void SetResourceTypeSizeFunc(
+ RESTYPE /*type*/, SizeType /*sizeFunc*/);
+
+extern _X_EXPORT void SetResourceTypeErrorValue(
+ RESTYPE /*type*/, int /*errorValue*/);
+
extern _X_EXPORT RESTYPE CreateNewResourceClass(void);
extern _X_EXPORT Bool InitClientResources(ClientPtr /*client */ );
@@ -193,6 +227,15 @@ extern _X_EXPORT void FindAllClientResources(ClientPtr /*client */ ,
FindAllRes /*func */ ,
pointer /*cdata */ );
+/** @brief Iterate through all subresources of a resource.
+
+ @note The XID argument provided to the FindAllRes function
+ may be 0 for subresources that don't have an XID */
+extern _X_EXPORT void FindSubResources(pointer /*resource*/,
+ RESTYPE /*type*/,
+ FindAllRes /*func*/,
+ pointer /*cdata*/);
+
extern _X_EXPORT void FreeClientNeverRetainResources(ClientPtr /*client */ );
extern _X_EXPORT void FreeClientResources(ClientPtr /*client */ );
@@ -231,4 +274,17 @@ extern _X_EXPORT unsigned int GetXIDList(ClientPtr /*client */ ,
extern _X_EXPORT RESTYPE lastResourceType;
extern _X_EXPORT RESTYPE TypeMask;
-#endif /* RESOURCE_H */
+/** @brief A hashing function to be used for hashing resource IDs
+
+ @param id The resource ID to hash
+ @param numBits The number of bits in the resulting hash. Must be >=0.
+
+ @note This function is really only for handling
+ INITHASHSIZE..MAXHASHSIZE bit hashes, but will handle any number
+ of bits by either masking numBits lower bits of the ID or by
+ providing at most MAXHASHSIZE hashes.
+*/
+extern _X_EXPORT int HashResourceID(XID id,
+ int numBits);
+
+#endif /* RESOURCE_H */