1 /* i915_drv.h -- Private header for the I915 driver -*- linux-c -*-
5 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sub license, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
16 * The above copyright notice and this permission notice (including the
17 * next paragraph) shall be included in all copies or substantial portions
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
23 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
24 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 /* General customization:
36 #define DRIVER_AUTHOR "Tungsten Graphics, Inc."
38 #define DRIVER_NAME "i915"
39 #define DRIVER_DESC "Intel Graphics"
40 #define DRIVER_DATE "20070209"
42 #if defined(__linux__)
43 #define I915_HAVE_FENCE
44 #define I915_HAVE_BUFFER
50 * 1.2: Add Power Management
51 * 1.3: Add vblank support
52 * 1.4: Fix cmdbuffer path, add heap destroy
53 * 1.5: Add vblank pipe configuration
54 * 1.6: - New ioctl for scheduling buffer swaps on vertical blank
55 * - Support vertical blank on secondary display pipe
56 * 1.8: New ioctl for ARB_Occlusion_Query
57 * 1.9: Usable page flipping and triple buffering
58 * 1.10: Plane/pipe disentangling
59 * 1.11: TTM superioctl
61 #define DRIVER_MAJOR 1
62 #if defined(I915_HAVE_FENCE) && defined(I915_HAVE_BUFFER)
63 #define DRIVER_MINOR 11
65 #define DRIVER_MINOR 6
67 #define DRIVER_PATCHLEVEL 0
69 #ifdef I915_HAVE_BUFFER
70 #define I915_MAX_VALIDATE_BUFFERS 4096
73 struct drm_i915_ring_buffer {
86 struct mem_block *next;
87 struct mem_block *prev;
90 struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */
93 struct drm_i915_vbl_swap {
94 struct list_head head;
95 drm_drawable_t drw_id;
97 unsigned int sequence;
101 struct drm_i915_private {
102 struct drm_buffer_object *ring_buffer;
103 drm_local_map_t *sarea;
104 drm_local_map_t *mmio_map;
106 unsigned long mmiobase;
107 unsigned long mmiolen;
109 struct drm_i915_sarea *sarea_priv;
110 struct drm_i915_ring_buffer ring;
112 struct drm_dma_handle *status_page_dmah;
113 void *hw_status_page;
114 dma_addr_t dma_status_page;
116 unsigned int status_gfx_addr;
117 drm_local_map_t hws_map;
120 int use_mi_batchbuffer_start;
122 wait_queue_head_t irq_queue;
123 atomic_t irq_received;
124 atomic_t irq_emitted;
126 int tex_lru_log_granularity;
127 int allow_batchbuffer;
128 struct mem_block *agp_heap;
129 unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds;
131 DRM_SPINTYPE user_irq_lock;
132 int user_irq_refcount;
134 uint32_t irq_enable_reg;
137 #ifdef I915_HAVE_FENCE
138 uint32_t flush_sequence;
139 uint32_t flush_flags;
140 uint32_t flush_pending;
141 uint32_t saved_flush_status;
143 #ifdef I915_HAVE_BUFFER
145 unsigned int max_validate_buffers;
146 struct mutex cmdbuf_mutex;
149 DRM_SPINTYPE swaps_lock;
150 struct drm_i915_vbl_swap vbl_swaps;
151 unsigned int swaps_pending;
154 int backlight_duty_cycle; /* restore backlight to this value */
155 bool panel_wants_dither;
156 struct drm_display_mode *panel_fixed_mode;
183 u32 savePFIT_PGM_RATIOS;
185 u32 saveBLC_PWM_CTL2;
203 u32 saveVCLK_DIVISOR_VGA0;
204 u32 saveVCLK_DIVISOR_VGA1;
205 u32 saveVCLK_POST_DIV;
218 u32 savePFIT_CONTROL;
219 u32 save_palette_a[256];
220 u32 save_palette_b[256];
221 u32 saveFBC_CFB_BASE;
224 u32 saveFBC_CONTROL2;
234 u8 saveDACDATA[256*3]; /* 256 3-byte colors */
238 enum intel_chip_family {
245 extern struct drm_ioctl_desc i915_ioctls[];
246 extern int i915_max_ioctl;
249 extern void i915_kernel_lost_context(struct drm_device * dev);
250 extern int i915_driver_load(struct drm_device *, unsigned long flags);
251 extern int i915_driver_unload(struct drm_device *dev);
252 extern void i915_driver_lastclose(struct drm_device * dev);
253 extern void i915_driver_preclose(struct drm_device *dev,
254 struct drm_file *file_priv);
255 extern int i915_driver_device_is_agp(struct drm_device * dev);
256 extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
258 extern void i915_emit_breadcrumb(struct drm_device *dev);
259 extern void i915_dispatch_flip(struct drm_device * dev, int pipes, int sync);
260 extern int i915_emit_mi_flush(struct drm_device *dev, uint32_t flush);
261 extern int i915_driver_firstopen(struct drm_device *dev);
262 extern int i915_do_cleanup_pageflip(struct drm_device *dev);
263 extern int i915_dma_cleanup(struct drm_device *dev);
266 extern int i915_irq_emit(struct drm_device *dev, void *data,
267 struct drm_file *file_priv);
268 extern int i915_irq_wait(struct drm_device *dev, void *data,
269 struct drm_file *file_priv);
271 extern void i915_driver_wait_next_vblank(struct drm_device *dev, int pipe);
272 extern int i915_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence);
273 extern int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence);
274 extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS);
275 extern void i915_driver_irq_preinstall(struct drm_device * dev);
276 extern void i915_driver_irq_postinstall(struct drm_device * dev);
277 extern void i915_driver_irq_uninstall(struct drm_device * dev);
278 extern int i915_vblank_pipe_set(struct drm_device *dev, void *data,
279 struct drm_file *file_priv);
280 extern int i915_vblank_pipe_get(struct drm_device *dev, void *data,
281 struct drm_file *file_priv);
282 extern int i915_emit_irq(struct drm_device * dev);
283 extern void i915_user_irq_on(struct drm_i915_private *dev_priv);
284 extern void i915_user_irq_off(struct drm_i915_private *dev_priv);
285 extern void i915_enable_interrupt (struct drm_device *dev);
286 extern int i915_vblank_swap(struct drm_device *dev, void *data,
287 struct drm_file *file_priv);
290 extern int i915_mem_alloc(struct drm_device *dev, void *data,
291 struct drm_file *file_priv);
292 extern int i915_mem_free(struct drm_device *dev, void *data,
293 struct drm_file *file_priv);
294 extern int i915_mem_init_heap(struct drm_device *dev, void *data,
295 struct drm_file *file_priv);
296 extern int i915_mem_destroy_heap(struct drm_device *dev, void *data,
297 struct drm_file *file_priv);
298 extern void i915_mem_takedown(struct mem_block **heap);
299 extern void i915_mem_release(struct drm_device * dev,
300 struct drm_file *file_priv,
301 struct mem_block *heap);
302 #ifdef I915_HAVE_FENCE
306 extern void i915_fence_handler(struct drm_device *dev);
307 extern int i915_fence_emit_sequence(struct drm_device *dev, uint32_t class,
310 uint32_t *native_type);
311 extern void i915_poke_flush(struct drm_device *dev, uint32_t class);
312 extern int i915_fence_has_irq(struct drm_device *dev, uint32_t class, uint32_t flags);
315 #ifdef I915_HAVE_BUFFER
317 extern struct drm_ttm_backend *i915_create_ttm_backend_entry(struct drm_device *dev);
318 extern int i915_fence_types(struct drm_buffer_object *bo, uint32_t *fclass,
320 extern int i915_invalidate_caches(struct drm_device *dev, uint64_t buffer_flags);
321 extern int i915_init_mem_type(struct drm_device *dev, uint32_t type,
322 struct drm_mem_type_manager *man);
323 extern uint32_t i915_evict_mask(struct drm_buffer_object *bo);
324 extern int i915_move(struct drm_buffer_object *bo, int evict,
325 int no_wait, struct drm_bo_mem_reg *new_mem);
326 void i915_flush_ttm(struct drm_ttm *ttm);
329 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
330 extern void intel_init_chipset_flush_compat(struct drm_device *dev);
331 extern void intel_fini_chipset_flush_compat(struct drm_device *dev);
336 extern void intel_modeset_init(struct drm_device *dev);
337 extern void intel_modeset_cleanup(struct drm_device *dev);
340 #define I915_READ(reg) DRM_READ32(dev_priv->mmio_map, (reg))
341 #define I915_WRITE(reg,val) DRM_WRITE32(dev_priv->mmio_map, (reg), (val))
342 #define I915_READ16(reg) DRM_READ16(dev_priv->mmio_map, (reg))
343 #define I915_WRITE16(reg,val) DRM_WRITE16(dev_priv->mmio_map, (reg), (val))
345 #define I915_VERBOSE 0
347 #define RING_LOCALS unsigned int outring, ringmask, outcount; \
350 #define BEGIN_LP_RING(n) do { \
352 DRM_DEBUG("BEGIN_LP_RING(%d) in %s\n", \
353 (n), __FUNCTION__); \
354 if (dev_priv->ring.space < (n)*4) \
355 i915_wait_ring(dev, (n)*4, __FUNCTION__); \
357 outring = dev_priv->ring.tail; \
358 ringmask = dev_priv->ring.tail_mask; \
359 virt = dev_priv->ring.virtual_start; \
362 #define OUT_RING(n) do { \
363 if (I915_VERBOSE) DRM_DEBUG(" OUT_RING %x\n", (int)(n)); \
364 *(volatile unsigned int *)(virt + outring) = (n); \
367 outring &= ringmask; \
370 #define ADVANCE_LP_RING() do { \
371 if (I915_VERBOSE) DRM_DEBUG("ADVANCE_LP_RING %x\n", outring); \
372 dev_priv->ring.tail = outring; \
373 dev_priv->ring.space -= outcount * 4; \
374 I915_WRITE(LP_RING + RING_TAIL, outring); \
377 #define MI_NOOP (0x00 << 23)
379 extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
382 * The Bridge device's PCI config space has information about the
383 * fb aperture size and the amount of pre-reserved memory.
385 #define INTEL_GMCH_CTRL 0x52
386 #define INTEL_GMCH_ENABLED 0x4
387 #define INTEL_GMCH_MEM_MASK 0x1
388 #define INTEL_GMCH_MEM_64M 0x1
389 #define INTEL_GMCH_MEM_128M 0
391 #define INTEL_855_GMCH_GMS_MASK (0x7 << 4)
392 #define INTEL_855_GMCH_GMS_DISABLED (0x0 << 4)
393 #define INTEL_855_GMCH_GMS_STOLEN_1M (0x1 << 4)
394 #define INTEL_855_GMCH_GMS_STOLEN_4M (0x2 << 4)
395 #define INTEL_855_GMCH_GMS_STOLEN_8M (0x3 << 4)
396 #define INTEL_855_GMCH_GMS_STOLEN_16M (0x4 << 4)
397 #define INTEL_855_GMCH_GMS_STOLEN_32M (0x5 << 4)
399 #define INTEL_915G_GMCH_GMS_STOLEN_48M (0x6 << 4)
400 #define INTEL_915G_GMCH_GMS_STOLEN_64M (0x7 << 4)
402 /* Extended config space */
407 #define VGA_ST01_MDA 0x3ba
408 #define VGA_ST01_CGA 0x3da
410 #define VGA_MSR_WRITE 0x3c2
411 #define VGA_MSR_READ 0x3cc
412 #define VGA_MSR_MEM_EN (1<<1)
413 #define VGA_MSR_CGA_MODE (1<<0)
415 #define VGA_SR_INDEX 0x3c4
416 #define VGA_SR_DATA 0x3c5
418 #define VGA_AR_INDEX 0x3c0
419 #define VGA_AR_VID_EN (1<<5)
420 #define VGA_AR_DATA_WRITE 0x3c0
421 #define VGA_AR_DATA_READ 0x3c1
423 #define VGA_GR_INDEX 0x3ce
424 #define VGA_GR_DATA 0x3cf
426 #define VGA_GR_MEM_READ_MODE_SHIFT 3
427 #define VGA_GR_MEM_READ_MODE_PLANE 1
429 #define VGA_GR_MEM_MODE_MASK 0xc
430 #define VGA_GR_MEM_MODE_SHIFT 2
431 #define VGA_GR_MEM_A0000_AFFFF 0
432 #define VGA_GR_MEM_A0000_BFFFF 1
433 #define VGA_GR_MEM_B0000_B7FFF 2
434 #define VGA_GR_MEM_B0000_BFFFF 3
436 #define VGA_DACMASK 0x3c6
437 #define VGA_DACRX 0x3c7
438 #define VGA_DACWX 0x3c8
439 #define VGA_DACDATA 0x3c9
441 #define VGA_CR_INDEX_MDA 0x3b4
442 #define VGA_CR_DATA_MDA 0x3b5
443 #define VGA_CR_INDEX_CGA 0x3d4
444 #define VGA_CR_DATA_CGA 0x3d5
446 #define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23))
447 #define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23))
448 #define CMD_REPORT_HEAD (7<<23)
449 #define CMD_STORE_DWORD_IDX ((0x21<<23) | 0x1)
450 #define CMD_OP_BATCH_BUFFER ((0x0<<29)|(0x30<<23)|0x1)
452 #define CMD_MI_FLUSH (0x04 << 23)
453 #define MI_NO_WRITE_FLUSH (1 << 2)
454 #define MI_READ_FLUSH (1 << 0)
455 #define MI_EXE_FLUSH (1 << 1)
456 #define MI_END_SCENE (1 << 4) /* flush binner and incr scene count */
457 #define MI_SCENE_COUNT (1 << 3) /* just increment scene count */
459 /* Packet to load a register value from the ring/batch command stream:
461 #define CMD_MI_LOAD_REGISTER_IMM ((0x22 << 23)|0x1)
463 #define BB1_START_ADDR_MASK (~0x7)
464 #define BB1_PROTECTED (1<<0)
465 #define BB1_UNPROTECTED (0<<0)
466 #define BB2_END_ADDR_MASK (~0x7)
468 #define I915REG_HWS_PGA 0x02080
470 /* Framebuffer compression */
471 #define FBC_CFB_BASE 0x03200 /* 4k page aligned */
472 #define FBC_LL_BASE 0x03204 /* 4k page aligned */
473 #define FBC_CONTROL 0x03208
474 #define FBC_CTL_EN (1<<31)
475 #define FBC_CTL_PERIODIC (1<<30)
476 #define FBC_CTL_INTERVAL_SHIFT (16)
477 #define FBC_CTL_UNCOMPRESSIBLE (1<<14)
478 #define FBC_CTL_STRIDE_SHIFT (5)
479 #define FBC_CTL_FENCENO (1<<0)
480 #define FBC_COMMAND 0x0320c
481 #define FBC_CMD_COMPRESS (1<<0)
482 #define FBC_STATUS 0x03210
483 #define FBC_STAT_COMPRESSING (1<<31)
484 #define FBC_STAT_COMPRESSED (1<<30)
485 #define FBC_STAT_MODIFIED (1<<29)
486 #define FBC_STAT_CURRENT_LINE (1<<0)
487 #define FBC_CONTROL2 0x03214
488 #define FBC_CTL_FENCE_DBL (0<<4)
489 #define FBC_CTL_IDLE_IMM (0<<2)
490 #define FBC_CTL_IDLE_FULL (1<<2)
491 #define FBC_CTL_IDLE_LINE (2<<2)
492 #define FBC_CTL_IDLE_DEBUG (3<<2)
493 #define FBC_CTL_CPU_FENCE (1<<1)
494 #define FBC_CTL_PLANEA (0<<0)
495 #define FBC_CTL_PLANEB (1<<0)
496 #define FBC_FENCE_OFF 0x0321b
498 #define FBC_LL_SIZE (1536)
499 #define FBC_LL_PAD (32)
503 #define USER_INT_FLAG (1<<1)
504 #define VSYNC_PIPEB_FLAG (1<<5)
505 #define VSYNC_PIPEA_FLAG (1<<7)
506 #define HWB_OOM_FLAG (1<<13) /* binner out of memory */
508 #define I915REG_HWSTAM 0x02098
509 #define I915REG_INT_IDENTITY_R 0x020a4
510 #define I915REG_INT_MASK_R 0x020a8
511 #define I915REG_INT_ENABLE_R 0x020a0
512 #define I915REG_INSTPM 0x020c0
514 #define I915REG_PIPEASTAT 0x70024
515 #define I915REG_PIPEBSTAT 0x71024
517 #define I915_VBLANK_INTERRUPT_ENABLE (1UL<<17)
518 #define I915_VBLANK_CLEAR (1UL<<1)
528 # define GPIO_CLOCK_DIR_MASK (1 << 0)
529 # define GPIO_CLOCK_DIR_IN (0 << 1)
530 # define GPIO_CLOCK_DIR_OUT (1 << 1)
531 # define GPIO_CLOCK_VAL_MASK (1 << 2)
532 # define GPIO_CLOCK_VAL_OUT (1 << 3)
533 # define GPIO_CLOCK_VAL_IN (1 << 4)
534 # define GPIO_CLOCK_PULLUP_DISABLE (1 << 5)
535 # define GPIO_DATA_DIR_MASK (1 << 8)
536 # define GPIO_DATA_DIR_IN (0 << 9)
537 # define GPIO_DATA_DIR_OUT (1 << 9)
538 # define GPIO_DATA_VAL_MASK (1 << 10)
539 # define GPIO_DATA_VAL_OUT (1 << 11)
540 # define GPIO_DATA_VAL_IN (1 << 12)
541 # define GPIO_DATA_PULLUP_DISABLE (1 << 13)
545 #define VCLK2_VCO_M 0x6008 /* treat as 16 bit? (includes msbs) */
546 #define VCLK2_VCO_N 0x600a
547 #define VCLK2_VCO_DIV_SEL 0x6012
549 #define VCLK_DIVISOR_VGA0 0x6000
550 #define VCLK_DIVISOR_VGA1 0x6004
551 #define VCLK_POST_DIV 0x6010
552 /** Selects a post divisor of 4 instead of 2. */
553 # define VGA1_PD_P2_DIV_4 (1 << 15)
554 /** Overrides the p2 post divisor field */
555 # define VGA1_PD_P1_DIV_2 (1 << 13)
556 # define VGA1_PD_P1_SHIFT 8
557 /** P1 value is 2 greater than this field */
558 # define VGA1_PD_P1_MASK (0x1f << 8)
559 /** Selects a post divisor of 4 instead of 2. */
560 # define VGA0_PD_P2_DIV_4 (1 << 7)
561 /** Overrides the p2 post divisor field */
562 # define VGA0_PD_P1_DIV_2 (1 << 5)
563 # define VGA0_PD_P1_SHIFT 0
564 /** P1 value is 2 greater than this field */
565 # define VGA0_PD_P1_MASK (0x1f << 0)
567 #define POST_DIV_SELECT 0x70
568 #define POST_DIV_1 0x00
569 #define POST_DIV_2 0x10
570 #define POST_DIV_4 0x20
571 #define POST_DIV_8 0x30
572 #define POST_DIV_16 0x40
573 #define POST_DIV_32 0x50
574 #define VCO_LOOP_DIV_BY_4M 0x00
575 #define VCO_LOOP_DIV_BY_16M 0x04
577 #define SRX_INDEX 0x3c4
578 #define SRX_DATA 0x3c5
580 #define SR01_SCREEN_OFF (1<<5)
583 #define PPCR_ON (1<<0)
586 #define DVOA_ON (1<<31)
588 #define DVOB_ON (1<<31)
590 #define DVOC_ON (1<<31)
592 #define LVDS_ON (1<<31)
595 #define ADPA_DPMS_MASK (~(3<<10))
596 #define ADPA_DPMS_ON (0<<10)
597 #define ADPA_DPMS_SUSPEND (1<<10)
598 #define ADPA_DPMS_STANDBY (2<<10)
599 #define ADPA_DPMS_OFF (3<<10)
602 #define LP_RING 0x2030
603 #define HP_RING 0x2040
604 /* The binner has its own ring buffer:
606 #define HWB_RING 0x2400
608 #define RING_TAIL 0x00
609 #define TAIL_ADDR 0x001FFFF8
610 #define RING_HEAD 0x04
611 #define HEAD_WRAP_COUNT 0xFFE00000
612 #define HEAD_WRAP_ONE 0x00200000
613 #define HEAD_ADDR 0x001FFFFC
614 #define RING_START 0x08
615 #define START_ADDR 0x0xFFFFF000
616 #define RING_LEN 0x0C
617 #define RING_NR_PAGES 0x001FF000
618 #define RING_REPORT_MASK 0x00000006
619 #define RING_REPORT_64K 0x00000002
620 #define RING_REPORT_128K 0x00000004
621 #define RING_NO_REPORT 0x00000000
622 #define RING_VALID_MASK 0x00000001
623 #define RING_VALID 0x00000001
624 #define RING_INVALID 0x00000000
626 /* Instruction parser error reg:
630 /* Scratch pad debug 0 reg:
638 /* Secondary DMA fetch address debug reg:
640 #define DMA_FADD_S 0x20d4
643 * - Manipulating render cache behaviour is central
644 * to the concept of zone rendering, tuning this reg can help avoid
645 * unnecessary render cache reads and even writes (for z/stencil)
646 * at beginning and end of scene.
648 * - To change a bit, write to this reg with a mask bit set and the
649 * bit of interest either set or cleared. EG: (BIT<<16) | BIT to set.
651 #define Cache_Mode_0 0x2120
652 #define CM0_MASK_SHIFT 16
653 #define CM0_IZ_OPT_DISABLE (1<<6)
654 #define CM0_ZR_OPT_DISABLE (1<<5)
655 #define CM0_DEPTH_EVICT_DISABLE (1<<4)
656 #define CM0_COLOR_EVICT_DISABLE (1<<3)
657 #define CM0_DEPTH_WRITE_DISABLE (1<<1)
658 #define CM0_RC_OP_FLUSH_DISABLE (1<<0)
661 /* Graphics flush control. A CPU write flushes the GWB of all writes.
662 * The data is discarded.
664 #define GFX_FLSH_CNTL 0x2170
666 /* Binner control. Defines the location of the bin pointer list:
668 #define BINCTL 0x2420
669 #define BC_MASK (1 << 9)
671 /* Binned scene info.
673 #define BINSCENE 0x2428
674 #define BS_OP_LOAD (1 << 8)
675 #define BS_MASK (1 << 22)
677 /* Bin command parser debug reg:
681 /* Bin memory control debug reg:
685 /* Bin data cache debug reg:
689 /* Binner pointer cache debug reg:
693 /* Binner scratch pad debug reg:
695 #define BINSKPD 0x24f0
697 /* HWB scratch pad debug reg:
699 #define HWBSKPD 0x24f4
701 /* Binner memory pool reg:
703 #define BMP_BUFFER 0x2430
704 #define BMP_PAGE_SIZE_4K (0 << 10)
705 #define BMP_BUFFER_SIZE_SHIFT 1
706 #define BMP_ENABLE (1 << 0)
708 /* Get/put memory from the binner memory pool:
710 #define BMP_GET 0x2438
711 #define BMP_PUT 0x2440
712 #define BMP_OFFSET_SHIFT 5
716 #define GFX_OP_RASTER_RULES ((0x3<<29)|(0x7<<24))
718 #define GFX_OP_SCISSOR ((0x3<<29)|(0x1c<<24)|(0x10<<19))
719 #define SC_UPDATE_SCISSOR (0x1<<1)
720 #define SC_ENABLE_MASK (0x1<<0)
721 #define SC_ENABLE (0x1<<0)
723 #define GFX_OP_LOAD_INDIRECT ((0x3<<29)|(0x1d<<24)|(0x7<<16))
725 #define GFX_OP_SCISSOR_INFO ((0x3<<29)|(0x1d<<24)|(0x81<<16)|(0x1))
726 #define SCI_YMIN_MASK (0xffff<<16)
727 #define SCI_XMIN_MASK (0xffff<<0)
728 #define SCI_YMAX_MASK (0xffff<<16)
729 #define SCI_XMAX_MASK (0xffff<<0)
731 #define GFX_OP_SCISSOR_ENABLE ((0x3<<29)|(0x1c<<24)|(0x10<<19))
732 #define GFX_OP_SCISSOR_RECT ((0x3<<29)|(0x1d<<24)|(0x81<<16)|1)
733 #define GFX_OP_COLOR_FACTOR ((0x3<<29)|(0x1d<<24)|(0x1<<16)|0x0)
734 #define GFX_OP_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16))
735 #define GFX_OP_MAP_INFO ((0x3<<29)|(0x1d<<24)|0x4)
736 #define GFX_OP_DESTBUFFER_VARS ((0x3<<29)|(0x1d<<24)|(0x85<<16)|0x0)
737 #define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3))
739 #define GFX_OP_DRAWRECT_INFO_I965 ((0x7900<<16)|0x2)
741 #define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|4)
742 #define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6)
743 #define XY_MONO_SRC_COPY_IMM_BLT ((2<<29)|(0x71<<22)|5)
744 #define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21)
745 #define XY_SRC_COPY_BLT_WRITE_RGB (1<<20)
746 #define BLT_DEPTH_8 (0<<24)
747 #define BLT_DEPTH_16_565 (1<<24)
748 #define BLT_DEPTH_16_1555 (2<<24)
749 #define BLT_DEPTH_32 (3<<24)
750 #define BLT_ROP_GXCOPY (0xcc<<16)
752 #define MI_BATCH_BUFFER ((0x30<<23)|1)
753 #define MI_BATCH_BUFFER_START (0x31<<23)
754 #define MI_BATCH_BUFFER_END (0xA<<23)
755 #define MI_BATCH_NON_SECURE (1)
757 #define MI_BATCH_NON_SECURE_I965 (1<<8)
759 #define MI_WAIT_FOR_EVENT ((0x3<<23))
760 #define MI_WAIT_FOR_PLANE_B_FLIP (1<<6)
761 #define MI_WAIT_FOR_PLANE_A_FLIP (1<<2)
762 #define MI_WAIT_FOR_PLANE_A_SCANLINES (1<<1)
764 #define MI_LOAD_SCAN_LINES_INCL ((0x12<<23))
766 #define CMD_OP_DISPLAYBUFFER_INFO ((0x0<<29)|(0x14<<23)|2)
767 #define ASYNC_FLIP (1<<22)
768 #define DISPLAY_PLANE_A (0<<20)
769 #define DISPLAY_PLANE_B (1<<20)
772 #define DSPACNTR 0x70180
773 #define DSPBCNTR 0x71180
774 #define DISPPLANE_SEL_PIPE_MASK (1<<24)
776 /* Define the region of interest for the binner:
778 #define CMD_OP_BIN_CONTROL ((0x3<<29)|(0x1d<<24)|(0x84<<16)|4)
780 #define CMD_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1)
782 #define BREADCRUMB_BITS 31
783 #define BREADCRUMB_MASK ((1U << BREADCRUMB_BITS) - 1)
785 #define READ_BREADCRUMB(dev_priv) (((volatile u32*)(dev_priv->hw_status_page))[5])
786 #define READ_HWSP(dev_priv, reg) (((volatile u32*)(dev_priv->hw_status_page))[reg])
788 #define BLC_PWM_CTL 0x61254
789 #define BACKLIGHT_MODULATION_FREQ_SHIFT (17)
791 #define BLC_PWM_CTL2 0x61250
794 * This is the most significant 15 bits of the number of backlight cycles in a
795 * complete cycle of the modulated backlight control.
797 * The actual value is this field multiplied by two.
799 #define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17)
800 #define BLM_LEGACY_MODE (1 << 16)
802 * This is the number of cycles out of the backlight modulation cycle for which
803 * the backlight is on.
805 * This field must be no greater than the number of cycles in the complete
806 * backlight modulation cycle.
808 #define BACKLIGHT_DUTY_CYCLE_SHIFT (0)
809 #define BACKLIGHT_DUTY_CYCLE_MASK (0xffff)
811 #define I915_GCFGC 0xf0
812 #define I915_LOW_FREQUENCY_ENABLE (1 << 7)
813 #define I915_DISPLAY_CLOCK_190_200_MHZ (0 << 4)
814 #define I915_DISPLAY_CLOCK_333_MHZ (4 << 4)
815 #define I915_DISPLAY_CLOCK_MASK (7 << 4)
817 #define I855_HPLLCC 0xc0
818 #define I855_CLOCK_CONTROL_MASK (3 << 0)
819 #define I855_CLOCK_133_200 (0 << 0)
820 #define I855_CLOCK_100_200 (1 << 0)
821 #define I855_CLOCK_100_133 (2 << 0)
822 #define I855_CLOCK_166_250 (3 << 0)
826 #define VCLK2_VCO_M 0x6008 /* treat as 16 bit? (includes msbs) */
827 #define VCLK2_VCO_N 0x600a
828 #define VCLK2_VCO_DIV_SEL 0x6012
830 #define VCLK_DIVISOR_VGA0 0x6000
831 #define VCLK_DIVISOR_VGA1 0x6004
832 #define VCLK_POST_DIV 0x6010
833 /** Selects a post divisor of 4 instead of 2. */
834 # define VGA1_PD_P2_DIV_4 (1 << 15)
835 /** Overrides the p2 post divisor field */
836 # define VGA1_PD_P1_DIV_2 (1 << 13)
837 # define VGA1_PD_P1_SHIFT 8
838 /** P1 value is 2 greater than this field */
839 # define VGA1_PD_P1_MASK (0x1f << 8)
840 /** Selects a post divisor of 4 instead of 2. */
841 # define VGA0_PD_P2_DIV_4 (1 << 7)
842 /** Overrides the p2 post divisor field */
843 # define VGA0_PD_P1_DIV_2 (1 << 5)
844 # define VGA0_PD_P1_SHIFT 0
845 /** P1 value is 2 greater than this field */
846 # define VGA0_PD_P1_MASK (0x1f << 0)
848 /* I830 CRTC registers */
849 #define HTOTAL_A 0x60000
850 #define HBLANK_A 0x60004
851 #define HSYNC_A 0x60008
852 #define VTOTAL_A 0x6000c
853 #define VBLANK_A 0x60010
854 #define VSYNC_A 0x60014
855 #define PIPEASRC 0x6001c
856 #define BCLRPAT_A 0x60020
857 #define VSYNCSHIFT_A 0x60028
859 #define HTOTAL_B 0x61000
860 #define HBLANK_B 0x61004
861 #define HSYNC_B 0x61008
862 #define VTOTAL_B 0x6100c
863 #define VBLANK_B 0x61010
864 #define VSYNC_B 0x61014
865 #define PIPEBSRC 0x6101c
866 #define BCLRPAT_B 0x61020
867 #define VSYNCSHIFT_B 0x61028
869 #define PP_STATUS 0x61200
870 # define PP_ON (1 << 31)
872 * Indicates that all dependencies of the panel are on:
876 * - LVDS/DVOB/DVOC on
878 # define PP_READY (1 << 30)
879 # define PP_SEQUENCE_NONE (0 << 28)
880 # define PP_SEQUENCE_ON (1 << 28)
881 # define PP_SEQUENCE_OFF (2 << 28)
882 # define PP_SEQUENCE_MASK 0x30000000
883 #define PP_CONTROL 0x61204
884 # define POWER_TARGET_ON (1 << 0)
886 #define LVDSPP_ON 0x61208
887 #define LVDSPP_OFF 0x6120c
888 #define PP_CYCLE 0x61210
890 #define PFIT_CONTROL 0x61230
891 # define PFIT_ENABLE (1 << 31)
892 # define PFIT_PIPE_MASK (3 << 29)
893 # define PFIT_PIPE_SHIFT 29
894 # define VERT_INTERP_DISABLE (0 << 10)
895 # define VERT_INTERP_BILINEAR (1 << 10)
896 # define VERT_INTERP_MASK (3 << 10)
897 # define VERT_AUTO_SCALE (1 << 9)
898 # define HORIZ_INTERP_DISABLE (0 << 6)
899 # define HORIZ_INTERP_BILINEAR (1 << 6)
900 # define HORIZ_INTERP_MASK (3 << 6)
901 # define HORIZ_AUTO_SCALE (1 << 5)
902 # define PANEL_8TO6_DITHER_ENABLE (1 << 3)
904 #define PFIT_PGM_RATIOS 0x61234
905 # define PFIT_VERT_SCALE_MASK 0xfff00000
906 # define PFIT_HORIZ_SCALE_MASK 0x0000fff0
908 #define PFIT_AUTO_RATIOS 0x61238
911 #define DPLL_A 0x06014
912 #define DPLL_B 0x06018
913 # define DPLL_VCO_ENABLE (1 << 31)
914 # define DPLL_DVO_HIGH_SPEED (1 << 30)
915 # define DPLL_SYNCLOCK_ENABLE (1 << 29)
916 # define DPLL_VGA_MODE_DIS (1 << 28)
917 # define DPLLB_MODE_DAC_SERIAL (1 << 26) /* i915 */
918 # define DPLLB_MODE_LVDS (2 << 26) /* i915 */
919 # define DPLL_MODE_MASK (3 << 26)
920 # define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24) /* i915 */
921 # define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5 (1 << 24) /* i915 */
922 # define DPLLB_LVDS_P2_CLOCK_DIV_14 (0 << 24) /* i915 */
923 # define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */
924 # define DPLL_P2_CLOCK_DIV_MASK 0x03000000 /* i915 */
925 # define DPLL_FPA01_P1_POST_DIV_MASK 0x00ff0000 /* i915 */
927 * The i830 generation, in DAC/serial mode, defines p1 as two plus this
928 * bitfield, or just 2 if PLL_P1_DIVIDE_BY_TWO is set.
930 # define DPLL_FPA01_P1_POST_DIV_MASK_I830 0x001f0000
932 * The i830 generation, in LVDS mode, defines P1 as the bit number set within
933 * this field (only one bit may be set).
935 # define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS 0x003f0000
936 # define DPLL_FPA01_P1_POST_DIV_SHIFT 16
937 # define PLL_P2_DIVIDE_BY_4 (1 << 23) /* i830, required in DVO non-gang */
938 # define PLL_P1_DIVIDE_BY_TWO (1 << 21) /* i830 */
939 # define PLL_REF_INPUT_DREFCLK (0 << 13)
940 # define PLL_REF_INPUT_TVCLKINA (1 << 13) /* i830 */
941 # define PLL_REF_INPUT_TVCLKINBC (2 << 13) /* SDVO TVCLKIN */
942 # define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13)
943 # define PLL_REF_INPUT_MASK (3 << 13)
944 # define PLL_LOAD_PULSE_PHASE_SHIFT 9
946 * Parallel to Serial Load Pulse phase selection.
947 * Selects the phase for the 10X DPLL clock for the PCIe
948 * digital display port. The range is 4 to 13; 10 or more
949 * is just a flip delay. The default is 6
951 # define PLL_LOAD_PULSE_PHASE_MASK (0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
952 # define DISPLAY_RATE_SELECT_FPA1 (1 << 8)
955 * SDVO multiplier for 945G/GM. Not used on 965.
957 * \sa DPLL_MD_UDI_MULTIPLIER_MASK
959 # define SDVO_MULTIPLIER_MASK 0x000000ff
960 # define SDVO_MULTIPLIER_SHIFT_HIRES 4
961 # define SDVO_MULTIPLIER_SHIFT_VGA 0
963 /** @defgroup DPLL_MD
966 /** Pipe A SDVO/UDI clock multiplier/divider register for G965. */
967 #define DPLL_A_MD 0x0601c
968 /** Pipe B SDVO/UDI clock multiplier/divider register for G965. */
969 #define DPLL_B_MD 0x06020
971 * UDI pixel divider, controlling how many pixels are stuffed into a packet.
973 * Value is pixels minus 1. Must be set to 1 pixel for SDVO.
975 # define DPLL_MD_UDI_DIVIDER_MASK 0x3f000000
976 # define DPLL_MD_UDI_DIVIDER_SHIFT 24
977 /** UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
978 # define DPLL_MD_VGA_UDI_DIVIDER_MASK 0x003f0000
979 # define DPLL_MD_VGA_UDI_DIVIDER_SHIFT 16
981 * SDVO/UDI pixel multiplier.
983 * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
984 * clock rate is 10 times the DPLL clock. At low resolution/refresh rate
985 * modes, the bus rate would be below the limits, so SDVO allows for stuffing
986 * dummy bytes in the datastream at an increased clock rate, with both sides of
987 * the link knowing how many bytes are fill.
989 * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
990 * rate to 130Mhz to get a bus rate of 1.30Ghz. The DPLL clock rate would be
991 * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
992 * through an SDVO command.
994 * This register field has values of multiplication factor minus 1, with
995 * a maximum multiplier of 5 for SDVO.
997 # define DPLL_MD_UDI_MULTIPLIER_MASK 0x00003f00
998 # define DPLL_MD_UDI_MULTIPLIER_SHIFT 8
999 /** SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
1000 * This best be set to the default value (3) or the CRT won't work. No,
1001 * I don't entirely understand what this does...
1003 # define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f
1004 # define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
1007 #define DPLL_TEST 0x606c
1008 # define DPLLB_TEST_SDVO_DIV_1 (0 << 22)
1009 # define DPLLB_TEST_SDVO_DIV_2 (1 << 22)
1010 # define DPLLB_TEST_SDVO_DIV_4 (2 << 22)
1011 # define DPLLB_TEST_SDVO_DIV_MASK (3 << 22)
1012 # define DPLLB_TEST_N_BYPASS (1 << 19)
1013 # define DPLLB_TEST_M_BYPASS (1 << 18)
1014 # define DPLLB_INPUT_BUFFER_ENABLE (1 << 16)
1015 # define DPLLA_TEST_N_BYPASS (1 << 3)
1016 # define DPLLA_TEST_M_BYPASS (1 << 2)
1017 # define DPLLA_INPUT_BUFFER_ENABLE (1 << 0)
1019 #define ADPA 0x61100
1020 #define ADPA_DAC_ENABLE (1<<31)
1021 #define ADPA_DAC_DISABLE 0
1022 #define ADPA_PIPE_SELECT_MASK (1<<30)
1023 #define ADPA_PIPE_A_SELECT 0
1024 #define ADPA_PIPE_B_SELECT (1<<30)
1025 #define ADPA_USE_VGA_HVPOLARITY (1<<15)
1026 #define ADPA_SETS_HVPOLARITY 0
1027 #define ADPA_VSYNC_CNTL_DISABLE (1<<11)
1028 #define ADPA_VSYNC_CNTL_ENABLE 0
1029 #define ADPA_HSYNC_CNTL_DISABLE (1<<10)
1030 #define ADPA_HSYNC_CNTL_ENABLE 0
1031 #define ADPA_VSYNC_ACTIVE_HIGH (1<<4)
1032 #define ADPA_VSYNC_ACTIVE_LOW 0
1033 #define ADPA_HSYNC_ACTIVE_HIGH (1<<3)
1034 #define ADPA_HSYNC_ACTIVE_LOW 0
1036 #define FPA0 0x06040
1037 #define FPA1 0x06044
1038 #define FPB0 0x06048
1039 #define FPB1 0x0604c
1040 # define FP_N_DIV_MASK 0x003f0000
1041 # define FP_N_DIV_SHIFT 16
1042 # define FP_M1_DIV_MASK 0x00003f00
1043 # define FP_M1_DIV_SHIFT 8
1044 # define FP_M2_DIV_MASK 0x0000003f
1045 # define FP_M2_DIV_SHIFT 0
1048 #define PORT_HOTPLUG_EN 0x61110
1049 # define SDVOB_HOTPLUG_INT_EN (1 << 26)
1050 # define SDVOC_HOTPLUG_INT_EN (1 << 25)
1051 # define TV_HOTPLUG_INT_EN (1 << 18)
1052 # define CRT_HOTPLUG_INT_EN (1 << 9)
1053 # define CRT_HOTPLUG_FORCE_DETECT (1 << 3)
1055 #define PORT_HOTPLUG_STAT 0x61114
1056 # define CRT_HOTPLUG_INT_STATUS (1 << 11)
1057 # define TV_HOTPLUG_INT_STATUS (1 << 10)
1058 # define CRT_HOTPLUG_MONITOR_MASK (3 << 8)
1059 # define CRT_HOTPLUG_MONITOR_COLOR (3 << 8)
1060 # define CRT_HOTPLUG_MONITOR_MONO (2 << 8)
1061 # define CRT_HOTPLUG_MONITOR_NONE (0 << 8)
1062 # define SDVOC_HOTPLUG_INT_STATUS (1 << 7)
1063 # define SDVOB_HOTPLUG_INT_STATUS (1 << 6)
1065 #define SDVOB 0x61140
1066 #define SDVOC 0x61160
1067 #define SDVO_ENABLE (1 << 31)
1068 #define SDVO_PIPE_B_SELECT (1 << 30)
1069 #define SDVO_STALL_SELECT (1 << 29)
1070 #define SDVO_INTERRUPT_ENABLE (1 << 26)
1072 * 915G/GM SDVO pixel multiplier.
1074 * Programmed value is multiplier - 1, up to 5x.
1076 * \sa DPLL_MD_UDI_MULTIPLIER_MASK
1078 #define SDVO_PORT_MULTIPLY_MASK (7 << 23)
1079 #define SDVO_PORT_MULTIPLY_SHIFT 23
1080 #define SDVO_PHASE_SELECT_MASK (15 << 19)
1081 #define SDVO_PHASE_SELECT_DEFAULT (6 << 19)
1082 #define SDVO_CLOCK_OUTPUT_INVERT (1 << 18)
1083 #define SDVOC_GANG_MODE (1 << 16)
1084 #define SDVO_BORDER_ENABLE (1 << 7)
1085 #define SDVOB_PCIE_CONCURRENCY (1 << 3)
1086 #define SDVO_DETECTED (1 << 2)
1087 /* Bits to be preserved when writing */
1088 #define SDVOB_PRESERVE_MASK ((1 << 17) | (1 << 16) | (1 << 14))
1089 #define SDVOC_PRESERVE_MASK (1 << 17)
1095 * This register controls the LVDS output enable, pipe selection, and data
1098 * All of the clock/data pairs are force powered down by power sequencing.
1100 #define LVDS 0x61180
1102 * Enables the LVDS port. This bit must be set before DPLLs are enabled, as
1103 * the DPLL semantics change when the LVDS is assigned to that pipe.
1105 # define LVDS_PORT_EN (1 << 31)
1106 /** Selects pipe B for LVDS data. Must be set on pre-965. */
1107 # define LVDS_PIPEB_SELECT (1 << 30)
1110 * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
1113 # define LVDS_A0A2_CLKA_POWER_MASK (3 << 8)
1114 # define LVDS_A0A2_CLKA_POWER_DOWN (0 << 8)
1115 # define LVDS_A0A2_CLKA_POWER_UP (3 << 8)
1117 * Controls the A3 data pair, which contains the additional LSBs for 24 bit
1118 * mode. Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
1121 # define LVDS_A3_POWER_MASK (3 << 6)
1122 # define LVDS_A3_POWER_DOWN (0 << 6)
1123 # define LVDS_A3_POWER_UP (3 << 6)
1125 * Controls the CLKB pair. This should only be set when LVDS_B0B3_POWER_UP
1128 # define LVDS_CLKB_POWER_MASK (3 << 4)
1129 # define LVDS_CLKB_POWER_DOWN (0 << 4)
1130 # define LVDS_CLKB_POWER_UP (3 << 4)
1133 * Controls the B0-B3 data pairs. This must be set to match the DPLL p2
1134 * setting for whether we are in dual-channel mode. The B3 pair will
1135 * additionally only be powered up when LVDS_A3_POWER_UP is set.
1137 # define LVDS_B0B3_POWER_MASK (3 << 2)
1138 # define LVDS_B0B3_POWER_DOWN (0 << 2)
1139 # define LVDS_B0B3_POWER_UP (3 << 2)
1141 #define PIPEACONF 0x70008
1142 #define PIPEACONF_ENABLE (1<<31)
1143 #define PIPEACONF_DISABLE 0
1144 #define PIPEACONF_DOUBLE_WIDE (1<<30)
1145 #define I965_PIPECONF_ACTIVE (1<<30)
1146 #define PIPEACONF_SINGLE_WIDE 0
1147 #define PIPEACONF_PIPE_UNLOCKED 0
1148 #define PIPEACONF_PIPE_LOCKED (1<<25)
1149 #define PIPEACONF_PALETTE 0
1150 #define PIPEACONF_GAMMA (1<<24)
1151 #define PIPECONF_FORCE_BORDER (1<<25)
1152 #define PIPECONF_PROGRESSIVE (0 << 21)
1153 #define PIPECONF_INTERLACE_W_FIELD_INDICATION (6 << 21)
1154 #define PIPECONF_INTERLACE_FIELD_0_ONLY (7 << 21)
1156 #define PIPEBCONF 0x71008
1157 #define PIPEBCONF_ENABLE (1<<31)
1158 #define PIPEBCONF_DISABLE 0
1159 #define PIPEBCONF_DOUBLE_WIDE (1<<30)
1160 #define PIPEBCONF_DISABLE 0
1161 #define PIPEBCONF_GAMMA (1<<24)
1162 #define PIPEBCONF_PALETTE 0
1164 #define PIPEBGCMAXRED 0x71010
1165 #define PIPEBGCMAXGREEN 0x71014
1166 #define PIPEBGCMAXBLUE 0x71018
1167 #define PIPEBSTAT 0x71024
1168 #define PIPEBFRAMEHIGH 0x71040
1169 #define PIPEBFRAMEPIXEL 0x71044
1171 #define DSPACNTR 0x70180
1172 #define DSPBCNTR 0x71180
1173 #define DISPLAY_PLANE_ENABLE (1<<31)
1174 #define DISPLAY_PLANE_DISABLE 0
1175 #define DISPPLANE_GAMMA_ENABLE (1<<30)
1176 #define DISPPLANE_GAMMA_DISABLE 0
1177 #define DISPPLANE_PIXFORMAT_MASK (0xf<<26)
1178 #define DISPPLANE_8BPP (0x2<<26)
1179 #define DISPPLANE_15_16BPP (0x4<<26)
1180 #define DISPPLANE_16BPP (0x5<<26)
1181 #define DISPPLANE_32BPP_NO_ALPHA (0x6<<26)
1182 #define DISPPLANE_32BPP (0x7<<26)
1183 #define DISPPLANE_STEREO_ENABLE (1<<25)
1184 #define DISPPLANE_STEREO_DISABLE 0
1185 #define DISPPLANE_SEL_PIPE_MASK (1<<24)
1186 #define DISPPLANE_SEL_PIPE_A 0
1187 #define DISPPLANE_SEL_PIPE_B (1<<24)
1188 #define DISPPLANE_SRC_KEY_ENABLE (1<<22)
1189 #define DISPPLANE_SRC_KEY_DISABLE 0
1190 #define DISPPLANE_LINE_DOUBLE (1<<20)
1191 #define DISPPLANE_NO_LINE_DOUBLE 0
1192 #define DISPPLANE_STEREO_POLARITY_FIRST 0
1193 #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18)
1195 #define DISPPLANE_ALPHA_TRANS_ENABLE (1<<15)
1196 #define DISPPLANE_ALPHA_TRANS_DISABLE 0
1197 #define DISPPLANE_SPRITE_ABOVE_DISPLAYA 0
1198 #define DISPPLANE_SPRITE_ABOVE_OVERLAY (1)
1200 #define DSPABASE 0x70184
1201 #define DSPASTRIDE 0x70188
1203 #define DSPBBASE 0x71184
1204 #define DSPBADDR DSPBBASE
1205 #define DSPBSTRIDE 0x71188
1207 #define DSPAKEYVAL 0x70194
1208 #define DSPAKEYMASK 0x70198
1210 #define DSPAPOS 0x7018C /* reserved */
1211 #define DSPASIZE 0x70190
1212 #define DSPBPOS 0x7118C
1213 #define DSPBSIZE 0x71190
1215 #define DSPASURF 0x7019C
1216 #define DSPATILEOFF 0x701A4
1218 #define DSPBSURF 0x7119C
1219 #define DSPBTILEOFF 0x711A4
1221 #define VGACNTRL 0x71400
1222 # define VGA_DISP_DISABLE (1 << 31)
1223 # define VGA_2X_MODE (1 << 30)
1224 # define VGA_PIPE_B_SELECT (1 << 29)
1227 * Some BIOS scratch area registers. The 845 (and 830?) store the amount
1228 * of video memory available to the BIOS in SWF1.
1231 #define SWF0 0x71410
1232 #define SWF1 0x71414
1233 #define SWF2 0x71418
1234 #define SWF3 0x7141c
1235 #define SWF4 0x71420
1236 #define SWF5 0x71424
1237 #define SWF6 0x71428
1239 #define SWF10 0x70410
1240 #define SWF30 0x72414
1241 #define SWF31 0x72418
1242 #define SWF32 0x7241c
1245 * Overlay registers. These are overlay registers accessed via MMIO.
1246 * Those loaded via the overlay register page are defined in i830_video.c.
1248 #define OVADD 0x30000
1250 #define DOVSTA 0x30008
1251 #define OC_BUF (0x3<<20)
1253 #define OGAMC5 0x30010
1254 #define OGAMC4 0x30014
1255 #define OGAMC3 0x30018
1256 #define OGAMC2 0x3001c
1257 #define OGAMC1 0x30020
1258 #define OGAMC0 0x30024
1263 #define PALETTE_A 0x0a000
1264 #define PALETTE_B 0x0a800
1266 #define IS_I830(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82830_CGC)
1267 #define IS_845G(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82845G_IG)
1268 #define IS_I85X(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82855GM_IG)
1269 #define IS_I855(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82855GM_IG)
1270 #define IS_I865G(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82865_IG)
1272 #define IS_I915G(dev) (dev->pci_device == PCI_DEVICE_ID_INTEL_82915G_IG)/* || dev->pci_device == PCI_DEVICE_ID_INTELPCI_CHIP_E7221_G)*/
1273 #define IS_I915GM(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82915GM_IG)
1274 #define IS_I945G(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82945G_IG)
1275 #define IS_I945GM(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82945GM_IG)
1277 #define IS_I965G(dev) ((dev)->pci_device == 0x2972 || \
1278 (dev)->pci_device == 0x2982 || \
1279 (dev)->pci_device == 0x2992 || \
1280 (dev)->pci_device == 0x29A2 || \
1281 (dev)->pci_device == 0x2A02 || \
1282 (dev)->pci_device == 0x2A12)
1284 #define IS_I965GM(dev) ((dev)->pci_device == 0x2A02)
1286 #define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \
1287 (dev)->pci_device == 0x29B2 || \
1288 (dev)->pci_device == 0x29D2)
1290 #define IS_I9XX(dev) (IS_I915G(dev) || IS_I915GM(dev) || IS_I945G(dev) || \
1291 IS_I945GM(dev) || IS_I965G(dev) || IS_G33(dev))
1293 #define IS_MOBILE(dev) (IS_I830(dev) || IS_I85X(dev) || IS_I915GM(dev) || \
1294 IS_I945GM(dev) || IS_I965GM(dev))
1296 #define PRIMARY_RINGBUFFER_SIZE (128*1024)