~ubuntu-branches/ubuntu/precise/mesa/precise-updates

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/tdfx/tdfx_lock.c

  • Committer: Package Import Robot
  • Author(s): Robert Hooker
  • Date: 2012-02-02 12:05:48 UTC
  • mfrom: (1.7.1) (3.3.27 sid)
  • Revision ID: package-import@ubuntu.com-20120202120548-nvkma85jq0h4coix
Tags: 8.0~rc2-0ubuntu4
Drop drisearchdir handling, it is no longer needed with multiarch
and dri-alternates being removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c; c-basic-offset: 3 -*-
2
 
 *
3
 
 * Copyright 2000 VA Linux Systems Inc., Fremont, California.
4
 
 *
5
 
 * All Rights Reserved.
6
 
 *
7
 
 * Permission is hereby granted, free of charge, to any person obtaining a
8
 
 * copy of this software and associated documentation files (the "Software"),
9
 
 * to deal in the Software without restriction, including without limitation
10
 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
 
 * and/or sell copies of the Software, and to permit persons to whom the
12
 
 * Software is furnished to do so, subject to the following conditions:
13
 
 *
14
 
 * The above copyright notice and this permission notice (including the next
15
 
 * paragraph) shall be included in all copies or substantial portions of the
16
 
 * Software.
17
 
 *
18
 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
 
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21
 
 * VA LINUX SYSTEMS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22
 
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
23
 
 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
 
 * SOFTWARE.
25
 
 */
26
 
 
27
 
/*
28
 
 * Original rewrite:
29
 
 *      Gareth Hughes <gareth@valinux.com>, 29 Sep - 1 Oct 2000
30
 
 *
31
 
 * Authors:
32
 
 *      Gareth Hughes <gareth@valinux.com>
33
 
 *
34
 
 */
35
 
 
36
 
#include "tdfx_context.h"
37
 
#include "tdfx_lock.h"
38
 
#include "tdfx_state.h"
39
 
#include "tdfx_render.h"
40
 
#include "tdfx_texman.h"
41
 
 
42
 
#include "drirenderbuffer.h"
43
 
 
44
 
 
45
 
void tdfxGetLock( tdfxContextPtr fxMesa )
46
 
{
47
 
    __DRIcontext *cPriv = fxMesa->driContext;
48
 
    __DRIdrawable *const drawable = cPriv->driDrawablePriv;
49
 
    __DRIdrawable *const readable = cPriv->driReadablePriv;
50
 
    __DRIscreen *sPriv = drawable->driScreenPriv;
51
 
    TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) (((char *) sPriv->pSAREA) +
52
 
                                        fxMesa->fxScreen->sarea_priv_offset);
53
 
    unsigned int stamp = drawable->lastStamp;
54
 
 
55
 
    drmGetLock( fxMesa->driFd, fxMesa->hHWContext, 0 );
56
 
 
57
 
    /* This macro will update drawable's cliprects if needed */
58
 
    DRI_VALIDATE_DRAWABLE_INFO(sPriv, drawable);
59
 
    if (drawable != readable) {
60
 
        DRI_VALIDATE_DRAWABLE_INFO(sPriv, readable);
61
 
    }
62
 
 
63
 
    if ( saPriv->fifoOwner != fxMesa->hHWContext ) {
64
 
        fxMesa->Glide.grDRIImportFifo( saPriv->fifoPtr, saPriv->fifoRead );
65
 
    }
66
 
 
67
 
    if ( saPriv->ctxOwner != fxMesa->hHWContext ) {
68
 
        /* This sequence looks a little odd. Glide mirrors the state, and
69
 
         * when you get the state you are forcing the mirror to be up to
70
 
         * date, and then getting a copy from the mirror. You can then force
71
 
         * that state onto the hardware when you set the state.
72
 
         */
73
 
        void *state;
74
 
        FxI32 stateSize;
75
 
        fxMesa->Glide.grGet(GR_GLIDE_STATE_SIZE, 4, &stateSize);
76
 
        state = malloc(stateSize);
77
 
        fxMesa->Glide.grGlideGetState( state );
78
 
        fxMesa->Glide.grGlideSetState( state );
79
 
        free( state );
80
 
    }
81
 
 
82
 
#if 0
83
 
    if ( saPriv->texOwner != fxMesa->hHWContext ) {
84
 
        tdfxTMRestoreTextures_NoLock( fxMesa );
85
 
    }
86
 
#endif
87
 
 
88
 
    if ((*drawable->pStamp != stamp)
89
 
        || (saPriv->ctxOwner != fxMesa->hHWContext)) {
90
 
       driUpdateFramebufferSize(fxMesa->glCtx, drawable);
91
 
       if (drawable != readable) {
92
 
           driUpdateFramebufferSize(fxMesa->glCtx, readable);
93
 
       }
94
 
 
95
 
       tdfxUpdateClipping(fxMesa->glCtx);
96
 
       tdfxUploadClipping(fxMesa);
97
 
    }
98
 
 
99
 
    DEBUG_LOCK();
100
 
}