diff options
author | Dave Airlie <airlied@redhat.com> | 2009-06-23 19:48:08 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-07-29 01:42:18 -0400 |
commit | e024e11070a0a0dc7163ce1ec2da354a638bdbed (patch) | |
tree | add483e7428f91da6f3c26be702aa45e6d69b694 /drivers/gpu/drm/radeon/radeon_fb.c | |
parent | c836e862803b2aa2bd9a354e151316d2b42c44ec (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_fb.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_fb.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c index 260870a29d83..36d2f5588f20 100644 --- a/drivers/gpu/drm/radeon/radeon_fb.c +++ b/drivers/gpu/drm/radeon/radeon_fb.c | |||
@@ -471,10 +471,10 @@ static struct notifier_block paniced = { | |||
471 | .notifier_call = radeonfb_panic, | 471 | .notifier_call = radeonfb_panic, |
472 | }; | 472 | }; |
473 | 473 | ||
474 | static int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp) | 474 | static int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tiled) |
475 | { | 475 | { |
476 | int aligned = width; | 476 | int aligned = width; |
477 | int align_large = (ASIC_IS_AVIVO(rdev)); | 477 | int align_large = (ASIC_IS_AVIVO(rdev)) || tiled; |
478 | int pitch_mask = 0; | 478 | int pitch_mask = 0; |
479 | 479 | ||
480 | switch (bpp / 8) { | 480 | switch (bpp / 8) { |
@@ -512,12 +512,13 @@ int radeonfb_create(struct radeon_device *rdev, | |||
512 | u64 fb_gpuaddr; | 512 | u64 fb_gpuaddr; |
513 | void *fbptr = NULL; | 513 | void *fbptr = NULL; |
514 | unsigned long tmp; | 514 | unsigned long tmp; |
515 | bool fb_tiled = false; /* useful for testing */ | ||
515 | 516 | ||
516 | mode_cmd.width = surface_width; | 517 | mode_cmd.width = surface_width; |
517 | mode_cmd.height = surface_height; | 518 | mode_cmd.height = surface_height; |
518 | mode_cmd.bpp = 32; | 519 | mode_cmd.bpp = 32; |
519 | /* need to align pitch with crtc limits */ | 520 | /* need to align pitch with crtc limits */ |
520 | mode_cmd.pitch = radeon_align_pitch(rdev, mode_cmd.width, mode_cmd.bpp) * ((mode_cmd.bpp + 1) / 8); | 521 | mode_cmd.pitch = radeon_align_pitch(rdev, mode_cmd.width, mode_cmd.bpp, fb_tiled) * ((mode_cmd.bpp + 1) / 8); |
521 | mode_cmd.depth = 24; | 522 | mode_cmd.depth = 24; |
522 | 523 | ||
523 | size = mode_cmd.pitch * mode_cmd.height; | 524 | size = mode_cmd.pitch * mode_cmd.height; |
@@ -535,6 +536,8 @@ int radeonfb_create(struct radeon_device *rdev, | |||
535 | } | 536 | } |
536 | robj = gobj->driver_private; | 537 | robj = gobj->driver_private; |
537 | 538 | ||
539 | if (fb_tiled) | ||
540 | radeon_object_set_tiling_flags(robj, RADEON_TILING_MACRO|RADEON_TILING_SURFACE, mode_cmd.pitch); | ||
538 | mutex_lock(&rdev->ddev->struct_mutex); | 541 | mutex_lock(&rdev->ddev->struct_mutex); |
539 | fb = radeon_framebuffer_create(rdev->ddev, &mode_cmd, gobj); | 542 | fb = radeon_framebuffer_create(rdev->ddev, &mode_cmd, gobj); |
540 | if (fb == NULL) { | 543 | if (fb == NULL) { |
@@ -563,6 +566,9 @@ int radeonfb_create(struct radeon_device *rdev, | |||
563 | } | 566 | } |
564 | rfbdev = info->par; | 567 | rfbdev = info->par; |
565 | 568 | ||
569 | if (fb_tiled) | ||
570 | radeon_object_check_tiling(robj, 0, 0); | ||
571 | |||
566 | ret = radeon_object_kmap(robj, &fbptr); | 572 | ret = radeon_object_kmap(robj, &fbptr); |
567 | if (ret) { | 573 | if (ret) { |
568 | goto out_unref; | 574 | goto out_unref; |