<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, Oct 23, 2018 at 10:38 PM Zhang, Jerry(Junwei) <<a href="mailto:Jerry.Zhang@amd.com">Jerry.Zhang@amd.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 10/24/18 3:07 AM, Marek Olšák wrote:<br>
> From: Marek Olšák <<a href="mailto:marek.olsak@amd.com" target="_blank">marek.olsak@amd.com</a>><br>
<br>
We need commit log and sign-off here.<br>
<br>
BTW, have you encounter any issue about that?<br></blockquote><div><br></div><div>I don't know what you mean. I'm pretty sure that a sign-off is not needed for libdrm.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
><br>
> ---<br>
> amdgpu/amdgpu_bo.c | 19 +++++++++++++++++--<br>
> 1 file changed, 17 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c<br>
> index c0f42e81..81f8a5f7 100644<br>
> --- a/amdgpu/amdgpu_bo.c<br>
> +++ b/amdgpu/amdgpu_bo.c<br>
> @@ -22,20 +22,21 @@<br>
> *<br>
> */<br>
> <br>
> #include <stdlib.h><br>
> #include <stdio.h><br>
> #include <stdint.h><br>
> #include <string.h><br>
> #include <errno.h><br>
> #include <fcntl.h><br>
> #include <unistd.h><br>
> +#include <limits.h><br>
> #include <sys/ioctl.h><br>
> #include <sys/mman.h><br>
> #include <sys/time.h><br>
> <br>
> #include "libdrm_macros.h"<br>
> #include "xf86drm.h"<br>
> #include "amdgpu_drm.h"<br>
> #include "amdgpu_internal.h"<br>
> #include "util_math.h"<br>
> <br>
> @@ -442,21 +443,29 @@ drm_public int amdgpu_bo_cpu_map(amdgpu_bo_handle bo, void **cpu)<br>
> {<br>
> union drm_amdgpu_gem_mmap args;<br>
> void *ptr;<br>
> int r;<br>
> <br>
> pthread_mutex_lock(&bo->cpu_access_mutex);<br>
> <br>
> if (bo->cpu_ptr) {<br>
> /* already mapped */<br>
> assert(bo->cpu_map_count > 0);<br>
> - bo->cpu_map_count++;<br>
> +<br>
> + /* If the counter has already reached INT_MAX, don't increment<br>
> + * it and assume that the buffer will be mapped indefinitely.<br>
> + * The buffer is pretty unlikely to get unmapped by the user<br>
> + * at this point.<br>
> + */<br>
> + if (bo->cpu_map_count != INT_MAX)<br>
> + bo->cpu_map_count++;<br>
<br>
If so, shall we print some error here to notice that indefinite mappings <br>
come up.<br></blockquote><div><br></div><div>No error. This is expected usage.</div><div><br></div><div>Marek</div></div></div>