mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-20 03:30:22 +01:00
omap: fix omap_bo_size for tiled buffers
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@ti.com> Signed-off-by: Andrew Davis <afd@ti.com>
This commit is contained in:
parent
d72d7c6eef
commit
b71953a199
1 changed files with 1 additions and 11 deletions
|
|
@ -41,10 +41,6 @@
|
|||
#include "omap_drm.h"
|
||||
#include "omap_drmif.h"
|
||||
|
||||
#define __round_mask(x, y) ((__typeof__(x))((y)-1))
|
||||
#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
|
||||
#define PAGE_SIZE 4096
|
||||
|
||||
static pthread_mutex_t table_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
static void * dev_table;
|
||||
|
||||
|
|
@ -207,12 +203,6 @@ 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 {
|
||||
bo->size = size.bytes;
|
||||
}
|
||||
|
||||
return bo;
|
||||
|
||||
fail:
|
||||
|
|
@ -432,7 +422,7 @@ drm_public uint32_t omap_bo_size(struct omap_bo *bo)
|
|||
drm_public void *omap_bo_map(struct omap_bo *bo)
|
||||
{
|
||||
if (!bo->map) {
|
||||
if (!bo->offset) {
|
||||
if (!bo->size || !bo->offset) {
|
||||
get_buffer_info(bo);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue