Re: [Mesa-dev] [PATCH] winsys/radeon: Only add bo to hash table when creating flink

2013-03-01 Thread Alex Deucher
On Fri, Mar 1, 2013 at 4:34 PM, Martin Andersson  wrote:
> The problem is that we mix bo handles and flinked names in the hash
> table. Because kms type handles are not flinked they should not be
> added to the hash table. If we do that we will sooner or later
> get a situation where we will overwrite a correct entry because
> the bo handle was the same as a flinked name.

Reviewed-by: Alex Deucher 

Should probably got to stable branches as well.

Alex

> ---
>  src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c 
> b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> index 2d41c26..f4ac526 100644
> --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> @@ -957,16 +957,16 @@ static boolean radeon_winsys_bo_get_handle(struct 
> pb_buffer *buffer,
>
>  bo->flinked = TRUE;
>  bo->flink = flink.name;
> +
> +pipe_mutex_lock(bo->mgr->bo_handles_mutex);
> +util_hash_table_set(bo->mgr->bo_handles, 
> (void*)(uintptr_t)bo->flink, bo);
> +pipe_mutex_unlock(bo->mgr->bo_handles_mutex);
>  }
>  whandle->handle = bo->flink;
>  } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
>  whandle->handle = bo->handle;
>  }
>
> -pipe_mutex_lock(bo->mgr->bo_handles_mutex);
> -util_hash_table_set(bo->mgr->bo_handles, 
> (void*)(uintptr_t)whandle->handle, bo);
> -pipe_mutex_unlock(bo->mgr->bo_handles_mutex);
> -
>  whandle->stride = stride;
>  return TRUE;
>  }
> --
> 1.8.1.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] winsys/radeon: Only add bo to hash table when creating flink

2013-03-01 Thread Jerome Glisse
On Fri, Mar 1, 2013 at 4:34 PM, Martin Andersson  wrote:
> The problem is that we mix bo handles and flinked names in the hash
> table. Because kms type handles are not flinked they should not be
> added to the hash table. If we do that we will sooner or later
> get a situation where we will overwrite a correct entry because
> the bo handle was the same as a flinked name.
> ---
>  src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c 
> b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> index 2d41c26..f4ac526 100644
> --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> @@ -957,16 +957,16 @@ static boolean radeon_winsys_bo_get_handle(struct 
> pb_buffer *buffer,
>
>  bo->flinked = TRUE;
>  bo->flink = flink.name;
> +
> +pipe_mutex_lock(bo->mgr->bo_handles_mutex);
> +util_hash_table_set(bo->mgr->bo_handles, 
> (void*)(uintptr_t)bo->flink, bo);
> +pipe_mutex_unlock(bo->mgr->bo_handles_mutex);
>  }
>  whandle->handle = bo->flink;
>  } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
>  whandle->handle = bo->handle;
>  }
>
> -pipe_mutex_lock(bo->mgr->bo_handles_mutex);
> -util_hash_table_set(bo->mgr->bo_handles, 
> (void*)(uintptr_t)whandle->handle, bo);
> -pipe_mutex_unlock(bo->mgr->bo_handles_mutex);
> -
>  whandle->stride = stride;
>  return TRUE;
>  }
> --
> 1.8.1.4
>

Reviewed-by: Jerome Glisse 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] winsys/radeon: Only add bo to hash table when creating flink

2013-03-01 Thread Martin Andersson
The problem is that we mix bo handles and flinked names in the hash
table. Because kms type handles are not flinked they should not be
added to the hash table. If we do that we will sooner or later
get a situation where we will overwrite a correct entry because
the bo handle was the same as a flinked name.
---
 src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c 
b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index 2d41c26..f4ac526 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -957,16 +957,16 @@ static boolean radeon_winsys_bo_get_handle(struct 
pb_buffer *buffer,
 
 bo->flinked = TRUE;
 bo->flink = flink.name;
+
+pipe_mutex_lock(bo->mgr->bo_handles_mutex);
+util_hash_table_set(bo->mgr->bo_handles, 
(void*)(uintptr_t)bo->flink, bo);
+pipe_mutex_unlock(bo->mgr->bo_handles_mutex);
 }
 whandle->handle = bo->flink;
 } else if (whandle->type == DRM_API_HANDLE_TYPE_KMS) {
 whandle->handle = bo->handle;
 }
 
-pipe_mutex_lock(bo->mgr->bo_handles_mutex);
-util_hash_table_set(bo->mgr->bo_handles, 
(void*)(uintptr_t)whandle->handle, bo);
-pipe_mutex_unlock(bo->mgr->bo_handles_mutex);
-
 whandle->stride = stride;
 return TRUE;
 }
-- 
1.8.1.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev