+/**
+ * Asks the driver to flush any queued work necessary for serializing with the
+ * X command stream, and optionally the slightly more strict requirement of
+ * glFlush() equivalence (which would require flushing even if nothing had
+ * been drawn to a window system framebuffer, for example).
+ */
+static void
+dri2Flush(struct dri2_screen *psc,
+ __DRIcontext *ctx,
+ struct dri2_drawable *draw,
+ unsigned flags,
+ enum __DRI2throttleReason throttle_reason)
+{
+ if (ctx && psc->f && psc->f->base.version >= 4) {
+ psc->f->flush_with_flags(ctx, draw->driDrawable, flags, throttle_reason);
+ } else {
+ if (flags & __DRI2_FLUSH_CONTEXT)
+ glFlush();
+
+ if (psc->f)
+ psc->f->flush(draw->driDrawable);
+
+ dri2Throttle(psc, draw, throttle_reason);
+ }
+}
+