mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-11-16 22:05:58 +01:00
buffer: align size to stride (#50)
calculate the size to the stride we get from gb_bo_map to better align it.
This commit is contained in:
parent
4f6642808b
commit
05f4efca81
1 changed files with 4 additions and 4 deletions
|
@ -224,13 +224,13 @@ SDMABUFAttrs Aquamarine::CGBMBuffer::dmabuf() {
|
|||
}
|
||||
|
||||
std::tuple<uint8_t*, uint32_t, size_t> Aquamarine::CGBMBuffer::beginDataPtr(uint32_t flags) {
|
||||
uint32_t dst_stride = 0;
|
||||
uint32_t stride = 0;
|
||||
if (boBuffer)
|
||||
allocator->backend->log(AQ_LOG_ERROR, "beginDataPtr is called a second time without calling endDataPtr first. Returning old mapping");
|
||||
else
|
||||
boBuffer = gbm_bo_map(bo, 0, 0, attrs.size.x, attrs.size.y, flags, &dst_stride, &gboMapping);
|
||||
// FIXME: assumes a 32-bit pixel format
|
||||
return {(uint8_t*)boBuffer, attrs.format, attrs.size.x * attrs.size.y * 4};
|
||||
boBuffer = gbm_bo_map(bo, 0, 0, attrs.size.x, attrs.size.y, flags, &stride, &gboMapping);
|
||||
|
||||
return {(uint8_t*)boBuffer, attrs.format, stride * attrs.size.y};
|
||||
}
|
||||
|
||||
void Aquamarine::CGBMBuffer::endDataPtr() {
|
||||
|
|
Loading…
Reference in a new issue