[PATCH libdrm] omap: fix omap_bo_size for tiled buffers
Tomi Valkeinen
tomi.valkeinen at ti.com
Wed May 24 06:40:11 UTC 2017
The buffer size is calculated using pixels, not bytes as it should. The
result is often correct, though, as the stride is aligned to page size,
but there are still many cases where the size ends up being wrong.
Fix this by not calculating the size at all, as in that case
DRM_OMAP_GEM_INFO ioctl is used to get the correct size from the kernel.
This is better in any case as then the userspace library doesn't need to
know how the tiled buffers need to be aligned.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ti.com>
---
omap/omap_drm.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/omap/omap_drm.c b/omap/omap_drm.c
index 08ba64e..a6f8a21 100644
--- a/omap/omap_drm.c
+++ b/omap/omap_drm.c
@@ -215,11 +215,9 @@ static struct omap_bo * omap_bo_new_impl(struct omap_device *dev,
bo = bo_from_handle(dev, req.handle);
pthread_mutex_unlock(&table_lock);
- if (flags & OMAP_BO_TILED) {
- bo->size = round_up(size.tiled.width, PAGE_SIZE) * size.tiled.height;
- } else {
+ /* for tiled buffers we get the size with DRM_OMAP_GEM_INFO later */
+ if (!(flags & OMAP_BO_TILED))
bo->size = size.bytes;
- }
return bo;
--
2.7.4
More information about the dri-devel
mailing list