xserver

xserver with xephyr scale patch
git clone https://git.neptards.moe/u3shit/xserver.git
Log | Files | Refs | README | LICENSE

present.h (6707B)


      1 /*
      2  * Copyright © 2013 Keith Packard
      3  *
      4  * Permission to use, copy, modify, distribute, and sell this software and its
      5  * documentation for any purpose is hereby granted without fee, provided that
      6  * the above copyright notice appear in all copies and that both that copyright
      7  * notice and this permission notice appear in supporting documentation, and
      8  * that the name of the copyright holders not be used in advertising or
      9  * publicity pertaining to distribution of the software without specific,
     10  * written prior permission.  The copyright holders make no representations
     11  * about the suitability of this software for any purpose.  It is provided "as
     12  * is" without express or implied warranty.
     13  *
     14  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
     15  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
     16  * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
     17  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
     18  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
     19  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
     20  * OF THIS SOFTWARE.
     21  */
     22 
     23 #ifndef _PRESENT_H_
     24 #define _PRESENT_H_
     25 
     26 #include <X11/extensions/presentproto.h>
     27 #include "randrstr.h"
     28 #include "presentext.h"
     29 
     30 typedef enum {
     31     PRESENT_FLIP_REASON_UNKNOWN,
     32     PRESENT_FLIP_REASON_BUFFER_FORMAT
     33 } PresentFlipReason;
     34 
     35 typedef struct present_vblank present_vblank_rec, *present_vblank_ptr;
     36 
     37 /* Return the current CRTC for 'window'.
     38  */
     39 typedef RRCrtcPtr (*present_get_crtc_ptr) (WindowPtr window);
     40 
     41 /* Return the current ust/msc for 'crtc'
     42  */
     43 typedef int (*present_get_ust_msc_ptr) (RRCrtcPtr crtc, uint64_t *ust, uint64_t *msc);
     44 typedef int (*present_wnmd_get_ust_msc_ptr) (WindowPtr window, uint64_t *ust, uint64_t *msc);
     45 
     46 /* Queue callback on 'crtc' for time 'msc'. Call present_event_notify with 'event_id'
     47  * at or after 'msc'. Return false if it didn't happen (which might occur if 'crtc'
     48  * is not currently generating vblanks).
     49  */
     50 typedef Bool (*present_queue_vblank_ptr) (RRCrtcPtr crtc,
     51                                           uint64_t event_id,
     52                                           uint64_t msc);
     53 typedef Bool (*present_wnmd_queue_vblank_ptr) (WindowPtr window,
     54                                                RRCrtcPtr crtc,
     55                                                uint64_t event_id,
     56                                                uint64_t msc);
     57 
     58 /* Abort pending vblank. The extension is no longer interested in
     59  * 'event_id' which was to be notified at 'msc'. If possible, the
     60  * driver is free to de-queue the notification.
     61  */
     62 typedef void (*present_abort_vblank_ptr) (RRCrtcPtr crtc, uint64_t event_id, uint64_t msc);
     63 typedef void (*present_wnmd_abort_vblank_ptr) (WindowPtr window,
     64                                                RRCrtcPtr crtc,
     65                                                uint64_t event_id,
     66                                                uint64_t msc);
     67 
     68 /* Flush pending drawing on 'window' to the hardware.
     69  */
     70 typedef void (*present_flush_ptr) (WindowPtr window);
     71 
     72 /* Check if 'pixmap' is suitable for flipping to 'window'.
     73  */
     74 typedef Bool (*present_check_flip_ptr) (RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, Bool sync_flip);
     75 
     76 /* Same as 'check_flip' but it can return a 'reason' why the flip would fail.
     77  */
     78 typedef Bool (*present_check_flip2_ptr) (RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap, Bool sync_flip, PresentFlipReason *reason);
     79 
     80 /* Flip pixmap, return false if it didn't happen.
     81  *
     82  * 'crtc' is to be used for any necessary synchronization.
     83  *
     84  * 'sync_flip' requests that the flip be performed at the next
     85  * vertical blank interval to avoid tearing artifacts. If false, the
     86  * flip should be performed as soon as possible.
     87  *
     88  * present_event_notify should be called with 'event_id' when the flip
     89  * occurs
     90  */
     91 typedef Bool (*present_flip_ptr) (RRCrtcPtr crtc,
     92                                   uint64_t event_id,
     93                                   uint64_t target_msc,
     94                                   PixmapPtr pixmap,
     95                                   Bool sync_flip);
     96 /* Flip pixmap for window, return false if it didn't happen.
     97  *
     98  * Like present_flip_ptr, additionally with:
     99  *
    100  * 'window' used for synchronization.
    101  *
    102  */
    103 typedef Bool (*present_wnmd_flip_ptr) (WindowPtr window,
    104                                        RRCrtcPtr crtc,
    105                                        uint64_t event_id,
    106                                        uint64_t target_msc,
    107                                        PixmapPtr pixmap,
    108                                        Bool sync_flip,
    109                                        RegionPtr damage);
    110 
    111 /* "unflip" back to the regular screen scanout buffer
    112  *
    113  * present_event_notify should be called with 'event_id' when the unflip occurs.
    114  */
    115 typedef void (*present_unflip_ptr) (ScreenPtr screen,
    116                                     uint64_t event_id);
    117 
    118 /* Doing flips has been discontinued.
    119  *
    120  * Inform driver for potential cleanup on its side.
    121  */
    122 typedef void (*present_wnmd_flips_stop_ptr) (WindowPtr window);
    123 
    124 #define PRESENT_SCREEN_INFO_VERSION        1
    125 
    126 typedef struct present_screen_info {
    127     uint32_t                            version;
    128 
    129     present_get_crtc_ptr                get_crtc;
    130     present_get_ust_msc_ptr             get_ust_msc;
    131     present_queue_vblank_ptr            queue_vblank;
    132     present_abort_vblank_ptr            abort_vblank;
    133     present_flush_ptr                   flush;
    134     uint32_t                            capabilities;
    135     present_check_flip_ptr              check_flip;
    136     present_flip_ptr                    flip;
    137     present_unflip_ptr                  unflip;
    138     present_check_flip2_ptr             check_flip2;
    139 
    140 } present_screen_info_rec, *present_screen_info_ptr;
    141 
    142 /*
    143  * Called when 'event_id' occurs. 'ust' and 'msc' indicate when the
    144  * event actually happened
    145  */
    146 extern _X_EXPORT void
    147 present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc);
    148 
    149 extern _X_EXPORT Bool
    150 present_screen_init(ScreenPtr screen, present_screen_info_ptr info);
    151 
    152 typedef void (*present_complete_notify_proc)(WindowPtr window,
    153                                              CARD8 kind,
    154                                              CARD8 mode,
    155                                              CARD32 serial,
    156                                              uint64_t ust,
    157                                              uint64_t msc);
    158 
    159 extern _X_EXPORT void
    160 present_register_complete_notify(present_complete_notify_proc proc);
    161 
    162 extern _X_EXPORT Bool
    163 present_can_window_flip(WindowPtr window);
    164 
    165 extern _X_EXPORT uint32_t FakeScreenFps;
    166 
    167 #endif /* _PRESENT_H_ */