~ubuntu-branches/ubuntu/trusty/xserver-xorg-video-nouveau/trusty

« back to all changes in this revision

Viewing changes to src/nv50_xv.c

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2009-02-05 00:21:35 UTC
  • mfrom: (1.1.3 upstream) (2.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090205002135-wjjfsjsda0rz6w0d
Tags: 1:0.0.10~git+20090205+4dfd0b1-1
* New upstream snapshot (Closes: #514080)
  - 4dfd0b1... oops
  - e02813a... link against libdrm_nouveau (installed with libdrm)
  - 2c06308... require drm 0.0.12
  - 29aa134... fix NoAccel from when map/unmap became stricter
  - 62adc55... Revert "Improve the NoAccel situation, but it's not working 
    yet."
  - 285027a... Improve the NoAccel situation, but it's not working yet.
  - 5e63c78... Revert "nv50: make entire offscreen area tiled, use extra 
    blits to scanout buffer"
  - 6c3f8da... nv50: make entire offscreen area tiled, use extra blits to 
    scanout buffer
  - 6179102... nv10: use the correct 3d object on NV1A
  - dfd87ec... xv: Unmap filter table BO after init so it can be validated 
    (nv30,40)
  - b8de749... Avoid any risk of parsing oscillation on if_is_24bit
  - 0a0bb72... Split up parsing the bit structure, complain when necessary 
    tables are missing
  - 2d86018... Swap the order of calling parse_fp_mode_table and 
    parse_lvds_manufacturer_table
  - 8c6b3a8... Make calling of init bios functions common
  - 9b32034... Don't read obviously useless bios images, and drop 5x 
    reading on PROM
  - 63aa210... Implement bios I2C opcode 4E (untested)
  - a81f159... Handle I2C device 0xff fallback for I2C bios opcodes
  - 34e967e... Fix pasta error in bios opcode 4D
  - 786dd36... Fix nv04+ IFC upload and frag prog upload
  - 3ab65cf... add vm_vram_base field to nouveau_device instead of 
    hardcoding 512MiB
  - d833c81... nv50/xv: previous xv commit was bonged - fix that
  - 0f741eb... exa: small cleanup
  - c10c3c9... exa: mass renaming and movement of nv04 solid/copy code to 
    nv04_exa.c
  - 81ace5d... exa: remove driver pixmaps path that never worked here anyway
  - 4b1829e... exa: remove NVCopyROP table..
  - 410788d... blow up horribly if GPU access to mapped buffer is attempted
  - 4c9346b... bo_del->bo_ref, closer to ng api
  - c533f86... exa: same for UTS state
  - 02677c0... exa: ensure DFS state is updated across flushes
  - 69d02bc... nv50: remove some redundant init, this stuff is done as 
    required now
  - 60aea90... nv50: forgotten buffer access flags during init
  - 5a382dd... nv10/exa: resubmit state in composite as needed
  - d4ff8db... nv30/exa: resubmit state in composite as needed
  - b71ebcb... nv40/exa: resubmit state in composite as necessary
  - 6ddaddb... exa: rework common pre-nv50 code in the same way nv50 code 
    just was
  - f36fa31... nv50/xv: ensure entire frame will fit in pushbuf without 
    causing a flush
  - 1b48331... nv50/exa: ensure buffer usage is tracked correctly
  - 7e64426... remove unconditional FIRE_RING() in DoneComposite() hooks
  - 34fc446... hack a flush_notify() hook in to match ng
  - d9da090... Drop GPU resources on LeaveVT, reaquire on EnterVT
  - 1eb8b87... Enable ShadowFB for DRM-less mode.
  - 4874638... Allow NoAccel operation without the DRM module present.
  - f78aeed... if CARD_INIT ioctl fails, report it instead of continuing
  - cf65b87... Fix stupidity introduced in 
    25de6b867f319099dac05ba84f170da0f0e6c803
  - 55e9cdd... Split out a function for finding the panel power sequencer 
    stuff
  - 1b3546b... Move the bios flat-panel pointers back into the bios struct
  - d29c481... Remove a BITism from BMP parsing path, and move old style 
    BMP init into common path
  - 3e971f6... randr12: lock independent crtc base registers separately 
    (#19620)
  - ffbca72... randr12: code motion and allow ramdac580 setting on nv40
  - 75a0376... randr12: better selection of nv4x single pll mode and some 
    notes
  - 767fcea... randr12: no mmiotrace indication that the blob ever clears 
    these bits
  - 985ac72... randr12: no mmiotrace evidence for nv47 using the special 
    pll bits
  - 3ef6b41... twoStagePLL is actually a description of cards using two PLL 
    regs
  - c7a423a... nv04 blitter: use correct number of dma params for real nv04
  - 25de6b8... Complain more about weird bios images
  - 4d72981... randr12: avoid classic macro error
  - 133c1a5... No need of separate allocation for bios image
  - 8a25049... Make turning on bios execution logging slightly easier
  - 54d43c4... nv50: small fix
  - 5c9f8d3... nv50: Add a fallback for non-repeating XRGB pixmaps.
  - 0321e67... nv50: don't segfault if preinit fails before display setup 
    done
* Don't include .git in .orig.tar.gz.
* Replace "(C)" in debian/copyright with "©" to appease lintian.
* Replace usage of `dh_clean -k` with dh_prep.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
        return TRUE;
58
58
}
59
59
 
60
 
int
61
 
nv50_xv_image_put(ScrnInfoPtr pScrn,
62
 
                  struct nouveau_bo *src, int src_offset, int src_offset2,
63
 
                  int id, int src_pitch, BoxPtr dstBox,
64
 
                  int x1, int y1, int x2, int y2,
65
 
                  uint16_t width, uint16_t height,
66
 
                  uint16_t src_w, uint16_t src_h,
67
 
                  uint16_t drw_w, uint16_t drw_h,
68
 
                  RegionPtr clipBoxes, PixmapPtr ppix,
69
 
                  NVPortPrivPtr pPriv)
 
60
static void
 
61
nv50_xv_state_emit(PixmapPtr ppix, int id, struct nouveau_bo *src,
 
62
                   int packed_y, int uv, int src_w, int src_h)
70
63
{
 
64
        ScrnInfoPtr pScrn = xf86Screens[ppix->drawable.pScreen->myNum];
71
65
        NVPtr pNv = NVPTR(pScrn);
72
66
        struct nouveau_channel *chan = pNv->chan;
73
67
        struct nouveau_grobj *tesla = pNv->Nv3D;
74
 
        float X1, X2, Y1, Y2;
75
 
        BoxPtr pbox;
76
 
        int nbox;
77
 
 
78
 
        if (!nv50_xv_check_image_put(ppix))
79
 
                return BadMatch;
80
 
 
 
68
        const unsigned shd_flags = NOUVEAU_BO_RD | NOUVEAU_BO_VRAM;
 
69
        const unsigned tcb_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM;
 
70
 
 
71
        WAIT_RING (chan, 256);
81
72
        BEGIN_RING(chan, tesla, NV50TCL_RT_ADDRESS_HIGH(0), 5);
82
73
        OUT_PIXMAPh(chan, ppix, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
83
74
        OUT_PIXMAPl(chan, ppix, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
97
88
        BEGIN_RING(chan, tesla, NV50TCL_BLEND_ENABLE(0), 1);
98
89
        OUT_RING  (chan, 0);
99
90
 
 
91
        BEGIN_RING(chan, tesla, NV50TCL_TIC_ADDRESS_HIGH, 3);
 
92
        OUT_RELOCh(chan, pNv->tesla_scratch, TIC_OFFSET, tcb_flags);
 
93
        OUT_RELOCl(chan, pNv->tesla_scratch, TIC_OFFSET, tcb_flags);
 
94
        OUT_RING  (chan, 0x00000800);
 
95
        BEGIN_RING(chan, tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
 
96
        OUT_RELOCh(chan, pNv->tesla_scratch, TIC_OFFSET, tcb_flags);
 
97
        OUT_RELOCl(chan, pNv->tesla_scratch, TIC_OFFSET, tcb_flags);
 
98
        OUT_RING  (chan, (CB_TIC << NV50TCL_CB_DEF_SET_BUFFER_SHIFT) | 0x4000);
100
99
        BEGIN_RING(chan, tesla, NV50TCL_CB_ADDR, 1);
101
100
        OUT_RING  (chan, CB_TIC);
102
101
        BEGIN_RING(chan, tesla, NV50TCL_CB_DATA(0) | 0x40000000, 16);
106
105
                         NV50TIC_0_0_MAPG_ZERO | NV50TIC_0_0_TYPEG_UNORM |
107
106
                         NV50TIC_0_0_MAPB_ZERO | NV50TIC_0_0_TYPEB_UNORM |
108
107
                         NV50TIC_0_0_FMT_8);
109
 
        OUT_RELOCl(chan, src,
110
 
                         src_offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
 
108
        OUT_RELOCl(chan, src, packed_y, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
111
109
        OUT_RING  (chan, 0xd0005000);
112
110
        OUT_RING  (chan, 0x00300000);
113
111
        OUT_RING  (chan, src_w);
114
112
        OUT_RING  (chan, (1 << NV50TIC_0_5_DEPTH_SHIFT) | src_h);
115
113
        OUT_RING  (chan, 0x03000000);
116
 
        OUT_RELOCh(chan, src,
117
 
                         src_offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
 
114
        OUT_RELOCh(chan, src, packed_y, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
118
115
        OUT_RING  (chan, NV50TIC_0_0_MAPA_C1 | NV50TIC_0_0_TYPEA_UNORM |
119
116
                         NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM |
120
117
                         NV50TIC_0_0_MAPG_ZERO | NV50TIC_0_0_TYPEG_UNORM |
121
118
                         NV50TIC_0_0_MAPB_ZERO | NV50TIC_0_0_TYPEB_UNORM |
122
119
                         NV50TIC_0_0_FMT_8_8);
123
 
        OUT_RELOCl(chan, src,
124
 
                         src_offset2, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
 
120
        OUT_RELOCl(chan, src, uv, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
125
121
        OUT_RING  (chan, 0xd0005000);
126
122
        OUT_RING  (chan, 0x00300000);
127
123
        OUT_RING  (chan, src_w >> 1);
128
124
        OUT_RING  (chan, (1 << NV50TIC_0_5_DEPTH_SHIFT) | (src_h >> 1));
129
125
        OUT_RING  (chan, 0x03000000);
130
 
        OUT_RELOCh(chan, src,
131
 
                         src_offset2, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
 
126
        OUT_RELOCh(chan, src, uv, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
132
127
        } else {
133
128
        OUT_RING  (chan, NV50TIC_0_0_MAPA_C0 | NV50TIC_0_0_TYPEA_UNORM |
134
129
                         NV50TIC_0_0_MAPR_ZERO | NV50TIC_0_0_TYPER_UNORM |
135
130
                         NV50TIC_0_0_MAPG_ZERO | NV50TIC_0_0_TYPEG_UNORM |
136
131
                         NV50TIC_0_0_MAPB_ZERO | NV50TIC_0_0_TYPEB_UNORM |
137
132
                         NV50TIC_0_0_FMT_8_8);
138
 
        OUT_RELOCl(chan, src,
139
 
                         src_offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
 
133
        OUT_RELOCl(chan, src, packed_y, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
140
134
        OUT_RING  (chan, 0xd0005000);
141
135
        OUT_RING  (chan, 0x00300000);
142
136
        OUT_RING  (chan, src_w);
143
137
        OUT_RING  (chan, (1 << NV50TIC_0_5_DEPTH_SHIFT) | src_h);
144
138
        OUT_RING  (chan, 0x03000000);
145
 
        OUT_RELOCh(chan, src,
146
 
                         src_offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
 
139
        OUT_RELOCh(chan, src, packed_y, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
147
140
        OUT_RING  (chan, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM |
148
141
                         NV50TIC_0_0_MAPR_C1 | NV50TIC_0_0_TYPER_UNORM |
149
142
                         NV50TIC_0_0_MAPG_ZERO | NV50TIC_0_0_TYPEG_UNORM |
150
143
                         NV50TIC_0_0_MAPB_ZERO | NV50TIC_0_0_TYPEB_UNORM |
151
144
                         NV50TIC_0_0_FMT_8_8_8_8);
152
 
        OUT_RELOCl(chan, src,
153
 
                         src_offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
 
145
        OUT_RELOCl(chan, src, packed_y, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
154
146
        OUT_RING  (chan, 0xd0005000);
155
147
        OUT_RING  (chan, 0x00300000);
156
148
        OUT_RING  (chan, (src_w >> 1));
157
149
        OUT_RING  (chan, (1 << NV50TIC_0_5_DEPTH_SHIFT) | src_h);
158
150
        OUT_RING  (chan, 0x03000000);
159
 
        OUT_RELOCh(chan, src,
160
 
                         src_offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
 
151
        OUT_RELOCh(chan, src, packed_y, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
161
152
        }
162
153
 
 
154
        BEGIN_RING(chan, tesla, NV50TCL_TSC_ADDRESS_HIGH, 3);
 
155
        OUT_RELOCh(chan, pNv->tesla_scratch, TSC_OFFSET, tcb_flags);
 
156
        OUT_RELOCl(chan, pNv->tesla_scratch, TSC_OFFSET, tcb_flags);
 
157
        OUT_RING  (chan, 0x00000000);
 
158
        BEGIN_RING(chan, tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3);
 
159
        OUT_RELOCh(chan, pNv->tesla_scratch, TSC_OFFSET, tcb_flags);
 
160
        OUT_RELOCl(chan, pNv->tesla_scratch, TSC_OFFSET, tcb_flags);
 
161
        OUT_RING  (chan, (CB_TSC << NV50TCL_CB_DEF_SET_BUFFER_SHIFT) | 0x4000);
163
162
        BEGIN_RING(chan, tesla, NV50TCL_CB_ADDR, 1);
164
163
        OUT_RING  (chan, CB_TSC);
165
164
        BEGIN_RING(chan, tesla, NV50TCL_CB_DATA(0) | 0x40000000, 16);
188
187
        OUT_RING  (chan, 0x00000000);
189
188
        OUT_RING  (chan, 0x00000000);
190
189
 
 
190
        BEGIN_RING(chan, tesla, NV50TCL_VP_ADDRESS_HIGH, 2);
 
191
        OUT_RELOCh(chan, pNv->tesla_scratch, PVP_OFFSET, shd_flags);
 
192
        OUT_RELOCl(chan, pNv->tesla_scratch, PVP_OFFSET, shd_flags);
 
193
        BEGIN_RING(chan, tesla, NV50TCL_FP_ADDRESS_HIGH, 2);
 
194
        OUT_RELOCh(chan, pNv->tesla_scratch, PFP_OFFSET, shd_flags);
 
195
        OUT_RELOCl(chan, pNv->tesla_scratch, PFP_OFFSET, shd_flags);
191
196
        BEGIN_RING(chan, tesla, NV50TCL_FP_START_ID, 1);
192
197
        OUT_RING  (chan, PFP_NV12);
193
198
 
199
204
        BEGIN_RING(chan, tesla, 0x1458, 1);
200
205
        OUT_RING  (chan, 0x203);
201
206
 
 
207
}
 
208
 
 
209
int
 
210
nv50_xv_image_put(ScrnInfoPtr pScrn,
 
211
                  struct nouveau_bo *src, int packed_y, int uv,
 
212
                  int id, int src_pitch, BoxPtr dstBox,
 
213
                  int x1, int y1, int x2, int y2,
 
214
                  uint16_t width, uint16_t height,
 
215
                  uint16_t src_w, uint16_t src_h,
 
216
                  uint16_t drw_w, uint16_t drw_h,
 
217
                  RegionPtr clipBoxes, PixmapPtr ppix,
 
218
                  NVPortPrivPtr pPriv)
 
219
{
 
220
        NVPtr pNv = NVPTR(pScrn);
 
221
        struct nouveau_channel *chan = pNv->chan;
 
222
        struct nouveau_grobj *tesla = pNv->Nv3D;
 
223
        float X1, X2, Y1, Y2;
 
224
        BoxPtr pbox;
 
225
        int nbox;
 
226
 
 
227
        if (!nv50_xv_check_image_put(ppix))
 
228
                return BadMatch;
 
229
        nv50_xv_state_emit(ppix, id, src, packed_y, uv, src_w, src_h);
 
230
 
202
231
        /* These are fixed point values in the 16.16 format. */
203
232
        X1 = (float)(x1>>16)+(float)(x1&0xFFFF)/(float)0x10000;
204
233
        Y1 = (float)(y1>>16)+(float)(y1&0xFFFF)/(float)0x10000;
205
234
        X2 = (float)(x2>>16)+(float)(x2&0xFFFF)/(float)0x10000;
206
235
        Y2 = (float)(y2>>16)+(float)(y2&0xFFFF)/(float)0x10000;
207
236
 
208
 
        BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1);
209
 
        OUT_RING  (chan, NV50TCL_VERTEX_BEGIN_QUADS);
210
 
 
211
237
        pbox = REGION_RECTS(clipBoxes);
212
238
        nbox = REGION_NUM_RECTS(clipBoxes);
213
239
        while(nbox--) {
225
251
                ty1 = ty1 / src_h;
226
252
                ty2 = ty2 / src_h;
227
253
 
 
254
                if (AVAIL_RING(chan) < 64) {
 
255
                        nv50_xv_state_emit(ppix, id, src, packed_y, uv,
 
256
                                           src_w, src_h);
 
257
                }
 
258
 
 
259
                BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1);
 
260
                OUT_RING  (chan, NV50TCL_VERTEX_BEGIN_QUADS);
228
261
                VTX2s(pNv, tx1, ty1, tx1, ty1, sx1, sy1);
229
262
                VTX2s(pNv, tx2, ty1, tx2, ty1, sx2, sy1);
230
263
                VTX2s(pNv, tx2, ty2, tx2, ty2, sx2, sy2);
231
264
                VTX2s(pNv, tx1, ty2, tx1, ty2, sx1, sy2);
 
265
                BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
 
266
                OUT_RING  (chan, 0);
232
267
 
233
268
                pbox++;
234
269
        }
235
270
 
236
 
        BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1);
237
 
        OUT_RING  (chan, 0);
238
 
 
239
271
        FIRE_RING (chan);
240
 
 
241
272
        return Success;
242
273
}
243
274