x11/dri3: Store raw present completion mode
authorDaniel Stone <daniels@collabora.com>
Wed, 21 Feb 2018 10:39:34 +0000 (10:39 +0000)
committerDaniel Stone <daniels@collabora.com>
Wed, 21 Feb 2018 21:57:38 +0000 (21:57 +0000)
The DRI3 drawable info struct currently stores a boolean for whether the
last completed operation was a flip or not. As we need to track the full
completion mode for handling suboptimal returns, change the 'flipping'
field to the raw present completion mode from the server.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
src/loader/loader_dri3_helper.c
src/loader/loader_dri3_helper.h

index cb947c58728be7a43a0d8d9d50693b22bb10aeb9..426966a786afdbac5a7910846de9d63d49190e95 100644 (file)
@@ -196,7 +196,7 @@ dri3_fence_await(xcb_connection_t *c, struct loader_dri3_drawable *draw,
 static void
 dri3_update_num_back(struct loader_dri3_drawable *draw)
 {
-   if (draw->flipping)
+   if (draw->last_present_mode == XCB_PRESENT_COMPLETE_MODE_FLIP)
       draw->num_back = 3;
    else
       draw->num_back = 2;
@@ -369,14 +369,8 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw,
          draw->recv_sbc = (draw->send_sbc & 0xffffffff00000000LL) | ce->serial;
          if (draw->recv_sbc > draw->send_sbc)
             draw->recv_sbc -= 0x100000000;
-         switch (ce->mode) {
-         case XCB_PRESENT_COMPLETE_MODE_FLIP:
-            draw->flipping = true;
-            break;
-         case XCB_PRESENT_COMPLETE_MODE_COPY:
-            draw->flipping = false;
-            break;
-         }
+
+         draw->last_present_mode = ce->mode;
 
          if (draw->vtable->show_fps)
             draw->vtable->show_fps(draw, ce->ust);
index 839cba30df0193574154bcd650b0cf9522b6f28d..5caf214b37233dca28f3f742282afc0de97e2b0d 100644 (file)
@@ -116,7 +116,6 @@ struct loader_dri3_drawable {
    uint8_t have_back;
    uint8_t have_fake_front;
    uint8_t is_pixmap;
-   uint8_t flipping;
 
    /* Information about the GPU owning the buffer */
    __DRIscreen *dri_screen;
@@ -157,6 +156,7 @@ struct loader_dri3_drawable {
 
    unsigned int swap_method;
    unsigned int back_format;
+   xcb_present_complete_mode_t last_present_mode;
 
    /* Currently protects the following fields:
     * event_cnd, has_event_waiter,