~ubuntu-branches/debian/wheezy/xserver-xorg-video-intel/wheezy

« back to all changes in this revision

Viewing changes to src/sna/sna.h

  • Committer: Package Import Robot
  • Author(s): Cyril Brulebois, Timo Aaltonen
  • Date: 2011-11-19 12:46:57 UTC
  • mfrom: (26.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20111119124657-zpht20ygj578uqwn
Tags: 2:2.17.0-1
[ Timo Aaltonen ]
New upstream release. (Closes: #635953)

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 *
35
35
 */
36
36
 
 
37
#ifndef _SNA_H_
 
38
#define _SNA_H_
 
39
 
37
40
#ifdef HAVE_CONFIG_H
38
41
#include "config.h"
39
42
#endif
40
43
 
41
44
#include <stdint.h>
42
45
 
43
 
#ifndef _SNA_H_
44
 
#define _SNA_H_
45
 
 
46
 
#include "xf86_OSproc.h"
47
46
#include "compiler.h"
48
 
#include "xf86PciInfo.h"
49
 
#include "xf86Pci.h"
50
 
#include "xf86Cursor.h"
51
 
#include "xf86xv.h"
52
 
#include "vgaHW.h"
53
 
#include "xf86Crtc.h"
54
 
#include "xf86RandR12.h"
 
47
#include <xf86_OSproc.h>
 
48
#include <xf86PciInfo.h>
 
49
#include <xf86Pci.h>
 
50
#include <xf86Cursor.h>
 
51
#include <xf86xv.h>
 
52
#include <xf86Crtc.h>
 
53
#include <xf86RandR12.h>
 
54
#include <gcstruct.h>
55
55
 
56
 
#include "xorg-server.h"
 
56
#include <xorg-server.h>
57
57
#include <pciaccess.h>
58
58
 
59
 
#include "xf86drm.h"
60
 
#include "xf86drmMode.h"
 
59
#include <xf86drm.h>
 
60
#include <xf86drmMode.h>
61
61
 
62
62
#define _XF86DRI_SERVER_
63
 
#include "dri.h"
64
 
#include "dri2.h"
65
 
#include "i915_drm.h"
 
63
#include <dri2.h>
 
64
#include <i915_drm.h>
66
65
 
67
66
#if HAVE_UDEV
68
67
#include <libudev.h>
69
68
#endif
70
69
 
 
70
#include "compiler.h"
 
71
 
71
72
#define DBG(x)
72
73
 
73
74
#define DEBUG_ALL (HAS_DEBUG_FULL || 0)
122
123
 
123
124
#ifndef CREATE_PIXMAP_USAGE_SCRATCH_HEADER
124
125
#define FAKE_CREATE_PIXMAP_USAGE_SCRATCH_HEADER 1
125
 
#define CREATE_PIXMAP_USAGE_SCRATCH_HEADER -1
 
126
#define CREATE_PIXMAP_USAGE_SCRATCH_HEADER (unsigned)-1
126
127
#endif
127
128
 
128
129
#define SNA_CURSOR_X                    64
141
142
        uint8_t pinned :1;
142
143
        uint8_t gpu_only :1;
143
144
        uint8_t flush :1;
144
 
};
 
145
        uint8_t gpu :1;
 
146
};
 
147
 
 
148
struct sna_glyph {
 
149
        PicturePtr atlas;
 
150
        pixman_image_t *image;
 
151
        struct sna_coordinate coordinate;
 
152
        uint16_t size, pos;
 
153
};
 
154
 
 
155
extern DevPrivateKeyRec sna_private_index;
 
156
extern DevPrivateKeyRec sna_pixmap_index;
 
157
extern DevPrivateKeyRec sna_gc_index;
 
158
extern DevPrivateKeyRec sna_glyph_key;
 
159
 
 
160
static inline PixmapPtr get_window_pixmap(WindowPtr window)
 
161
{
 
162
#if 0
 
163
        return window->drawable.pScreen->GetWindowPixmap(window)
 
164
#else
 
165
        return *(void **)window->devPrivates;
 
166
#endif
 
167
}
145
168
 
