diff options
author | Chris Ball <cjb@laptop.org> | 2010-09-26 07:47:24 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-10-05 21:50:21 -0400 |
commit | be64c2bb4731b0e6223a496eed615b816ac879ec (patch) | |
tree | 1c2723d354e47167aa3b59d01c011efec9acdb6e /drivers/gpu | |
parent | 4dd19b0dd79c2bfe04a7a19bea0caf9284695cb4 (diff) |
drm/nouveau/kms: Implement KDB debug hooks for nouveau KMS.
Tested on nv50 and nv04 HW.
Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
CC: Jesse Barnes <jbarnes@virtuousgeek.org>
CC: dri-devel@lists.freedesktop.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_fbcon.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv04_crtc.c | 46 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_crtc.c | 49 |
3 files changed, 80 insertions, 21 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index d2047713dc59..c5afd146aeb2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -104,6 +104,8 @@ static struct fb_ops nouveau_fbcon_ops = { | |||
104 | .fb_pan_display = drm_fb_helper_pan_display, | 104 | .fb_pan_display = drm_fb_helper_pan_display, |
105 | .fb_blank = drm_fb_helper_blank, | 105 | .fb_blank = drm_fb_helper_blank, |
106 | .fb_setcmap = drm_fb_helper_setcmap, | 106 | .fb_setcmap = drm_fb_helper_setcmap, |
107 | .fb_debug_enter = drm_fb_helper_debug_enter, | ||
108 | .fb_debug_leave = drm_fb_helper_debug_leave, | ||
107 | }; | 109 | }; |
108 | 110 | ||
109 | static struct fb_ops nv04_fbcon_ops = { | 111 | static struct fb_ops nv04_fbcon_ops = { |
@@ -117,6 +119,8 @@ static struct fb_ops nv04_fbcon_ops = { | |||
117 | .fb_pan_display = drm_fb_helper_pan_display, | 119 | .fb_pan_display = drm_fb_helper_pan_display, |
118 | .fb_blank = drm_fb_helper_blank, | 120 | .fb_blank = drm_fb_helper_blank, |
119 | .fb_setcmap = drm_fb_helper_setcmap, | 121 | .fb_setcmap = drm_fb_helper_setcmap, |
122 | .fb_debug_enter = drm_fb_helper_debug_enter, | ||
123 | .fb_debug_leave = drm_fb_helper_debug_leave, | ||
120 | }; | 124 | }; |
121 | 125 | ||
122 | static struct fb_ops nv50_fbcon_ops = { | 126 | static struct fb_ops nv50_fbcon_ops = { |
@@ -130,6 +134,8 @@ static struct fb_ops nv50_fbcon_ops = { | |||
130 | .fb_pan_display = drm_fb_helper_pan_display, | 134 | .fb_pan_display = drm_fb_helper_pan_display, |
131 | .fb_blank = drm_fb_helper_blank, | 135 | .fb_blank = drm_fb_helper_blank, |
132 | .fb_setcmap = drm_fb_helper_setcmap, | 136 | .fb_setcmap = drm_fb_helper_setcmap, |
137 | .fb_debug_enter = drm_fb_helper_debug_enter, | ||
138 | .fb_debug_leave = drm_fb_helper_debug_leave, | ||
133 | }; | 139 | }; |
134 | 140 | ||
135 | static void nouveau_fbcon_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, | 141 | static void nouveau_fbcon_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, |
diff --git a/drivers/gpu/drm/nouveau/nv04_crtc.c b/drivers/gpu/drm/nouveau/nv04_crtc.c index 497df8765f28..f5bbd46f76bc 100644 --- a/drivers/gpu/drm/nouveau/nv04_crtc.c +++ b/drivers/gpu/drm/nouveau/nv04_crtc.c | |||
@@ -768,8 +768,9 @@ nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t start, | |||
768 | } | 768 | } |
769 | 769 | ||
770 | static int | 770 | static int |
771 | nv04_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, | 771 | nv04_crtc_do_mode_set_base(struct drm_crtc *crtc, |
772 | struct drm_framebuffer *old_fb) | 772 | struct drm_framebuffer *passed_fb, |
773 | int x, int y, bool atomic) | ||
773 | { | 774 | { |
774 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 775 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
775 | struct drm_device *dev = crtc->dev; | 776 | struct drm_device *dev = crtc->dev; |
@@ -780,13 +781,26 @@ nv04_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, | |||
780 | int arb_burst, arb_lwm; | 781 | int arb_burst, arb_lwm; |
781 | int ret; | 782 | int ret; |
782 | 783 | ||
783 | ret = nouveau_bo_pin(fb->nvbo, TTM_PL_FLAG_VRAM); | 784 | /* If atomic, we want to switch to the fb we were passed, so |
784 | if (ret) | 785 | * now we update pointers to do that. (We don't pin; just |
785 | return ret; | 786 | * assume we're already pinned and update the base address.) |
787 | */ | ||
788 | if (atomic) { | ||
789 | drm_fb = passed_fb; | ||
790 | fb = nouveau_framebuffer(passed_fb); | ||
791 | } | ||
792 | else { | ||
793 | /* If not atomic, we can go ahead and pin, and unpin the | ||
794 | * old fb we were passed. | ||
795 | */ | ||
796 | ret = nouveau_bo_pin(fb->nvbo, TTM_PL_FLAG_VRAM); | ||
797 | if (ret) | ||
798 | return ret; | ||
786 | 799 | ||
787 | if (old_fb) { | 800 | if (passed_fb) { |
788 | struct nouveau_framebuffer *ofb = nouveau_framebuffer(old_fb); | 801 | struct nouveau_framebuffer *ofb = nouveau_framebuffer(passed_fb); |
789 | nouveau_bo_unpin(ofb->nvbo); | 802 | nouveau_bo_unpin(ofb->nvbo); |
803 | } | ||
790 | } | 804 | } |
791 | 805 | ||
792 | nv_crtc->fb.offset = fb->nvbo->bo.offset; | 806 | nv_crtc->fb.offset = fb->nvbo->bo.offset; |
@@ -834,6 +848,21 @@ nv04_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, | |||
834 | return 0; | 848 | return 0; |
835 | } | 849 | } |
836 | 850 | ||
851 | static int | ||
852 | nv04_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, | ||
853 | struct drm_framebuffer *old_fb) | ||
854 | { | ||
855 | return nv04_crtc_do_mode_set_base(crtc, old_fb, x, y, false); | ||
856 | } | ||
857 | |||
858 | static int | ||
859 | nv04_crtc_mode_set_base_atomic(struct drm_crtc *crtc, | ||
860 | struct drm_framebuffer *fb, | ||
861 | int x, int y) | ||
862 | { | ||
863 | return nv04_crtc_do_mode_set_base(crtc, fb, x, y, true); | ||
864 | } | ||
865 | |||
837 | static void nv04_cursor_upload(struct drm_device *dev, struct nouveau_bo *src, | 866 | static void nv04_cursor_upload(struct drm_device *dev, struct nouveau_bo *src, |
838 | struct nouveau_bo *dst) | 867 | struct nouveau_bo *dst) |
839 | { | 868 | { |
@@ -962,6 +991,7 @@ static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = { | |||
962 | .mode_fixup = nv_crtc_mode_fixup, | 991 | .mode_fixup = nv_crtc_mode_fixup, |
963 | .mode_set = nv_crtc_mode_set, | 992 | .mode_set = nv_crtc_mode_set, |
964 | .mode_set_base = nv04_crtc_mode_set_base, | 993 | .mode_set_base = nv04_crtc_mode_set_base, |
994 | .mode_set_base_atomic = nv04_crtc_mode_set_base_atomic, | ||
965 | .load_lut = nv_crtc_gamma_load, | 995 | .load_lut = nv_crtc_gamma_load, |
966 | }; | 996 | }; |
967 | 997 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c index bfd4ca2fe7ef..f41b44864e80 100644 --- a/drivers/gpu/drm/nouveau/nv50_crtc.c +++ b/drivers/gpu/drm/nouveau/nv50_crtc.c | |||
@@ -491,8 +491,9 @@ nv50_crtc_mode_fixup(struct drm_crtc *crtc, struct drm_display_mode *mode, | |||
491 | } | 491 | } |
492 | 492 | ||
493 | static int | 493 | static int |
494 | nv50_crtc_do_mode_set_base(struct drm_crtc *crtc, int x, int y, | 494 | nv50_crtc_do_mode_set_base(struct drm_crtc *crtc, |
495 | struct drm_framebuffer *old_fb, bool update) | 495 | struct drm_framebuffer *passed_fb, |
496 | int x, int y, bool update, bool atomic) | ||
496 | { | 497 | { |
497 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); | 498 | struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); |
498 | struct drm_device *dev = nv_crtc->base.dev; | 499 | struct drm_device *dev = nv_crtc->base.dev; |
@@ -504,6 +505,28 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc, int x, int y, | |||
504 | 505 | ||
505 | NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index); | 506 | NV_DEBUG_KMS(dev, "index %d\n", nv_crtc->index); |
506 | 507 | ||
508 | /* If atomic, we want to switch to the fb we were passed, so | ||
509 | * now we update pointers to do that. (We don't pin; just | ||
510 | * assume we're already pinned and update the base address.) | ||
511 | */ | ||
512 | if (atomic) { | ||
513 | drm_fb = passed_fb; | ||
514 | fb = nouveau_framebuffer(passed_fb); | ||
515 | } | ||
516 | else { | ||
517 | /* If not atomic, we can go ahead and pin, and unpin the | ||
518 | * old fb we were passed. | ||
519 | */ | ||
520 | ret = nouveau_bo_pin(fb->nvbo, TTM_PL_FLAG_VRAM); | ||
521 | if (ret) | ||
522 | return ret; | ||
523 | |||
524 | if (passed_fb) { | ||
525 | struct nouveau_framebuffer *ofb = nouveau_framebuffer(passed_fb); | ||
526 | nouveau_bo_unpin(ofb->nvbo); | ||
527 | } | ||
528 | } | ||
529 | |||
507 | switch (drm_fb->depth) { | 530 | switch (drm_fb->depth) { |
508 | case 8: | 531 | case 8: |
509 | format = NV50_EVO_CRTC_FB_DEPTH_8; | 532 | format = NV50_EVO_CRTC_FB_DEPTH_8; |
@@ -526,15 +549,6 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc, int x, int y, | |||
526 | return -EINVAL; | 549 | return -EINVAL; |
527 | } | 550 | } |
528 | 551 | ||
529 | ret = nouveau_bo_pin(fb->nvbo, TTM_PL_FLAG_VRAM); | ||
530 | if (ret) | ||
531 | return ret; | ||
532 | |||
533 | if (old_fb) { | ||
534 | struct nouveau_framebuffer *ofb = nouveau_framebuffer(old_fb); | ||
535 | nouveau_bo_unpin(ofb->nvbo); | ||
536 | } | ||
537 | |||
538 | nv_crtc->fb.offset = fb->nvbo->bo.offset - dev_priv->vm_vram_base; | 552 | nv_crtc->fb.offset = fb->nvbo->bo.offset - dev_priv->vm_vram_base; |
539 | nv_crtc->fb.tile_flags = fb->nvbo->tile_flags; | 553 | nv_crtc->fb.tile_flags = fb->nvbo->tile_flags; |
540 | nv_crtc->fb.cpp = drm_fb->bits_per_pixel / 8; | 554 | nv_crtc->fb.cpp = drm_fb->bits_per_pixel / 8; |
@@ -685,14 +699,22 @@ nv50_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, | |||
685 | nv_crtc->set_dither(nv_crtc, nv_connector->use_dithering, false); | 699 | nv_crtc->set_dither(nv_crtc, nv_connector->use_dithering, false); |
686 | nv_crtc->set_scale(nv_crtc, nv_connector->scaling_mode, false); | 700 | nv_crtc->set_scale(nv_crtc, nv_connector->scaling_mode, false); |
687 | 701 | ||
688 | return nv50_crtc_do_mode_set_base(crtc, x, y, old_fb, false); | 702 | return nv50_crtc_do_mode_set_base(crtc, old_fb, x, y, false, false); |
689 | } | 703 | } |
690 | 704 | ||
691 | static int | 705 | static int |
692 | nv50_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, | 706 | nv50_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, |
693 | struct drm_framebuffer *old_fb) | 707 | struct drm_framebuffer *old_fb) |
694 | { | 708 | { |
695 | return nv50_crtc_do_mode_set_base(crtc, x, y, old_fb, true); | 709 | return nv50_crtc_do_mode_set_base(crtc, old_fb, x, y, true, false); |
710 | } | ||
711 | |||
712 | static int | ||
713 | nv50_crtc_mode_set_base_atomic(struct drm_crtc *crtc, | ||
714 | struct drm_framebuffer *fb, | ||
715 | int x, int y) | ||
716 | { | ||
717 | return nv50_crtc_do_mode_set_base(crtc, fb, x, y, true, true); | ||
696 | } | 718 | } |
697 | 719 | ||
698 | static const struct drm_crtc_helper_funcs nv50_crtc_helper_funcs = { | 720 | static const struct drm_crtc_helper_funcs nv50_crtc_helper_funcs = { |
@@ -702,6 +724,7 @@ static const struct drm_crtc_helper_funcs nv50_crtc_helper_funcs = { | |||
702 | .mode_fixup = nv50_crtc_mode_fixup, | 724 | .mode_fixup = nv50_crtc_mode_fixup, |
703 | .mode_set = nv50_crtc_mode_set, | 725 | .mode_set = nv50_crtc_mode_set, |
704 | .mode_set_base = nv50_crtc_mode_set_base, | 726 | .mode_set_base = nv50_crtc_mode_set_base, |
727 | .mode_set_base_atomic = nv50_crtc_mode_set_base_atomic, | ||
705 | .load_lut = nv50_crtc_lut_load, | 728 | .load_lut = nv50_crtc_lut_load, |
706 | }; | 729 | }; |
707 | 730 | ||