Skip to content

Commit

Permalink
frontends/dri: only release pipe when screen init fails
Browse files Browse the repository at this point in the history
the caller (driCreateNewScreen3) will always call dri_destroy_screen()
when these functions return failure, so releasing the screen
is always wrong

cc: mesa-stable

Tracked-On: OAM-122605
Reviewed-by: Adam Jackson <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29021>
Signed-off-by: Weifeng Liu <[email protected]>
Signed-off-by: Mike Blumenkrantz <[email protected]>
  • Loading branch information
zmike authored and celadon committed Jul 25, 2024
1 parent e68b024 commit 6d19eeb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/gallium/frontends/dri/dri2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2385,7 +2385,7 @@ dri2_init_screen(struct dri_screen *screen)
pscreen = pipe_loader_create_screen(screen->dev);

if (!pscreen)
goto fail;
return NULL;

dri_init_options(screen);
screen->throttle = pscreen->get_param(pscreen, PIPE_CAP_THROTTLE);
Expand Down Expand Up @@ -2419,7 +2419,7 @@ dri2_init_screen(struct dri_screen *screen)
return configs;

fail:
dri_release_screen(screen);
pipe_loader_release(&screen->dev, 1);

return NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions src/gallium/frontends/dri/drisw.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ drisw_init_screen(struct dri_screen *screen)
pscreen = pipe_loader_create_screen(screen->dev);

if (!pscreen)
goto fail;
return NULL;

dri_init_options(screen);
configs = dri_init_screen(screen, pscreen);
Expand Down Expand Up @@ -593,7 +593,7 @@ drisw_init_screen(struct dri_screen *screen)

return configs;
fail:
dri_release_screen(screen);
pipe_loader_release(&screen->dev, 1);
return NULL;
}

Expand Down
4 changes: 2 additions & 2 deletions src/gallium/frontends/dri/kopper.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ kopper_init_screen(struct dri_screen *screen)
pscreen = pipe_loader_create_screen(screen->dev);

if (!pscreen)
goto fail;
return NULL;

dri_init_options(screen);
screen->unwrapped_screen = trace_screen_unwrap(pscreen);
Expand Down Expand Up @@ -167,7 +167,7 @@ kopper_init_screen(struct dri_screen *screen)

return configs;
fail:
dri_release_screen(screen);
pipe_loader_release(&screen->dev, 1);
return NULL;
}

Expand Down

0 comments on commit 6d19eeb

Please sign in to comment.