~ubuntu-branches/ubuntu/natty/mesa/natty-proposed

« back to all changes in this revision

Viewing changes to src/gallium/drivers/nouveau/nouveau_util.h

  • Committer: Bazaar Package Importer
  • Author(s): Robert Hooker, Robert Hooker, Christopher James Halse Rogers
  • Date: 2010-09-14 08:55:40 UTC
  • mfrom: (1.2.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20100914085540-m4fpl0hdjlfd4jgz
Tags: 7.9~git20100909-0ubuntu1
[ Robert Hooker ]
* New upstream git snapshot up to commit 94118fe2d4b1e5 (LP: #631413)
* New features include ATI HD5xxx series support in r600, and a vastly
  improved glsl compiler.
* Remove pre-generated .pc's, use the ones generated at build time
  instead.
* Remove all references to mesa-utils now that its no longer shipped
  with the mesa source.
* Disable the experimental ARB_fragment_shader option by default on
  i915, it exposes incomplete functionality that breaks KDE compositing
  among other things. It can be enabled via driconf still. (LP: #628930).

[ Christopher James Halse Rogers ]
* debian/patches/04_osmesa_version.diff:
  - Refresh for new upstream
* Bugs fixed in this release:
  - Fixes severe rendering corruption in Unity on radeon (LP: #628727,
    LP: #596292, LP: #599741, LP: #630315, LP: #613694, LP: #599741).
  - Also fixes rendering in gnome-shell (LP: #578619).
  - Flickering in OpenGL apps on radeon (LP: #626943, LP: #610541).
  - Provides preliminary support for new intel chips (LP: #601052).
* debian/rules:
  - Update configure flags to match upstream reshuffling.
  - Explicitly remove gallium DRI drivers that we don't want to ship.
* Update debian/gbp.conf for this Maverick-specific packaging
* libegl1-mesa-dri-x11,kms: There are no longer separate kms or x11 drivers
  for EGL, libegl1-mesa-drivers now contains a single driver that provides
  both backends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef __NOUVEAU_UTIL_H__
2
 
#define __NOUVEAU_UTIL_H__
3
 
 
4
 
/* Determine how many vertices can be pushed into the command stream.
5
 
 * Where the remaining space isn't large enough to represent all verices,
6
 
 * split the buffer at primitive boundaries.
7
 
 *
8
 
 * Returns a count of vertices that can be rendered, and an index to
9
 
 * restart drawing at after a flush.
10
 
 */
11
 
static INLINE unsigned
12
 
nouveau_vbuf_split(unsigned remaining, unsigned overhead, unsigned vpp,
13
 
                   unsigned mode, unsigned start, unsigned count,
14
 
                   unsigned *restart)
15
 
{
16
 
        int max, adj = 0;
17
 
 
18
 
        max  = remaining - overhead;
19
 
        if (max < 0)
20
 
                return 0;
21
 
 
22
 
        max *= vpp;
23
 
        if (max >= count)
24
 
                return count;
25
 
 
26
 
        switch (mode) {
27
 
        case PIPE_PRIM_POINTS:
28
 
                break;
29
 
        case PIPE_PRIM_LINES:
30
 
                max = max & 1;
31
 
                break;
32
 
        case PIPE_PRIM_TRIANGLES:
33
 
                max = max - (max % 3);
34
 
                break;
35
 
        case PIPE_PRIM_QUADS:
36
 
                max = max & 3;
37
 
                break;
38
 
        case PIPE_PRIM_LINE_LOOP:
39
 
        case PIPE_PRIM_LINE_STRIP:
40
 
                if (max < 2)
41
 
                        max = 0;
42
 
                adj = 1;
43
 
                break;
44
 
        case PIPE_PRIM_POLYGON:
45
 
        case PIPE_PRIM_TRIANGLE_STRIP:
46
 
        case PIPE_PRIM_TRIANGLE_FAN:
47
 
                if (max < 3)
48
 
                        max = 0;
49
 
                adj = 2;
50
 
                break;
51
 
        case PIPE_PRIM_QUAD_STRIP:
52
 
                if (max < 4)
53
 
                        max = 0;
54
 
                adj = 3;
55
 
                break;
56
 
        default:
57
 
                assert(0);
58
 
        }
59
 
 
60
 
        *restart = start + max - adj;
61
 
        return max;
62
 
}
63
 
 
64
 
/* Integer base-2 logarithm, rounded towards zero. */
65
 
static INLINE unsigned log2i(unsigned i)
66
 
{
67
 
        unsigned r = 0;
68
 
 
69
 
        if (i & 0xffff0000) {
70
 
                i >>= 16;
71
 
                r += 16;
72
 
        }
73
 
        if (i & 0x0000ff00) {
74
 
                i >>= 8;
75
 
                r += 8;
76
 
        }
77
 
        if (i & 0x000000f0) {
78
 
                i >>= 4;
79
 
                r += 4;
80
 
        }
81
 
        if (i & 0x0000000c) {
82
 
                i >>= 2;
83
 
                r += 2;
84
 
        }
85
 
        if (i & 0x00000002) {
86
 
                r += 1;
87
 
        }
88
 
        return r;
89
 
}
90
 
 
91
 
#endif