V2 - atomic kernel mode setting for radeon, nouveau, plus fixes
Subsystems (5)
cover V2 - atomic kernel mode setting for radeon, nouveau, plus fixes
What is new in patch set v2
* patch 4 which was previously radeon specific was replaced with a generic patch to save and restore the LUT data for all drivers
* minor white space cleanup vs checkpatch.pl in patches
---
The goal of this patch set is to add atomic kernel mode setting hooks for the radeon and nouveau cards for the purpose of using kdb (the kernel debug shell).
David Airlie had asked for more research into the gamma data corruption after initially reviewing the patch that attempts to solve the visible palette corruption after an atomic mode set operation. The final conclusion was that other types of pallet corruption are possible with the gamma data when using atomic mode setting so the problem should be solved generically.
The mode_set_base_atomic() now receives and additional parameter to note of the atomic mode set operation is an enter or exit such that a driver can appropriately enable or disable hardware that will not work in the polling context.
These patches have now passed the kgdb/kdb regression tests and are deemed stable and ready for further integration and comment with the hope of integrating the patches upstream.
Many thanks to Chris Ball for the contribution of the radeon and nouveau hooks, as well as the time he spent helping debug the initial LUT save and restore.
Thanks,
Jason.
---
The following changes since commit 29979aa8bd69becd94cbad59093807a417ce2a9e:
Linus Torvalds (1):
Merge branch 'rc-fixes' of git://git.kernel.org/.../mmarek/kbuild-2.6
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb.git for_dri
Chris Ball (3):
drm/radeon/kms: Implement KDB debug hooks for radeon KMS. drm/nouveau/kms: Implement KDB debug hooks for nouveau KMS. drm/nouveau/kms: Avoid a hang entering KDB with VT accel on.
Jason Wessel (2):
drm,kdb,kms: Add an enter argument to mode_set_base_atomic() API kdb,kms: Save and restore the LUT on atomic KMS enter/exit
drivers/gpu/drm/drm_fb_helper.c | 37 ++++++++- drivers/gpu/drm/i915/intel_display.c | 4 +- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 6 ++ drivers/gpu/drm/nouveau/nv04_crtc.c | 54 +++++++++++-- drivers/gpu/drm/nouveau/nv50_crtc.c | 48 ++++++++--- drivers/gpu/drm/radeon/atombios_crtc.c | 117 +++++++++++++++++++-------- drivers/gpu/drm/radeon/radeon_fb.c | 2 + drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 44 ++++++++--- drivers/gpu/drm/radeon/radeon_mode.h | 10 ++- include/drm/drm_crtc_helper.h | 3 +- 10 files changed, 251 insertions(+), 74 deletions(-)
PATCH 1/5 drm/radeon/kms: Implement KDB debug hooks for radeon KMS.
From: Chris Ball <[email protected]>
--- drivers/gpu/drm/radeon/atombios_crtc.c | 117 +++++++++++++++++++-------- drivers/gpu/drm/radeon/radeon_fb.c | 2 + drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 44 ++++++++--- drivers/gpu/drm/radeon/radeon_mode.h | 10 ++- 4 files changed, 126 insertions(+), 47 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +82 -35
@@ -854,13 +854,15 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode } -static int evergreen_crtc_set_base (struct drm_crtc *crtc,int x,int y, -struct drm_framebuffer *old_fb) +static int evergreen_crtc_do_set_base (struct drm_crtc *crtc, +struct drm_framebuffer *fb, +int x,int y,int atomic) {struct radeon_crtc *radeon_crtc =to_radeon_crtc (crtc);struct drm_device *dev = crtc->dev;struct radeon_device *rdev = dev->dev_private;struct radeon_framebuffer *radeon_fb; +struct drm_framebuffer *target_fb;struct drm_gem_object *obj;struct radeon_bo *rbo;uint64_t fb_location;
@@ -868,28 +870,42 @@ static int evergreen_crtc_set_base(struct drm_crtc *crtc, int x, int y,int r;/* no fb bound */ -if (!crtc->fb) { +if (!atomic && !crtc->fb) {DRM_DEBUG_KMS ("No FB bound\n" );return 0 ; } - radeon_fb =to_radeon_framebuffer (crtc->fb); +if (atomic) { + radeon_fb =to_radeon_framebuffer (fb); + target_fb = fb; + }else { + radeon_fb =to_radeon_framebuffer (crtc->fb); + target_fb = crtc->fb; + } -/* Pin framebuffer & get tilling informations */ +/* If atomic, assume fb object is pinned & idle & fenced and +* just update base pointers +*/ obj = radeon_fb->obj; rbo = obj->driver_private; r =radeon_bo_reserve (rbo, false);if (unlikely (r !=0 ))return r; - r =radeon_bo_pin (rbo,RADEON_GEM_DOMAIN_VRAM , &fb_location); -if (unlikely (r !=0 )) { -radeon_bo_unreserve (rbo); -return -EINVAL ; + +if (atomic) + fb_location =radeon_bo_gpu_offset (rbo); +else { + r =radeon_bo_pin (rbo,RADEON_GEM_DOMAIN_VRAM , &fb_location); +if (unlikely (r !=0 )) { +radeon_bo_unreserve (rbo); +return -EINVAL ; + } } +radeon_bo_get_tiling_flags (rbo, &tiling_flags,NULL );radeon_bo_unreserve (rbo); -switch (crtc->fb->bits_per_pixel) { +switch (target_fb->bits_per_pixel) {case 8 : fb_format = (EVERGREEN_GRPH_DEPTH (EVERGREEN_GRPH_DEPTH_8BPP ) |EVERGREEN_GRPH_FORMAT (EVERGREEN_GRPH_FORMAT_INDEXED ));
@@ -909,7 +925,7 @@ static int evergreen_crtc_set_base(struct drm_crtc *crtc, int x, int y,break ;default :DRM_ERROR ("Unsupported screen depth %d\n" , - crtc->fb->bits_per_pixel); + target_fb->bits_per_pixel);return -EINVAL ; }
@@ -955,10 +971,10 @@ static int evergreen_crtc_set_base(struct drm_crtc *crtc, int x, int y,WREG32 (EVERGREEN_GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset,0 );WREG32 (EVERGREEN_GRPH_X_START + radeon_crtc->crtc_offset,0 );WREG32 (EVERGREEN_GRPH_Y_START + radeon_crtc->crtc_offset,0 ); -WREG32 (EVERGREEN_GRPH_X_END + radeon_crtc->crtc_offset, crtc->fb->width); -WREG32 (EVERGREEN_GRPH_Y_END + radeon_crtc->crtc_offset, crtc->fb->height); +WREG32 (EVERGREEN_GRPH_X_END + radeon_crtc->crtc_offset, target_fb->width); +WREG32 (EVERGREEN_GRPH_Y_END + radeon_crtc->crtc_offset, target_fb->height); - fb_pitch_pixels = crtc->fb->pitch / (crtc->fb->bits_per_pixel /8 ); + fb_pitch_pixels = target_fb->pitch / (target_fb->bits_per_pixel /8 );WREG32 (EVERGREEN_GRPH_PITCH + radeon_crtc->crtc_offset, fb_pitch_pixels);WREG32 (EVERGREEN_GRPH_ENABLE + radeon_crtc->crtc_offset,1 );
@@ -977,8 +993,8 @@ static int evergreen_crtc_set_base(struct drm_crtc *crtc, int x, int y,else WREG32 (EVERGREEN_DATA_FORMAT + radeon_crtc->crtc_offset,0 ); -if (old_fb && old_fb != crtc->fb) { - radeon_fb =to_radeon_framebuffer (old_fb); +if (!atomic && fb && fb != crtc->fb) { + radeon_fb =to_radeon_framebuffer (fb); rbo = radeon_fb->obj->driver_private; r =radeon_bo_reserve (rbo, false);if (unlikely (r !=0 ))
@@ -993,8 +1009,9 @@ static int evergreen_crtc_set_base(struct drm_crtc *crtc, int x, int y,return 0 ; } -static int avivo_crtc_set_base (struct drm_crtc *crtc,int x,int y, -struct drm_framebuffer *old_fb) +static int avivo_crtc_do_set_base (struct drm_crtc *crtc, +struct drm_framebuffer *fb, +int x,int y,int atomic) {struct radeon_crtc *radeon_crtc =to_radeon_crtc (crtc);struct drm_device *dev = crtc->dev;
@@ -1002,33 +1019,47 @@ static int avivo_crtc_set_base(struct drm_crtc *crtc, int x, int y,struct radeon_framebuffer *radeon_fb;struct drm_gem_object *obj;struct radeon_bo *rbo; +struct drm_framebuffer *target_fb;uint64_t fb_location;uint32_t fb_format, fb_pitch_pixels, tiling_flags;int r;/* no fb bound */ -if (!crtc->fb) { +if (!atomic && !crtc->fb) {DRM_DEBUG_KMS ("No FB bound\n" );return 0 ; } - radeon_fb =to_radeon_framebuffer (crtc->fb); +if (atomic) { + radeon_fb =to_radeon_framebuffer (fb); + target_fb = fb; + }else { + radeon_fb =to_radeon_framebuffer (crtc->fb); + target_fb = crtc->fb; + } -/* Pin framebuffer & get tilling informations */ obj = radeon_fb->obj; rbo = obj->driver_private; r =radeon_bo_reserve (rbo, false);if (unlikely (r !=0 ))return r; - r =radeon_bo_pin (rbo,RADEON_GEM_DOMAIN_VRAM , &fb_location); -if (unlikely (r !=0 )) { -radeon_bo_unreserve (rbo); -return -EINVAL ; + +/* If atomic, assume fb object is pinned & idle & fenced and +* just update base pointers +*/ +if (atomic) + fb_location =radeon_bo_gpu_offset (rbo); +else { + r =radeon_bo_pin (rbo,RADEON_GEM_DOMAIN_VRAM , &fb_location); +if (unlikely (r !=0 )) { +radeon_bo_unreserve (rbo); +return -EINVAL ; + } }radeon_bo_get_tiling_flags (rbo, &tiling_flags,NULL );radeon_bo_unreserve (rbo); -switch (crtc->fb->bits_per_pixel) { +switch (target_fb->bits_per_pixel) {case 8 : fb_format = AVIVO_D1GRPH_CONTROL_DEPTH_8BPP |
@@ -1052,7 +1083,7 @@ static int avivo_crtc_set_base(struct drm_crtc *crtc, int x, int y,break ;default :DRM_ERROR ("Unsupported screen depth %d\n" , - crtc->fb->bits_per_pixel); + target_fb->bits_per_pixel);return -EINVAL ; }
@@ -1093,10 +1124,10 @@ static int avivo_crtc_set_base(struct drm_crtc *crtc, int x, int y,WREG32 (AVIVO_D1GRPH_SURFACE_OFFSET_Y + radeon_crtc->crtc_offset,0 );WREG32 (AVIVO_D1GRPH_X_START + radeon_crtc->crtc_offset,0 );WREG32 (AVIVO_D1GRPH_Y_START + radeon_crtc->crtc_offset,0 ); -WREG32 (AVIVO_D1GRPH_X_END + radeon_crtc->crtc_offset, crtc->fb->width); -WREG32 (AVIVO_D1GRPH_Y_END + radeon_crtc->crtc_offset, crtc->fb->height); +WREG32 (AVIVO_D1GRPH_X_END + radeon_crtc->crtc_offset, target_fb->width); +WREG32 (AVIVO_D1GRPH_Y_END + radeon_crtc->crtc_offset, target_fb->height); - fb_pitch_pixels = crtc->fb->pitch / (crtc->fb->bits_per_pixel /8 ); + fb_pitch_pixels = target_fb->pitch / (target_fb->bits_per_pixel /8 );WREG32 (AVIVO_D1GRPH_PITCH + radeon_crtc->crtc_offset, fb_pitch_pixels);WREG32 (AVIVO_D1GRPH_ENABLE + radeon_crtc->crtc_offset,1 );
@@ -1115,8 +1146,8 @@ static int avivo_crtc_set_base(struct drm_crtc *crtc, int x, int y,else WREG32 (AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset,0 ); -if (old_fb && old_fb != crtc->fb) { - radeon_fb =to_radeon_framebuffer (old_fb); +if (!atomic && fb && fb != crtc->fb) { + radeon_fb =to_radeon_framebuffer (fb); rbo = radeon_fb->obj->driver_private; r =radeon_bo_reserve (rbo, false);if (unlikely (r !=0 ))
@@ -1138,11 +1169,26 @@ int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y,struct radeon_device *rdev = dev->dev_private;if (ASIC_IS_DCE4 (rdev)) -return evergreen_crtc_set_base (crtc, x, y, old_fb); +return evergreen_crtc_do_set_base (crtc, old_fb, x, y,0 ); +else if (ASIC_IS_AVIVO (rdev)) +return avivo_crtc_do_set_base (crtc, old_fb, x, y,0 ); +else +return radeon_crtc_do_set_base (crtc, old_fb, x, y,0 ); +} + +int atombios_crtc_set_base_atomic (struct drm_crtc *crtc, +struct drm_framebuffer *fb, +int x,int y) +{ +struct drm_device *dev = crtc->dev; +struct radeon_device *rdev = dev->dev_private; + +if (ASIC_IS_DCE4 (rdev)) +return evergreen_crtc_do_set_base (crtc, fb, x, y,1 );else if (ASIC_IS_AVIVO (rdev)) -return avivo_crtc_set_base (crtc, x, y, old_fb); +return avivo_crtc_do_set_base (crtc, fb, x, y,1 );else -return radeon_crtc_set_base (crtc, x, y, old_fb); +return radeon_crtc_do_set_base (crtc, fb, x, y,1 ); }/* properly set additional regs when using atombios */
@@ -1311,6 +1357,7 @@ static const struct drm_crtc_helper_funcs atombios_helper_funcs = { .mode_fixup = atombios_crtc_mode_fixup, .mode_set = atombios_crtc_mode_set, .mode_set_base = atombios_crtc_set_base, + .mode_set_base_atomic = atombios_crtc_set_base_atomic, .prepare = atombios_crtc_prepare, .commit = atombios_crtc_commit, .load_lut = radeon_crtc_load_lut,
drivers/gpu/drm/radeon/radeon_fb.c +2 -0
@@ -59,6 +59,8 @@ static struct fb_ops radeonfb_ops = { .fb_pan_display = drm_fb_helper_pan_display, .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap, + .fb_debug_enter = drm_fb_helper_debug_enter, + .fb_debug_leave = drm_fb_helper_debug_leave, };
drivers/gpu/drm/radeon/radeon_legacy_crtc.c +33 -11
95 lines not on this page · raw message
drivers/gpu/drm/radeon/radeon_mode.h +9 -1
@@ -514,6 +514,9 @@ extern void radeon_encoder_set_active_device(struct drm_encoder *encoder);extern void radeon_crtc_load_lut (struct drm_crtc *crtc);extern int atombios_crtc_set_base (struct drm_crtc *crtc,int x,int y,struct drm_framebuffer *old_fb); +extern int atombios_crtc_set_base_atomic (struct drm_crtc *crtc, +struct drm_framebuffer *fb, +int x,int y); extern int atombios_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode,
@@ -523,7 +526,12 @@ extern void atombios_crtc_dpms(struct drm_crtc *crtc, int mode);extern int radeon_crtc_set_base (struct drm_crtc *crtc,int x,int y,struct drm_framebuffer *old_fb); - +extern int radeon_crtc_set_base_atomic (struct drm_crtc *crtc, +struct drm_framebuffer *fb, +int x,int y); +extern int radeon_crtc_do_set_base (struct drm_crtc *crtc, +struct drm_framebuffer *fb, +int x,int y,int atomic); extern int radeon_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, uint32_t handle,
Signature · 1 line
1.6.3.3
PATCH 2/5 drm/nouveau/kms: Implement KDB debug hooks for nouveau KMS.
In reply to Jason WesselFrom: Chris Ball <[email protected]>
Tested on nv50 and nv04 HW.
--- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 6 ++++ drivers/gpu/drm/nouveau/nv04_crtc.c | 45 +++++++++++++++++++++++----- drivers/gpu/drm/nouveau/nv50_crtc.c | 48 ++++++++++++++++++++++-------- 3 files changed, 78 insertions(+), 21 deletions(-)
drivers/gpu/drm/nouveau/nouveau_fbcon.c +6 -0
@@ -104,6 +104,8 @@ static struct fb_ops nouveau_fbcon_ops = { .fb_pan_display = drm_fb_helper_pan_display, .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap, + .fb_debug_enter = drm_fb_helper_debug_enter, + .fb_debug_leave = drm_fb_helper_debug_leave, };static struct fb_ops nv04_fbcon_ops = {
@@ -117,6 +119,8 @@ static struct fb_ops nv04_fbcon_ops = { .fb_pan_display = drm_fb_helper_pan_display, .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap, + .fb_debug_enter = drm_fb_helper_debug_enter, + .fb_debug_leave = drm_fb_helper_debug_leave, };static struct fb_ops nv50_fbcon_ops = {
@@ -130,6 +134,8 @@ static struct fb_ops nv50_fbcon_ops = { .fb_pan_display = drm_fb_helper_pan_display, .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap, + .fb_debug_enter = drm_fb_helper_debug_enter, + .fb_debug_leave = drm_fb_helper_debug_leave, }; static void nouveau_fbcon_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
drivers/gpu/drm/nouveau/nv04_crtc.c +37 -8
70 lines not on this page · raw message
drivers/gpu/drm/nouveau/nv50_crtc.c +35 -13
84 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 3/5 drm,kdb,kms: Add an enter argument to mode_set_base_atomic() API
In reply to Jason WesselSome devices such as the pre nv02 chips have enter and exit constraints where hardware compression must be turned off and re-enabled on resuming normal operations.
This patch extends the mode_set_base_atomic() call to pass an argument to indicate if this is an entry or an exit from an atomic kernel mode set change. Individual drm drivers can properly save and restore state accordingly.
--- drivers/gpu/drm/drm_fb_helper.c | 5 +++-- drivers/gpu/drm/i915/intel_display.c | 4 ++-- drivers/gpu/drm/nouveau/nv04_crtc.c | 2 +- drivers/gpu/drm/nouveau/nv50_crtc.c | 2 +- drivers/gpu/drm/radeon/atombios_crtc.c | 2 +- drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 2 +- drivers/gpu/drm/radeon/radeon_mode.h | 4 ++-- include/drm/drm_crtc_helper.h | 3 ++- 8 files changed, 13 insertions(+), 11 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +3 -2
@@ -263,7 +263,8 @@ int drm_fb_helper_debug_enter(struct fb_info *info) funcs->mode_set_base_atomic (mode_set->crtc, mode_set->fb, mode_set->x, - mode_set->y); + mode_set->y, +1 ); } }
@@ -309,7 +310,7 @@ int drm_fb_helper_debug_leave(struct fb_info *info) } funcs->mode_set_base_atomic (mode_set->crtc, fb, crtc->x, - crtc->y); + crtc->y,0 ); }return 0 ;
drivers/gpu/drm/i915/intel_display.c +2 -2
@@ -1458,7 +1458,7 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, struct drm_gem_object *obj)/* Assume fb object is pinned & idle & fenced and just update base pointers */ static int intel_pipe_set_base_atomic (struct drm_crtc *crtc,struct drm_framebuffer *fb, -int x,int y) +int x,int y,int enter) {struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1593,7 +1593,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,return ret; } - ret =intel_pipe_set_base_atomic (crtc, crtc->fb, x, y); + ret =intel_pipe_set_base_atomic (crtc, crtc->fb, x, y,0 );if (ret) {i915_gem_object_unpin (obj);mutex_unlock (&dev->struct_mutex);
drivers/gpu/drm/nouveau/nv04_crtc.c +1 -1
@@ -857,7 +857,7 @@ nv04_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,static int nv04_crtc_mode_set_base_atomic (struct drm_crtc *crtc,struct drm_framebuffer *fb, -int x,int y) +int x,int y,int enter) {return nv04_crtc_do_mode_set_base (crtc, fb, x, y, true); }
drivers/gpu/drm/nouveau/nv50_crtc.c +1 -1
@@ -711,7 +711,7 @@ nv50_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,static int nv50_crtc_mode_set_base_atomic (struct drm_crtc *crtc,struct drm_framebuffer *fb, -int x,int y) +int x,int y,int enter) {return nv50_crtc_do_mode_set_base (crtc, fb, x, y, true, true); }
drivers/gpu/drm/radeon/atombios_crtc.c +1 -1
@@ -1178,7 +1178,7 @@ int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y,int atombios_crtc_set_base_atomic (struct drm_crtc *crtc,struct drm_framebuffer *fb, -int x,int y) +int x,int y,int enter) {struct drm_device *dev = crtc->dev;struct radeon_device *rdev = dev->dev_private;
drivers/gpu/drm/radeon/radeon_legacy_crtc.c +1 -1
@@ -353,7 +353,7 @@ int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y,int radeon_crtc_set_base_atomic (struct drm_crtc *crtc,struct drm_framebuffer *fb, -int x,int y) +int x,int y,int enter) {return radeon_crtc_do_set_base (crtc, fb, x, y,1 ); }
drivers/gpu/drm/radeon/radeon_mode.h +2 -2
@@ -516,7 +516,7 @@ extern int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y, struct drm_framebuffer *old_fb);extern int atombios_crtc_set_base_atomic (struct drm_crtc *crtc,struct drm_framebuffer *fb, -int x,int y); +int x,int y,int enter); extern int atombios_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode,
@@ -528,7 +528,7 @@ extern int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y, struct drm_framebuffer *old_fb);extern int radeon_crtc_set_base_atomic (struct drm_crtc *crtc,struct drm_framebuffer *fb, -int x,int y); +int x,int y,int enter);extern int radeon_crtc_do_set_base (struct drm_crtc *crtc,struct drm_framebuffer *fb,int x,int y,int atomic);
include/drm/drm_crtc_helper.h +2 -1
@@ -61,7 +61,8 @@ struct drm_crtc_helper_funcs {int (*mode_set_base)(struct drm_crtc *crtc,int x,int y,struct drm_framebuffer *old_fb);int (*mode_set_base_atomic)(struct drm_crtc *crtc, -struct drm_framebuffer *fb,int x,int y); +struct drm_framebuffer *fb,int x,int y, +int is_enter);/* reload the current crtc LUT */ void (*load_lut)(struct drm_crtc *crtc);
Signature · 1 line
1.6.3.3
Re: [PATCH 3/5] drm,kdb,kms: Add an enter argument to mode_set_base_atomic() API
Quoted 29 lines · On Tue, 12 Oct 2010 07:49:59 -0500 Jason Wessel <[email protected]>…
Some devices such as the pre nv02 chips have enter and exit constraints where hardware compression must be turned off and re-enabled on resuming normal operations.
This patch extends the
mode_set_base_atomic()call to pass an argument to indicate if this is an entry or an exit from an atomic kernel mode set change. Individual drm drivers can properly save and restore state accordingly.Signed-off-by Jason Wessel <[email protected]>CC Jesse Barnes <[email protected]>CC David Airlie <[email protected]>--- drivers/gpu/drm/drm_fb_helper.c | 5 +++-- drivers/gpu/drm/i915/intel_display.c | 4 ++-- drivers/gpu/drm/nouveau/nv04_crtc.c | 2 +- drivers/gpu/drm/nouveau/nv50_crtc.c | 2 +- drivers/gpu/drm/radeon/atombios_crtc.c | 2 +- drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 2 +- drivers/gpu/drm/radeon/radeon_mode.h | 4 ++-- include/drm/drm_crtc_helper.h | 3 ++- 8 files changed, 13 insertions(+), 11 deletions(-)drivers/gpu/drm/drm_fb_helper.c +0
-0
drivers/gpu/drm/drm_fb_helper.c int drm_fb_helper_debug_enter(struct fb_info *info) · line 267
Quoted 6 lines
drivers/gpu/drm/drm_fb_helper.c +2
-1@@ -263,7 +263,8 @@ int drm_fb_helper_debug_enter(struct fb_info *info) funcs->mode_set_base_atomic (mode_set->crtc, mode_set->fb, mode_set->x, - mode_set->y); + mode_set->y, +1 );
An enum for the last arg would make this call much less mysterious. :)
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: [PATCH 3/5] drm,kdb,kms: Add an enter argument to mode_set_base_atomic() API
Quoted 28 lines · Jesse Barnes
Quoted 24 lines · On Tue, 12 Oct 2010 07:49:59 -0500 Jason Wessel <[email protected]>…
Some devices such as the pre nv02 chips have enter and exit constraints where hardware compression must be turned off and re-enabled on resuming normal operations.
This patch extends the
mode_set_base_atomic()call to pass an argument to indicate if this is an entry or an exit from an atomic kernel mode set change. Individual drm drivers can properly save and restore state accordingly.Signed-off-by Jason Wessel <[email protected]>CC Jesse Barnes <[email protected]>CC David Airlie <[email protected]>--- drivers/gpu/drm/drm_fb_helper.c | 5 +++-- drivers/gpu/drm/i915/intel_display.c | 4 ++-- drivers/gpu/drm/nouveau/nv04_crtc.c | 2 +- drivers/gpu/drm/nouveau/nv50_crtc.c | 2 +- drivers/gpu/drm/radeon/atombios_crtc.c | 2 +- drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 2 +- drivers/gpu/drm/radeon/radeon_mode.h | 4 ++-- include/drm/drm_crtc_helper.h | 3 ++- 8 files changed, 13 insertions(+), 11 deletions(-)
Quoted 16 lines
drivers/gpu/drm/drm_fb_helper.c int drm_fb_helper_debug_enter(struct fb_info *info) · line 268
Quoted 12 lines
drivers/gpu/drm/drm_fb_helper.c +2
-1@@ -263,7 +263,8 @@ int drm_fb_helper_debug_enter(struct fb_info *info) funcs->mode_set_base_atomic (mode_set->crtc, mode_set->fb, mode_set->x, - mode_set->y); + mode_set->y, +1 );An enum for the last arg would make this call much less mysterious. :)
Is there anything that is already predefined or would you prefer just true or false?
This could be changed to a bool because there are really only two states, entering and exiting. If you provide some guidance on the preferred naming, I can re-spin the patch.
Thanks,
Jason.
Re: [PATCH 3/5] drm,kdb,kms: Add an enter argument to mode_set_base_atomic() API
Quoted 45 lines · On Tue, 12 Oct 2010 10:46:52 -0500 Jason Wessel <[email protected]>…
Quoted 28 lines · Jesse Barnes
Quoted 24 lines · On Tue, 12 Oct 2010 07:49:59 -0500 Jason Wessel <[email protected]>…
Some devices such as the pre nv02 chips have enter and exit constraints where hardware compression must be turned off and re-enabled on resuming normal operations.
This patch extends the
mode_set_base_atomic()call to pass an argument to indicate if this is an entry or an exit from an atomic kernel mode set change. Individual drm drivers can properly save and restore state accordingly.Signed-off-by Jason Wessel <[email protected]>CC Jesse Barnes <[email protected]>CC David Airlie <[email protected]>--- drivers/gpu/drm/drm_fb_helper.c | 5 +++-- drivers/gpu/drm/i915/intel_display.c | 4 ++-- drivers/gpu/drm/nouveau/nv04_crtc.c | 2 +- drivers/gpu/drm/nouveau/nv50_crtc.c | 2 +- drivers/gpu/drm/radeon/atombios_crtc.c | 2 +- drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 2 +- drivers/gpu/drm/radeon/radeon_mode.h | 4 ++-- include/drm/drm_crtc_helper.h | 3 ++- 8 files changed, 13 insertions(+), 11 deletions(-)Quoted 16 lines
drivers/gpu/drm/drm_fb_helper.c int drm_fb_helper_debug_enter(struct fb_info *info) · line 268
Quoted 12 lines
drivers/gpu/drm/drm_fb_helper.c +2
-1@@ -263,7 +263,8 @@ int drm_fb_helper_debug_enter(struct fb_info *info) funcs->mode_set_base_atomic (mode_set->crtc, mode_set->fb, mode_set->x, - mode_set->y); + mode_set->y, +1 );An enum for the last arg would make this call much less mysterious. :)
Quoted 6 lines
Is there anything that is already predefined or would you prefer just true or false?
This could be changed to a bool because there are really only two states, entering and exiting. If you provide some guidance on the preferred naming, I can re-spin the patch.
I was thinking:
enum mode_set_atomic {
ENTER_KDB,
EXIT_KDB,
};
or something similar (the name of the enum could probably be better). Just having a number or true/false always makes me have to check the function prototype. Having an enum means it's readable at the callsite. But this is really just a nitpick; bool args like this are a pet peeve of mine. :)
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
PATCH 4/5 kdb,kms: Save and restore the LUT on atomic KMS enter/exit
In reply to Jason WesselWhen changing VTs non-atomically the kernel works in conjunction with the Xserver in user space and receives the LUT information from the Xserver via a system call. When changing modes atomically for kdb, this information must be saved and restored without disturbing user space as if nothing ever happened.
There is a short cut used by this patch where gamma_store is used as the save space. If this turns out to be a problem in the future a pre-allocated chunk of memory will be required for each crtc to save and restore the LUT information.
--- drivers/gpu/drm/drm_fb_helper.c | 32 +++++++++++++++++++++++++++++++- 1 files changed, 31 insertions(+), 1 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +31 -1
@@ -242,6 +242,34 @@ static int drm_fb_helper_parse_command_line(struct drm_fb_helper *fb_helper)return 0 ; } +static void drm_fb_helper_save_lut_atomic (struct drm_crtc *crtc,struct drm_fb_helper *helper) +{ +int size; +uint16_t *r_base, *g_base, *b_base; +int i; + + size = crtc->gamma_size * (sizeof (uint16_t )); + r_base = crtc->gamma_store; + g_base = r_base + size; + b_base = g_base + size; + +for (i =0 ; i < size; i++) + helper->funcs->gamma_get (crtc, &r_base[i], &g_base[i], &b_base[i], i); +} + +static void drm_fb_helper_restore_lut_atomic (struct drm_crtc *crtc) +{ +int size; +uint16_t *r_base, *g_base, *b_base; + + size = crtc->gamma_size * (sizeof (uint16_t )); + r_base = crtc->gamma_store; + g_base = r_base + size; + b_base = g_base + size; + + crtc->funcs->gamma_set (crtc, r_base, g_base, b_base,0 , size); +} +int drm_fb_helper_debug_enter (struct fb_info *info) {struct drm_fb_helper *helper = info->par;
@@ -260,12 +288,13 @@ int drm_fb_helper_debug_enter(struct fb_info *info)continue ; funcs = mode_set->crtc->helper_private; + +drm_fb_helper_save_lut_atomic (mode_set->crtc, helper); funcs->mode_set_base_atomic (mode_set->crtc, mode_set->fb, mode_set->x, mode_set->y,1 ); - } }
@@ -309,6 +338,7 @@ int drm_fb_helper_debug_leave(struct fb_info *info)continue ; } +drm_fb_helper_restore_lut_atomic (mode_set->crtc); funcs->mode_set_base_atomic (mode_set->crtc, fb, crtc->x, crtc->y,0 ); }
Signature · 1 line
1.6.3.3
PATCH 5/5 drm/nouveau/kms: Avoid a hang entering KDB with VT accel on.
In reply to Jason WesselFrom: Chris Ball <[email protected]>
Francisco Jerez advises that pre-nv20 cards would hang if we entered kdb with accel on and IRQs disabled, so we now disable accel before entering kdb and re-enable it on the way back out.
--- drivers/gpu/drm/nouveau/nv04_crtc.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
drivers/gpu/drm/nouveau/nv04_crtc.c +9 -0
@@ -33,6 +33,7 @@#include "nouveau_fb.h" #include "nouveau_hw.h" #include "nvreg.h" +#include "nouveau_fbcon.h" static int nv04_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
@@ -859,6 +860,14 @@ nv04_crtc_mode_set_base_atomic(struct drm_crtc *crtc,struct drm_framebuffer *fb, int x, int y, int enter) { + struct drm_nouveau_private *dev_priv = crtc->dev->dev_private; +struct drm_device *dev = dev_priv->dev; + +if (enter) +nouveau_fbcon_save_disable_accel (dev); +else +nouveau_fbcon_restore_accel (dev); +return nv04_crtc_do_mode_set_base (crtc, fb, x, y, true); }
Signature · 1 line
1.6.3.3