From 3b0b44f7def0acb4f7a7aef086c0bece321418a6 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 9 Apr 2014 01:07:52 +0200 Subject: winsys/radeon: fix a race condition in initialization of radeon_winsys::screen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Create the screen in the winsys while the mutex is locked. This also results in a nice code cleanup! Reviewed-by: Michel Dänzer Reviewed-by: Christian König --- src/gallium/targets/pipe-loader/pipe_r600.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'src/gallium/targets/pipe-loader/pipe_r600.c') diff --git a/src/gallium/targets/pipe-loader/pipe_r600.c b/src/gallium/targets/pipe-loader/pipe_r600.c index 5d89aca6ec3..0c590875784 100644 --- a/src/gallium/targets/pipe-loader/pipe_r600.c +++ b/src/gallium/targets/pipe-loader/pipe_r600.c @@ -7,19 +7,9 @@ static struct pipe_screen * create_screen(int fd) { struct radeon_winsys *rw; - struct pipe_screen *screen; - rw = radeon_drm_winsys_create(fd); - if (!rw) - return NULL; - - screen = r600_screen_create(rw); - if (!screen) - return NULL; - - screen = debug_screen_wrap(screen); - - return screen; + rw = radeon_drm_winsys_create(fd, r600_screen_create); + return rw ? debug_screen_wrap(rw->screen) : NULL; } PUBLIC -- cgit v1.2.3