dri3: use CloseScreen hook

Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-10-04 22:08:46 +02:00
parent a9d35bcdd2
commit 553ea7ebbe
2 changed files with 6 additions and 8 deletions

View File

@ -19,6 +19,9 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE. * OF THIS SOFTWARE.
*/ */
#include <dix-config.h>
#include "dix/screen_hooks_priv.h"
#include "dri3_priv.h" #include "dri3_priv.h"
#include "extinit_priv.h" #include "extinit_priv.h"
@ -29,15 +32,11 @@ DevPrivateKeyRec dri3_screen_private_key;
static int dri3_screen_generation; static int dri3_screen_generation;
static Bool static void dri3_screen_close(CallbackListPtr *pcbl, ScreenPtr screen, void *unused)
dri3_close_screen(ScreenPtr screen)
{ {
dri3_screen_priv_ptr screen_priv = dri3_screen_priv(screen); dri3_screen_priv_ptr screen_priv = dri3_screen_priv(screen);
dixScreenUnhookClose(screen, dri3_screen_close);
unwrap(screen_priv, screen, CloseScreen);
free(screen_priv); free(screen_priv);
return (*screen->CloseScreen) (screen);
} }
Bool Bool
@ -53,7 +52,7 @@ dri3_screen_init(ScreenPtr screen, const dri3_screen_info_rec *info)
if (!screen_priv) if (!screen_priv)
return FALSE; return FALSE;
wrap(screen_priv, screen, CloseScreen, dri3_close_screen); dixScreenHookClose(screen, dri3_screen_close);
screen_priv->info = info; screen_priv->info = info;

View File

@ -44,7 +44,6 @@ typedef struct dri3_dmabuf_format {
} dri3_dmabuf_format_rec, *dri3_dmabuf_format_ptr; } dri3_dmabuf_format_rec, *dri3_dmabuf_format_ptr;
typedef struct dri3_screen_priv { typedef struct dri3_screen_priv {
CloseScreenProcPtr CloseScreen;
ConfigNotifyProcPtr ConfigNotify; ConfigNotifyProcPtr ConfigNotify;
Bool formats_cached; Bool formats_cached;