Changeset 69310 in vbox for trunk/src/VBox/Additions/common/crOpenGL/dri_util.c
- Timestamp:
- Oct 25, 2017 2:24:45 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/crOpenGL/dri_util.c
r64525 r69310 8 8 * useful stuff is done here that otherwise would have to be duplicated in most 9 9 * drivers. 10 * 10 * 11 11 * Basically, these utility functions take care of some of the dirty details of 12 12 * screen initialization, context creation, context binding, DRM setup, etc. … … 48 48 /** 49 49 * Print message to \c stderr if the \c LIBGL_DEBUG environment variable 50 * is set. 51 * 50 * is set. 51 * 52 52 * Is called from the drivers. 53 * 53 * 54 54 * \param f \c printf like format string. 55 55 */ … … 88 88 /** 89 89 * Unbind context. 90 * 90 * 91 91 * \param scrn the screen. 92 92 * \param gc context. 93 93 * 94 94 * \return \c GL_TRUE on success, or \c GL_FALSE on failure. 95 * 95 * 96 96 * \internal 97 97 * This function calls __DriverAPIRec::UnbindContext, and then decrements 98 98 * __DRIdrawablePrivateRec::refcount which must be non-zero for a successful 99 99 * return. 100 * 100 * 101 101 * While casting the opaque private pointers associated with the parameters 102 * into their respective real types it also assures they are not \c NULL. 102 * into their respective real types it also assures they are not \c NULL. 103 103 */ 104 104 static int driUnbindContext(__DRIcontext *pcp) … … 197 197 DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); 198 198 } 199 199 200 200 if ((pdp != prp) && (!prp->pStamp || *prp->pStamp != prp->lastStamp)) { 201 201 DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); … … 223 223 * 224 224 * \param pdp pointer to the private drawable information to update. 225 * 225 * 226 226 * This function basically updates the __DRIdrawablePrivate struct's 227 227 * cliprect information by calling \c __DRIinterfaceMethods::getDrawableInfo. … … 236 236 __DRIscreenPrivate *psp = pdp->driScreenPriv; 237 237 __DRIcontextPrivate *pcp = pdp->driContextPriv; 238 239 if (!pcp 238 239 if (!pcp 240 240 || ((pdp != pcp->driDrawablePriv) && (pdp != pcp->driReadablePriv))) { 241 /* ERROR!!! 241 /* ERROR!!! 242 242 * ...but we must ignore it. There can be many contexts bound to a 243 243 * drawable. … … 246 246 247 247 if (pdp->pClipRects) { 248 _mesa_free(pdp->pClipRects); 248 _mesa_free(pdp->pClipRects); 249 249 pdp->pClipRects = NULL; 250 250 } 251 251 252 252 if (pdp->pBackClipRects) { 253 _mesa_free(pdp->pBackClipRects); 253 _mesa_free(pdp->pBackClipRects); 254 254 pdp->pBackClipRects = NULL; 255 255 } … … 330 330 case DRI2_EVENT_BUFFER_ATTACH: 331 331 ba = (__DRIBufferAttachEvent *) p; 332 if (ba->drawable == pdp->dri2.drawable_id && 332 if (ba->drawable == pdp->dri2.drawable_id && 333 333 ba->buffer.attachment == DRI_DRAWABLE_BUFFER_FRONT_LEFT) 334 334 last_ba = ba; … … 336 336 } 337 337 } 338 338 339 339 if (last_dc) { 340 340 if (pdp->w != last_dc->width || pdp->h != last_dc->height) … … 449 449 * 450 450 * \param drawablePrivate opaque pointer to the per-drawable private info. 451 * 451 * 452 452 * \internal 453 453 * This function calls __DRIdrawablePrivate::swapBuffers. 454 * 454 * 455 455 * Is called directly from glXSwapBuffers(). 456 456 */ … … 595 595 /* This special default value is replaced with the configured 596 596 * default value when the drawable is first bound to a direct 597 * rendering context. 597 * rendering context. 598 598 */ 599 599 pdp->swap_interval = (unsigned)-1; … … 651 651 /** 652 652 * Destroy the per-context private information. 653 * 653 * 654 654 * \internal 655 655 * This function calls __DriverAPIRec::DestroyContext on \p contextPrivate, calls … … 668 668 /** 669 669 * Create the per-drawable private driver information. 670 * 670 * 671 671 * \param render_type Type of rendering target. \c GLX_RGBA is the only 672 672 * type likely to ever be supported for direct-rendering. … … 675 675 * \returns An opaque pointer to the per-context private information on 676 676 * success, or \c NULL on failure. 677 * 677 * 678 678 * \internal 679 679 * This function allocates and fills a __DRIcontextPrivateRec structure. It … … 685 685 static __DRIcontext * 686 686 driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config, 687 int render_type, __DRIcontext *shared, 687 int render_type, __DRIcontext *shared, 688 688 drm_context_t hwContext, void *data) 689 689 { … … 756 756 /** 757 757 * Destroy the per-screen private information. 758 * 758 * 759 759 * \internal 760 760 * This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls … … 813 813 * 814 814 * For legacy DRI. 815 * 815 * 816 816 * \param scrn Index of the screen 817 817 * \param ddx_version Version of the 2D DDX. This may not be meaningful for … … 826 826 * \param driver_modes Returns modes supported by the driver 827 827 * \param loaderPrivate ?? 828 * 828 * 829 829 * \note There is no need to check the minimum API version in this 830 830 * function. Since the name of this function is versioned, it is … … 837 837 const __DRIversion *drm_version, 838 838 const __DRIframebuffer *frame_buffer, 839 drmAddress pSAREA, int fd, 839 drmAddress pSAREA, int fd, 840 840 const __DRIextension **extensions, 841 841 const __DRIconfig ***driver_modes, … … 1049 1049 { __DRI_FRAME_TRACKING, __DRI_FRAME_TRACKING_VERSION }, 1050 1050 driFrameTracking, 1051 driQueryFrameTracking 1051 driQueryFrameTracking 1052 1052 }; 1053 1053 1054 1054 /** 1055 1055 * Calculate amount of swap interval used between GLX buffer swaps. 1056 * 1056 * 1057 1057 * The usage value, on the range [0,max], is the fraction of total swap 1058 1058 * interval time used between GLX buffer swaps is calculated. 1059 1059 * 1060 1060 * \f$p = t_d / (i * t_r)\f$ 1061 * 1061 * 1062 1062 * Where \f$t_d\f$ is the time since the last GLX buffer swap, \f$i\f$ is the 1063 1063 * swap interval (as set by \c glXSwapIntervalSGI), and \f$t_r\f$ time 1064 1064 * required for a single vertical refresh period (as returned by \c 1065 1065 * glXGetMscRateOML). 1066 * 1066 * 1067 1067 * See the documentation for the GLX_MESA_swap_frame_usage extension for more 1068 1068 * details. … … 1076 1076 * 1077 1077 * \sa glXSwapIntervalSGI glXGetMscRateOML 1078 * 1078 * 1079 1079 * \todo Instead of caching the \c glXGetMscRateOML function pointer, would it 1080 1080 * be possible to cache the sync rate? … … 1111 1111 usage /= 1000000.0; 1112 1112 } 1113 1113 1114 1114 return usage; 1115 1115 }
Note:
See TracChangeset
for help on using the changeset viewer.