radeon: Drop dri2 checks now that it's always true.

This makes LOCK_HARDWARE empty, so it goes away.
This commit is contained in:
Eric Anholt 2011-10-14 12:49:59 -07:00
parent fb52b4303d
commit 53b382637c
16 changed files with 0 additions and 349 deletions

View file

@ -20,7 +20,6 @@ RADEON_COMMON_SOURCES = \
radeon_dma.c \
radeon_debug.c \
radeon_fbo.c \
radeon_lock.c \
radeon_mipmap_tree.c \
radeon_pixel_read.c \
radeon_queryobj.c \

View file

@ -54,8 +54,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_screen.h"
#include "radeon_common.h"
#include "radeon_lock.h"
struct r200_context;
typedef struct r200_context r200ContextRec;
typedef struct r200_context *r200ContextPtr;

View file

@ -44,7 +44,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_common.h"
#include "radeon_lock.h"
#include "r200_context.h"
#include "r200_ioctl.h"
#include "radeon_reg.h"
@ -60,7 +59,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
static void r200Clear( struct gl_context *ctx, GLbitfield mask )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
GLuint flags = 0;
GLuint orig_mask = mask;
@ -71,13 +69,6 @@ static void r200Clear( struct gl_context *ctx, GLbitfield mask )
fprintf( stderr, "r200Clear %x radeon->sarea is NULL\n", mask);
}
{
LOCK_HARDWARE( &rmesa->radeon );
UNLOCK_HARDWARE( &rmesa->radeon );
if ( dPriv->numClipRects == 0 )
return;
}
radeonFlush( ctx );
if ( mask & BUFFER_BIT_FRONT_LEFT ) {

View file

@ -851,8 +851,6 @@ r200PointsBitmap( struct gl_context *ctx, GLint px, GLint py,
/* Update window height
*/
LOCK_HARDWARE( &rmesa->radeon );
UNLOCK_HARDWARE( &rmesa->radeon );
h = radeon_get_drawable(&rmesa->radeon)->h + radeon_get_drawable(&rmesa->radeon)->y;
px += radeon_get_drawable(&rmesa->radeon)->x;

View file

@ -1 +0,0 @@
../radeon/radeon_lock.c

View file

@ -1 +0,0 @@
../radeon/radeon_lock.h

View file

@ -21,7 +21,6 @@ RADEON_COMMON_SOURCES = \
radeon_dma.c \
radeon_debug.c \
radeon_fbo.c \
radeon_lock.c \
radeon_mipmap_tree.c \
radeon_pixel_read.c \
radeon_queryobj.c \

View file

@ -54,7 +54,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_common.h"
#include "radeon_bocs_wrapper.h"
#include "radeon_lock.h"
#include "radeon_drm.h"
#include "radeon_queryobj.h"
@ -277,58 +276,6 @@ uint32_t radeonGetAge(radeonContextPtr radeon)
return age;
}
/* wait for idle */
void radeonWaitForIdleLocked(radeonContextPtr radeon)
{
int ret;
int i = 0;
do {
ret = drmCommandNone(radeon->dri.fd, DRM_RADEON_CP_IDLE);
if (ret)
DO_USLEEP(1);
} while (ret && ++i < 100);
if (ret < 0) {
UNLOCK_HARDWARE(radeon);
fprintf(stderr, "Error: R300 timed out... exiting\n");
exit(-1);
}
}
static void radeon_flip_renderbuffers(struct radeon_framebuffer *rfb)
{
int current_page = rfb->pf_current_page;
int next_page = (current_page + 1) % rfb->pf_num_pages;
struct gl_renderbuffer *tmp_rb;
/* Exchange renderbuffers if necessary but make sure their
* reference counts are preserved.
*/
if (rfb->color_rb[current_page] &&
rfb->base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer !=
&rfb->color_rb[current_page]->base) {
tmp_rb = NULL;
_mesa_reference_renderbuffer(&tmp_rb,
rfb->base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer);
tmp_rb = &rfb->color_rb[current_page]->base;
_mesa_reference_renderbuffer(&rfb->base.Attachment[BUFFER_FRONT_LEFT].Renderbuffer, tmp_rb);
_mesa_reference_renderbuffer(&tmp_rb, NULL);
}
if (rfb->color_rb[next_page] &&
rfb->base.Attachment[BUFFER_BACK_LEFT].Renderbuffer !=
&rfb->color_rb[next_page]->base) {
tmp_rb = NULL;
_mesa_reference_renderbuffer(&tmp_rb,
rfb->base.Attachment[BUFFER_BACK_LEFT].Renderbuffer);
tmp_rb = &rfb->color_rb[next_page]->base;
_mesa_reference_renderbuffer(&rfb->base.Attachment[BUFFER_BACK_LEFT].Renderbuffer, tmp_rb);
_mesa_reference_renderbuffer(&tmp_rb, NULL);
}
}
/**
* Check if we're about to draw into the front color buffer.
* If so, set the intel->front_buffer_dirty field to true.
@ -556,27 +503,10 @@ void radeonReadBuffer( struct gl_context *ctx, GLenum mode )
}
}
/* Turn on/off page flipping according to the flags in the sarea:
*/
void radeonUpdatePageFlipping(radeonContextPtr radeon)
{
struct radeon_framebuffer *rfb = radeon_get_drawable(radeon)->driverPrivate;
rfb->pf_active = radeon->sarea->pfState;
rfb->pf_current_page = radeon->sarea->pfCurrentPage;
rfb->pf_num_pages = 2;
radeon_flip_renderbuffers(rfb);
radeon_draw_buffer(radeon->glCtx, radeon->glCtx->DrawBuffer);
}
void radeon_window_moved(radeonContextPtr radeon)
{
/* Cliprects has to be updated before doing anything else */
radeonSetCliprects(radeon);
if (!radeon->radeonScreen->driScreen->dri2.enabled) {
radeonUpdatePageFlipping(radeon);
}
}
void radeon_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei height)
@ -862,9 +792,7 @@ int rcommonFlushCmdBuf(radeonContextPtr rmesa, const char *caller)
radeonReleaseDmaRegions(rmesa);
LOCK_HARDWARE(rmesa);
ret = rcommonFlushCmdBufLocked(rmesa, caller);
UNLOCK_HARDWARE(rmesa);
if (ret) {
fprintf(stderr, "drmRadeonCmdBuffer: %d. Kernel failed to "

View file

@ -11,11 +11,8 @@ void radeonSetCliprects(radeonContextPtr radeon);
void radeonUpdateScissor( struct gl_context *ctx );
void radeonScissor(struct gl_context* ctx, GLint x, GLint y, GLsizei w, GLsizei h);
void radeonWaitForIdleLocked(radeonContextPtr radeon);
extern uint32_t radeonGetAge(radeonContextPtr radeon);
void radeonUpdatePageFlipping(radeonContextPtr rmesa);
void radeonFlush(struct gl_context *ctx);
void radeonFinish(struct gl_context * ctx);
void radeonEmitState(radeonContextPtr radeon);

View file

@ -60,8 +60,6 @@ struct r100_context;
typedef struct r100_context r100ContextRec;
typedef struct r100_context *r100ContextPtr;
#include "radeon_lock.h"
#define R100_TEX_ALL 0x7

View file

@ -328,11 +328,6 @@ void radeonReleaseDmaRegions(radeonContextPtr rmesa)
__FUNCTION__, free, wait, reserved, rmesa->dma.minimum_size);
}
if (!rmesa->radeonScreen->driScreen->dri2.enabled) {
/* request updated cs processing information from kernel */
legacy_track_pending(rmesa->radeonScreen->bom, 0);
}
/* move waiting bos to free list.
wait list provides gpu time to handle data before reuse */
foreach_s(dma_bo, temp, &rmesa->dma.wait) {

View file

@ -383,7 +383,6 @@ void radeonEmitAOS( r100ContextPtr rmesa,
static void radeonClear( struct gl_context *ctx, GLbitfield mask )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
__DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
GLuint flags = 0;
GLuint orig_mask = mask;
@ -395,13 +394,6 @@ static void radeonClear( struct gl_context *ctx, GLbitfield mask )
fprintf( stderr, "radeonClear\n");
}
{
LOCK_HARDWARE( &rmesa->radeon );
UNLOCK_HARDWARE( &rmesa->radeon );
if ( dPriv->numClipRects == 0 )
return;
}
radeon_firevertices(&rmesa->radeon);
if ( mask & BUFFER_BIT_FRONT_LEFT ) {

View file

@ -37,7 +37,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define __RADEON_IOCTL_H__
#include "main/simple_list.h"
#include "radeon_lock.h"
#include "radeon_bocs_wrapper.h"
extern void radeonEmitVertexAOS( r100ContextPtr rmesa,

View file

@ -1,156 +0,0 @@
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
VA Linux Systems Inc., Fremont, California.
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
The Weather Channel (TM) funded Tungsten Graphics to develop the
initial release of the Radeon 8500 driver under the XFree86 license.
This notice must be preserved.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Gareth Hughes <gareth@valinux.com>
* Keith Whitwell <keith@tungstengraphics.com>
* Kevin E. Martin <martin@valinux.com>
*/
#include "main/glheader.h"
#include "main/mtypes.h"
#include "main/colormac.h"
#include "dri_util.h"
#include "radeon_screen.h"
#include "radeon_common.h"
#include "radeon_lock.h"
/* Update the hardware state. This is called if another context has
* grabbed the hardware lock, which includes the X server. This
* function also updates the driver's window state after the X server
* moves, resizes or restacks a window -- the change will be reflected
* in the drawable position and clip rects. Since the X server grabs
* the hardware lock when it changes the window state, this routine will
* automatically be called after such a change.
*/
void radeonGetLock(radeonContextPtr rmesa, GLuint flags)
{
__DRIdrawable *const drawable = radeon_get_drawable(rmesa);
__DRIdrawable *const readable = radeon_get_readable(rmesa);
__DRIscreen *sPriv = rmesa->dri.screen;
drmGetLock(rmesa->dri.fd, rmesa->dri.hwContext, flags);
/* The window might have moved, so we might need to get new clip
* rects.
*
* NOTE: This releases and regrabs the hw lock to allow the X server
* to respond to the DRI protocol request for new drawable info.
* Since the hardware state depends on having the latest drawable
* clip rects, all state checking must be done _after_ this call.
*/
if (drawable)
DRI_VALIDATE_DRAWABLE_INFO(sPriv, drawable);
if (readable && drawable != readable) {
DRI_VALIDATE_DRAWABLE_INFO(sPriv, readable);
}
if (drawable && (rmesa->lastStamp != drawable->lastStamp)) {
radeon_window_moved(rmesa);
rmesa->lastStamp = drawable->lastStamp;
}
rmesa->vtbl.get_lock(rmesa);
}
#ifndef NDEBUG
struct lock_debug {
const char* function;
const char* file;
int line;
};
static struct lock_debug ldebug = {0};
#endif
#if 0
/** TODO: use atomic operations for reference counting **/
/** gcc 4.2 has builtin functios for this **/
#define ATOMIC_INC_AND_FETCH(atomic) __sync_add_and_fetch(&atomic, 1)
#define ATOMIC_DEC_AND_FETCH(atomic) __sync_sub_and_fetch(&atomic, 1)
#else
#define ATOMIC_INC_AND_FETCH(atomic) (++atomic)
#define ATOMIC_DEC_AND_FETCH(atomic) (--atomic)
#endif
void radeon_lock_hardware(radeonContextPtr radeon
#ifndef NDEBUG
,const char* function
,const char* file
,const int line
#endif
)
{
char ret = 0;
if (!radeon->radeonScreen->driScreen->dri2.enabled) {
if (ATOMIC_INC_AND_FETCH(radeon->dri.hwLockCount) > 1)
{
#ifndef NDEBUG
if ( RADEON_DEBUG & RADEON_SANITY )
fprintf(stderr, "*** %d times of recursive call to %s ***\n"
"Original call was from %s (file: %s line: %d)\n"
"Now call is coming from %s (file: %s line: %d)\n"
, radeon->dri.hwLockCount, __FUNCTION__
, ldebug.function, ldebug.file, ldebug.line
, function, file, line
);
#endif
return;
}
DRM_CAS(radeon->dri.hwLock, radeon->dri.hwContext,
(DRM_LOCK_HELD | radeon->dri.hwContext), ret );
if (ret)
radeonGetLock(radeon, 0);
#ifndef NDEBUG
ldebug.function = function;
ldebug.file = file;
ldebug.line = line;
#endif
}
}
void radeon_unlock_hardware(radeonContextPtr radeon)
{
if (!radeon->radeonScreen->driScreen->dri2.enabled) {
if (ATOMIC_DEC_AND_FETCH(radeon->dri.hwLockCount) > 0)
{
return;
}
DRM_UNLOCK( radeon->dri.fd,
radeon->dri.hwLock,
radeon->dri.hwContext );
}
}

View file

@ -1,69 +0,0 @@
/**************************************************************************
Copyright 2000, 2001 ATI Technologies Inc., Ontario, Canada, and
VA Linux Systems Inc., Fremont, California.
Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
The Weather Channel (TM) funded Tungsten Graphics to develop the
initial release of the Radeon 8500 driver under the XFree86 license.
This notice must be preserved.
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
/*
* Authors:
* Gareth Hughes <gareth@valinux.com>
* Keith Whitwell <keith@tungstengraphics.com>
* Kevin E. Martin <martin@valinux.com>
*/
#ifndef COMMON_LOCK_H
#define COMMON_LOCK_H
#include "main/colormac.h"
#include "radeon_screen.h"
#include "radeon_common.h"
extern void radeonGetLock(radeonContextPtr rmesa, GLuint flags);
void radeon_lock_hardware(radeonContextPtr rmesa
#ifndef NDEBUG
,const char* function
,const char* file
,const int line
#endif
);
void radeon_unlock_hardware(radeonContextPtr rmesa);
/* Lock the hardware and validate our state.
*/
#ifdef NDEBUG
#define LOCK_HARDWARE( rmesa ) radeon_lock_hardware(rmesa)
#else
#define LOCK_HARDWARE( rmesa ) radeon_lock_hardware(rmesa, __FUNCTION__, __FILE__, __LINE__)
#endif
#define UNLOCK_HARDWARE( rmesa ) radeon_unlock_hardware(rmesa)
#endif

View file

@ -45,7 +45,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "swrast/swrast.h"
#include "radeon_common.h"
#include "radeon_lock.h"
#include "radeon_span.h"
#define DBG 0
@ -608,16 +607,6 @@ static void radeonSpanRenderStart(struct gl_context * ctx)
radeon_firevertices(rmesa);
/* The locking and wait for idle should really only be needed in classic mode.
* In a future memory manager based implementation, this should become
* unnecessary due to the fact that mapping our buffers, textures, etc.
* should implicitly wait for any previous rendering commands that must
* be waited on. */
if (!rmesa->radeonScreen->driScreen->dri2.enabled) {
LOCK_HARDWARE(rmesa);
radeonWaitForIdleLocked(rmesa);
}
for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
if (ctx->Texture.Unit[i]._ReallyEnabled)
ctx->Driver.MapTexture(ctx, ctx->Texture.Unit[i]._Current);
@ -630,7 +619,6 @@ static void radeonSpanRenderStart(struct gl_context * ctx)
static void radeonSpanRenderFinish(struct gl_context * ctx)
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
int i;
_swrast_flush(ctx);
@ -643,10 +631,6 @@ static void radeonSpanRenderFinish(struct gl_context * ctx)
radeon_map_unmap_framebuffer(ctx, ctx->DrawBuffer, GL_FALSE);
if (ctx->ReadBuffer != ctx->DrawBuffer)
radeon_map_unmap_framebuffer(ctx, ctx->ReadBuffer, GL_FALSE);
if (!rmesa->radeonScreen->driScreen->dri2.enabled) {
UNLOCK_HARDWARE(rmesa);
}
}
void radeonInitSpanFuncs(struct gl_context * ctx)