diff options
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/drmP.h | 2 | ||||
-rw-r--r-- | linux-core/drm_bo.c | 8 | ||||
-rw-r--r-- | linux-core/drm_mm.c | 5 |
3 files changed, 11 insertions, 4 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 1ed20b09..d02184c7 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -1016,7 +1016,7 @@ typedef struct drm_buffer_object{ unsigned long buffer_start; drm_bo_type_t type; unsigned long offset; - + uint32_t page_alignment; atomic_t mapped; uint32_t flags; uint32_t mask; diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c index 954b7a03..65e24fb6 100644 --- a/linux-core/drm_bo.c +++ b/linux-core/drm_bo.c @@ -571,7 +571,7 @@ int drm_bo_alloc_space(drm_buffer_object_t * buf, unsigned mem_type, mutex_lock(&dev->struct_mutex); do { - node = drm_mm_search_free(mm, size, 0, 1); + node = drm_mm_search_free(mm, size, buf->page_alignment, 1); if (node) break; @@ -599,7 +599,7 @@ int drm_bo_alloc_space(drm_buffer_object_t * buf, unsigned mem_type, return -ENOMEM; } - node = drm_mm_get_block(node, size, 0); + node = drm_mm_get_block(node, size, buf->page_alignment); mutex_unlock(&dev->struct_mutex); BUG_ON(!node); node->private = (void *)buf; @@ -959,6 +959,7 @@ static void drm_bo_fill_rep_arg(drm_buffer_object_t * bo, rep->buffer_start = bo->buffer_start; rep->fence_flags = bo->fence_type; rep->rep_flags = 0; + rep->page_alignment = bo->page_alignment; if ((bo->priv_flags & _DRM_BO_FLAG_UNFENCED) || drm_bo_quick_busy(bo)) { DRM_FLAG_MASKED(rep->rep_flags, DRM_BO_REP_BUSY, @@ -1387,6 +1388,7 @@ int drm_buffer_object_create(drm_file_t * priv, drm_bo_type_t type, uint32_t mask, uint32_t hint, + uint32_t page_alignment, unsigned long buffer_start, drm_buffer_object_t ** buf_obj) { @@ -1426,6 +1428,7 @@ int drm_buffer_object_create(drm_file_t * priv, bo->num_pages = num_pages; bo->node_card = NULL; bo->node_ttm = NULL; + bo->page_alignment = page_alignment; if (bo->type == drm_bo_type_fake) { bo->offset = buffer_start; bo->buffer_start = 0; @@ -1516,6 +1519,7 @@ int drm_bo_ioctl(DRM_IOCTL_ARGS) req->type, req->mask, req->hint, + req->page_alignment, req->buffer_start, &entry); if (rep.ret) break; diff --git a/linux-core/drm_mm.c b/linux-core/drm_mm.c index dcd55209..a5566b2f 100644 --- a/linux-core/drm_mm.c +++ b/linux-core/drm_mm.c @@ -147,7 +147,10 @@ drm_mm_node_t *drm_mm_get_block(drm_mm_node_t * parent, drm_mm_node_t *align_splitoff = NULL; drm_mm_node_t *child; - unsigned tmp = size % alignment; + unsigned tmp = 0; + + if (alignment) + tmp = size % alignment; if (tmp) { align_splitoff = drm_mm_split_at_start(parent, alignment - tmp); |