drm/i915: unconditionally copy mode into crtc at boot time
Subsystems (2)
PATCH 1/8 drm/i915: unconditionally copy mode into crtc at boot time
The BIOS code will need this to properly inherit the mode.
--- drivers/gpu/drm/i915/intel_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -11175,7 +11175,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,*/ list_for_each_entry (crtc, &dev->mode_config.crtc_list, base.head) { -if (crtc->active && i915_fastboot) { +if (crtc->active) {intel_crtc_mode_from_pipe_config (crtc, &crtc->config); DRM_DEBUG_KMS("[CRTC:%d] found active mode: ",
Signature · 1 line
1.8.4.2
PATCH 2/8 drm/i915/vlv: add early DPIO init v3
Just add an early init since we may need to access DPIO regs early on. The init call in modeset_init_hw is also needed for the resume case, when we need to reset DPIO to keep things happy.
v2: split reset and reg init
v3: split patches (Daniel)
--- drivers/gpu/drm/i915/intel_display.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_display.c +2 -0
@@ -10861,6 +10861,8 @@ void intel_modeset_init(struct drm_device *dev) } } +intel_init_dpio (dev); +intel_cpu_pll_init (dev);intel_shared_dpll_init (dev);
Signature · 1 line
1.8.4.2
PATCH 3/8 drm/i915/vlv: split DPIO init and reset
In reply to Jesse BarnesWe only need to init the reg offset for DPIO once, but we need to reset DPIO at resume time and at init time.
--- drivers/gpu/drm/i915/intel_display.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +11 -1
@@ -1368,6 +1368,15 @@ static void intel_init_dpio(struct drm_device *dev)return ;DPIO_PHY_IOSF_PORT (DPIO_PHY0 ) =IOSF_PORT_DPIO ; +} + +static void intel_reset_dpio (struct drm_device *dev) +{ +struct drm_i915_private *dev_priv = dev->dev_private; + +if (!IS_VALLEYVIEW (dev)) +return ; +/* * From VLV2A0_DP_eDP_DPIO_driver_vbios_notes_10.docx - * 6. De-assert cmn_reset/side_reset. Same as VLV X0.
@@ -10799,7 +10808,7 @@ void intel_modeset_init_hw(struct drm_device *dev)I915_WRITE (DPLL (PIPE_B ),I915_READ (DPLL (PIPE_B )) |DPLL_INTEGRATED_CRI_CLK_VLV ); -intel_init_dpio (dev); +intel_reset_dpio (dev);mutex_lock (&dev->struct_mutex);intel_enable_gt_powersave (dev);
@@ -10862,6 +10871,7 @@ void intel_modeset_init(struct drm_device *dev) }intel_init_dpio (dev); +intel_reset_dpio (dev);intel_cpu_pll_init (dev);intel_shared_dpll_init (dev);
Signature · 1 line
1.8.4.2
PATCH 4/8 drm/i915: read out hw state earlier
In reply to Jesse BarnesWe want to do this early on before we try to fetch the plane config, which depends on some of the pipe config state.
--- drivers/gpu/drm/i915/intel_display.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_display.c +5 -5
@@ -10882,6 +10882,11 @@ void intel_modeset_init(struct drm_device *dev)/* Just in case the BIOS is doing something questionable. */ intel_disable_fbc (dev); + +drm_modeset_lock_all (dev); +drm_mode_config_reset (dev); +intel_modeset_setup_hw_state (dev, false); +drm_modeset_unlock_all (dev); } static void
@@ -11249,11 +11254,6 @@ void intel_modeset_gem_init(struct drm_device *dev)intel_modeset_init_hw (dev);intel_setup_overlay (dev); - -drm_modeset_lock_all (dev); -drm_mode_config_reset (dev); -intel_modeset_setup_hw_state (dev, false); -drm_modeset_unlock_all (dev); }void intel_modeset_cleanup (struct drm_device *dev)
Signature · 1 line
1.8.4.2
Re: [PATCH 4/8] drm/i915: read out hw state earlier
Quoted 4 lines · Jesse Barnes
We want to do this early on before we try to fetch the plane config, which depends on some of the pipe config state.
Signed-off-by Jesse Barnes <[email protected]>
I've merged patches 2&3 from this series. This one here needs a backmerge which atm is blocked on Dave moving drm-fixes ahead ... -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 5/8 drm/i915: retrieve current fb config into new plane_config structure at init v7
In reply to Jesse BarnesRead out the current plane configuration at init time into a new plane_config structure. This allows us to track any existing framebuffers attached to the plane and potentially re-use them in our fbdev code for a smooth handoff.
v2: update for new pitch_for_width function (Jesse)
comment how get_plane_config works with shared fbs (Jesse)
v3: s/ARGB/XRGB (Ville)
use pipesrc width/height (Ville)
fix fourcc comment (Bob)
use drm_format_plane_cpp (Ville)
v4: use fb for tracking fb data object (Ville)
v5: fix up gen2 pitch limits (Ville)
v6: read out stride as well (Daniel)
v7: split out init ordering changes (Daniel)
don't fetch config if !CONFIG_FB
--- drivers/gpu/drm/i915/i915_drv.h | 3 + drivers/gpu/drm/i915/intel_display.c | 126 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 8 +++ 3 files changed, 137 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -366,6 +366,7 @@ struct drm_i915_error_state {struct intel_connector ;struct intel_crtc_config ; +struct intel_plane_config ;struct intel_crtc ;struct intel_limit ;struct dpll ;
@@ -404,6 +405,8 @@ struct drm_i915_display_funcs {* fills out the pipe-config with the hw state. */ bool (*get_pipe_config)(struct intel_crtc *,struct intel_crtc_config *); +void (*get_plane_config)(struct intel_crtc *, +struct intel_plane_config *);int (*crtc_mode_set)(struct drm_crtc *crtc,int x,int y,struct drm_framebuffer *old_fb);
drivers/gpu/drm/i915/intel_display.c +126 -0
162 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +8 -0
@@ -209,6 +209,12 @@ typedef struct dpll {int p; } intel_clock_t; +struct intel_plane_config { +struct intel_framebuffer *fb;/* ends up managed by intel_fbdev.c */ +bool tiled; +int size; +}; +struct intel_crtc_config {/** * quirks - bitfield with hw state readout quirks
@@ -358,6 +364,7 @@ struct intel_crtc {bool cursor_visible;struct intel_crtc_config config; +struct intel_plane_config plane_config;uint32_t ddi_pll_sel;
@@ -707,6 +714,7 @@ void hsw_enable_ips(struct intel_crtc *crtc);void hsw_disable_ips (struct intel_crtc *crtc);void intel_display_set_init_power (struct drm_device *dev,bool enable);int valleyview_get_vco (struct drm_i915_private *dev_priv); +int intel_format_to_fourcc (int format);/* intel_dp.c */ void intel_dp_init (struct drm_device *dev,int output_reg,enum port port);
Signature · 1 line
1.8.4.2
Re: [PATCH 5/8] drm/i915: retrieve current fb config into new plane_config structure at init v7
Quoted 9 lines · Jesse Barnes
drivers/gpu/drm/i915/intel_display.c +9
-0+if (INTEL_INFO (dev)->gen >=4 ) { +if (plane_config->tiled) + offset =I915_READ (DSPTILEOFF (plane)); +else + offset =I915_READ (DSPLINOFF (plane)); + base =I915_READ (DSPSURF (plane)) &0xfffff000 ; + }else { + base =I915_READ (DSPADDR (plane)); + }
drivers/gpu/drm/i915/intel_display.c static void vlv_crtc_clock_get(struct intel_crtc *crtc, · line 5543
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+ + val =I915_READ (PIPESRC (pipe)); + plane_config->fb->base.width = ((val >>16 ) &0xfff ) +1 ; + plane_config->fb->base.height = ((val >>0 ) &0xfff ) +1 ; + + val =I915_READ (DSPSTRIDE (pipe)); + plane_config->fb->base.pitches[0 ] = val &0xffffff80 ; + + plane_config->size =ALIGN (plane_config->fb->base.pitches[0 ] * + plane_config->fb->base.height,PAGE_SIZE );
This underestimates the size of a tiled framebuffer. Height should be aligned to 1,16,64 depending on tiling.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 5/8] drm/i915: retrieve current fb config into new plane_config structure at init v7
Quoted 15 lines · On Tue, 17 Dec 2013 10:03:12 +0000 Chris Wilson <[email protected]>…
Quoted 14 lines · Jesse Barnes
drivers/gpu/drm/i915/intel_display.c +14
-0+if (INTEL_INFO (dev)->gen >=4 ) { +if (plane_config->tiled) + offset =I915_READ (DSPTILEOFF (plane)); +else + offset =I915_READ (DSPLINOFF (plane)); + base =I915_READ (DSPSURF (plane)) &0xfffff000 ; + }else { + base =I915_READ (DSPADDR (plane)); + } + + val =I915_READ (PIPESRC (pipe)); + plane_config->fb->base.width = ((val >>16 ) &0xfff ) +1 ; + plane_config->fb->base.height = ((val >>0 ) &0xfff ) +1 ; +
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c static void vlv_crtc_clock_get(struct intel_crtc *crtc, · line 5543
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +5
-0+ val =I915_READ (DSPSTRIDE (pipe)); + plane_config->fb->base.pitches[0 ] = val &0xffffff80 ; + + plane_config->size =ALIGN (plane_config->fb->base.pitches[0 ] * + plane_config->fb->base.height,PAGE_SIZE );This underestimates the size of a tiled framebuffer. Height should be aligned to 1,16,64 depending on tiling.
Fixed, thanks.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
PATCH 6/8 drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v7
In reply to Jesse BarnesRetrieve current framebuffer config info from the regs and create an fb object for the buffer the BIOS or boot loader left us. This should allow for smooth transitions to userspace apps once we finish the initial configuration construction.
v2: check for non-native modes and adjust (Jesse)
fixup aperture and cmap frees (Imre)
use unlocked unref if init_bios fails (Jesse)
fix curly brace around DSPADDR check (Imre)
comment failure path for pin_and_fence (Imre)
v3: fixup fixup of aperture frees (Chris)
v4: update to current bits (locking & pin_and_fence hack) (Jesse)
v5: move fb config fetch to display code (Jesse)
re-order hw state readout on initial load to suit fb inherit (Jesse) re-add pin_and_fence in fbdev code to make sure we refcount properly (Je
v6: rename to plane_config (Daniel)
check for valid object when initializing BIOS fb (Jesse) split from plane_config readout and other display changes (Jesse) drop use_bios_fb option (Chris)
update comments (Jesse)
rework fbdev_init_bios for clarity (Jesse)
drop fb obj ref under lock (Chris)
v7: use fb object from plane_config instead (Ville)
take ref on fb object (Jesse)
--- drivers/gpu/drm/i915/intel_display.c | 4 +- drivers/gpu/drm/i915/intel_drv.h | 4 +- drivers/gpu/drm/i915/intel_fbdev.c | 235 ++++++++++++++++++++++++++++++++--- 3 files changed, 224 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -2
@@ -7826,11 +7826,11 @@ mode_fits_in_fbdev(struct drm_device *dev,if (dev_priv->fbdev ==NULL )return NULL ; - obj = dev_priv->fbdev->ifb.obj; + obj = dev_priv->fbdev->fb->obj;if (obj ==NULL )return NULL ; - fb = &dev_priv->fbdev->ifb.base; + fb = &dev_priv->fbdev->fb->base;if (fb->pitches[0 ] <intel_framebuffer_pitch_for_width (mode->hdisplay, fb->bits_per_pixel))return NULL ;
drivers/gpu/drm/i915/intel_drv.h +3 -1
@@ -110,9 +110,10 @@ struct intel_framebuffer {struct intel_fbdev {struct drm_fb_helper helper; -struct intel_framebuffer ifb; +struct intel_framebuffer *fb;struct list_head fbdev_list;struct drm_display_mode *our_mode; +int preferred_bpp; };struct intel_encoder {
@@ -671,6 +672,7 @@ int intel_framebuffer_init(struct drm_device *dev,struct intel_framebuffer *ifb, struct drm_mode_fb_cmd2 *mode_cmd, struct drm_i915_gem_object *obj); +void intel_fbdev_init_bios (struct drm_device *dev);void intel_framebuffer_fini (struct intel_framebuffer *fb);void intel_prepare_page_flip (struct drm_device *dev,int plane);void intel_finish_page_flip (struct drm_device *dev,int pipe);
drivers/gpu/drm/i915/intel_fbdev.c +219 -16
319 lines not on this page · raw message
Signature · 1 line
1.8.4.2
Re: [PATCH 6/8] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v7
drivers/gpu/drm/i915/intel_fbdev.c MODULE_LICENSE("GPL and additional rights"); · line 540
Quoted 8 lines · Jesse Barnes
drivers/gpu/drm/i915/intel_fbdev.c +2
-1@@ -333,7 +535,8 @@ MODULE_LICENSE("GPL and additional rights");void intel_fbdev_output_poll_changed (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; -drm_fb_helper_hotplug_event (&dev_priv->fbdev->helper); +if (dev_priv->fbdev) +drm_fb_helper_hotplug_event (&dev_priv->fbdev->helper); }
Also intel_fbdev_restore_mode() needs the NULL fbdev safeguard. -Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 6/8] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v7
Quoted 11 lines · On Tue, 17 Dec 2013 10:34:39 +0000 Chris Wilson <[email protected]>…
drivers/gpu/drm/i915/intel_fbdev.c MODULE_LICENSE("GPL and additional rights"); · line 540
Quoted 8 lines · Jesse Barnes
drivers/gpu/drm/i915/intel_fbdev.c +2
-1@@ -333,7 +535,8 @@ MODULE_LICENSE("GPL and additional rights");void intel_fbdev_output_poll_changed (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; -drm_fb_helper_hotplug_event (&dev_priv->fbdev->helper); +if (dev_priv->fbdev) +drm_fb_helper_hotplug_event (&dev_priv->fbdev->helper); }Also
intel_fbdev_restore_mode()needs the NULL fbdev safeguard.
Fixed.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: [PATCH 6/8] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v7
Quoted 12 lines · Jesse Barnes
Quoted 11 lines · Jesse Barnes
drivers/gpu/drm/i915/intel_fbdev.c MODULE_LICENSE("GPL and additional rights"); · line 540
Quoted 8 lines
drivers/gpu/drm/i915/intel_fbdev.c +2
-1@@ -333,7 +535,8 @@ MODULE_LICENSE("GPL and additional rights");void intel_fbdev_output_poll_changed (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; -drm_fb_helper_hotplug_event (&dev_priv->fbdev->helper); +if (dev_priv->fbdev) +drm_fb_helper_hotplug_event (&dev_priv->fbdev->helper); }Also
intel_fbdev_restore_mode()needs the NULL fbdev safeguard.
Quoted 1 line
Fixed.
I still don't get why we need this check - for CONFIG_FB=n we have a special dummy function and we are really careful in the setup code to only enable the interrupt handling code once fbdev is fully set up. Or do I miss some change here which makes this required? If so the right fix imo would be to shuffle the init sequence again (and update all the tons of comments about it, ofc).
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 6/8] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v7
Quoted 13 lines · On Tue, 17 Dec 2013 22:17:22 +0100 Daniel Vetter <[email protected]> wrote:
Quoted 12 lines · Jesse Barnes
Quoted 11 lines · Jesse Barnes
drivers/gpu/drm/i915/intel_fbdev.c MODULE_LICENSE("GPL and additional rights"); · line 540
Quoted 8 lines
drivers/gpu/drm/i915/intel_fbdev.c +2
-1@@ -333,7 +535,8 @@ MODULE_LICENSE("GPL and additional rights");void intel_fbdev_output_poll_changed (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; -drm_fb_helper_hotplug_event (&dev_priv->fbdev->helper); +if (dev_priv->fbdev) +drm_fb_helper_hotplug_event (&dev_priv->fbdev->helper); }Also
intel_fbdev_restore_mode()needs the NULL fbdev safeguard.
Quoted 8 lines
Quoted 1 line
Fixed.
I still don't get why we need this check - for
CONFIG_FB=nwe have a special dummy function and we are really careful in the setup code to only enable the interrupt handling code once fbdev is fully set up. Or do I miss some change here which makes this required? If so the right fix imo would be to shuffle the init sequence again (and update all the tons of comments about it, ofc).
In the init code I'm more careful now to avoid leaving a bogus pointer around:
ret = drm_fb_helper_init(dev, &ifbdev->helper,
INTEL_INFO(dev)->num_pipes, 4);
if (ret) {
+ dev_priv->fbdev = NULL;
kfree(ifbdev);
return ret;
}
So in the unlikely event that the fb helper code fails I don't want to fall over.
But that shouldn't happen in practice. I only have the checks in place to catch when I failed to set the fbdev field in one path (which is now fixed).
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: [PATCH 6/8] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v7
Quoted 35 lines · Jesse Barnes
Quoted 13 lines · Jesse Barnes
Quoted 12 lines
Quoted 11 lines · Jesse Barnes
drivers/gpu/drm/i915/intel_fbdev.c MODULE_LICENSE("GPL and additional rights"); · line 540
Quoted 8 lines
drivers/gpu/drm/i915/intel_fbdev.c +2
-1@@ -333,7 +535,8 @@ MODULE_LICENSE("GPL and additional rights");void intel_fbdev_output_poll_changed (struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private; -drm_fb_helper_hotplug_event (&dev_priv->fbdev->helper); +if (dev_priv->fbdev) +drm_fb_helper_hotplug_event (&dev_priv->fbdev->helper); }Also
intel_fbdev_restore_mode()needs the NULL fbdev safeguard.Quoted 8 lines
Quoted 1 line
Fixed.
I still don't get why we need this check - for
CONFIG_FB=nwe have a special dummy function and we are really careful in the setup code to only enable the interrupt handling code once fbdev is fully set up. Or do I miss some change here which makes this required? If so the right fix imo would be to shuffle the init sequence again (and update all the tons of comments about it, ofc).In the init code I'm more careful now to avoid leaving a bogus pointer around:
ret = drm_fb_helper_init(dev, &ifbdev->helper, INTEL_INFO(dev)->num_pipes, 4); if (ret) { + dev_priv->fbdev = NULL; kfree(ifbdev); return ret; }
Quoted 6 lines
So in the unlikely event that the fb helper code fails I don't want to fall over.
But that shouldn't happen in practice. I only have the checks in place to catch when I failed to set the fbdev field in one path (which is now fixed)
Imo if a core piece of the driver fails to initialize we should just fail driver loading. We've had tons of crazy lore around contexts failing, ppgtt failing and other similar stuff, and I think it just makes the normal code more fragile with no real gain.
If you think something slips through the cracks maybe just throw a BUG_ON in there instead.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 6/8] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v7
Quoted 8 lines · Daniel Vetter
Quoted 6 lines · Jesse Barnes
So in the unlikely event that the fb helper code fails I don't want to fall over.
But that shouldn't happen in practice. I only have the checks in place to catch when I failed to set the fbdev field in one path (which is now fixed)
Quoted 7 lines
Imo if a core piece of the driver fails to initialize we should just fail driver loading. We've had tons of crazy lore around contexts failing, ppgtt failing and other similar stuff, and I think it just makes the normal code more fragile with no real gain.
If you think something slips through the cracks maybe just throw a
BUG_ONin there instead.
I tripped over it earlier when I was disabling parts of the driver. I think allowing dev_priv->fbdev to be NULL fits nicely with your crusade against fbcon.
(In fact it was quite fun to load the driver without modesetting as a headless accelerator...)
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 6/8] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v7
Quoted 14 lines · Chris Wilson
Quoted 13 lines · Daniel Vetter
Quoted 6 lines · Jesse Barnes
So in the unlikely event that the fb helper code fails I don't want to fall over.
But that shouldn't happen in practice. I only have the checks in place to catch when I failed to set the fbdev field in one path (which is now fixed)
Imo if a core piece of the driver fails to initialize we should just fail driver loading. We've had tons of crazy lore around contexts failing, ppgtt failing and other similar stuff, and I think it just makes the normal code more fragile with no real gain.
Quoted 8 lines
Quoted 2 lines
If you think something slips through the cracks maybe just throw a
BUG_ONin there instead.I tripped over it earlier when I was disabling parts of the driver. I think allowing
dev_priv->fbdevto be NULL fits nicely with your crusade against fbcon.
(In fact it was quite fun to load the driver without modesetting as a headless accelerator...)
Well for fully disabled fbdev we nuke all those functions completely. If we want to go with this safety net here then I think at least a WARN_ON or something should be put in there, since this really shouldn't happen.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Re: [PATCH 6/8] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v7
In reply to Jesse BarnesQuoted 13 lines · Jesse Barnes
int
intel_fbdev_init(struct drm_device *dev)drivers/gpu/drm/i915/intel_fbdev.c +2
-5@@ -268,17 +461,25 @@ int intel_fbdev_init(struct drm_device *dev)struct drm_i915_private *dev_priv = dev->dev_private;int ret; - ifbdev =kzalloc (sizeof (*ifbdev),GFP_KERNEL ); -if (!ifbdev) -return -ENOMEM ; +/* This may fail, if so, dev_priv->fbdev won't be set below */ +intel_fbdev_init_bios (dev); - dev_priv->fbdev = ifbdev; - ifbdev->helper.funcs = &intel_fb_helper_funcs;
drivers/gpu/drm/i915/intel_fbdev.c int intel_fbdev_init(struct drm_device *dev) · line 476
Quoted 10 lines
drivers/gpu/drm/i915/intel_fbdev.c +10
-0+if ((ifbdev = dev_priv->fbdev) ==NULL ) { + ifbdev =kzalloc (sizeof (struct intel_fbdev ),GFP_KERNEL ); +if (ifbdev ==NULL ) +return -ENOMEM ; + + ifbdev->helper.funcs = &intel_fb_helper_funcs; + ifbdev->preferred_bpp =32 ; + + dev_priv->fbdev = ifbdev; + }
Since Daniel also mentioned the same bikeshed, I think this would look neater with the allocation here and ifbdev being passed to intel_fbdev_init_bios to fill in:
ifbdev = kzalloc(sizeof(*ifbdev), GFP_KERNEL);
if (ifbdev == NULL)
return -ENODEV;
if (!intel_fbdev_init_bios(dev, ifbdev)) {
ifbdev->helper.funcs = &intel_fb_helper_funcs;
ifbdev->preferred_bpp = 32;
}
dev_priv->fbdev = ifbdev;
return 0;-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 6/8] drm/i915: Wrap the preallocated BIOS framebuffer and preserve for KMS fbcon v7
Quoted 29 lines · On Tue, 17 Dec 2013 19:29:00 +0000 Chris Wilson <[email protected]>…
Quoted 13 lines · Jesse Barnes
int
intel_fbdev_init(struct drm_device *dev)drivers/gpu/drm/i915/intel_fbdev.c +2
-5@@ -268,17 +461,25 @@ int intel_fbdev_init(struct drm_device *dev)struct drm_i915_private *dev_priv = dev->dev_private;int ret; - ifbdev =kzalloc (sizeof (*ifbdev),GFP_KERNEL ); -if (!ifbdev) -return -ENOMEM ; +/* This may fail, if so, dev_priv->fbdev won't be set below */ +intel_fbdev_init_bios (dev); - dev_priv->fbdev = ifbdev; - ifbdev->helper.funcs = &intel_fb_helper_funcs;drivers/gpu/drm/i915/intel_fbdev.c int intel_fbdev_init(struct drm_device *dev) · line 476
Quoted 10 lines
drivers/gpu/drm/i915/intel_fbdev.c +10
-0+if ((ifbdev = dev_priv->fbdev) ==NULL ) { + ifbdev =kzalloc (sizeof (struct intel_fbdev ),GFP_KERNEL ); +if (ifbdev ==NULL ) +return -ENOMEM ; + + ifbdev->helper.funcs = &intel_fb_helper_funcs; + ifbdev->preferred_bpp =32 ; + + dev_priv->fbdev = ifbdev; + }Since Daniel also mentioned the same bikeshed, I think this would look neater with the allocation here and ifbdev being passed to
intel_fbdev_init_biosto fill in:
Quoted 11 lines
ifbdev = kzalloc(sizeof(*ifbdev), GFP_KERNEL);
if (ifbdev == NULL)
return -ENODEV;
if (!intel_fbdev_init_bios(dev, ifbdev)) {
ifbdev->helper.funcs = &intel_fb_helper_funcs;
ifbdev->preferred_bpp = 32;
}
dev_priv->fbdev = ifbdev;
return 0;Yeah, looks better that way. Fixed.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
PATCH 7/8 drm/i915: don't memset the fb buffer if preallocated
In reply to Jesse BarnesWe want to preserve the BIOS/bootloader contents for later.
--- drivers/gpu/drm/i915/intel_fbdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_fbdev.c +3 -1
@@ -132,6 +132,7 @@ static int intelfb_create(struct drm_fb_helper *helper,struct drm_framebuffer *fb;struct drm_i915_gem_object *obj;int size, ret; +bool prealloc = false;mutex_lock (&dev->struct_mutex);
@@ -142,6 +143,7 @@ static int intelfb_create(struct drm_fb_helper *helper, goto out_unlock; }else {DRM_DEBUG_KMS ("re-using BIOS fb\n" ); + prealloc = true; sizes->fb_width = intel_fb->base.width; sizes->fb_height = intel_fb->base.height; }
@@ -203,7 +205,7 @@ static int intelfb_create(struct drm_fb_helper *helper,* If the object is stolen however, it will be full of whatever * garbage was left in there. */ -if (ifbdev->fb->obj->stolen) +if (ifbdev->fb->obj->stolen && !prealloc)memset_io (info->screen_base,0 , info->screen_size);/* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */
Signature · 1 line
1.8.4.2
PATCH 8/8 drm/i915: inform drm_fb_helper if we abandoned a connected output v2
In reply to Jesse BarnesOtherwise subsequent fb activity will try to do blank/unblank on outputs that were never fully enabled.
v2: drop unnecessary enabled[] modifications in failure cases (Chris)
--- drivers/gpu/drm/i915/intel_fbdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_fbdev.c +1 -0
@@ -308,6 +308,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,if (!encoder || !encoder->crtc) {DRM_DEBUG_KMS ("connector %d has no encoder or crtc, skipping\n" , connector->base.id); + enabled[i] = false;continue ; }
Signature · 1 line
1.8.4.2