1XXX - Not complete yet!!! 2 3Name 4 5 SGI_cushion 6 7Name Strings 8 9 GLX_SGI_cushion 10 11Version 12 13 $Date: 1997/10/13 21:16:02 $ $Revision: 1.3 $ 14 15Number 16 17 62 18 19Dependencies 20 21 SGI_swap_control is required 22 SGIX_fbconfig affects the definition of this extension 23 24Overview 25 26 This extension is directed at constant frame-rate applications. Such 27 applications are written to ensure that a new image is generated every 28 N video frame periods, where N is itself a small constant integer. 29 If the application is unable to generate a frame within N video frame 30 periods, it is said to have dropped a frame. Dropping a frame is a 31 *bad thing*. 32 33 Constant frame-rate applications make every effort to avoid dropping 34 frames. In particular, they monitor the utilization of graphics 35 resources during the rendering of the current frame in order to predict 36 the behavior of subsequent frames. If such prediction indicates that 37 a frame may be dropped, the rendering complexity of the frame is 38 reduced (e.g. by using models of lower geometric resolution) so as to 39 avoid the overload condition. 40 41 Unfortunately, because exact prediction is not possible, and because 42 there is no elasticity in the buffering of images, it is necessary 43 for constant frame-rate applications to under utilize the graphics 44 hardware. This extension adds elasticity to the buffering of completed 45 images, in order to allow constant frame-rate applications to make full 46 use of the available graphics computation without dropping frames. 47 It further allows this elasticity to be controlled by the application in 48 order to minimize the introduction of latency that could otherwise 49 occur. 50 51 Applications that will benefit from this extension include simulation, 52 walk-through, and multimedia playback. 53 54 WARNING - Silicon Graphics has filed for patent protection for some 55 of the techniques described in this extension document. 56 57Issues 58 59 * This spec should talk about the vertical retrace interrupt, but I 60 can't find any mention of it in any other extension. Where is such 61 an interrupt specified? 62 63 * Are additional queries of rendering performance required to make 64 extension useful? 65 66 * How should this extension interact with SGI_video_sync? 67 68 * How is the cushion value queried? 69 70 * Can this be implemented efficiently on current hardware systems? 71 72New Procedures and Functions 73 74 void glXCushionSGI(Display *dpy, Window window, float cushion); 75 76New Tokens 77 78 Accepted by the <attribList> parameter of glXChooseVisual, and by the 79 <attrib> parameter of glXGetConfig: 80 81 GLX_CUSHION_BUFFERS_SGI 82 83Additions to Chapter 2 of the 1.0 Specification (OpenGL Operation) 84 85 None 86 87Additions to Chapter 3 of the 1.0 Specification (Rasterization) 88 89 None 90 91Additions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations 92and the Frame Buffer) 93 94 None 95 96Additions to Chapter 5 of the 1.0 Specification (Special Functions) 97 98 None 99 100Additions to Chapter 6 of the 1.0 Specification (State and State Requests) 101 102 None 103 104Additions to the GLX Specification 105 106 This extension increases the number of color buffers of a double 107 buffered visual. The additional buffers are referred to as cushion 108 buffers. It is not possible for an application to directly access 109 a cushion buffer -- access is provided only to the front and back 110 buffers (as before). 111 112 When glXSwapBuffers is executed, the contents of the back buffer are 113 transferred to the front buffer, which is itself appended onto a queue 114 of displayable buffers. However, the contents of the front buffer 115 will not typically be transferred to the back buffer. Instead, the 116 contents of the back buffer are undefined. Said another way, the 117 front buffer is the color buffer most recently appended to the queue 118 of displayable buffers, and the back buffer is the color buffer that 119 will next be appended to this queue. 120 121 When a buffer is appended onto the queue of displayable buffers, the 122 current value of the swap interval (specified by glXSwapIntervalSGI) is 123 stored with it. The display is always driven by the oldest displayable 124 buffer in the queue of displayable buffers. After the oldest buffer in 125 the queue has been displayed for its specified number of video frame 126 periods, it is removed from the queue, exposing the next-to-oldest 127 buffer for display. If there is only one buffer in the queue of 128 displayable buffers, the removal is deferred until another buffer 129 becomes displayable, and then until the next video frame boundary. 130 131 Cushion buffers are used to store displayable buffers on the queue. 132 There can be at most N+1 buffers in the queue of displayable buffers, 133 where N is the number of cushion buffers. N is queried by calling 134 glXGetConfig with <attrib> set to GLX_CUSHION_BUFFERS_SGI. 135 136 The new command 137 138 voidglXCushionSGI(Display *dpy, Window window, float cushion) 139 140 specifies a cushion value for a window. This value is silently clamped 141 to the continuous range [0,N], where N is the number of cushion buffers. 142 When a window is created, the cushion value is initialized to zero. 143 144 Let the remaining display time T for a buffer in the queue of 145 displayable buffers be the swap interval value for that buffer, minus 146 the (fractional) number of video periods that the buffer has already 147 been displayed. If T thus defined would be negative, then let T be 148 the fraction of the current video display period that remains. (During 149 the "vertical retrace period" this fraction is zero.) Let Q be the sum 150 of the remaining display times T for each buffer in the queue of 151 displayable buffers. If Q is greater than the product of the current 152 cushion value and the current swap interval, then glXSwapBuffers stalls 153 until at least the moment that Q becomes less than this product. While 154 glXSwapBuffers is stalled, the queueing of the back buffer as the next 155 displayable buffer is deferred, and the calling process is either not 156 allowed to proceed (glXSwapBuffers doesn't return) or the subsequent GL 157 command is not allowed to be issued. 158 159 (An interrupt could be generated at the moment that Q becomes equal to 160 the product of the current cushion value and the current swap interval.) 161 162 The <attribList> parameter of glXChooseVisual may include 163 GLX_CUSHION_BUFFERS_SGI, followed by an integer specifying the minimum 164 number of cushion buffers. (If GLX_CUSHION_BUFFERS_SGI is not included 165 in the attribute list, then the minimum is zero.) glXChooseVisual gives 166 preference to the conforming visual with the smallest number of cushion 167 buffers that is greater than or equal to the specified minimum. 168 169 Notes 170 ----- 171 172 * This extension is designed so that cushion buffers can be added 173 to existing visuals. It is intended that the semantics of this 174 extension be identical to the pre-extension semantics while the 175 cushion value is zero. Cushion buffers need not be allocated 176 until the cushion is set greater than zero. 177 178 * The extension can be implemented with data copies, in which case 179 a potentially large number of cushion buffers can be supported. 180 Or it can be implemented using the 4 stereo buffers (and while 181 holding the left/right signal constant at right). Using the 182 stereo buffers eliminates the need for data copies, thus 183 increasing the performance. 184 185 * This specification applies to both mono and stereo visuals, 186 but implementations will probably not support stereo visuals. 187 188 * An implementation can support the extension without providing 189 any cushion buffer visuals. 190 191GLX Protocol 192 193 XXX - not done yet 194 195Dependencies on SGI_swap_control 196 197 This extension requires SGI_swap_control. 198 199Dependencies on SGI_video_sync 200 201 XXX - not done yet 202 203Dependencies on SGIX_fbconfig 204 205 XXX - not done yet 206 207Errors 208 209 XXX - not done yet 210 211New State 212 Initial 213 Get Value Get Command Type Value Attrib 214 --------- ----------- ---- ------- ------ 215 GLX_CUSHION_SGI ? Z+ 0.0 window state 216 217New Implementation Dependent State 218 219 None 220