uxa: Drain the DRM event queue before server regeneration
Adam Jackson notes that what appeared to be my paranoid ramblings in SNA actually served a purpose - it prevents a server crash following server regen if an indirect client happened to be running at the time (e.g. LIBGL_INDIRECT_ALWAYS=1 glxgears). Reported-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
efb8ff1649
commit
ef431b2d35
|
|
@ -366,6 +366,7 @@ extern Bool intel_mode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp);
|
|||
extern void intel_mode_init(struct intel_screen_private *intel);
|
||||
extern void intel_mode_disable_unused_functions(ScrnInfoPtr scrn);
|
||||
extern void intel_mode_remove_fb(intel_screen_private *intel);
|
||||
extern void intel_mode_close(intel_screen_private *intel);
|
||||
extern void intel_mode_fini(intel_screen_private *intel);
|
||||
|
||||
extern int intel_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, xf86CrtcPtr crtc);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/poll.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
|
@ -1830,6 +1831,26 @@ intel_mode_remove_fb(intel_screen_private *intel)
|
|||
}
|
||||
}
|
||||
|
||||
static Bool has_pending_events(int fd)
|
||||
{
|
||||
struct pollfd pfd;
|
||||
pfd.fd = fd;
|
||||
pfd.events = POLLIN;
|
||||
return poll(&pfd, 1, 0) == 1;
|
||||
}
|
||||
|
||||
void
|
||||
intel_mode_close(intel_screen_private *intel)
|
||||
{
|
||||
struct intel_mode *mode = intel->modes;
|
||||
|
||||
if (mode == NULL)
|
||||
return;
|
||||
|
||||
while (has_pending_events(mode->fd))
|
||||
drmHandleEvent(mode->fd, &mode->event_context);
|
||||
}
|
||||
|
||||
void
|
||||
intel_mode_fini(intel_screen_private *intel)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1139,6 +1139,8 @@ static Bool I830CloseScreen(CLOSE_SCREEN_ARGS_DECL)
|
|||
I830UeventFini(scrn);
|
||||
#endif
|
||||
|
||||
intel_mode_close(intel);
|
||||
|
||||
DeleteCallback(&FlushCallback, intel_flush_callback, scrn);
|
||||
|
||||
intel_glamor_close_screen(screen);
|
||||
|
|
|
|||
Loading…
Reference in New Issue