mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 20:38:06 +02:00
Enable GLX_SGI_make_current_read for radeon.
Added code to track the drawable bound to the context for reading. In addition, when a drawable is initially bound (for reading or drawing) or when the size of the drawable changes, update the size of the framebuffer object that back the drawable (for software fallbacks). Deprecate the old GetBufferSize interface. Bump the driver date. These changes were tested with wincopy on both direct rendering and accelerated indirect rendering (AIGLX).
This commit is contained in:
parent
ec99e716a2
commit
3beaff1e3c
5 changed files with 57 additions and 34 deletions
|
|
@ -70,7 +70,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define need_GL_EXT_secondary_color
|
||||
#include "extension_helper.h"
|
||||
|
||||
#define DRIVER_DATE "20060327"
|
||||
#define DRIVER_DATE "20061018"
|
||||
|
||||
#include "vblank.h"
|
||||
#include "utils.h"
|
||||
|
|
@ -80,21 +80,6 @@ int RADEON_DEBUG = (0);
|
|||
#endif
|
||||
|
||||
|
||||
/* Return the width and height of the given buffer.
|
||||
*/
|
||||
static void radeonGetBufferSize( GLframebuffer *buffer,
|
||||
GLuint *width, GLuint *height )
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
|
||||
|
||||
LOCK_HARDWARE( rmesa );
|
||||
*width = rmesa->dri.drawable->w;
|
||||
*height = rmesa->dri.drawable->h;
|
||||
|
||||
UNLOCK_HARDWARE( rmesa );
|
||||
}
|
||||
|
||||
/* Return various strings for glGetString().
|
||||
*/
|
||||
static const GLubyte *radeonGetString( GLcontext *ctx, GLenum name )
|
||||
|
|
@ -186,7 +171,7 @@ static const struct tnl_pipeline_stage *radeon_pipeline[] = {
|
|||
*/
|
||||
static void radeonInitDriverFuncs( struct dd_function_table *functions )
|
||||
{
|
||||
functions->GetBufferSize = radeonGetBufferSize;
|
||||
functions->GetBufferSize = NULL; /* OBSOLETE */
|
||||
functions->GetString = radeonGetString;
|
||||
}
|
||||
|
||||
|
|
@ -280,7 +265,8 @@ radeonCreateContext( const __GLcontextModes *glVisual,
|
|||
/* Init radeon context data */
|
||||
rmesa->dri.context = driContextPriv;
|
||||
rmesa->dri.screen = sPriv;
|
||||
rmesa->dri.drawable = NULL; /* Set by XMesaMakeCurrent */
|
||||
rmesa->dri.drawable = NULL;
|
||||
rmesa->dri.readable = NULL;
|
||||
rmesa->dri.hwContext = driContextPriv->hHWContext;
|
||||
rmesa->dri.hwLock = &sPriv->pSAREA->lock;
|
||||
rmesa->dri.fd = sPriv->fd;
|
||||
|
|
@ -621,11 +607,17 @@ radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
|
|||
/* XXX we may need to validate the drawable here!!! */
|
||||
driDrawableInitVBlank( driDrawPriv, newCtx->vblank_flags,
|
||||
&newCtx->vbl_seq );
|
||||
}
|
||||
|
||||
if ( (newCtx->dri.drawable != driDrawPriv)
|
||||
|| (newCtx->dri.readable != driReadPriv) ) {
|
||||
newCtx->dri.drawable = driDrawPriv;
|
||||
newCtx->dri.readable = driReadPriv;
|
||||
|
||||
radeonUpdateWindow( newCtx->glCtx );
|
||||
radeonUpdateViewportOffset( newCtx->glCtx );
|
||||
}
|
||||
|
||||
|
||||
_mesa_make_current( newCtx->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate );
|
||||
|
|
|
|||
|
|
@ -496,7 +496,16 @@ struct radeon_dma {
|
|||
struct radeon_dri_mirror {
|
||||
__DRIcontextPrivate *context; /* DRI context */
|
||||
__DRIscreenPrivate *screen; /* DRI screen */
|
||||
__DRIdrawablePrivate *drawable; /* DRI drawable bound to this ctx */
|
||||
|
||||
/**
|
||||
* DRI drawable bound to this context for drawing.
|
||||
*/
|
||||
__DRIdrawablePrivate *drawable;
|
||||
|
||||
/**
|
||||
* DRI drawable bound to this context for reading.
|
||||
*/
|
||||
__DRIdrawablePrivate *readable;
|
||||
|
||||
drm_context_t hwContext;
|
||||
drm_hw_lock_t *hwLock;
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ radeonUpdatePageFlipping( radeonContextPtr rmesa )
|
|||
*/
|
||||
void radeonGetLock( radeonContextPtr rmesa, GLuint flags )
|
||||
{
|
||||
__DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
|
||||
__DRIdrawablePrivate *const drawable = rmesa->dri.drawable;
|
||||
__DRIdrawablePrivate *const readable = rmesa->dri.readable;
|
||||
__DRIscreenPrivate *sPriv = rmesa->dri.screen;
|
||||
drm_radeon_sarea_t *sarea = rmesa->sarea;
|
||||
|
||||
|
|
@ -85,14 +86,17 @@ void radeonGetLock( radeonContextPtr rmesa, GLuint flags )
|
|||
* Since the hardware state depends on having the latest drawable
|
||||
* clip rects, all state checking must be done _after_ this call.
|
||||
*/
|
||||
DRI_VALIDATE_DRAWABLE_INFO( sPriv, dPriv );
|
||||
DRI_VALIDATE_DRAWABLE_INFO( sPriv, drawable );
|
||||
if (drawable != readable) {
|
||||
DRI_VALIDATE_DRAWABLE_INFO( sPriv, readable );
|
||||
}
|
||||
|
||||
if ( rmesa->lastStamp != dPriv->lastStamp ) {
|
||||
if ( rmesa->lastStamp != drawable->lastStamp ) {
|
||||
radeonUpdatePageFlipping( rmesa );
|
||||
radeonSetCliprects( rmesa );
|
||||
radeonUpdateViewportOffset( rmesa->glCtx );
|
||||
driUpdateFramebufferSize(rmesa->glCtx, dPriv);
|
||||
rmesa->lastStamp = dPriv->lastStamp;
|
||||
driUpdateFramebufferSize(rmesa->glCtx, drawable);
|
||||
rmesa->lastStamp = drawable->lastStamp;
|
||||
}
|
||||
|
||||
RADEON_STATECHANGE( rmesa, ctx );
|
||||
|
|
|
|||
|
|
@ -727,6 +727,7 @@ radeonCreateScreen( __DRIscreenPrivate *sPriv )
|
|||
(*glx_enable_extension)( psc, "GLX_MESA_allocate_memory" );
|
||||
|
||||
(*glx_enable_extension)( psc, "GLX_MESA_copy_sub_buffer" );
|
||||
(*glx_enable_extension)( psc, "GLX_SGI_make_current_read" );
|
||||
}
|
||||
|
||||
#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R200)
|
||||
|
|
|
|||
|
|
@ -1635,25 +1635,42 @@ static void radeonLogicOpCode( GLcontext *ctx, GLenum opcode )
|
|||
*/
|
||||
void radeonSetCliprects( radeonContextPtr rmesa )
|
||||
{
|
||||
__DRIdrawablePrivate *dPriv = rmesa->dri.drawable;
|
||||
__DRIdrawablePrivate *const drawable = rmesa->dri.drawable;
|
||||
__DRIdrawablePrivate *const readable = rmesa->dri.readable;
|
||||
GLframebuffer *const draw_fb = (GLframebuffer*) drawable->driverPrivate;
|
||||
GLframebuffer *const read_fb = (GLframebuffer*) readable->driverPrivate;
|
||||
|
||||
if (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]
|
||||
if (draw_fb->_ColorDrawBufferMask[0]
|
||||
== BUFFER_BIT_BACK_LEFT) {
|
||||
/* Can't ignore 2d windows if we are page flipping.
|
||||
*/
|
||||
if ( dPriv->numBackClipRects == 0 || rmesa->doPageFlip ) {
|
||||
rmesa->numClipRects = dPriv->numClipRects;
|
||||
rmesa->pClipRects = dPriv->pClipRects;
|
||||
if ( drawable->numBackClipRects == 0 || rmesa->doPageFlip ) {
|
||||
rmesa->numClipRects = drawable->numClipRects;
|
||||
rmesa->pClipRects = drawable->pClipRects;
|
||||
}
|
||||
else {
|
||||
rmesa->numClipRects = dPriv->numBackClipRects;
|
||||
rmesa->pClipRects = dPriv->pBackClipRects;
|
||||
rmesa->numClipRects = drawable->numBackClipRects;
|
||||
rmesa->pClipRects = drawable->pBackClipRects;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* front buffer (or none, or multiple buffers */
|
||||
rmesa->numClipRects = dPriv->numClipRects;
|
||||
rmesa->pClipRects = dPriv->pClipRects;
|
||||
rmesa->numClipRects = drawable->numClipRects;
|
||||
rmesa->pClipRects = drawable->pClipRects;
|
||||
}
|
||||
|
||||
if ((draw_fb->Width != drawable->w) || (draw_fb->Height != drawable->h)) {
|
||||
_mesa_resize_framebuffer(&rmesa->glCtx, draw_fb,
|
||||
drawable->w, drawable->h);
|
||||
draw_fb->Initialized = GL_TRUE;
|
||||
}
|
||||
|
||||
if (drawable != readable) {
|
||||
if ((read_fb->Width != readable->w) || (read_fb->Height != readable->h)) {
|
||||
_mesa_resize_framebuffer(&rmesa->glCtx, read_fb,
|
||||
readable->w, readable->h);
|
||||
read_fb->Initialized = GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (rmesa->state.scissor.enabled)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue