glx/dri3: Convert to use dri3 helper in loader library
[mesa.git] / src / glx / dri3_priv.h
index 160444907e65c34334587bf17177cc9fec652843..56a63309f36b608f7a629df31eeb32778a6bb026 100644 (file)
 #include <xcb/present.h>
 #include <xcb/sync.h>
 
+#include "loader_dri3_helper.h"
+
 /* From xmlpool/options.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;
-   __DRIimage   *linear_buffer;
-   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;
-   uint64_t     last_swap;
-
-   enum dri3_buffer_type        buffer_type;
-};
-
 struct dri3_display
 {
    __GLXDRIdisplay base;
@@ -139,6 +103,8 @@ struct dri3_screen {
    int is_different_gpu;
 
    int show_fps_interval;
+
+   struct loader_dri3_extensions loader_dri3_ext;
 };
 
 struct dri3_context
@@ -147,60 +113,10 @@ struct dri3_context
    __DRIcontext *driContext;
 };
 
-#define DRI3_MAX_BACK   4
-#define DRI3_BACK_ID(i) (i)
-#define DRI3_FRONT_ID   (DRI3_MAX_BACK)
-
-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_MAX_BACK)
-
 struct dri3_drawable {
    __GLXDRIdrawable base;
-   __DRIdrawable *driDrawable;
-   int width, height, depth;
+   struct loader_dri3_drawable loader_drawable;
    int swap_interval;
-   uint8_t have_back;
-   uint8_t have_fake_front;
-   uint8_t is_pixmap;
-   uint8_t flipping;
-
-   /* Present extension capabilities
-    */
-   uint32_t present_capabilities;
-
-   /* SBC numbers are tracked by using the serial numbers
-    * in the present request and complete events
-    */
-   uint64_t send_sbc;
-   uint64_t recv_sbc;
-
-   /* Last received UST/MSC values for pixmap present complete */
-   uint64_t ust, msc;
-
-   /* Last received UST/MSC values from present notify msc event */
-   uint64_t notify_ust, notify_msc;
-
-   /* Serial numbers for tracking wait_for_msc events */
-   uint32_t send_msc_serial;
-   uint32_t recv_msc_serial;
-
-   struct dri3_buffer *buffers[DRI3_NUM_BUFFERS];
-   int cur_back;
-   int num_back;
-
-   uint32_t *stamp;
-
-   xcb_present_event_t eid;
-   xcb_gcontext_t gc;
-   xcb_special_event_t *special_event;
 
    /* LIBGL_SHOW_FPS support */
    uint64_t previous_ust;