3.1.1.1.1 Bitmap Caches

Bitmap caches are used by the client and server to store graphic bitmaps. Each bitmap cache holds bitmaps of a specified size in pixels (known as the "tile size"). If a bitmap does not fit into a single cache entry, the server uses a tiling algorithm to divide the bitmap into tiles that will fit into the cache entries so that they can be stored separately into the cache.

The Cache Bitmap - Revision 1 (section 2.2.2.2.1.2.2), Cache Bitmap - Revision 2 (section 2.2.2.2.1.2.3), and Cache Bitmap - Revision 3 (section 2.2.2.2.1.2.8) Secondary Drawing Orders are used to update the contents of the client-side bitmap cache.

There are two versions of bitmap caches. Revision 1 bitmap caches are used in association with the Cache Bitmap – Revision 1 Secondary Drawing Order and only support memory-based caching. Revision 2 bitmap caches are used in association with the both the Cache Bitmap – Revision 2 and Cache Bitmap – Revision 3 Secondary Drawing Orders and support persistent disk caching (in addition to memory caching) by associating a 64-bit key (derived from a cryptographic hash of the bitmap contents) with each bitmap. These 64-bit keys SHOULD be sent to the server on subsequent connections (using the Persistent Key List PDU specified in [MS-RDPBCGR] section 2.2.1.17.1) to initialize the persistent disk cache. The server maintains its own cache of bitmap keys that it has already sent to the client (section 3.3.1.1).

When using the Revision 2 bitmap caches, the client is able to request that the server delays forcing it to cache a bitmap to disk until the bitmap has been used more than once. This is implemented by requesting that the server maintain a Bitmap Cache Wait List (see section 3.3.1.3). Once a particular bitmap has been encountered by the server more than once, it MUST instruct the client to cache it (see section 2.2.2.2.1.2.3).

Support for the Revision 2 bitmap caches is advertised by the server by using the Bitmap Cache Host Support Capability Set ([MS-RDPBCGR] section 2.2.7.2.1). Client support for the Revision 1 bitmap caches is advertised by using the Revision 1 Bitmap Cache Capability Set ([MS-RDPBCGR] section 2.2.7.1.4.1) while support for the Revision 2 bitmap caches is advertised by using the Revision 2 Bitmap Cache Capability Set ([MS-RDPBCGR] section 2.2.7.1.4.2).

The Revision 1 bitmap cache defaults to 1500 KB of memory cache for 8 bpp, 3000 KB for 16 bpp, 4500 KB for 24 bpp, and 6000 KB for 32 bpp. The Revision 2 bitmap cache defaults to 10 MB of persistent cache storage for 8 bpp, 20 MB for 16 bpp, 30 MB for 24 bpp, and 40 MB for 32 bpp. The actual layout of the bitmap caches is specified in the Bitmap Cache Capability Sets ([MS-RDPBCGR] section 2.2.7.1.4).

The following table shows the default Revision 1 bitmap cache layout.

 Bitmap cache ID

 Tile size (in pixels)

 Cache entry size

 Number of cache entries

0

16 x 16

256 bytes for 8 bpp

512 bytes for 16 bpp

768 bytes for 24 bpp

1024 bytes for 32 bpp

120

1

32 x 32

1024 bytes for 8 bpp

2048 bytes for 16 bpp

3072 bytes for 24 bpp

4096 bytes for 32 bpp

120

2

64 x 64

4096 bytes for 8 bpp

8192 bytes for 16 bpp

12288 bytes for 24 bpp

16384 bytes for 32 bpp

337

The following table shows the default Revision 2 bitmap cache layout with persistent storage enabled for cache 2.

 Bitmap cache ID

 Tile size (in pixels)

 Cache entry size

 Number of cache entries

0

16 x 16

256 bytes for 8 bpp

512 bytes for 16 bpp

768 bytes for 24 bpp

1024 bytes for 32 bpp

120

1

32 x 32

1024 bytes for 8 bpp

2048 bytes for 16 bpp

3072 bytes for 24 bpp

4096 bytes for 32 bpp

120

2

64 x 64

4096 bytes for 8 bpp

8192 bytes for 16 bpp

12288 bytes for 24 bpp

16384 bytes for 32 bpp

2547 for 8 bpp

2553 for 16 bpp

2555 for 24 bpp

2556 for 32 bpp

If persistent bitmap caching is enabled, the client SHOULD enumerate the entries in its local persistent bitmap cache to obtain the 64-bit bitmap keys for all of the stored bitmaps, and then send one or more Persistent Key List PDUs that contains this data to the server ([MS-RDPBCGR] section 2.2.1.17).

Bitmap images stored in the bitmap caches are rendered using the MemBlt (section 2.2.2.2.1.1.2.9) and Mem3Blt (section 2.2.2.2.1.1.2.10) Primary Drawing Orders.