diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_drv.h')
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 93 |
1 files changed, 90 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index b3cc4731aa7c..4756e5cd6b5e 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -31,6 +31,7 @@ | |||
31 | #define _I915_DRV_H_ | 31 | #define _I915_DRV_H_ |
32 | 32 | ||
33 | #include "i915_reg.h" | 33 | #include "i915_reg.h" |
34 | #include "intel_bios.h" | ||
34 | #include <linux/io-mapping.h> | 35 | #include <linux/io-mapping.h> |
35 | 36 | ||
36 | /* General customization: | 37 | /* General customization: |
@@ -103,15 +104,23 @@ struct intel_opregion { | |||
103 | int enabled; | 104 | int enabled; |
104 | }; | 105 | }; |
105 | 106 | ||
107 | struct drm_i915_master_private { | ||
108 | drm_local_map_t *sarea; | ||
109 | struct _drm_i915_sarea *sarea_priv; | ||
110 | }; | ||
111 | #define I915_FENCE_REG_NONE -1 | ||
112 | |||
113 | struct drm_i915_fence_reg { | ||
114 | struct drm_gem_object *obj; | ||
115 | }; | ||
116 | |||
106 | typedef struct drm_i915_private { | 117 | typedef struct drm_i915_private { |
107 | struct drm_device *dev; | 118 | struct drm_device *dev; |
108 | 119 | ||
109 | int has_gem; | 120 | int has_gem; |
110 | 121 | ||
111 | void __iomem *regs; | 122 | void __iomem *regs; |
112 | drm_local_map_t *sarea; | ||
113 | 123 | ||
114 | drm_i915_sarea_t *sarea_priv; | ||
115 | drm_i915_ring_buffer_t ring; | 124 | drm_i915_ring_buffer_t ring; |
116 | 125 | ||
117 | drm_dma_handle_t *status_page_dmah; | 126 | drm_dma_handle_t *status_page_dmah; |
@@ -144,8 +153,30 @@ typedef struct drm_i915_private { | |||
144 | unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds; | 153 | unsigned int sr01, adpa, ppcr, dvob, dvoc, lvds; |
145 | int vblank_pipe; | 154 | int vblank_pipe; |
146 | 155 | ||
156 | bool cursor_needs_physical; | ||
157 | |||
158 | struct drm_mm vram; | ||
159 | |||
160 | int irq_enabled; | ||
161 | |||
147 | struct intel_opregion opregion; | 162 | struct intel_opregion opregion; |
148 | 163 | ||
164 | /* LVDS info */ | ||
165 | int backlight_duty_cycle; /* restore backlight to this value */ | ||
166 | bool panel_wants_dither; | ||
167 | struct drm_display_mode *panel_fixed_mode; | ||
168 | struct drm_display_mode *vbt_mode; /* if any */ | ||
169 | |||
170 | /* Feature bits from the VBIOS */ | ||
171 | unsigned int int_tv_support:1; | ||
172 | unsigned int lvds_dither:1; | ||
173 | unsigned int lvds_vbt:1; | ||
174 | unsigned int int_crt_support:1; | ||
175 | |||
176 | struct drm_i915_fence_reg fence_regs[16]; /* assume 965 */ | ||
177 | int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ | ||
178 | int num_fence_regs; /* 8 on pre-965, 16 otherwise */ | ||
179 | |||
149 | /* Register state */ | 180 | /* Register state */ |
150 | u8 saveLBB; | 181 | u8 saveLBB; |
151 | u32 saveDSPACNTR; | 182 | u32 saveDSPACNTR; |
@@ -364,6 +395,21 @@ struct drm_i915_gem_object { | |||
364 | * This is the same as gtt_space->start | 395 | * This is the same as gtt_space->start |
365 | */ | 396 | */ |
366 | uint32_t gtt_offset; | 397 | uint32_t gtt_offset; |
398 | /** | ||
399 | * Required alignment for the object | ||
400 | */ | ||
401 | uint32_t gtt_alignment; | ||
402 | /** | ||
403 | * Fake offset for use by mmap(2) | ||
404 | */ | ||
405 | uint64_t mmap_offset; | ||
406 | |||
407 | /** | ||
408 | * Fence register bits (if any) for this object. Will be set | ||
409 | * as needed when mapped into the GTT. | ||
410 | * Protected by dev->struct_mutex. | ||
411 | */ | ||
412 | int fence_reg; | ||
367 | 413 | ||
368 | /** Boolean whether this object has a valid gtt offset. */ | 414 | /** Boolean whether this object has a valid gtt offset. */ |
369 | int gtt_bound; | 415 | int gtt_bound; |
@@ -376,6 +422,7 @@ struct drm_i915_gem_object { | |||
376 | 422 | ||
377 | /** Current tiling mode for the object. */ | 423 | /** Current tiling mode for the object. */ |
378 | uint32_t tiling_mode; | 424 | uint32_t tiling_mode; |
425 | uint32_t stride; | ||
379 | 426 | ||
380 | /** AGP mapping type (AGP_USER_MEMORY or AGP_USER_CACHED_MEMORY */ | 427 | /** AGP mapping type (AGP_USER_MEMORY or AGP_USER_CACHED_MEMORY */ |
381 | uint32_t agp_type; | 428 | uint32_t agp_type; |
@@ -385,6 +432,10 @@ struct drm_i915_gem_object { | |||
385 | * flags which individual pages are valid. | 432 | * flags which individual pages are valid. |
386 | */ | 433 | */ |
387 | uint8_t *page_cpu_valid; | 434 | uint8_t *page_cpu_valid; |
435 | |||
436 | /** User space pin count and filp owning the pin */ | ||
437 | uint32_t user_pin_count; | ||
438 | struct drm_file *pin_filp; | ||
388 | }; | 439 | }; |
389 | 440 | ||
390 | /** | 441 | /** |
@@ -414,8 +465,19 @@ struct drm_i915_file_private { | |||
414 | } mm; | 465 | } mm; |
415 | }; | 466 | }; |
416 | 467 | ||
468 | enum intel_chip_family { | ||
469 | CHIP_I8XX = 0x01, | ||
470 | CHIP_I9XX = 0x02, | ||
471 | CHIP_I915 = 0x04, | ||
472 | CHIP_I965 = 0x08, | ||
473 | }; | ||
474 | |||
417 | extern struct drm_ioctl_desc i915_ioctls[]; | 475 | extern struct drm_ioctl_desc i915_ioctls[]; |
418 | extern int i915_max_ioctl; | 476 | extern int i915_max_ioctl; |
477 | extern unsigned int i915_fbpercrtc; | ||
478 | |||
479 | extern int i915_master_create(struct drm_device *dev, struct drm_master *master); | ||
480 | extern void i915_master_destroy(struct drm_device *dev, struct drm_master *master); | ||
419 | 481 | ||
420 | /* i915_dma.c */ | 482 | /* i915_dma.c */ |
421 | extern void i915_kernel_lost_context(struct drm_device * dev); | 483 | extern void i915_kernel_lost_context(struct drm_device * dev); |
@@ -441,6 +503,7 @@ extern int i915_irq_wait(struct drm_device *dev, void *data, | |||
441 | struct drm_file *file_priv); | 503 | struct drm_file *file_priv); |
442 | void i915_user_irq_get(struct drm_device *dev); | 504 | void i915_user_irq_get(struct drm_device *dev); |
443 | void i915_user_irq_put(struct drm_device *dev); | 505 | void i915_user_irq_put(struct drm_device *dev); |
506 | extern void i915_enable_interrupt (struct drm_device *dev); | ||
444 | 507 | ||
445 | extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS); | 508 | extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS); |
446 | extern void i915_driver_irq_preinstall(struct drm_device * dev); | 509 | extern void i915_driver_irq_preinstall(struct drm_device * dev); |
@@ -487,6 +550,8 @@ int i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, | |||
487 | struct drm_file *file_priv); | 550 | struct drm_file *file_priv); |
488 | int i915_gem_mmap_ioctl(struct drm_device *dev, void *data, | 551 | int i915_gem_mmap_ioctl(struct drm_device *dev, void *data, |
489 | struct drm_file *file_priv); | 552 | struct drm_file *file_priv); |
553 | int i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data, | ||
554 | struct drm_file *file_priv); | ||
490 | int i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, | 555 | int i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, |
491 | struct drm_file *file_priv); | 556 | struct drm_file *file_priv); |
492 | int i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data, | 557 | int i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data, |
@@ -523,6 +588,16 @@ uint32_t i915_get_gem_seqno(struct drm_device *dev); | |||
523 | void i915_gem_retire_requests(struct drm_device *dev); | 588 | void i915_gem_retire_requests(struct drm_device *dev); |
524 | void i915_gem_retire_work_handler(struct work_struct *work); | 589 | void i915_gem_retire_work_handler(struct work_struct *work); |
525 | void i915_gem_clflush_object(struct drm_gem_object *obj); | 590 | void i915_gem_clflush_object(struct drm_gem_object *obj); |
591 | int i915_gem_object_set_domain(struct drm_gem_object *obj, | ||
592 | uint32_t read_domains, | ||
593 | uint32_t write_domain); | ||
594 | int i915_gem_init_ringbuffer(struct drm_device *dev); | ||
595 | void i915_gem_cleanup_ringbuffer(struct drm_device *dev); | ||
596 | int i915_gem_do_init(struct drm_device *dev, unsigned long start, | ||
597 | unsigned long end); | ||
598 | int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); | ||
599 | int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj, | ||
600 | int write); | ||
526 | 601 | ||
527 | /* i915_gem_tiling.c */ | 602 | /* i915_gem_tiling.c */ |
528 | void i915_gem_detect_bit_6_swizzle(struct drm_device *dev); | 603 | void i915_gem_detect_bit_6_swizzle(struct drm_device *dev); |
@@ -561,6 +636,10 @@ static inline void opregion_asle_intr(struct drm_device *dev) { return; } | |||
561 | static inline void opregion_enable_asle(struct drm_device *dev) { return; } | 636 | static inline void opregion_enable_asle(struct drm_device *dev) { return; } |
562 | #endif | 637 | #endif |
563 | 638 | ||
639 | /* modesetting */ | ||
640 | extern void intel_modeset_init(struct drm_device *dev); | ||
641 | extern void intel_modeset_cleanup(struct drm_device *dev); | ||
642 | |||
564 | /** | 643 | /** |
565 | * Lock test for when it's just for synchronization of ring access. | 644 | * Lock test for when it's just for synchronization of ring access. |
566 | * | 645 | * |
@@ -578,6 +657,13 @@ static inline void opregion_enable_asle(struct drm_device *dev) { return; } | |||
578 | #define I915_WRITE16(reg, val) writel(val, dev_priv->regs + (reg)) | 657 | #define I915_WRITE16(reg, val) writel(val, dev_priv->regs + (reg)) |
579 | #define I915_READ8(reg) readb(dev_priv->regs + (reg)) | 658 | #define I915_READ8(reg) readb(dev_priv->regs + (reg)) |
580 | #define I915_WRITE8(reg, val) writeb(val, dev_priv->regs + (reg)) | 659 | #define I915_WRITE8(reg, val) writeb(val, dev_priv->regs + (reg)) |
660 | #ifdef writeq | ||
661 | #define I915_WRITE64(reg, val) writeq(val, dev_priv->regs + (reg)) | ||
662 | #else | ||
663 | #define I915_WRITE64(reg, val) (writel(val, dev_priv->regs + (reg)), \ | ||
664 | writel(upper_32_bits(val), dev_priv->regs + \ | ||
665 | (reg) + 4)) | ||
666 | #endif | ||
581 | 667 | ||
582 | #define I915_VERBOSE 0 | 668 | #define I915_VERBOSE 0 |
583 | 669 | ||
@@ -660,7 +746,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
660 | 746 | ||
661 | #define IS_G4X(dev) ((dev)->pci_device == 0x2E02 || \ | 747 | #define IS_G4X(dev) ((dev)->pci_device == 0x2E02 || \ |
662 | (dev)->pci_device == 0x2E12 || \ | 748 | (dev)->pci_device == 0x2E12 || \ |
663 | (dev)->pci_device == 0x2E22) | 749 | (dev)->pci_device == 0x2E22 || \ |
750 | IS_GM45(dev)) | ||
664 | 751 | ||
665 | #define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \ | 752 | #define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \ |
666 | (dev)->pci_device == 0x29B2 || \ | 753 | (dev)->pci_device == 0x29B2 || \ |