diff options
author | Ben Widawsky <benjamin.widawsky@intel.com> | 2016-01-30 11:21:16 -0800 |
---|---|---|
committer | Ben Widawsky <benjamin.widawsky@intel.com> | 2016-02-01 14:25:37 -0800 |
commit | 5ba7b5450cbfa19c1a360ecd9bbabe92c09e81c7 (patch) | |
tree | 5a29a10acda6a0d2f122e283c29a9e760c3e7bc5 | |
parent | 107262935b0dd8261faf587f67285b183481b4eb (diff) |
i965/miptree: CPU map the aux buffer for initcpu_map_mcs
This patch uses the fast cpu mapping to initialize the MCS buffer on platforms
with LLC.
The MCS buffer needs to be initialized to 0xff in order to indicate that the
data within is invalid. Later, hardware will end up correctly filling out the
MCS buffer. The current code is naively calling the raw miptree map function,
which ends up doing a GTT mapping. This all makes sense because the buffer is
tiled, and so we want the proper tiling to occur. Additionally, on platforms
without LLC, we'd need to make sure that the writes made it out to memory, and
gtt writes is the mechanism employed today in i965.
I realized that for this initialization case, we'd write the whole buffer with
all 1s. As a result of this, it should be safe to not bother tiling the data.
Coherency is handled for us on LLC platforms. As a result, we may as well not
bother with a GTT mapping at all and get the cheaper cached writes.
Tiling is tricky. If you CPU map, you must make sure you align the height in
order to capture the full width of the buffer. It's weird and I need to explain
that better.
Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 858c7f51da..e628d94e71 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -1468,9 +1468,15 @@ intel_miptree_alloc_mcs(struct brw_context *brw, * * Note: the clear value for MCS buffers is all 1's, so we memset to 0xff. */ - assert(brw_bo_map_gtt(brw, mt->mcs_mt->bo, "miptree") == 0); + size_t height = mt->mcs_mt->total_height; + if (brw->has_llc) { + brw_bo_map(brw, mt->mcs_mt->bo, true, "miptree"); + height = ALIGN(mt->mcs_mt->total_height, 32); + } else + brw_bo_map_gtt(brw, mt->mcs_mt->bo, "miptree"); + void *data = mt->mcs_mt->bo->virtual; - memset(data, 0xff, mt->mcs_mt->total_height * mt->mcs_mt->pitch); + memset(data, 0xff, height * mt->mcs_mt->pitch); intel_miptree_unmap_raw(mt->mcs_mt); mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_CLEAR; |