146
169
static inline PixmapPtr get_drawable_pixmap(DrawablePtr drawable)
147
170
{
148
 
        ScreenPtr screen = drawable->pScreen;
149
 
 
150
171
        if (drawable->type == DRAWABLE_PIXMAP)
151
172
                return (PixmapPtr)drawable;
152
173
        else
153
 
                return screen->GetWindowPixmap((WindowPtr)drawable);
 
174
                return get_window_pixmap((WindowPtr)drawable);
154
175
}
155
176
 
156
 
extern DevPrivateKeyRec sna_pixmap_index;
157
 
 
158
177
static inline struct sna_pixmap *sna_pixmap(PixmapPtr pixmap)
159
178
{
160
 
        return dixGetPrivate(&pixmap->devPrivates, &sna_pixmap_index);
 
179
        return ((void **)pixmap->devPrivates)[1];
161
180
}
162
181
 
163
182
static inline struct sna_pixmap *sna_pixmap_from_drawable(DrawablePtr drawable)
165
184
        return sna_pixmap(get_drawable_pixmap(drawable));
166
185
}
167
186
 
168
 
static inline void sna_set_pixmap(PixmapPtr pixmap, struct sna_pixmap *sna)
 
187
struct sna_gc {
 
188
        long changes;
 
189
        long serial;
 
190
};
 
191
 
 
192
static inline struct sna_gc *sna_gc(GCPtr gc)
169
193
{
170
 
        dixSetPrivate(&pixmap->devPrivates, &sna_pixmap_index, sna);
 
194
        return (struct sna_gc *)gc->devPrivates;
171
195
}
172
196
 
173
197
enum {
181
205
        OPTION_RELAXED_FENCING,
182
206
        OPTION_VMAP,
183
207
        OPTION_ZAPHOD,
 
208
        OPTION_DELAYED_FLUSH,
 
209
        NUM_OPTIONS
184
210
};
185
211
 
