<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hey Sergii,<br>
<br>
Sorry for the late answer.<br>
<br>
For the sake of clarity, I would split the changes
(4096->PAGE_SIZE) and the actual bug fix into 2 different
patches.<br>
I don't have see a problem with the PAGE_SIZE change.<br>
<br>
Thanks a lot,<br>
<br>
-<br>
Lionel<br>
<br>
On 25/07/18 14:24, Sergii Romantsov wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CALt4EURBBC2ygVeQoHS=oextdKWtiENAy7QXy2=w+VTjT-y0vw@mail.gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div dir="ltr">
<div
style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">Sorry,</div>
<div
style="font-size:small;text-decoration-style:initial;text-decoration-color:initial">do
we have any objections about <span style="font-size:12.8px">PAGE_SIZE
usage instead of 4096?</span></div>
<div
style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><span
style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br>
</span></div>
<div
style="font-size:small;text-decoration-style:initial;text-decoration-color:initial"><span
style="font-size:12.8px;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">And
what do you think if, maybe, some auto Intel-internal tests
to run with that patch?</span></div>
<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Jul 25, 2018 at 1:21 PM, Sergii
Romantsov <span dir="ltr"><<a
href="mailto:sergii.romantsov@gmail.com" target="_blank"
moz-do-not-send="true">sergii.romantsov@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"><span
class="">Kernel (for ppgtt) requires memory address to be<br>
aligned to page size (4096).<br>
<br>
</span>-v2: added marking that also fixes initial commit
01058a552294.<br>
-v3: numbers replaced by PAGE_SIZE; buffer-object size is
aligned<br>
instead of alignment of offsets (Chris Wilson).<br>
<span class=""><br>
Bugzilla: <a
href="https://bugs.freedesktop.org/show_bug.cgi?id=106997"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=106997</a><br>
Fixes: a363bb2cd0e2 (i965: Allocate VMA in userspace for
full-PPGTT systems.)<br>
Fixes: 01058a552294 (i965: Add virtual memory allocator
infrastructure to brw_bufmgr.)<br>
Signed-off-by: Sergii Romantsov <<a
href="mailto:sergii.romantsov@globallogic.com"
moz-do-not-send="true">sergii.romantsov@globallogic.<wbr>com</a>><br>
---<br>
</span> src/mesa/drivers/dri/i965/brw_<wbr>bufmgr.c | 19
+++++++++----------<br>
1 file changed, 9 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_bufmgr.c
b/src/mesa/drivers/dri/i965/<wbr>brw_bufmgr.c<br>
index 09d45e3..66d7751 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_bufmgr.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_bufmgr.c<br>
@@ -195,7 +195,7 @@ bo_tile_size(struct brw_bufmgr *bufmgr,
uint64_t size, uint32_t tiling)<br>
return size;<br>
<br>
/* 965+ just need multiples of page size for tiling */<br>
- return ALIGN(size, 4096);<br>
+ return ALIGN(size, PAGE_SIZE);<br>
}<br>
<br>
/*<br>
<span class="">@@ -496,7 +496,6 @@ bo_alloc_internal(struct
brw_bufmgr *bufmgr,<br>
uint32_t stride)<br>
{<br>
struct brw_bo *bo;<br>
- unsigned int page_size = getpagesize();<br>
int ret;<br>
struct bo_cache_bucket *bucket;<br>
bool alloc_from_cache;<br>
@@ -522,12 +521,12 @@ bo_alloc_internal(struct brw_bufmgr
*bufmgr,<br>
</span><span class=""> * allocation up.<br>
*/<br>
if (bucket == NULL) {<br>
</span><span class="">- bo_size = size;<br>
- if (bo_size < page_size)<br>
- bo_size = page_size;<br>
+ unsigned int page_size = getpagesize();<br>
+ bo_size = ALIGN(size, page_size);<br>
} else {<br>
bo_size = bucket->size;<br>
}<br>
+ assert(bo_size);<br>
<br>
mtx_lock(&bufmgr->lock);<br>
/* Get a buffer out of the cache if available */<br>
</span>@@ -1578,12 +1577,12 @@ init_cache_buckets(struct
brw_bufmgr *bufmgr)<br>
* width/height alignment and rounding of sizes to pages
will<br>
* get us useful cache hit rates anyway)<br>
*/<br>
- add_bucket(bufmgr, 4096);<br>
- add_bucket(bufmgr, 4096 * 2);<br>
- add_bucket(bufmgr, 4096 * 3);<br>
+ add_bucket(bufmgr, PAGE_SIZE);<br>
+ add_bucket(bufmgr, PAGE_SIZE * 2);<br>
+ add_bucket(bufmgr, PAGE_SIZE * 3);<br>
<br>
/* Initialize the linked lists for BO reuse cache. */<br>
- for (size = 4 * 4096; size <= cache_max_size; size *=
2) {<br>
+ for (size = 4 * PAGE_SIZE; size <= cache_max_size;
size *= 2) {<br>
add_bucket(bufmgr, size);<br>
<br>
add_bucket(bufmgr, size + size * 1 / 4);<br>
@@ -1729,7 +1728,7 @@ brw_bufmgr_init(struct gen_device_info
*devinfo, int fd)<br>
bufmgr->initial_kflags |= EXEC_OBJECT_PINNED;<br>
<br>
util_vma_heap_init(&bufmgr-><wbr>vma_allocator[BRW_MEMZONE_LOW_<wbr>4G],<br>
- 4096, _4GB);<br>
+ PAGE_SIZE, _4GB);<br>
util_vma_heap_init(&bufmgr-><wbr>vma_allocator[BRW_MEMZONE_<wbr>OTHER],<br>
1 * _4GB, gtt_size - 1 * _4GB);<br>
} else if (devinfo->gen >= 10) {<br>
<span class="HOEnZb"><font color="#888888">-- <br>
2.7.4<br>
</font></span>
<div class="HOEnZb">
<div class="h5"><br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org"
moz-do-not-send="true">mesa-dev@lists.freedesktop.org</a><br>
<a
href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">Sergii Romantsov<br>
</div>
<div dir="ltr">
<div
style="margin:0px;padding:0px;color:rgb(23,43,77);font-family:-apple-system,BlinkMacSystemFont,"Segoe
UI",Roboto,Oxygen,Ubuntu,"Fira
Sans","Droid Sans","Helvetica
Neue",sans-serif;font-size:14px">GlobalLogic
Inc.<br>
<a href="http://www.globallogic.com/" rel="nofollow"
style="color:rgb(0,82,204)" target="_blank"
moz-do-not-send="true">www.globallogic.com</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<p><br>
</p>
</body>
</html>