if (address >= IRIS_MEMZONE_OTHER_START)
return IRIS_MEMZONE_OTHER;
- if (address >= IRIS_MEMZONE_DYNAMIC_START)
- return IRIS_MEMZONE_DYNAMIC;
+ if (address == IRIS_MEMZONE_DYNAMIC_START)
+ return IRIS_MEMZONE_BORDER_COLOR_POOL;
- /* Use > to exclude the binder */
- if (address > IRIS_MEMZONE_SURFACE_START)
- return IRIS_MEMZONE_SURFACE;
+ if (address > IRIS_MEMZONE_DYNAMIC_START)
+ return IRIS_MEMZONE_DYNAMIC;
if (address == IRIS_BINDER_ADDRESS)
return IRIS_MEMZONE_BINDER;
+ if (address > IRIS_MEMZONE_SURFACE_START)
+ return IRIS_MEMZONE_SURFACE;
+
return IRIS_MEMZONE_SHADER;
}
{
if (memzone == IRIS_MEMZONE_BINDER)
return IRIS_BINDER_ADDRESS;
+ else if (memzone == IRIS_MEMZONE_BORDER_COLOR_POOL)
+ return IRIS_BORDER_COLOR_POOL_ADDRESS;
struct bo_cache_bucket *bucket = get_bucket_allocator(bufmgr, size);
uint64_t addr;
IRIS_MEMZONE_SURFACE_START + IRIS_BINDER_SIZE,
_4GB - IRIS_BINDER_SIZE);
util_vma_heap_init(&bufmgr->vma_allocator[IRIS_MEMZONE_DYNAMIC],
- IRIS_MEMZONE_DYNAMIC_START, _4GB);
+ IRIS_MEMZONE_DYNAMIC_START + IRIS_BORDER_COLOR_POOL_SIZE,
+ _4GB - IRIS_BORDER_COLOR_POOL_SIZE);
util_vma_heap_init(&bufmgr->vma_allocator[IRIS_MEMZONE_OTHER],
IRIS_MEMZONE_OTHER_START,
(1ull << 48) - IRIS_MEMZONE_OTHER_START);
* A special 64kB "binder" buffer lives at the start of the surface memory
* zone, holding binding tables referring to objects in the rest of the zone.
*
+ * A special buffer for border color lives at the start of the dynamic state
+ * memory zone. This unfortunately has to be handled specially because the
+ * hardware designers only gave us 24-bit pointers.
+ *
* Each GL context uses a separate GEM context, which technically gives them
* each a separate VMA. However, we assign address globally, so buffers will
* have the same address in all GEM contexts. This lets us have a single BO
IRIS_MEMZONE_OTHER,
IRIS_MEMZONE_BINDER,
+ IRIS_MEMZONE_BORDER_COLOR_POOL,
};
-/* Intentionally exclude IRIS_MEMZONE_BINDER */
-#define IRIS_MEMZONE_COUNT (IRIS_MEMZONE_OTHER + 1)
+/* Intentionally exclude single buffer "zones" */
+#define IRIS_MEMZONE_COUNT (IRIS_MEMZONE_OTHER + 2)
#define IRIS_MEMZONE_SHADER_START (0ull * (1ull << 32))
#define IRIS_MEMZONE_SURFACE_START (1ull * (1ull << 32))
#define IRIS_MEMZONE_DYNAMIC_START (2ull * (1ull << 32))
#define IRIS_MEMZONE_OTHER_START (3ull * (1ull << 32))
+#define IRIS_BINDER_SIZE (64 * 1024)
#define IRIS_BINDER_ADDRESS IRIS_MEMZONE_SURFACE_START
#define IRIS_BINDER_SIZE (64 * 1024)
+/* This is large enough for every surface in the binder to have a border
+ * color, which although unlikely, guarantees we'll never overflow.
+ */
+#define IRIS_BORDER_COLOR_POOL_SIZE ((IRIS_BINDER_SIZE / 4) * 64)
+#define IRIS_BORDER_COLOR_POOL_ADDRESS IRIS_MEMZONE_DYNAMIC_START
+
struct iris_bo {
/**
* Size in bytes of the buffer object.