Added few more stubs so that control reaches to DestroyDevice().
[mesa.git] / src / glx / dri3_priv.h
index 682849386ab857ed6d57b943d7caf283f1792e54..dbd04c00bb4903998f8f481b582cf43d75c0f206 100644 (file)
 #include <xcb/present.h>
 #include <xcb/sync.h>
 
-/* From xmlpool/options.h, user exposed so should be stable */
+#include "loader_dri3_helper.h"
+
+/* From driconf.h, user exposed so should be stable */
 #define DRI_CONF_VBLANK_NEVER 0
 #define DRI_CONF_VBLANK_DEF_INTERVAL_0 1
 #define DRI_CONF_VBLANK_DEF_INTERVAL_1 2
 #define DRI_CONF_VBLANK_ALWAYS_SYNC 3
 
-enum dri3_buffer_type {
-   dri3_buffer_back = 0,
-   dri3_buffer_front = 1
-};
-
-struct dri3_buffer {
-   __DRIimage   *image;
-   uint32_t     pixmap;
-
-   /* Synchronization between the client and X server is done using an
-    * xshmfence that is mapped into an X server SyncFence. This lets the
-    * client check whether the X server is done using a buffer with a simple
-    * xshmfence call, rather than going to read X events from the wire.
-    *
-    * However, we can only wait for one xshmfence to be triggered at a time,
-    * so we need to know *which* buffer is going to be idle next. We do that
-    * by waiting for a PresentIdleNotify event. When that event arrives, the
-    * 'busy' flag gets cleared and the client knows that the fence has been
-    * triggered, and that the wait call will not block.
-    */
-
-   uint32_t     sync_fence;     /* XID of X SyncFence object */
-   struct xshmfence *shm_fence; /* pointer to xshmfence object */
-   GLboolean    busy;           /* Set on swap, cleared on IdleNotify */
-   GLboolean    own_pixmap;     /* We allocated the pixmap ID, free on destroy */
-   void         *driverPrivate;
-
-   uint32_t     size;
-   uint32_t     pitch;
-   uint32_t     cpp;
-   uint32_t     flags;
-   uint32_t     width, height;
-
-   enum dri3_buffer_type        buffer_type;
-};
-
 struct dri3_display
 {
    __GLXDRIdisplay base;
 
-   const __DRIextension *loader_extensions[8];
+   const __DRIextension **loader_extensions;
 
    /* DRI3 bits */
    int dri3Major;
@@ -129,12 +95,17 @@ struct dri3_screen {
    const __DRI2flushExtension *f;
    const __DRI2configQueryExtension *config;
    const __DRItexBufferExtension *texBuffer;
+   const __DRI2rendererQueryExtension *rendererQuery;
+   const __DRI2interopExtension *interop;
    const __DRIconfig **driver_configs;
 
    void *driver;
    int fd;
+   bool is_different_gpu;
 
-   Bool show_fps;
+   int show_fps_interval;
+
+   struct loader_dri3_extensions loader_dri3_ext;
 };
 
 struct dri3_context
@@ -143,63 +114,29 @@ struct dri3_context
    __DRIcontext *driContext;
 };
 
-#define DRI3_NUM_BACK   2
-#define DRI3_BACK_ID(i) (i)
-#define DRI3_FRONT_ID   (DRI3_NUM_BACK)
-
-static inline int
-dri3_buf_id_next(int buf_id)
-{
-   if (buf_id == DRI3_NUM_BACK - 1)
-      return 0;
-   return buf_id + 1;
-}
-
-static inline int
-dri3_buf_id_prev(int buf_id)
-{
-   if (buf_id == 0)
-      return DRI3_NUM_BACK - 1;
-   return buf_id - 1;
-}
-
-static inline int
-dri3_pixmap_buf_id(enum dri3_buffer_type buffer_type)
-{
-   if (buffer_type == dri3_buffer_back)
-      return DRI3_BACK_ID(0);
-   else
-      return DRI3_FRONT_ID;
-}
-
-#define DRI3_NUM_BUFFERS        (1 + DRI3_NUM_BACK)
-
 struct dri3_drawable {
    __GLXDRIdrawable base;
-   __DRIdrawable *driDrawable;
-   int width, height, depth;
-   int swap_interval;
-   uint8_t have_back;
-   uint8_t have_fake_front;
-   uint8_t is_pixmap;
-
-   uint32_t present_request_serial;
-   uint32_t present_event_serial;
+   struct loader_dri3_drawable loader_drawable;
 
-   uint64_t sbc;
+   /* LIBGL_SHOW_FPS support */
+   uint64_t previous_ust;
+   unsigned frames;
+};
 
-   uint64_t ust, msc;
 
-   /* For WaitMSC */
-   uint32_t present_msc_request_serial;
-   uint32_t present_msc_event_serial;
+_X_HIDDEN int
+dri3_query_renderer_integer(struct glx_screen *base, int attribute,
+                            unsigned int *value);
 
-   struct dri3_buffer *buffers[DRI3_NUM_BUFFERS];
-   int cur_back;
+_X_HIDDEN int
+dri3_query_renderer_string(struct glx_screen *base, int attribute,
+                           const char **value);
 
-   uint32_t *stamp;
+_X_HIDDEN int
+dri3_interop_query_device_info(struct glx_context *ctx,
+                               struct mesa_glinterop_device_info *out);
 
-   xcb_present_event_t eid;
-   xcb_gcontext_t gc;
-   xcb_special_event_t *special_event;
-};
+_X_HIDDEN int
+dri3_interop_export_object(struct glx_context *ctx,
+                           struct mesa_glinterop_export_in *in,
+                           struct mesa_glinterop_export_out *out);