aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon.h
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-06-23 19:48:08 -0400
committerDave Airlie <airlied@redhat.com>2009-07-29 01:42:18 -0400
commite024e11070a0a0dc7163ce1ec2da354a638bdbed (patch)
treeadd483e7428f91da6f3c26be702aa45e6d69b694 /drivers/gpu/drm/radeon/radeon.h
parentc836e862803b2aa2bd9a354e151316d2b42c44ec (diff)
drm/radeon/kms: add initial colortiling support.
This adds new set/get tiling interfaces where the pitch and macro/micro tiling enables can be set. Along with a flag to decide if this object should have a surface when mapped. The only thing we need to allocate with a mapped surface should be the frontbuffer. Note rotate scanout shouldn't require one, and back/depth shouldn't either, though mesa needs some fixes. It fixes the TTM interfaces along Thomas's suggestions, and I've tested the surface stealing code with two X servers and not seen any lockdep issues. I've stopped tiling the fbcon frontbuffer, as I don't see there being any advantage other than testing, I've left the testing commands in there, just flip the fb_tiled to true in radeon_fb.c Open: Can we integrate endian swapping in with this? Future features: texture tiling - need to relocate texture registers TXOFFSET* with tiling info. This also merges Michel's cleanup surfaces regs at init time patch even though it makes sense on its own, this patch really relies on it. Some PowerMac firmwares set up a tiling surface at the beginning of VRAM which messes us up otherwise. that patch is: Signed-off-by: Michel Dänzer <daenzer@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon.h')
-rw-r--r--drivers/gpu/drm/radeon/radeon.h32
1 files changed, 30 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 7f007185e7f7..af12a2fe3221 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -201,6 +201,14 @@ int radeon_fence_wait_last(struct radeon_device *rdev);
201struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence); 201struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence);
202void radeon_fence_unref(struct radeon_fence **fence); 202void radeon_fence_unref(struct radeon_fence **fence);
203 203
204/*
205 * Tiling registers
206 */
207struct radeon_surface_reg {
208 struct radeon_object *robj;
209};
210
211#define RADEON_GEM_MAX_SURFACES 8
204 212
205/* 213/*
206 * Radeon buffer. 214 * Radeon buffer.
@@ -213,6 +221,7 @@ struct radeon_object_list {
213 uint64_t gpu_offset; 221 uint64_t gpu_offset;
214 unsigned rdomain; 222 unsigned rdomain;
215 unsigned wdomain; 223 unsigned wdomain;
224 uint32_t tiling_flags;
216}; 225};
217 226
218int radeon_object_init(struct radeon_device *rdev); 227int radeon_object_init(struct radeon_device *rdev);
@@ -242,8 +251,15 @@ void radeon_object_list_clean(struct list_head *head);
242int radeon_object_fbdev_mmap(struct radeon_object *robj, 251int radeon_object_fbdev_mmap(struct radeon_object *robj,
243 struct vm_area_struct *vma); 252 struct vm_area_struct *vma);
244unsigned long radeon_object_size(struct radeon_object *robj); 253unsigned long radeon_object_size(struct radeon_object *robj);
245 254void radeon_object_clear_surface_reg(struct radeon_object *robj);
246 255int radeon_object_check_tiling(struct radeon_object *robj, bool has_moved,
256 bool force_drop);
257void radeon_object_set_tiling_flags(struct radeon_object *robj,
258 uint32_t tiling_flags, uint32_t pitch);
259void radeon_object_get_tiling_flags(struct radeon_object *robj, uint32_t *tiling_flags, uint32_t *pitch);
260void radeon_bo_move_notify(struct ttm_buffer_object *bo,
261 struct ttm_mem_reg *mem);
262void radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo);
247/* 263/*
248 * GEM objects. 264 * GEM objects.
249 */ 265 */
@@ -535,6 +551,11 @@ struct radeon_asic {
535 void (*set_memory_clock)(struct radeon_device *rdev, uint32_t mem_clock); 551 void (*set_memory_clock)(struct radeon_device *rdev, uint32_t mem_clock);
536 void (*set_pcie_lanes)(struct radeon_device *rdev, int lanes); 552 void (*set_pcie_lanes)(struct radeon_device *rdev, int lanes);
537 void (*set_clock_gating)(struct radeon_device *rdev, int enable); 553 void (*set_clock_gating)(struct radeon_device *rdev, int enable);
554
555 int (*set_surface_reg)(struct radeon_device *rdev, int reg,
556 uint32_t tiling_flags, uint32_t pitch,
557 uint32_t offset, uint32_t obj_size);
558 int (*clear_surface_reg)(struct radeon_device *rdev, int reg);
538}; 559};
539 560
540union radeon_asic_config { 561union radeon_asic_config {
@@ -568,6 +589,10 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
568int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, 589int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
569 struct drm_file *filp); 590 struct drm_file *filp);
570int radeon_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp); 591int radeon_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp);
592int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data,
593 struct drm_file *filp);
594int radeon_gem_get_tiling_ioctl(struct drm_device *dev, void *data,
595 struct drm_file *filp);
571 596
572 597
573/* 598/*
@@ -627,6 +652,7 @@ struct radeon_device {
627 bool shutdown; 652 bool shutdown;
628 bool suspend; 653 bool suspend;
629 bool need_dma32; 654 bool need_dma32;
655 struct radeon_surface_reg surface_regs[RADEON_GEM_MAX_SURFACES];
630}; 656};
631 657
632int radeon_device_init(struct radeon_device *rdev, 658int radeon_device_init(struct radeon_device *rdev,
@@ -801,5 +827,7 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
801#define radeon_set_memory_clock(rdev, e) (rdev)->asic->set_engine_clock((rdev), (e)) 827#define radeon_set_memory_clock(rdev, e) (rdev)->asic->set_engine_clock((rdev), (e))
802#define radeon_set_pcie_lanes(rdev, l) (rdev)->asic->set_pcie_lanes((rdev), (l)) 828#define radeon_set_pcie_lanes(rdev, l) (rdev)->asic->set_pcie_lanes((rdev), (l))
803#define radeon_set_clock_gating(rdev, e) (rdev)->asic->set_clock_gating((rdev), (e)) 829#define radeon_set_clock_gating(rdev, e) (rdev)->asic->set_clock_gating((rdev), (e))
830#define radeon_set_surface_reg(rdev, r, f, p, o, s) ((rdev)->asic->set_surface_reg((rdev), (r), (f), (p), (o), (s)))
831#define radeon_clear_surface_reg(rdev, r) ((rdev)->asic->clear_surface_reg((rdev), (r)))
804 832
805#endif 833#endif