186
212
enum {
194
220
 
195
221
        unsigned flags;
196
222
#define SNA_NO_THROTTLE         0x1
 
223
#define SNA_NO_DELAYED_FLUSH    0x2
197
224
 
198
225
        int timer[NUM_TIMERS];
199
226
        int timer_active;
200
227
 
 
228
        int vblank_interval;
 
229
 
201
230
        struct list deferred_free;
202
231
        struct list dirty_pixmaps;
203
232
 
204
233
        PixmapPtr front, shadow;
 
234
        PixmapPtr freed_pixmap;
205
235
 
206
236
        struct sna_mode {
207
237
                uint32_t fb_id;
234
264
        void *WakeupData;
235
265
        CloseScreenProcPtr CloseScreen;
236
266
 
 
267
        struct {
 
268
                uint32_t fill_bo;
 
269
                uint32_t fill_pixel;
 
270
                uint32_t fill_alu;
 
271
        } blt_state;
237
272
        union {
238
273
                struct gen2_render_state gen2;
239
274
                struct gen3_render_state gen3;
269
304
extern int sna_crtc_id(xf86CrtcPtr crtc);
270
305
extern int sna_output_dpms_status(xf86OutputPtr output);
271
306
 
272
 
extern int sna_do_pageflip(struct sna *sna,
273
 
                            PixmapPtr pixmap,
274
 
                            void *data,
275
 
                            int ref_crtc_hw_id,
276
 
                            uint32_t *old_fb);
 
307
extern int sna_page_flip(struct sna *sna,
 
308
                         struct kgem_bo *bo,
 
309
                         void *data,
 
310
                         int ref_crtc_hw_id,
 
311
                         uint32_t *old_fb);
277
312
 
278
313
extern PixmapPtr sna_set_screen_pixmap(struct sna *sna, PixmapPtr pixmap);
279
314
 
280
 
void sna_mode_delete_fb(struct sna *sna, PixmapPtr pixmap, uint32_t fb);
 
315
void sna_mode_delete_fb(struct sna *sna, uint32_t fb);
281
316
 
282
317
static inline struct sna *
283
318
to_sna(ScrnInfoPtr scrn)
292
327
}
293
328
 
294
329
static inline struct sna *
 
330
to_sna_from_pixmap(PixmapPtr pixmap)
 
331
{
 
332
        return *(void **)pixmap->devPrivates;
 
333
}
 
334
 
 
335
static inline struct sna *
295
336
to_sna_from_drawable(DrawablePtr drawable)
296
337
{
297
338
        return to_sna_from_screen(drawable->pScreen);
298
339
}
299
340
 
 
341
static inline struct sna *
 
342
to_sna_from_kgem(struct kgem *kgem)
 
343
{
 
344
        return container_of(kgem, struct sna, kgem);
 
345
}
 
346
 
300
347
#ifndef ARRAY_SIZE
301
348
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
302
349
#endif
464
511
Bool sna_transform_is_translation(const PictTransform *t,
465
512
                                  pixman_fixed_t *tx, pixman_fixed_t *ty);
466
513
 
 
514
static inline bool wedged(struct sna *sna)
 
515
{
 
516
        return unlikely(sna->kgem.wedged);
 
517
}
467
518
 
468
519
static inline uint32_t pixmap_size(PixmapPtr pixmap)
469
520
{
475
526
{
476
527
        struct sna_pixmap *priv;
477
528
 
478
 
        if (kgem->wedged)
 
529
        if (unlikely(kgem->wedged))
479
530
                return NULL;
480
531
 
481
532
        priv = sna_pixmap_attach(pixmap);
487
538
                                               pixmap->devPrivate.ptr,
488
539
                                               pixmap_size(pixmap),
489
540
                                               0);
490
 
                if (priv->cpu_bo)
 
541
                if (priv->cpu_bo) {
491
542
                        priv->cpu_bo->pitch = pixmap->devKind;
 
543
                        if (pixmap->usage_hint == CREATE_PIXMAP_USAGE_SCRATCH_HEADER)
 
544
                                priv->cpu_bo->sync = true;
 
545
                }
492
546
        }
493
547
 
494
548
        return priv->cpu_bo;
523
577
                              PictFormatPtr maskFormat,
524
578
                              INT16 xSrc, INT16 ySrc,
525
579
                              int ntrap, xTrapezoid *traps);
 
580
void sna_add_traps(PicturePtr picture, INT16 x, INT16 y, int n, xTrap *t);
 
581
 
 
582
void sna_composite_triangles(CARD8 op,
 
583
                             PicturePtr src,
 
584
                             PicturePtr dst,
 
585
                             PictFormatPtr maskFormat,
 
586
                             INT16 xSrc, INT16 ySrc,
 
587
                             int ntri, xTriangle *tri);
 
588
 
 
589
void sna_composite_tristrip(CARD8 op,
 
590
                            PicturePtr src,
 
591
                            PicturePtr dst,
 
592
                            PictFormatPtr maskFormat,
 
593
                            INT16 xSrc, INT16 ySrc,
 
594
                            int npoints, xPointFixed *points);
 
595
 
 
596
void sna_composite_trifan(CARD8 op,
 
597
                          PicturePtr src,
 
598
                          PicturePtr dst,
 
599
                          PictFormatPtr maskFormat,
 
600
                          INT16 xSrc, INT16 ySrc,
 
601
                          int npoints, xPointFixed *points);
526
602
 
527
603
Bool sna_gradients_create(struct sna *sna);
528
604
void sna_gradients_close(struct sna *sna);
529
605
 
530
 
Bool sna_glyphs_init(ScreenPtr screen);
531
606
Bool sna_glyphs_create(struct sna *sna);
532
607
void sna_glyphs(CARD8 op,
533
608
                PicturePtr src,
571
646
 
572
647
void
573
648
memcpy_blt(const void *src, void *dst, int bpp,
574
 
           uint16_t src_stride, uint16_t dst_stride,
 
649
           int32_t src_stride, int32_t dst_stride,
575
650
           int16_t src_x, int16_t src_y,
576
651
           int16_t dst_x, int16_t dst_y,
577
652
           uint16_t width, uint16_t height);
578
653
 
579
654
#define SNA_CREATE_FB 0x10
 
655
#define SNA_CREATE_SCRATCH 0x11
580
656
 
581
657
#endif /* _SNA_H */