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

« back to all changes in this revision

Viewing changes to src/gallium/drivers/nvfx/nvfx_context.c

  • 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
#include "draw/draw_context.h"
 
2
#include "pipe/p_defines.h"
 
3
#include "util/u_framebuffer.h"
 
4
 
 
5
#include "nvfx_context.h"
 
6
#include "nvfx_screen.h"
 
7
#include "nvfx_resource.h"
 
8
 
 
9
static void
 
10
nvfx_flush(struct pipe_context *pipe, unsigned flags,
 
11
           struct pipe_fence_handle **fence)
 
12
{
 
13
        struct nvfx_context *nvfx = nvfx_context(pipe);
 
14
        struct nvfx_screen *screen = nvfx->screen;
 
15
        struct nouveau_channel *chan = screen->base.channel;
 
16
        struct nouveau_grobj *eng3d = screen->eng3d;
 
17
 
 
18
        /* XXX: we need to actually be intelligent here */
 
19
        if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
 
20
                WAIT_RING(chan, 4);
 
21
                OUT_RING(chan, RING_3D(0x1fd8, 1));
 
22
                OUT_RING(chan, 2);
 
23
                OUT_RING(chan, RING_3D(0x1fd8, 1));
 
24
                OUT_RING(chan, 1);
 
25
        }
 
26
 
 
27
        FIRE_RING(chan);
 
28
        if (fence)
 
29
                *fence = NULL;
 
30
}
 
31
 
 
32
static void
 
33
nvfx_destroy(struct pipe_context *pipe)
 
34
{
 
35
        struct nvfx_context *nvfx = nvfx_context(pipe);
 
36
 
 
37
        if(nvfx->dummy_fs)
 
38
                pipe->delete_fs_state(pipe, nvfx->dummy_fs);
 
39
 
 
40
        for(unsigned i = 0; i < nvfx->vtxbuf_nr; ++i)
 
41
                pipe_resource_reference(&nvfx->vtxbuf[i].buffer, 0);
 
42
        pipe_resource_reference(&nvfx->idxbuf.buffer, 0);
 
43
        util_unreference_framebuffer_state(&nvfx->framebuffer);
 
44
        for(unsigned i = 0; i < PIPE_MAX_SAMPLERS; ++i)
 
45
                pipe_sampler_view_reference(&nvfx->fragment_sampler_views[i], 0);
 
46
 
 
47
        if (nvfx->draw)
 
48
                draw_destroy(nvfx->draw);
 
49
 
 
50
        if(nvfx->screen->cur_ctx == nvfx)
 
51
                nvfx->screen->cur_ctx = NULL;
 
52
 
 
53
        FREE(nvfx);
 
54
}
 
55
 
 
56
struct pipe_context *
 
57
nvfx_create(struct pipe_screen *pscreen, void *priv)
 
58
{
 
59
        struct nvfx_screen *screen = nvfx_screen(pscreen);
 
60
        struct pipe_winsys *ws = pscreen->winsys;
 
61
        struct nvfx_context *nvfx;
 
62
        struct nouveau_winsys *nvws = screen->nvws;
 
63
 
 
64
        nvfx = CALLOC(1, sizeof(struct nvfx_context));
 
65
        if (!nvfx)
 
66
                return NULL;
 
67
        nvfx->screen = screen;
 
68
 
 
69
        nvfx->nvws = nvws;
 
70
 
 
71
        nvfx->pipe.winsys = ws;
 
72
        nvfx->pipe.screen = pscreen;
 
73
        nvfx->pipe.priv = priv;
 
74
        nvfx->pipe.destroy = nvfx_destroy;
 
75
        nvfx->pipe.draw_vbo = nvfx_draw_vbo;
 
76
        nvfx->pipe.clear = nvfx_clear;
 
77
        nvfx->pipe.flush = nvfx_flush;
 
78
 
 
79
        nvfx->is_nv4x = screen->is_nv4x;
 
80
        nvfx->use_nv4x = screen->use_nv4x;
 
81
        /* TODO: it seems that nv30 might have fixed function clipping usable with vertex programs
 
82
         * However, my code for that doesn't work, so use vp clipping for all cards, which works.
 
83
         */
 
84
        nvfx->use_vp_clipping = TRUE;
 
85
 
 
86
        nvfx_init_query_functions(nvfx);
 
87
        nvfx_init_surface_functions(nvfx);
 
88
        nvfx_init_state_functions(nvfx);
 
89
        nvfx_init_sampling_functions(nvfx);
 
90
        nvfx_init_vbo_functions(nvfx);
 
91
        nvfx_init_fragprog_functions(nvfx);
 
92
        nvfx_init_vertprog_functions(nvfx);
 
93
        nvfx_init_resource_functions(&nvfx->pipe);
 
94
        nvfx_init_transfer_functions(&nvfx->pipe);
 
95
 
 
96
        /* Create, configure, and install fallback swtnl path */
 
97
        nvfx->draw = draw_create(&nvfx->pipe);
 
98
        draw_wide_point_threshold(nvfx->draw, 9999999.0);
 
99
        draw_wide_line_threshold(nvfx->draw, 9999999.0);
 
100
        draw_enable_line_stipple(nvfx->draw, FALSE);
 
101
        draw_enable_point_sprites(nvfx->draw, FALSE);
 
102
        draw_set_rasterize_stage(nvfx->draw, nvfx_draw_render_stage(nvfx));
 
103
 
 
104
        /* set these to that we init them on first validation */
 
105
        nvfx->state.scissor_enabled = ~0;
 
106
        nvfx->hw_pointsprite_control = -1;
 
107
        nvfx->hw_vp_output = -1;
 
108
        nvfx->use_vertex_buffers = -1;
 
109
        nvfx->relocs_needed = NVFX_RELOCATE_ALL;
 
110
 
 
111
        LIST_INITHEAD(&nvfx->render_cache);
 
112
 
 
113
        return &nvfx->pipe;
 
114
}