Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* [GIT PULL] main fbdev changes for 3.16
From: Tomi Valkeinen @ 2014-06-04 12:27 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, Linux Fbdev development list

[-- Attachment #1: Type: text/plain, Size: 4606 bytes --]

Hi Linus,

Please pull the main fbdev changes for 3.16.

 Tomi

The following changes since commit a798c10faf62a505d24e5f6213fbaf904a39623f:

  Linux 3.15-rc2 (2014-04-20 11:08:50 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git tags/fbdev-main-3.16

for you to fetch changes up to fbc6c4a13bbfb420eedfdb26a0a859f9c07e8a7b:

  drivers/video/fbdev/fb-puv3.c: Add header files for function unifb_mmap (2014-05-23 13:51:10 +0300)

----------------------------------------------------------------
fbdev changes for 3.16 (main part)

Mainly fixes and small improvements. The biggest change seems to be backlight
control support for mx3fb.

----------------------------------------------------------------
Aaro Koskinen (1):
      video: omap: delete support for early fbmem allocation

Alexander Stein (1):
      video: mx3fb: Add backlight control support

Arnd Bergmann (7):
      video: sh_mobile_lcdcfb depends on meram
      video: clarify I2C dependencies
      video/omap: fix modular build
      video/mbx: fix building debugfs support
      video: export fb_prepare_logo
      video: atmel needs FB_BACKLIGHT
      video/nuc900: allow modular build

Boris BREZILLON (1):
      video: of: display_timing: fix default native-mode setting

Brian W Hart (1):
      fbdev/fb.h: silence warning with -Wsign-compare

Dan Carpenter (1):
      video: mmpfb: cleanup some static checker warnings in probe()

David Ung (1):
      video: Check EDID for HDMI connection

Denis Carikli (1):
      video: mx3fb: Use devm_kzalloc

Fabian Frederick (1):
      fbdev: fbmem: remove positive test on unsigned values

Jean Delvare (3):
      fbdev: Fix tmiofb driver dependencies
      video: exynos: Add a dependency to the menu
      video: Kconfig: Add a dependency to the Goldfish framebuffer driver

Jingoo Han (1):
      video: pxa3xx-gcu: use devm_ioremap_resource()

Jon Ringle (1):
      video: da8xx-fb: Add support for Densitron 84-0023-001T

Julia Lawall (1):
      video: delete unneeded call to platform_get_drvdata

Lucas Stach (1):
      video: of: display_timing: remove two unsafe error messages

Masami Ichikawa (1):
      fbcon: Fix memory leak in con2fb_release_oldinfo()

Masanari Iida (2):
      video: fbdev: Fix format string mismatch in wm8505fb.c
      video: fbdev: Fix format string mismatch in gbefb.c

Mikulas Patocka (1):
      matroxfb: perform a dummy read of M_STATUS

Richard Weinberger (2):
      video: mmp: Remove references to CPU_MMP3
      video: mmp: Remove references to CPU_PXA988

Rickard Strandqvist (2):
      video: fbdev: grvga.c: Fix for possible null pointer dereference
      video: fbdev: s3fb.c: Fix for possible null pointer dereference

Zhichuang SUN (1):
      drivers/video/fbdev/fb-puv3.c: Add header files for function unifb_mmap

 drivers/video/console/fbcon.c              |  1 +
 drivers/video/fbdev/Kconfig                | 11 ++--
 drivers/video/fbdev/bf54x-lq043fb.c        |  2 -
 drivers/video/fbdev/core/fbmem.c           |  7 +--
 drivers/video/fbdev/core/fbmon.c           |  9 +++-
 drivers/video/fbdev/da8xx-fb.c             | 14 +++++
 drivers/video/fbdev/exynos/Kconfig         |  2 +-
 drivers/video/fbdev/fb-puv3.c              |  2 +
 drivers/video/fbdev/gbefb.c                |  2 +-
 drivers/video/fbdev/grvga.c                |  3 +-
 drivers/video/fbdev/matrox/matroxfb_base.h |  2 +-
 drivers/video/fbdev/mbx/Makefile           |  3 +-
 drivers/video/fbdev/mbx/mbxdebugfs.c       |  2 +-
 drivers/video/fbdev/mbx/mbxfb.c            |  2 +
 drivers/video/fbdev/mmp/Kconfig            |  2 +-
 drivers/video/fbdev/mmp/fb/mmpfb.c         |  9 +---
 drivers/video/fbdev/mmp/hw/Kconfig         |  6 +--
 drivers/video/fbdev/mmp/hw/mmp_ctrl.h      | 32 -----------
 drivers/video/fbdev/mx3fb.c                | 85 ++++++++++++++++++++++++++++--
 drivers/video/fbdev/omap/Kconfig           |  9 ++++
 drivers/video/fbdev/omap/Makefile          | 23 ++++----
 drivers/video/fbdev/omap/lcdc.c            | 67 +----------------------
 drivers/video/fbdev/omap/omapfb_main.c     |  1 +
 drivers/video/fbdev/pxa3xx-gcu.c           |  6 +--
 drivers/video/fbdev/s3fb.c                 |  3 +-
 drivers/video/fbdev/wm8505fb.c             |  2 +-
 drivers/video/of_display_timing.c          | 10 ++--
 include/linux/fb.h                         |  3 +-
 include/linux/omap-dma.h                   |  2 +-
 29 files changed, 169 insertions(+), 153 deletions(-)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* [GIT PULL] omap fbdev changes for 3.16
From: Tomi Valkeinen @ 2014-06-04 12:30 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel, Linux Fbdev development list

[-- Attachment #1: Type: text/plain, Size: 6587 bytes --]

Hi Linus,

Please pull the omap fbdev changes for 3.16.

 Tomi

The following changes since commit 89ca3b881987f5a4be4c5dbaa7f0df12bbdde2fd:

  Linux 3.15-rc4 (2014-05-04 18:14:42 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git tags/fbdev-omap-3.16

for you to fetch changes up to f2dd36ac9974cc2353bcbb8e6b643fb96030564c:

  OMAPDSS: move 'compatible' converter to omapdss driver (2014-05-28 09:25:15 +0300)

----------------------------------------------------------------
fbdev changes for 3.16 (omap)

* DT support for the panel drivers that were still missing it
* TI AM43xx support
* TI OMAP5 support

----------------------------------------------------------------
Archit Taneja (4):
      omapdss: remove check for simpler port/endpoint binding
      OMAPDSS: HDMI: support larger register offsets for OMAP5 HDMI core
      OMAPDSS: HDMI: PHY changes for OMAP5
      OMAPDSS: HDMI: PLL changes for OMAP5

Arnd Bergmann (1):
      video: omap2dss: fix LPAE warnings

Fabian Frederick (1):
      OMAPDSS: add __exit to dss_uninit_ports

Jyri Sarha (1):
      OMAPDSS: hdmi5_core: Fix compilation with OMAP5_DSS_HDMI_AUDIO

Marek Belisko (2):
      omapdss: panel-tpo-td028ec1: Add DT support.
      omapdss: panel-tpo-td028ec1: Add module alias

Sathya Prakash M R (1):
      OMAPDSS: Add DSS features for AM43xx

Tomi Valkeinen (33):
      OMAPDSS: panel-dpi: use gpiod for enable gpio
      OMAPDSS: panel-dpi: Add DT support
      Doc/DT: Add DT binding documentation for MIPI DPI Panel
      OMAPDSS: connector-hdmi: hpd support
      Doc/DT: hdmi-connector: add HPD GPIO documentation
      OMAPDSS: HDMI: lane config support
      Doc/DT: ti,omap4-dss: hdmi lanes
      OMAPDSS: HDMI4: set regulator voltage to 1.8V
      OMAPDSS: DSI: set regulator voltage to 1.8V
      OMAPDSS: remove venc_panel.c
      OMAPDSS: remove unused macros
      ARM: OMAP: add detection of omap5-dss
      OMAPDSS: DSS & DISPC DT support for OMAP5
      OMAPDSS: features: fix OMAP5 features
      OMAPDSS: DPI: fix LCD3 DSI source
      OMAPDSS: DSI: Add OMAP5 DSI module IDs
      OMAPDSS: HDMI: improve Makefile
      OMAPDSS: HDMI: move irq & phy pwr handling
      OMAPDSS: HDMI: Add OMAP5 HDMI support
      OMAPDSS: HDMI: cleanup ioremaps
      Doc/DT: Add OMAP5 DSS DT bindings
      OMAPDSS: Fix writes to DISPC_POL_FREQ
      OMAPDSS: panel-dpi: enable-gpio
      OMAPDSS: panel-lgphilips-lb035q02: use gpiod for enable gpio
      OMAPDSS: panel-lgphilips-lb035q02: Add DT support
      Doc/DT: Add binding doc for lgphilips,lb035q02.txt
      OMAPDSS: Panel TPO-TD043MTEA1 DT support
      Doc/DT: Add DT binding documentation for TPO td043mtea1 panel
      OMAPDSS: panel NEC-NL8048HL11 DT support
      OMAPDSS: HDMI: cleanup WP ioremaps
      OMAPDSS: HDMI: remove unused defines
      OMAPDSS: HDMI: fix devm_ioremap_resource error checks
      OMAPDSS: move 'compatible' converter to omapdss driver

Tony Lindgren (3):
      OMAPDSS: panel-sharp-ls037v7dw01: update to use gpiod
      OMAPDSS: panel sharp-ls037v7dw01 DT support
      Doc/DT: Add DT binding documentation for SHARP LS037V7DW01

 .../devicetree/bindings/video/hdmi-connector.txt   |   1 +
 .../bindings/video/lgphilips,lb035q02.txt          |  33 +
 .../devicetree/bindings/video/panel-dpi.txt        |  45 +
 .../bindings/video/sharp,ls037v7dw01.txt           |  43 +
 .../devicetree/bindings/video/ti,omap4-dss.txt     |   4 +
 .../devicetree/bindings/video/ti,omap5-dss.txt     |  96 +++
 .../bindings/video/toppoly,td028ttec1.txt          |  30 +
 .../devicetree/bindings/video/tpo,td043mtea1.txt   |  33 +
 arch/arm/mach-omap2/display.c                      |  62 +-
 drivers/video/fbdev/omap2/Makefile                 |   2 +-
 .../fbdev/omap2/displays-new/connector-hdmi.c      |  25 +-
 drivers/video/fbdev/omap2/displays-new/panel-dpi.c |  95 ++-
 .../omap2/displays-new/panel-lgphilips-lb035q02.c  |  77 +-
 .../omap2/displays-new/panel-nec-nl8048hl11.c      |  45 +-
 .../omap2/displays-new/panel-sharp-ls037v7dw01.c   | 210 +++--
 .../omap2/displays-new/panel-tpo-td028ttec1.c      |  33 +-
 .../omap2/displays-new/panel-tpo-td043mtea1.c      |  42 +-
 drivers/video/fbdev/omap2/dss/Kconfig              |  26 +-
 drivers/video/fbdev/omap2/dss/Makefile             |   7 +-
 drivers/video/fbdev/omap2/dss/core.c               |   6 +
 drivers/video/fbdev/omap2/dss/dispc.c              |  22 +-
 drivers/video/fbdev/omap2/dss/dpi.c                |   4 +
 drivers/video/fbdev/omap2/dss/dsi.c                |  18 +
 drivers/video/fbdev/omap2/dss/dss.c                |  20 +-
 drivers/video/fbdev/omap2/dss/dss.h                |   3 +
 drivers/video/fbdev/omap2/dss/dss_features.c       |  70 +-
 drivers/video/fbdev/omap2/dss/hdmi.h               |  17 +-
 drivers/video/fbdev/omap2/dss/hdmi4.c              | 113 ++-
 drivers/video/fbdev/omap2/dss/hdmi4_core.c         |  28 +-
 drivers/video/fbdev/omap2/dss/hdmi5.c              | 829 ++++++++++++++++++
 drivers/video/fbdev/omap2/dss/hdmi5_core.c         | 922 +++++++++++++++++++++
 drivers/video/fbdev/omap2/dss/hdmi5_core.h         | 306 +++++++
 drivers/video/fbdev/omap2/dss/hdmi_common.c        |  41 +
 drivers/video/fbdev/omap2/dss/hdmi_phy.c           | 265 ++++--
 drivers/video/fbdev/omap2/dss/hdmi_pll.c           | 107 ++-
 drivers/video/fbdev/omap2/dss/hdmi_wp.c            |  29 +-
 drivers/video/fbdev/omap2/dss/omapdss-boot-init.c  | 229 +++++
 drivers/video/fbdev/omap2/dss/venc_panel.c         | 232 ------
 include/video/omapdss.h                            |   8 +-
 39 files changed, 3604 insertions(+), 574 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/video/lgphilips,lb035q02.txt
 create mode 100644 Documentation/devicetree/bindings/video/panel-dpi.txt
 create mode 100644 Documentation/devicetree/bindings/video/sharp,ls037v7dw01.txt
 create mode 100644 Documentation/devicetree/bindings/video/ti,omap5-dss.txt
 create mode 100644 Documentation/devicetree/bindings/video/toppoly,td028ttec1.txt
 create mode 100644 Documentation/devicetree/bindings/video/tpo,td043mtea1.txt
 create mode 100644 drivers/video/fbdev/omap2/dss/hdmi5.c
 create mode 100644 drivers/video/fbdev/omap2/dss/hdmi5_core.c
 create mode 100644 drivers/video/fbdev/omap2/dss/hdmi5_core.h
 create mode 100644 drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
 delete mode 100644 drivers/video/fbdev/omap2/dss/venc_panel.c


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH 0/10] use safer test on the result of find_first_zero_bit
From: Julia Lawall @ 2014-06-04 13:12 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Julia Lawall, David Laight, linux-rdma,
	kernel-janitors@vger.kernel.org, Linux Fbdev development list,
	Linux-sh list, linux-kernel@vger.kernel.org,
	ath10k@lists.infradead.org, linux-wireless,
	netdev@vger.kernel.org, driverdevel, iss_storagedev@hp.com, scsi,
	linux-s390, adi-buildroot-devel@lists.sourceforge.net,
	Arnd Bergmann, sebott
In-Reply-To: <CAMuHMdV2wP43Lxf-UtCum37HyMPSboRb6RLNTHzm_ZNOBeJR0g@mail.gmail.com>



On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:

> Hi Julia,
>
> On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > OK, thanks.  I was only looking at the C code.
> >
> > But the C code contains a loop that is followed by:
> >
> >         if (!size)
> >                 return result;
> >         tmp = *p;
> >
> > found_first:
> >         tmp |= ~0UL << size;
> >         if (tmp = ~0UL)        /* Are any bits zero? */
> >                 return result + size;   /* Nope. */
> >
> > In the first return, it would seem that result = size.  Could the second
> > one be changed to just return size?  It should not hurt performance.
>
> "size" may have been changed between function entry and this line.
> So you have to store it in a temporary.

Sorry, after reflection it seems that indeed size + result is always the
original size, so it is actually all of the code that uses >= that is
doing something unnecessary.  = for the failure test is fine.

julia

^ permalink raw reply

* Re: [PATCH] drm/i915: Kick out vga console
From: David Herrmann @ 2014-06-04 13:18 UTC (permalink / raw)
  To: Jani Nikula
  Cc: linux-fbdev@vger.kernel.org, Daniel Vetter,
	Intel Graphics Development, DRI Development, Tomi Valkeinen,
	Jean-Christophe Plagniol-Villard
In-Reply-To: <87sinkeuiu.fsf@intel.com>

Hi

On Wed, Jun 4, 2014 at 2:20 PM, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Wed, 04 Jun 2014, David Herrmann <dh.herrmann@gmail.com> wrote:
>> You rely on compiler-optimizations here. "dummy_con" is not available
>> if !CONFIG_DUMMY_CONSOLE, but you use it. This causes linker-failure
>> if dead-code elimination is not done (-O0).
>
> Nested #ifs too. How about
>
> #if !defined(CONFIG_VGA_CONSOLE)
> static inline int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> {
>         return 0;
> }
> #elif !defined(CONFIG_DUMMY_CONSOLE)
> static inline int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> {
>         return -ENODEV;
> }
> #else
> static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> {
>         /* ... */
> }
> #endif
>
> in proper kernel style?

Or even shorter:

#if defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_DUMMY_CONSOLE)
static inline int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
{
        ...
}
#else
static inline int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
{
        return IS_ENABLED(CONFIG_VGA_CONSOLE) ? -ENODEV : 0;
}
#endif

Thanks
David

On Wed, Jun 4, 2014 at 2:20 PM, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Wed, 04 Jun 2014, David Herrmann <dh.herrmann@gmail.com> wrote:
>> Hi
>>
>> On Wed, Jun 4, 2014 at 12:57 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>>> From: Chris Wilson <chris@chris-wilson.co.uk>
>>>
>>> Touching the VGA resources on an IVB EFI machine causes hard hangs when
>>> we then kick out the efifb. Ouch.
>>>
>>> Apparently this also prevents unclaimed register errors on hsw and
>>> hard machine hangs on my i855gm when trying to unbind fbcon.
>>>
>>> Also, we want this to make I915_FBDEV=n safe.
>>>
>>> v2: Rebase and pimp commit message.
>>>
>>> v3: We also need to unregister the vga console, otherwise the unbind
>>> of the fb console before module unload might resurrect it again.
>>>
>>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?idg813
>>> Cc: David Herrmann <dh.herrmann@gmail.com>
>>> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
>>> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
>>> Cc: linux-fbdev@vger.kernel.org
>>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
>>> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>>> ---
>>>  drivers/gpu/drm/i915/i915_dma.c  | 34 +++++++++++++++++++++++++++++++++-
>>>  drivers/video/console/dummycon.c |  1 +
>>>  drivers/video/console/vgacon.c   |  1 +
>>>  3 files changed, 35 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
>>> index b9159ade5e85..a4df80740b37 100644
>>> --- a/drivers/gpu/drm/i915/i915_dma.c
>>> +++ b/drivers/gpu/drm/i915/i915_dma.c
>>> @@ -36,6 +36,8 @@
>>>  #include "i915_drv.h"
>>>  #include "i915_trace.h"
>>>  #include <linux/pci.h>
>>> +#include <linux/console.h>
>>> +#include <linux/vt.h>
>>>  #include <linux/vgaarb.h>
>>>  #include <linux/acpi.h>
>>>  #include <linux/pnp.h>
>>> @@ -1450,6 +1452,29 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
>>>  }
>>>  #endif
>>>
>>> +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
>>> +{
>>> +#if !defined(CONFIG_VGA_CONSOLE)
>>> +       return 0;
>>> +#else
>>> +       int ret;
>>> +
>>> +#if !defined(CONFIG_DUMMY_CONSOLE)
>>> +       return -ENODEV;
>>> +#endif
>>> +
>>> +       DRM_INFO("Replacing VGA console driver\n");
>>> +
>>> +       console_lock();
>>> +       ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
>>
>> You rely on compiler-optimizations here. "dummy_con" is not available
>> if !CONFIG_DUMMY_CONSOLE, but you use it. This causes linker-failure
>> if dead-code elimination is not done (-O0).
>
> Nested #ifs too. How about
>
> #if !defined(CONFIG_VGA_CONSOLE)
> static inline int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> {
>         return 0;
> }
> #elif !defined(CONFIG_DUMMY_CONSOLE)
> static inline int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> {
>         return -ENODEV;
> }
> #else
> static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> {
>         /* ... */
> }
> #endif
>
> in proper kernel style?
>
> BR,
> Jani.
>
>
>>
>> Thanks
>> David
>>
>>> +       if (ret = 0)
>>> +               ret = do_unregister_con_driver(&vga_con);
>>> +       console_unlock();
>>> +
>>> +       return ret;
>>> +#endif
>>> +}
>>> +
>>>  static void i915_dump_device_info(struct drm_i915_private *dev_priv)
>>>  {
>>>         const struct intel_device_info *info = &dev_priv->info;
>>> @@ -1623,8 +1648,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
>>>         if (ret)
>>>                 goto out_regs;
>>>
>>> -       if (drm_core_check_feature(dev, DRIVER_MODESET))
>>> +       if (drm_core_check_feature(dev, DRIVER_MODESET)) {
>>> +               ret = i915_kick_out_vgacon(dev_priv);
>>> +               if (ret) {
>>> +                       DRM_ERROR("failed to remove conflicting VGA console\n");
>>> +                       goto out_gtt;
>>> +               }
>>> +
>>>                 i915_kick_out_firmware_fb(dev_priv);
>>> +       }
>>>
>>>         pci_set_master(dev->pdev);
>>>
>>> diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
>>> index b63860f7beab..40bec8d64b0a 100644
>>> --- a/drivers/video/console/dummycon.c
>>> +++ b/drivers/video/console/dummycon.c
>>> @@ -77,3 +77,4 @@ const struct consw dummy_con = {
>>>      .con_set_palette = DUMMY,
>>>      .con_scrolldelta = DUMMY,
>>>  };
>>> +EXPORT_SYMBOL_GPL(dummy_con);
>>> diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
>>> index 9d8feac67637..84acd6223dc5 100644
>>> --- a/drivers/video/console/vgacon.c
>>> +++ b/drivers/video/console/vgacon.c
>>> @@ -1440,5 +1440,6 @@ const struct consw vga_con = {
>>>         .con_build_attr = vgacon_build_attr,
>>>         .con_invert_region = vgacon_invert_region,
>>>  };
>>> +EXPORT_SYMBOL(vga_con);
>>>
>>>  MODULE_LICENSE("GPL");
>>> --
>>> 1.8.1.4
>>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Jani Nikula, Intel Open Source Technology Center

^ permalink raw reply

* RE: [PATCH 0/10] use safer test on the result of find_first_zero_bit
From: David Laight @ 2014-06-04 13:34 UTC (permalink / raw)
  To: 'Julia Lawall', Geert Uytterhoeven
  Cc: linux-rdma, kernel-janitors@vger.kernel.org,
	Linux Fbdev development list, Linux-sh list,
	linux-kernel@vger.kernel.org, ath10k@lists.infradead.org,
	linux-wireless, netdev@vger.kernel.org, driverdevel,
	iss_storagedev@hp.com, scsi, linux-s390,
	adi-buildroot-devel@lists.sourceforge.net, Arnd Bergmann,
	sebott@linux.vnet.ibm.com
In-Reply-To: <alpine.DEB.2.10.1406041510520.2441@hadrien>

From: Julia Lawall
> On Wed, 4 Jun 2014, Geert Uytterhoeven wrote:
> 
> > Hi Julia,
> >
> > On Wed, Jun 4, 2014 at 1:00 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> > > OK, thanks.  I was only looking at the C code.
> > >
> > > But the C code contains a loop that is followed by:
> > >
> > >         if (!size)
> > >                 return result;
> > >         tmp = *p;
> > >
> > > found_first:
> > >         tmp |= ~0UL << size;
> > >         if (tmp = ~0UL)        /* Are any bits zero? */
> > >                 return result + size;   /* Nope. */
> > >
> > > In the first return, it would seem that result = size.  Could the second
> > > one be changed to just return size?  It should not hurt performance.
> >
> > "size" may have been changed between function entry and this line.
> > So you have to store it in a temporary.
> 
> Sorry, after reflection it seems that indeed size + result is always the
> original size, so it is actually all of the code that uses >= that is
> doing something unnecessary.  = for the failure test is fine.

There is nothing wrong with defensive coding.
The 'tmp |= ~0UL << size' ensures that the return value is 'correct'
when there are no bits set.
The function could have been defined so that this wasn't needed.

If you assume that the 'no zero bits' is unlikely, then checking the
return value from ffz() could well be slightly faster.
Not that anything is likely to notice.

	David




^ permalink raw reply

* [PATCH 5/5] drm/i915: Kick out vga console
From: Daniel Vetter @ 2014-06-05 14:58 UTC (permalink / raw)
  To: Intel Graphics Development
  Cc: linux-fbdev, Daniel Vetter, LKML, DRI Development, Tomi Valkeinen,
	Jean-Christophe Plagniol-Villard
In-Reply-To: <1401980308-5116-1-git-send-email-daniel.vetter@ffwll.ch>

Touching the VGA resources on an IVB EFI machine causes hard hangs when
we then kick out the efifb. Ouch.

Apparently this also prevents unclaimed register errors on hsw and
hard machine hangs on my i855gm when trying to unbind fbcon.

Also, we want this to make I915_FBDEV=n safe.

v2: Rebase and pimp commit message.

v3: We also need to unregister the vga console, otherwise the unbind
of the fb console before module unload might resurrect it again.

v4: Ignore errors when the vga console is already unregistered - this
can happen when e.g. reloading i915.ko.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?idg813
Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: linux-fbdev@vger.kernel.org
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_dma.c  | 43 +++++++++++++++++++++++++++++++++++++++-
 drivers/video/console/dummycon.c |  1 +
 drivers/video/console/vgacon.c   |  1 +
 3 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 27fe65ac5940..bcb66ddd649e 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -36,6 +36,8 @@
 #include "i915_drv.h"
 #include "i915_trace.h"
 #include <linux/pci.h>
+#include <linux/console.h>
+#include <linux/vt.h>
 #include <linux/vgaarb.h>
 #include <linux/acpi.h>
 #include <linux/pnp.h>
@@ -1449,6 +1451,38 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
 }
 #endif
 
+#if !defined(CONFIG_VGA_CONSOLE)
+static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
+{
+	return 0;
+}
+#elif !defined(CONFIG_DUMMY_CONSOLE)
+static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
+{
+	return -ENODEV;
+}
+#else
+static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
+{
+	int ret;
+
+	DRM_INFO("Replacing VGA console driver\n");
+
+	console_lock();
+	ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
+	if (ret = 0) {
+		ret = do_unregister_con_driver(&vga_con);
+
+		/* Ignore "already unregistered". */
+		if (ret = -ENODEV)
+			ret = 0;
+	}
+	console_unlock();
+
+	return ret;
+}
+#endif
+
 static void i915_dump_device_info(struct drm_i915_private *dev_priv)
 {
 	const struct intel_device_info *info = &dev_priv->info;
@@ -1622,8 +1656,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	if (ret)
 		goto out_regs;
 
-	if (drm_core_check_feature(dev, DRIVER_MODESET))
+	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+		ret = i915_kick_out_vgacon(dev_priv);
+		if (ret) {
+			DRM_ERROR("failed to remove conflicting VGA console\n");
+			goto out_gtt;
+		}
+
 		i915_kick_out_firmware_fb(dev_priv);
+	}
 
 	pci_set_master(dev->pdev);
 
diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
index b63860f7beab..40bec8d64b0a 100644
--- a/drivers/video/console/dummycon.c
+++ b/drivers/video/console/dummycon.c
@@ -77,3 +77,4 @@ const struct consw dummy_con = {
     .con_set_palette =	DUMMY,
     .con_scrolldelta =	DUMMY,
 };
+EXPORT_SYMBOL_GPL(dummy_con);
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 9d8feac67637..84acd6223dc5 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -1440,5 +1440,6 @@ const struct consw vga_con = {
 	.con_build_attr = vgacon_build_attr,
 	.con_invert_region = vgacon_invert_region,
 };
+EXPORT_SYMBOL(vga_con);
 
 MODULE_LICENSE("GPL");
-- 
1.8.1.4


^ permalink raw reply related

* Re: [PATCH 5/5] drm/i915: Kick out vga console
From: David Herrmann @ 2014-06-06  7:28 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: linux-fbdev@vger.kernel.org, Intel Graphics Development, LKML,
	DRI Development, Tomi Valkeinen, Jean-Christophe Plagniol-Villard
In-Reply-To: <1401980308-5116-5-git-send-email-daniel.vetter@ffwll.ch>

Hi

On Thu, Jun 5, 2014 at 4:58 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Touching the VGA resources on an IVB EFI machine causes hard hangs when
> we then kick out the efifb. Ouch.
>
> Apparently this also prevents unclaimed register errors on hsw and
> hard machine hangs on my i855gm when trying to unbind fbcon.
>
> Also, we want this to make I915_FBDEV=n safe.
>
> v2: Rebase and pimp commit message.
>
> v3: We also need to unregister the vga console, otherwise the unbind
> of the fb console before module unload might resurrect it again.
>
> v4: Ignore errors when the vga console is already unregistered - this
> can happen when e.g. reloading i915.ko.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?idg813
> Cc: David Herrmann <dh.herrmann@gmail.com>
> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: linux-fbdev@vger.kernel.org
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_dma.c  | 43 +++++++++++++++++++++++++++++++++++++++-
>  drivers/video/console/dummycon.c |  1 +
>  drivers/video/console/vgacon.c   |  1 +
>  3 files changed, 44 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 27fe65ac5940..bcb66ddd649e 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -36,6 +36,8 @@
>  #include "i915_drv.h"
>  #include "i915_trace.h"
>  #include <linux/pci.h>
> +#include <linux/console.h>
> +#include <linux/vt.h>
>  #include <linux/vgaarb.h>
>  #include <linux/acpi.h>
>  #include <linux/pnp.h>
> @@ -1449,6 +1451,38 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
>  }
>  #endif
>
> +#if !defined(CONFIG_VGA_CONSOLE)
> +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> +{
> +       return 0;
> +}
> +#elif !defined(CONFIG_DUMMY_CONSOLE)

Why not "select DUMMY_CONSOLE if VT"? It's really stupid to disable
DUMMY_CONSOLE.. Furthermore, we already rely on HW_CONSOLE_BINDING so
this should be safe.

Patch looks good to me:

Reviewed-by: David Herrmann <dh.herrmann@gmail.com>

Thanks
David

> +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> +{
> +       return -ENODEV;
> +}
> +#else
> +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> +{
> +       int ret;
> +
> +       DRM_INFO("Replacing VGA console driver\n");
> +
> +       console_lock();
> +       ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> +       if (ret = 0) {
> +               ret = do_unregister_con_driver(&vga_con);
> +
> +               /* Ignore "already unregistered". */
> +               if (ret = -ENODEV)
> +                       ret = 0;
> +       }
> +       console_unlock();
> +
> +       return ret;
> +}
> +#endif
> +
>  static void i915_dump_device_info(struct drm_i915_private *dev_priv)
>  {
>         const struct intel_device_info *info = &dev_priv->info;
> @@ -1622,8 +1656,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
>         if (ret)
>                 goto out_regs;
>
> -       if (drm_core_check_feature(dev, DRIVER_MODESET))
> +       if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> +               ret = i915_kick_out_vgacon(dev_priv);
> +               if (ret) {
> +                       DRM_ERROR("failed to remove conflicting VGA console\n");
> +                       goto out_gtt;
> +               }
> +
>                 i915_kick_out_firmware_fb(dev_priv);
> +       }
>
>         pci_set_master(dev->pdev);
>
> diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
> index b63860f7beab..40bec8d64b0a 100644
> --- a/drivers/video/console/dummycon.c
> +++ b/drivers/video/console/dummycon.c
> @@ -77,3 +77,4 @@ const struct consw dummy_con = {
>      .con_set_palette = DUMMY,
>      .con_scrolldelta = DUMMY,
>  };
> +EXPORT_SYMBOL_GPL(dummy_con);
> diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
> index 9d8feac67637..84acd6223dc5 100644
> --- a/drivers/video/console/vgacon.c
> +++ b/drivers/video/console/vgacon.c
> @@ -1440,5 +1440,6 @@ const struct consw vga_con = {
>         .con_build_attr = vgacon_build_attr,
>         .con_invert_region = vgacon_invert_region,
>  };
> +EXPORT_SYMBOL(vga_con);
>
>  MODULE_LICENSE("GPL");
> --
> 1.8.1.4
>

^ permalink raw reply

* Re: [PATCH 5/5] drm/i915: Kick out vga console
From: Daniel Vetter @ 2014-06-06  7:47 UTC (permalink / raw)
  To: David Herrmann
  Cc: linux-fbdev@vger.kernel.org, Daniel Vetter,
	Intel Graphics Development, LKML, DRI Development, Tomi Valkeinen,
	Jean-Christophe Plagniol-Villard
In-Reply-To: <CANq1E4Si5+DVVz5xUcp0FXaX2rSH0XJTCa_TBD5PtRs0cJwo0A@mail.gmail.com>

On Fri, Jun 06, 2014 at 09:28:03AM +0200, David Herrmann wrote:
> Hi
> 
> On Thu, Jun 5, 2014 at 4:58 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > Touching the VGA resources on an IVB EFI machine causes hard hangs when
> > we then kick out the efifb. Ouch.
> >
> > Apparently this also prevents unclaimed register errors on hsw and
> > hard machine hangs on my i855gm when trying to unbind fbcon.
> >
> > Also, we want this to make I915_FBDEV=n safe.
> >
> > v2: Rebase and pimp commit message.
> >
> > v3: We also need to unregister the vga console, otherwise the unbind
> > of the fb console before module unload might resurrect it again.
> >
> > v4: Ignore errors when the vga console is already unregistered - this
> > can happen when e.g. reloading i915.ko.
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?idg813
> > Cc: David Herrmann <dh.herrmann@gmail.com>
> > Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
> > Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > Cc: linux-fbdev@vger.kernel.org
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > ---
> >  drivers/gpu/drm/i915/i915_dma.c  | 43 +++++++++++++++++++++++++++++++++++++++-
> >  drivers/video/console/dummycon.c |  1 +
> >  drivers/video/console/vgacon.c   |  1 +
> >  3 files changed, 44 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> > index 27fe65ac5940..bcb66ddd649e 100644
> > --- a/drivers/gpu/drm/i915/i915_dma.c
> > +++ b/drivers/gpu/drm/i915/i915_dma.c
> > @@ -36,6 +36,8 @@
> >  #include "i915_drv.h"
> >  #include "i915_trace.h"
> >  #include <linux/pci.h>
> > +#include <linux/console.h>
> > +#include <linux/vt.h>
> >  #include <linux/vgaarb.h>
> >  #include <linux/acpi.h>
> >  #include <linux/pnp.h>
> > @@ -1449,6 +1451,38 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
> >  }
> >  #endif
> >
> > +#if !defined(CONFIG_VGA_CONSOLE)
> > +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> > +{
> > +       return 0;
> > +}
> > +#elif !defined(CONFIG_DUMMY_CONSOLE)
> 
> Why not "select DUMMY_CONSOLE if VT"? It's really stupid to disable
> DUMMY_CONSOLE.. Furthermore, we already rely on HW_CONSOLE_BINDING so
> this should be safe.

Iirc this lead kconfig to complain about dep loops ... And I've tried to
figure it out, but I think it's actually impossible. So I let it be with
the -ENODEV to make sure if it's not impossible any more we'll catch it.
-Daniel

> 
> Patch looks good to me:
> 
> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
> 
> Thanks
> David
> 
> > +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> > +{
> > +       return -ENODEV;
> > +}
> > +#else
> > +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> > +{
> > +       int ret;
> > +
> > +       DRM_INFO("Replacing VGA console driver\n");
> > +
> > +       console_lock();
> > +       ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> > +       if (ret = 0) {
> > +               ret = do_unregister_con_driver(&vga_con);
> > +
> > +               /* Ignore "already unregistered". */
> > +               if (ret = -ENODEV)
> > +                       ret = 0;
> > +       }
> > +       console_unlock();
> > +
> > +       return ret;
> > +}
> > +#endif
> > +
> >  static void i915_dump_device_info(struct drm_i915_private *dev_priv)
> >  {
> >         const struct intel_device_info *info = &dev_priv->info;
> > @@ -1622,8 +1656,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
> >         if (ret)
> >                 goto out_regs;
> >
> > -       if (drm_core_check_feature(dev, DRIVER_MODESET))
> > +       if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> > +               ret = i915_kick_out_vgacon(dev_priv);
> > +               if (ret) {
> > +                       DRM_ERROR("failed to remove conflicting VGA console\n");
> > +                       goto out_gtt;
> > +               }
> > +
> >                 i915_kick_out_firmware_fb(dev_priv);
> > +       }
> >
> >         pci_set_master(dev->pdev);
> >
> > diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
> > index b63860f7beab..40bec8d64b0a 100644
> > --- a/drivers/video/console/dummycon.c
> > +++ b/drivers/video/console/dummycon.c
> > @@ -77,3 +77,4 @@ const struct consw dummy_con = {
> >      .con_set_palette = DUMMY,
> >      .con_scrolldelta = DUMMY,
> >  };
> > +EXPORT_SYMBOL_GPL(dummy_con);
> > diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
> > index 9d8feac67637..84acd6223dc5 100644
> > --- a/drivers/video/console/vgacon.c
> > +++ b/drivers/video/console/vgacon.c
> > @@ -1440,5 +1440,6 @@ const struct consw vga_con = {
> >         .con_build_attr = vgacon_build_attr,
> >         .con_invert_region = vgacon_invert_region,
> >  };
> > +EXPORT_SYMBOL(vga_con);
> >
> >  MODULE_LICENSE("GPL");
> > --
> > 1.8.1.4
> >

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply

* [PATCH] pwm-backlight:
From: Lothar Waßmann @ 2014-06-06 11:02 UTC (permalink / raw)
  To: Bryan Wu, Jean-Christophe Plagniol-Villard, Jingoo Han, Lee Jones,
	Thierry Reding, Tomi Valkeinen, linux-fbdev, linux-kernel,
	linux-pwm
  Cc: Lothar Waßmann

commit 257462dbf3ed pwm-backlight: switch to gpiod interface
introduced a regression leading to acquiring a bogus GPIO-0 when
configured from DT without an 'enable-gpios' property.
The driver will happily accept the 0 initialized 'enable_gpio' member
of the struct platform_pwm_backlight_data as valid gpio number, and
request this GPIO as enable pin. In case of multiple driver instances,
the second will fail to register with the error message:
pwm-backlight backlight1.23: failed to request GPIO#0: -16

Fix this by setting enable_gpio in the pdata struct to -EINVAL.

Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
---
 drivers/video/backlight/pwm_bl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 38ca88b..3d265c4 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -178,7 +178,7 @@ static int pwm_backlight_parse_dt(struct device *dev,
 		data->dft_brightness = value;
 		data->max_brightness--;
 	}
-
+	data->enable_gpio = -EINVAL;
 	return 0;
 }
 
-- 
1.7.10.4


^ permalink raw reply related

* Re: [PATCH] pwm-backlight:
From: Lee Jones @ 2014-06-06 12:42 UTC (permalink / raw)
  To: Lothar Waßmann
  Cc: Bryan Wu, Jean-Christophe Plagniol-Villard, Jingoo Han,
	Thierry Reding, Tomi Valkeinen, linux-fbdev, linux-kernel,
	linux-pwm
In-Reply-To: <1402052529-22761-1-git-send-email-LW@KARO-electronics.de>

On Fri, 06 Jun 2014, Lothar Waßmann wrote:

> commit 257462dbf3ed pwm-backlight: switch to gpiod interface
> introduced a regression leading to acquiring a bogus GPIO-0 when
> configured from DT without an 'enable-gpios' property.
> The driver will happily accept the 0 initialized 'enable_gpio' member
> of the struct platform_pwm_backlight_data as valid gpio number, and
> request this GPIO as enable pin. In case of multiple driver instances,
> the second will fail to register with the error message:
> pwm-backlight backlight1.23: failed to request GPIO#0: -16
> 
> Fix this by setting enable_gpio in the pdata struct to -EINVAL.
> 
> Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
> ---
>  drivers/video/backlight/pwm_bl.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index 38ca88b..3d265c4 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -178,7 +178,7 @@ static int pwm_backlight_parse_dt(struct device *dev,
>  		data->dft_brightness = value;
>  		data->max_brightness--;
>  	}
> -
> +	data->enable_gpio = -EINVAL;
>  	return 0;
>  }

This patch doesn't look like it will apply.  I suggest you pull
v3.17-rc1 when it lands and rebase your patch.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply

* Re: [PATCH 5/5] drm/i915: Kick out vga console
From: Daniel Vetter @ 2014-06-06 15:20 UTC (permalink / raw)
  To: Intel Graphics Development
  Cc: Linux Fbdev development list, Daniel Vetter, LKML,
	DRI Development, Tomi Valkeinen, David Herrmann,
	Jean-Christophe Plagniol-Villard
In-Reply-To: <1401980308-5116-5-git-send-email-daniel.vetter@ffwll.ch>

Tomi/Jean can you please ack merging this through drm-intel trees? It
just exports the vga and dummy consoles so that i915 can do what it
needs to do.

Thanks, Daniel

On Thu, Jun 5, 2014 at 4:58 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Touching the VGA resources on an IVB EFI machine causes hard hangs when
> we then kick out the efifb. Ouch.
>
> Apparently this also prevents unclaimed register errors on hsw and
> hard machine hangs on my i855gm when trying to unbind fbcon.
>
> Also, we want this to make I915_FBDEV=n safe.
>
> v2: Rebase and pimp commit message.
>
> v3: We also need to unregister the vga console, otherwise the unbind
> of the fb console before module unload might resurrect it again.
>
> v4: Ignore errors when the vga console is already unregistered - this
> can happen when e.g. reloading i915.ko.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?idg813
> Cc: David Herrmann <dh.herrmann@gmail.com>
> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: linux-fbdev@vger.kernel.org
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_dma.c  | 43 +++++++++++++++++++++++++++++++++++++++-
>  drivers/video/console/dummycon.c |  1 +
>  drivers/video/console/vgacon.c   |  1 +
>  3 files changed, 44 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
> index 27fe65ac5940..bcb66ddd649e 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -36,6 +36,8 @@
>  #include "i915_drv.h"
>  #include "i915_trace.h"
>  #include <linux/pci.h>
> +#include <linux/console.h>
> +#include <linux/vt.h>
>  #include <linux/vgaarb.h>
>  #include <linux/acpi.h>
>  #include <linux/pnp.h>
> @@ -1449,6 +1451,38 @@ static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
>  }
>  #endif
>
> +#if !defined(CONFIG_VGA_CONSOLE)
> +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> +{
> +       return 0;
> +}
> +#elif !defined(CONFIG_DUMMY_CONSOLE)
> +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> +{
> +       return -ENODEV;
> +}
> +#else
> +static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
> +{
> +       int ret;
> +
> +       DRM_INFO("Replacing VGA console driver\n");
> +
> +       console_lock();
> +       ret = do_take_over_console(&dummy_con, 0, MAX_NR_CONSOLES - 1, 1);
> +       if (ret = 0) {
> +               ret = do_unregister_con_driver(&vga_con);
> +
> +               /* Ignore "already unregistered". */
> +               if (ret = -ENODEV)
> +                       ret = 0;
> +       }
> +       console_unlock();
> +
> +       return ret;
> +}
> +#endif
> +
>  static void i915_dump_device_info(struct drm_i915_private *dev_priv)
>  {
>         const struct intel_device_info *info = &dev_priv->info;
> @@ -1622,8 +1656,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
>         if (ret)
>                 goto out_regs;
>
> -       if (drm_core_check_feature(dev, DRIVER_MODESET))
> +       if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> +               ret = i915_kick_out_vgacon(dev_priv);
> +               if (ret) {
> +                       DRM_ERROR("failed to remove conflicting VGA console\n");
> +                       goto out_gtt;
> +               }
> +
>                 i915_kick_out_firmware_fb(dev_priv);
> +       }
>
>         pci_set_master(dev->pdev);
>
> diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
> index b63860f7beab..40bec8d64b0a 100644
> --- a/drivers/video/console/dummycon.c
> +++ b/drivers/video/console/dummycon.c
> @@ -77,3 +77,4 @@ const struct consw dummy_con = {
>      .con_set_palette = DUMMY,
>      .con_scrolldelta = DUMMY,
>  };
> +EXPORT_SYMBOL_GPL(dummy_con);
> diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
> index 9d8feac67637..84acd6223dc5 100644
> --- a/drivers/video/console/vgacon.c
> +++ b/drivers/video/console/vgacon.c
> @@ -1440,5 +1440,6 @@ const struct consw vga_con = {
>         .con_build_attr = vgacon_build_attr,
>         .con_invert_region = vgacon_invert_region,
>  };
> +EXPORT_SYMBOL(vga_con);
>
>  MODULE_LICENSE("GPL");
> --
> 1.8.1.4
>



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply

* Re: [PATCH 5/5] drm/i915: Kick out vga console
From: Tomi Valkeinen @ 2014-06-09 13:22 UTC (permalink / raw)
  To: Daniel Vetter, Intel Graphics Development
  Cc: Linux Fbdev development list, LKML, DRI Development,
	David Herrmann, Jean-Christophe Plagniol-Villard
In-Reply-To: <CAKMK7uH7GWspr03NBi7rVY+2UN-vdthMV7eixXA-xc3t2JdzPg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 273 bytes --]

Hi,

On 06/06/14 18:20, Daniel Vetter wrote:
> Tomi/Jean can you please ack merging this through drm-intel trees? It
> just exports the vga and dummy consoles so that i915 can do what it
> needs to do.

Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* re: OMAPDSS: panel sharp-ls037v7dw01 DT support
From: Dan Carpenter @ 2014-06-10  9:04 UTC (permalink / raw)
  To: linux-fbdev

Hello Tony Lindgren,

This is a semi-automatic email about new static checker warnings.

The patch be88c16a22ed: "OMAPDSS: panel sharp-ls037v7dw01 DT support"
from May 16, 2014, leads to the following Smatch complaint:

drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c:113 sharp_ls_enable()
	 error: we previously assumed 'ddata->vcc' could be null (see line 105)

drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c
   104	
   105		if (ddata->vcc) {
                    ^^^^^^^^^^
Patch introduces a check.

   106			r = regulator_enable(ddata->vcc);
   107			if (r != 0)
   108				return r;
   109		}
   110	
   111		r = in->ops.dpi->enable(in);
   112		if (r) {
   113			regulator_disable(ddata->vcc);
                                          ^^^^^^^^^^
Patch introduces a new dereference and I was too lazy to find out if
an error in ->enable() implies a non-null "ddata->vcc" because I am a
bad person.

   114			return r;
   115		}

regards,
dan carpenter

^ permalink raw reply

* Re: [PATCH v7][ 3/5] video: mx3fb: Introduce regulator support.
From: Denis Carikli @ 2014-06-10 13:29 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20140317062026.GZ17250@pengutronix.de>

On 03/17/2014 07:20 AM, Sascha Hauer wrote:
> On Fri, Mar 14, 2014 at 10:12:47AM +0100, Denis Carikli wrote:
>>
>> +		of_property_read_string(display_np, "regulator-name",
>> +					&regulator_name);
>> +
>
> [...]
>
>> +	/* In dt mode,
>> +	 * using devm_regulator_get would require that the proprety referencing
>> +	 * the regulator phandle has to be inside the mx3fb node.
>> +	 */
>> +	if (np) {
>> +		if (regulator_name)
>> +			mx3fbi->reg_lcd = regulator_get(NULL, regulator_name);
>> +
>> +		if (IS_ERR(mx3fbi->reg_lcd))
>> +			return PTR_ERR(mx3fbi->reg_lcd);
>> +	} else {
>> +		/* Permit that driver without a regulator in non-dt mode */
>> +		mx3fbi->reg_lcd = regulator_get(dev, "lcd");
>> +	}
>
> This patch adds regulator support for the display of a i.MX3 IPU. The
> problem Denis has to solve here is that he needs to get the regulator,
> but the display devicenode doesn't have a struct device associated with
> it, so he cannot provide one to regulator_get(). One way out here could
> be a of_regulator_get(struct device_node *). Mark, would this be ok with
> you?

Here, the display devicenode has no struct device associated with it 
like mentioned above.
Because of that, retriving the regulator from the devicetree, for 
instance like regulator_dev_lookup() does, would require a different 
approach.

As I understand it, what happen in regulator_dev_lookup when 
regulator_get(NULL, regulator_name) is used is the following:

Since the struct device is NULL, it skips the struct device based 
lookup, but also the devicetree lookup (it uses dev->of_node for that)
At the end it falls back on a match on the regulator name to find it.

would keeping regulator_get(NULL, regulator_name); in the driver instead 
be better for now?

Denis.

^ permalink raw reply

* re: OMAPDSS: move 'compatible' converter to omapdss driver
From: Dan Carpenter @ 2014-06-10 19:00 UTC (permalink / raw)
  To: linux-fbdev

Hello Tomi Valkeinen,

The patch f2dd36ac9974: "OMAPDSS: move 'compatible' converter to
omapdss driver" from May 15, 2014, leads to the following static
checker warning:

	drivers/video/fbdev/omap2/dss/omapdss-boot-init.c:124 omapdss_add_to_list()
	error: potential null dereference 'n'. (kmalloc returns null)

drivers/video/fbdev/omap2/dss/omapdss-boot-init.c
   120  static void __init omapdss_add_to_list(struct device_node *node, bool root)
   121  {
   122          struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node),
   123                  GFP_KERNEL);
   124          n->node = node;
   125          n->root = root;
   126          list_add(&n->list, &dss_conv_list);
   127  }
   128  

regards,
dan carpenter

^ permalink raw reply

* [patch] video/mbx: indent some if statements
From: Dan Carpenter @ 2014-06-11  6:45 UTC (permalink / raw)
  To: linux-fbdev

Checkpatch.pl worries that we have left off the conditional bit because
it isn't indented correctly.

WARNING: suspect code indent for conditional statements (24, 24)

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/video/fbdev/mbx/mbxfb.c b/drivers/video/fbdev/mbx/mbxfb.c
index 2bd52ed..698df954 100644
--- a/drivers/video/fbdev/mbx/mbxfb.c
+++ b/drivers/video/fbdev/mbx/mbxfb.c
@@ -628,14 +628,14 @@ static int mbxfb_ioctl(struct fb_info *info, unsigned int cmd,
 		case MBXFB_IOCS_PLANEORDER:
 			if (copy_from_user(&porder, (void __user*)arg,
 					sizeof(struct mbxfb_planeorder)))
-			return -EFAULT;
+				return -EFAULT;
 
 			return mbxfb_ioctl_planeorder(&porder);
 
 		case MBXFB_IOCS_ALPHA:
 			if (copy_from_user(&alpha, (void __user*)arg,
 					sizeof(struct mbxfb_alphaCtl)))
-			return -EFAULT;
+				return -EFAULT;
 
 			return mbxfb_ioctl_alphactl(&alpha);
 

^ permalink raw reply related

* [PATCH] video: OF display-timings support for ocfb
From: Franck Jullien @ 2014-06-11 20:17 UTC (permalink / raw)
  To: linux-kernel, linux-fbdev
  Cc: tomi.valkeinen, plagnioj, stefan.kristiansson, Franck Jullien

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
---
 drivers/video/fbdev/Kconfig |    2 ++
 drivers/video/fbdev/ocfb.c  |   31 ++++++++++++++++++++++++++-----
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index e1f4727..b4ac6bb 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -942,6 +942,8 @@ config FB_OPENCORES
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
+	select VIDEOMODE_HELPERS
+	select FB_MODE_HELPERS
 	help
 	  This enables support for the OpenCores VGA/LCD core.
 
diff --git a/drivers/video/fbdev/ocfb.c b/drivers/video/fbdev/ocfb.c
index 7f9dc9b..6d15565 100644
--- a/drivers/video/fbdev/ocfb.c
+++ b/drivers/video/fbdev/ocfb.c
@@ -22,6 +22,8 @@
 #include <linux/string.h>
 #include <linux/slab.h>
 
+#include <video/of_display_timing.h>
+
 /* OCFB register defines */
 #define OCFB_CTRL	0x000
 #define OCFB_STAT	0x004
@@ -310,11 +312,30 @@ static int ocfb_probe(struct platform_device *pdev)
 	fbdev->info.device = &pdev->dev;
 	fbdev->info.par = fbdev;
 
-	/* Video mode setup */
-	if (!fb_find_mode(&fbdev->info.var, &fbdev->info, mode_option,
-			  NULL, 0, &default_mode, 16)) {
-		dev_err(&pdev->dev, "No valid video modes found\n");
-		return -EINVAL;
+	if (!mode_option && IS_ENABLED(CONFIG_OF)) {
+		struct fb_videomode mode;
+		u32 bpp;
+
+		ret = of_get_fb_videomode(pdev->dev.of_node, &mode,
+					  OF_USE_NATIVE_MODE);
+		if (ret)
+			return ret;
+
+		fb_videomode_to_var(&fbdev->info.var, &mode);
+
+		ret = of_property_read_u32(pdev->dev.of_node, "bits-per-pixel",
+					   &bpp);
+		if (ret)
+			return ret;
+
+		fbdev->info.var.bits_per_pixel = bpp;
+
+	} else {
+		if (!fb_find_mode(&fbdev->info.var, &fbdev->info, mode_option,
+				  NULL, 0, &default_mode, 16)) {
+			dev_err(&pdev->dev, "No valid video modes found\n");
+			return -EINVAL;
+		}
 	}
 	ocfb_init_var(fbdev);
 	ocfb_init_fix(fbdev);
-- 
1.7.1


^ permalink raw reply related

* [PATCH] video: fbdev: broadsheetfb.c: fix memory leak on sector_buffer
From: Colin King @ 2014-06-12 10:18 UTC (permalink / raw)
  To: linux-fbdev

From: Colin Ian King <colin.king@canonical.com>

static code analysis from cppcheck reports:

[drivers/video/fbdev/broadsheetfb.c:673]:
  (error) Memory leak: sector_buffer

sector_buffer is not being kfree'd on each call to
broadsheet_spiflash_rewrite_sector(), so free it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/video/fbdev/broadsheetfb.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/broadsheetfb.c b/drivers/video/fbdev/broadsheetfb.c
index 8556264..235542f 100644
--- a/drivers/video/fbdev/broadsheetfb.c
+++ b/drivers/video/fbdev/broadsheetfb.c
@@ -636,7 +636,7 @@ static int broadsheet_spiflash_rewrite_sector(struct broadsheetfb_par *par,
 		err = broadsheet_spiflash_read_range(par, start_sector_addr,
 						data_start_addr, sector_buffer);
 		if (err)
-			return err;
+			goto out;
 	}
 
 	/* now we copy our data into the right place in the sector buffer */
@@ -657,7 +657,7 @@ static int broadsheet_spiflash_rewrite_sector(struct broadsheetfb_par *par,
 		err = broadsheet_spiflash_read_range(par, tail_start_addr,
 			tail_len, sector_buffer + tail_start_addr);
 		if (err)
-			return err;
+			goto out;
 	}
 
 	/* if we got here we have the full sector that we want to rewrite. */
@@ -665,11 +665,13 @@ static int broadsheet_spiflash_rewrite_sector(struct broadsheetfb_par *par,
 	/* first erase the sector */
 	err = broadsheet_spiflash_erase_sector(par, start_sector_addr);
 	if (err)
-		return err;
+		goto out;
 
 	/* now write it */
 	err = broadsheet_spiflash_write_sector(par, start_sector_addr,
 					sector_buffer, sector_size);
+out:
+	kfree(sector_buffer);
 	return err;
 }
 
-- 
2.0.0


^ permalink raw reply related

* console / fbdev: fbcon support for bits_per_pixel = 1?
From: Stefan Biereigel @ 2014-06-14  9:55 UTC (permalink / raw)
  To: linux-kernel@vger.kernel org; +Cc: linux-fbdev, linux-console, brian

CC: linux-console, linux-fbdev

Hello Kernel Developers,
for a university assignment we are developing a frame buffer driver for a monochrome
display. We succeeded so far in making a simple "RAM frame buffer" module, which is needed
as the basis (we don't have read access to the RAM in the LCD).
We are using the system-default fb_ops (fb_sys_{read,write},
sys_{fillrect,copyarea,imageblit), and all is well when we use bits_per_pixel = 8. When we
map a console to the RAM frame buffer (con2fbmap 1 1), do strg-alt-F1, type some
characters there, we can then 'cat /dev/fb1' and plot the ram contents in Matlab
(reshaping the data to be our display geometry first), where our typed characters and the
console appear.

If we however change bits_per_pixel to 1, and divide line_length by 8 (as it should
represent the line length in bytes), this suddenly stops working: echo and cat to fb1 work
as intended: We change our Matlab-Script to interpret every byte as 8 pixels, bytes
written into /dev/fb1 can be read out correctly. If we however map the console to fb1, no
console output can be seen in RAM - it is (seemingly) filled with garbage.

We're using fbcon as the console driver, and the first frame buffer for me is intelfb. I
see, that the bitblitting-calls for every typed character are depth 1 and have correct
geometry, but the whole bitblitting-builtin seems not to work for bits_per_pixel = 1, i
tried it with a simple test image after the initialisation...

Is this behavior intended or are we triggering a bug here (that no one noticed, because
who in the world uses monochrome framebuffers these days..). I can't see any comments that
monochrome consoles should not work with 1 bit per pixel. See the code below if you spot
some errors (ignore some missing error handling and mediocre style for now, please).

Thank you for any help and input.
Best regards,
Stefan Biereigel

8<--- testfb.c

#include <linux/init.h>
#include <linux/module.h>

#include <linux/fb.h>
#include <linux/slab.h>
#include <linux/wait.h>
#include <linux/errno.h>
#include <linux/platform_device.h>

#define DISPLAY_WIDTH	240
#define DISPLAY_HEIGHT	64
#define FB_MEM_SIZE 	(DISPLAY_WIDTH * DISPLAY_HEIGHT)/8

static struct platform_device *testfb_device;

static struct fb_ops fbops = {
	.owner		= THIS_MODULE,
	.fb_fillrect	= sys_fillrect,
	.fb_copyarea	= sys_copyarea,
	.fb_imageblit	= sys_imageblit,
	.fb_read	= fb_sys_read,
	.fb_write	= fb_sys_write,
	.fb_sync	= NULL,
};

static int __init testfb_probe (struct platform_device *pdev) {
	void *fb_mem = NULL;
	struct fb_info *fbinfo = NULL;

	fb_mem = kzalloc(FB_MEM_SIZE, GFP_KERNEL);

	if (!fb_mem) {
		pr_err("testfb: memory allocation for framebuffer failed\n");
		return(-ENOMEM);
	}
	else
		pr_debug("testfb: allocated framebuffer memory successfully\n");

	fbinfo = framebuffer_alloc(0, &pdev->dev);

	if (!fbinfo) {
		pr_err("testfb: framebuffer_alloc() failed\n");
		kfree(fb_mem);
		return(-1);
	}
	else
		pr_debug("testfb: framebuffer_alloc was successful\n");

	fbinfo->fix.smem_start = (unsigned long) fb_mem;
	fbinfo->screen_base = (char __iomem *) fb_mem;
	fbinfo->fix.smem_len = FB_MEM_SIZE;
	fbinfo->fbops = &fbops;

	fbinfo->node			= 0;				/* ?int */
	fbinfo->device			= &pdev->dev;
	fbinfo->flags			= FBINFO_DEFAULT;		/*  */
	fbinfo->var.xres		= DISPLAY_WIDTH;		/* visible resolution */
	fbinfo->var.yres		= DISPLAY_HEIGHT;		/* visible resolution */
	fbinfo->var.xres_virtual	= DISPLAY_WIDTH;		/* virtual resolution */
	fbinfo->var.yres_virtual	= DISPLAY_HEIGHT;		/* virtual resolution */
	fbinfo->var.bits_per_pixel	= 1;				/* bits per pixel */
	fbinfo->var.activate		= FB_ACTIVATE_NOW;		/* set values immediately (or vbl) */
	fbinfo->var.sync		= 0;				/* ?see FB_SYNC_* */
	fbinfo->var.vmode		= FB_VMODE_NONINTERLACED;	/* non interlaced, see FB_VMODE_* */
	fbinfo->var.left_margin 	= 0;
	fbinfo->var.right_margin 	= 0;
	fbinfo->var.upper_margin 	= 0;
	fbinfo->var.lower_margin 	= 0;
	fbinfo->var.red.offset 		= 0;
	fbinfo->var.red.length 		= fbinfo->var.bits_per_pixel;
	fbinfo->var.green 		= fbinfo->var.red;
	fbinfo->var.blue  		= fbinfo->var.red;
	fbinfo->var.grayscale		= 1;
	strcpy(fbinfo->fix.id, "testfb");				/* identifier, 16 byte */
	fbinfo->fix.type		= FB_TYPE_PACKED_PIXELS;	/* pack pixels to avoid overhead */
	fbinfo->fix.visual		= FB_VISUAL_MONO10;		/* Monochr. 1=Black 0=White */
	fbinfo->fix.line_length		= DISPLAY_WIDTH/8;		/* length of a line in bytes */
	fbinfo->fix.accel		= FB_ACCEL_NONE;		/* no hardware accelerator */
	fbinfo->fix.xpanstep 		= 0;
	fbinfo->fix.ypanstep		= 0;
	fbinfo->fix.ywrapstep 		= 0;

	if (register_framebuffer(fbinfo) < 0) {
		pr_err("testfb: registering framebuffer failed\n");
		kfree((void *) fbinfo->fix.smem_start);
		framebuffer_release(fbinfo);
		return(-1);
	}
	else
		pr_debug("testfb: registered framebuffer\n");

	platform_set_drvdata(pdev, fbinfo);

	return 0;
}

static int testfb_remove(struct platform_device *pdev) {
	struct fb_info *fbinfo = NULL;

	fbinfo = platform_get_drvdata(pdev);

	if (!fbinfo) {
		pr_err("testfb: unable to get fbinfo from pdev\n");
		return(-1);
	}

	if (unregister_framebuffer(fbinfo) < 0)
		pr_err("testfb: unregistering framebuffer failed\n");
	else
		pr_debug("testfb: unregistered framebuffer\n");

	kfree((void *) fbinfo->fix.smem_start);

	framebuffer_release(fbinfo);

	return 0;
}

static struct platform_driver testfb_driver = {
	.probe = testfb_probe,
	.remove = testfb_remove,
	.driver = {
		.name = "testfb",
	},
};

static int __init testfb_init(void)
{
	int ret;

	ret = platform_driver_register(&testfb_driver);
	if (!ret) {
		testfb_device = platform_device_register_simple("testfb", 0,
								NULL, 0);

		if (IS_ERR(testfb_device)) {
			platform_driver_unregister(&testfb_driver);
			ret = PTR_ERR(testfb_device);
		} else {
			pr_info("testfb: platform_device registered\n");
		}

	}

	pr_info("testfb: module loaded\n");
	
	return 0;
}

static void __exit testfb_exit(void)
{
	platform_device_unregister(testfb_device);
	platform_driver_unregister(&testfb_driver);

	pr_info("testfb: module unloaded\n");
}

module_init(testfb_init);
module_exit(testfb_exit);

MODULE_LICENSE("GPL v2");
MODULE_ALIAS("testfb");
MODULE_AUTHOR("Brian Fonfara");
MODULE_DESCRIPTION("Ein Modul zum Test der Linux Framebuffer-Programmierung");
MODULE_DESCRIPTION("version 0.1");

^ permalink raw reply

* Re: console / fbdev: fbcon support for bits_per_pixel = 1?
From: Bruno Prémont @ 2014-06-14 12:35 UTC (permalink / raw)
  To: Stefan Biereigel; +Cc: linux-fbdev, linux-kernel, linux-console, brian
In-Reply-To: <539C1C1F.5060904@biereigel.de>

Hi Stefan,

On Sat, 14 June 2014 Stefan Biereigel <stefan@biereigel.de> wrote:
> CC: linux-console, linux-fbdev
> 
> Hello Kernel Developers,
> for a university assignment we are developing a frame buffer driver for a monochrome
> display. We succeeded so far in making a simple "RAM frame buffer" module, which is needed
> as the basis (we don't have read access to the RAM in the LCD).
> We are using the system-default fb_ops (fb_sys_{read,write},
> sys_{fillrect,copyarea,imageblit), and all is well when we use bits_per_pixel = 8. When we
> map a console to the RAM frame buffer (con2fbmap 1 1), do strg-alt-F1, type some
> characters there, we can then 'cat /dev/fb1' and plot the ram contents in Matlab
> (reshaping the data to be our display geometry first), where our typed characters and the
> console appear.
> 
> If we however change bits_per_pixel to 1, and divide line_length by 8 (as it should
> represent the line length in bytes), this suddenly stops working: echo and cat to fb1 work
> as intended: We change our Matlab-Script to interpret every byte as 8 pixels, bytes
> written into /dev/fb1 can be read out correctly. If we however map the console to fb1, no
> console output can be seen in RAM - it is (seemingly) filled with garbage.
> 
> We're using fbcon as the console driver, and the first frame buffer for me is intelfb. I
> see, that the bitblitting-calls for every typed character are depth 1 and have correct
> geometry, but the whole bitblitting-builtin seems not to work for bits_per_pixel = 1, i
> tried it with a simple test image after the initialisation...
> 
> Is this behavior intended or are we triggering a bug here (that no one noticed, because
> who in the world uses monochrome framebuffers these days..). I can't see any comments that
> monochrome consoles should not work with 1 bit per pixel. See the code below if you spot
> some errors (ignore some missing error handling and mediocre style for now, please).

fbcon on 1bpp frambuffer worked for me with picoLCD (though I have found no userspace
framebuffer application willing to operate at 1bpp).
Thus I allow for 1bpp or 8bpp and convert 8bpp to 1bpp for the picolcd. As for your case,
picoLCD is "write-only" monochrome LCD backed by in-RAM shadow framebuffer.

(see drivers/hid/hid-picolcd_fb.c)

Bruno

> Thank you for any help and input.
> Best regards,
> Stefan Biereigel
> 
> 8<--- testfb.c
> 
> #include <linux/init.h>
> #include <linux/module.h>
> 
> #include <linux/fb.h>
> #include <linux/slab.h>
> #include <linux/wait.h>
> #include <linux/errno.h>
> #include <linux/platform_device.h>
> 
> #define DISPLAY_WIDTH	240
> #define DISPLAY_HEIGHT	64
> #define FB_MEM_SIZE 	(DISPLAY_WIDTH * DISPLAY_HEIGHT)/8
> 
> static struct platform_device *testfb_device;
> 
> static struct fb_ops fbops = {
> 	.owner		= THIS_MODULE,
> 	.fb_fillrect	= sys_fillrect,
> 	.fb_copyarea	= sys_copyarea,
> 	.fb_imageblit	= sys_imageblit,
> 	.fb_read	= fb_sys_read,
> 	.fb_write	= fb_sys_write,
> 	.fb_sync	= NULL,
> };
> 
> static int __init testfb_probe (struct platform_device *pdev) {
> 	void *fb_mem = NULL;
> 	struct fb_info *fbinfo = NULL;
> 
> 	fb_mem = kzalloc(FB_MEM_SIZE, GFP_KERNEL);
> 
> 	if (!fb_mem) {
> 		pr_err("testfb: memory allocation for framebuffer failed\n");
> 		return(-ENOMEM);
> 	}
> 	else
> 		pr_debug("testfb: allocated framebuffer memory successfully\n");
> 
> 	fbinfo = framebuffer_alloc(0, &pdev->dev);
> 
> 	if (!fbinfo) {
> 		pr_err("testfb: framebuffer_alloc() failed\n");
> 		kfree(fb_mem);
> 		return(-1);
> 	}
> 	else
> 		pr_debug("testfb: framebuffer_alloc was successful\n");
> 
> 	fbinfo->fix.smem_start = (unsigned long) fb_mem;
> 	fbinfo->screen_base = (char __iomem *) fb_mem;
> 	fbinfo->fix.smem_len = FB_MEM_SIZE;
> 	fbinfo->fbops = &fbops;
> 
> 	fbinfo->node			= 0;				/* ?int */
> 	fbinfo->device			= &pdev->dev;
> 	fbinfo->flags			= FBINFO_DEFAULT;		/*  */
> 	fbinfo->var.xres		= DISPLAY_WIDTH;		/* visible resolution */
> 	fbinfo->var.yres		= DISPLAY_HEIGHT;		/* visible resolution */
> 	fbinfo->var.xres_virtual	= DISPLAY_WIDTH;		/* virtual resolution */
> 	fbinfo->var.yres_virtual	= DISPLAY_HEIGHT;		/* virtual resolution */
> 	fbinfo->var.bits_per_pixel	= 1;				/* bits per pixel */
> 	fbinfo->var.activate		= FB_ACTIVATE_NOW;		/* set values immediately (or vbl) */
> 	fbinfo->var.sync		= 0;				/* ?see FB_SYNC_* */
> 	fbinfo->var.vmode		= FB_VMODE_NONINTERLACED;	/* non interlaced, see FB_VMODE_* */
> 	fbinfo->var.left_margin 	= 0;
> 	fbinfo->var.right_margin 	= 0;
> 	fbinfo->var.upper_margin 	= 0;
> 	fbinfo->var.lower_margin 	= 0;
> 	fbinfo->var.red.offset 		= 0;
> 	fbinfo->var.red.length 		= fbinfo->var.bits_per_pixel;
> 	fbinfo->var.green 		= fbinfo->var.red;
> 	fbinfo->var.blue  		= fbinfo->var.red;
> 	fbinfo->var.grayscale		= 1;
> 	strcpy(fbinfo->fix.id, "testfb");				/* identifier, 16 byte */
> 	fbinfo->fix.type		= FB_TYPE_PACKED_PIXELS;	/* pack pixels to avoid overhead */
> 	fbinfo->fix.visual		= FB_VISUAL_MONO10;		/* Monochr. 1=Black 0=White */
> 	fbinfo->fix.line_length		= DISPLAY_WIDTH/8;		/* length of a line in bytes */
> 	fbinfo->fix.accel		= FB_ACCEL_NONE;		/* no hardware accelerator */
> 	fbinfo->fix.xpanstep 		= 0;
> 	fbinfo->fix.ypanstep		= 0;
> 	fbinfo->fix.ywrapstep 		= 0;
> 
> 	if (register_framebuffer(fbinfo) < 0) {
> 		pr_err("testfb: registering framebuffer failed\n");
> 		kfree((void *) fbinfo->fix.smem_start);
> 		framebuffer_release(fbinfo);
> 		return(-1);
> 	}
> 	else
> 		pr_debug("testfb: registered framebuffer\n");
> 
> 	platform_set_drvdata(pdev, fbinfo);
> 
> 	return 0;
> }
> 
> static int testfb_remove(struct platform_device *pdev) {
> 	struct fb_info *fbinfo = NULL;
> 
> 	fbinfo = platform_get_drvdata(pdev);
> 
> 	if (!fbinfo) {
> 		pr_err("testfb: unable to get fbinfo from pdev\n");
> 		return(-1);
> 	}
> 
> 	if (unregister_framebuffer(fbinfo) < 0)
> 		pr_err("testfb: unregistering framebuffer failed\n");
> 	else
> 		pr_debug("testfb: unregistered framebuffer\n");
> 
> 	kfree((void *) fbinfo->fix.smem_start);
> 
> 	framebuffer_release(fbinfo);
> 
> 	return 0;
> }
> 
> static struct platform_driver testfb_driver = {
> 	.probe = testfb_probe,
> 	.remove = testfb_remove,
> 	.driver = {
> 		.name = "testfb",
> 	},
> };
> 
> static int __init testfb_init(void)
> {
> 	int ret;
> 
> 	ret = platform_driver_register(&testfb_driver);
> 	if (!ret) {
> 		testfb_device = platform_device_register_simple("testfb", 0,
> 								NULL, 0);
> 
> 		if (IS_ERR(testfb_device)) {
> 			platform_driver_unregister(&testfb_driver);
> 			ret = PTR_ERR(testfb_device);
> 		} else {
> 			pr_info("testfb: platform_device registered\n");
> 		}
> 
> 	}
> 
> 	pr_info("testfb: module loaded\n");
> 	
> 	return 0;
> }
> 
> static void __exit testfb_exit(void)
> {
> 	platform_device_unregister(testfb_device);
> 	platform_driver_unregister(&testfb_driver);
> 
> 	pr_info("testfb: module unloaded\n");
> }
> 
> module_init(testfb_init);
> module_exit(testfb_exit);
> 
> MODULE_LICENSE("GPL v2");
> MODULE_ALIAS("testfb");
> MODULE_AUTHOR("Brian Fonfara");
> MODULE_DESCRIPTION("Ein Modul zum Test der Linux Framebuffer-Programmierung");
> MODULE_DESCRIPTION("version 0.1");
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH RESEND v2] console: Add persistent scrollback buffers for all VGA consoles
From: Manuel Schölling @ 2014-06-14 23:15 UTC (permalink / raw)
  To: plagnioj
  Cc: tomi.valkeinen, geert, broonie, rdunlap, hans.verkuil,
	dh.herrmann, tiwai, gregkh, airlied, mtosatti, linux-fbdev,
	linux-kernel, Manuel Schölling
In-Reply-To: <1401533856-4067-1-git-send-email-manuel.schoelling@gmx.de>

Add a scrollback buffers for each VGA console. The benefit is that
the scrollback history is not flushed when switching between consoles
but is persistent.
The buffers are allocated on demand when a new console is opened.

Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
---
 drivers/video/console/Kconfig  |   19 ++++-
 drivers/video/console/vgacon.c |  159 +++++++++++++++++++++++++++-------------
 2 files changed, 124 insertions(+), 54 deletions(-)

diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index fe1cd01..05fdc2c 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -43,9 +43,22 @@ config VGACON_SOFT_SCROLLBACK_SIZE
        range 1 1024
        default "64"
        help
-         Enter the amount of System RAM to allocate for the scrollback
-	 buffer.  Each 64KB will give you approximately 16 80x25
-	 screenfuls of scrollback buffer
+	  Enter the amount of System RAM to allocate for scrollback
+	  buffers of VGA consoles. Each 64KB will give you approximately
+	  16 80x25 screenfuls of scrollback buffer.
+
+config VGACON_SOFT_SCROLLBACK_FOR_EACH_CONSOLE
+	bool "Persistent Scrollback History for each console"
+	depends on VGACON_SOFT_SCROLLBACK
+	default y
+	help
+	  Say Y here if for each VGA console a scrollback buffer should
+	  be allocated. The scrollback history will persist when switching
+	  between consoles. If you say N here, scrollback is only supported
+	  for the active VGA console and scrollback history will be flushed
+	  when switching between consoles.
+
+	  If you use a RAM-constrained system, say N here.
 
 config MDA_CONSOLE
 	depends on !M68K && !PARISC && ISA
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index 9d8feac..652131d 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -181,70 +181,126 @@ static inline void vga_set_mem_top(struct vc_data *c)
 
 #ifdef CONFIG_VGACON_SOFT_SCROLLBACK
 /* software scrollback */
-static void *vgacon_scrollback;
-static int vgacon_scrollback_tail;
-static int vgacon_scrollback_size;
-static int vgacon_scrollback_rows;
-static int vgacon_scrollback_cnt;
-static int vgacon_scrollback_cur;
-static int vgacon_scrollback_save;
-static int vgacon_scrollback_restore;
-
-static void vgacon_scrollback_init(int pitch)
+struct vgacon_scrollback_info {
+	void *data;
+	int tail;
+	int size;
+	int rows;
+	int cnt;
+	int cur;
+	int save;
+	int restore;
+};
+static struct vgacon_scrollback_info *vgacon_scrollback_cur;
+#ifdef CONFIG_VGACON_SOFT_SCROLLBACK_FOR_EACH_CONSOLE
+static struct vgacon_scrollback_info vgacon_scrollbacks[MAX_NR_CONSOLES];
+#else
+static struct vgacon_scrollback_info vgacon_scrollbacks[1];
+#endif
+
+static void vgacon_scrollback_reset(size_t reset_size)
 {
-	int rows = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024/pitch;
-
-	if (vgacon_scrollback) {
-		vgacon_scrollback_cnt  = 0;
-		vgacon_scrollback_tail = 0;
-		vgacon_scrollback_cur  = 0;
-		vgacon_scrollback_rows = rows - 1;
-		vgacon_scrollback_size = rows * pitch;
+	if (vgacon_scrollback_cur->data && reset_size > 0)
+		memset(vgacon_scrollback_cur->data, 0, reset_size);
+
+	vgacon_scrollback_cur->cnt  = 0;
+	vgacon_scrollback_cur->tail = 0;
+	vgacon_scrollback_cur->cur  = 0;
+}
+
+static void vgacon_scrollback_init(int vc_num)
+{
+	int pitch = vga_video_num_columns * 2;
+	size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;
+	int rows = size/pitch;
+	void *data;
+
+	data = kcalloc(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE, 1024, GFP_NOWAIT);
+	if (data) {
+		vgacon_scrollbacks[vc_num].data = data;
+		vgacon_scrollback_cur = &vgacon_scrollbacks[vc_num];
+
+		vgacon_scrollback_cur->rows = rows - 1;
+		vgacon_scrollback_cur->size = rows * pitch;
+
+		vgacon_scrollback_reset(0);
+	} else {
+		pr_warn("VGAcon: failed to allocate memory for scrollback. Trying to reuse previous buffer.\n");
+		/* leave vgacon_scrollback_cur untouched
+		   but reset its content */
+		vgacon_scrollback_reset(size);
 	}
 }
 
+static void vgacon_switch_scrollback(int vc_num)
+{
+#ifdef CONFIG_VGACON_SOFT_SCROLLBACK_FOR_EACH_CONSOLE
+	if (!vgacon_scrollbacks[vc_num].data)
+		vgacon_scrollback_init(vc_num);
+	else
+		vgacon_scrollback_cur = &vgacon_scrollbacks[vc_num];
+#else
+	vc_num = 0;
+
+	if (!vgacon_scrollbacks[vc_num].data)
+		vgacon_scrollback_init(vc_num);
+	else {
+		size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;
+
+		vgacon_scrollback_reset(size);
+	}
+#endif
+}
+
 static void vgacon_scrollback_startup(void)
 {
-	vgacon_scrollback = kcalloc(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE, 1024, GFP_NOWAIT);
-	vgacon_scrollback_init(vga_video_num_columns * 2);
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(vgacon_scrollbacks); ++i)
+		vgacon_scrollbacks[i].data = NULL;
+
+	vgacon_scrollback_cur = &vgacon_scrollbacks[0];
+	vgacon_scrollback_init(0);
 }
 
 static void vgacon_scrollback_update(struct vc_data *c, int t, int count)
 {
 	void *p;
 
-	if (!vgacon_scrollback_size || c->vc_num != fg_console)
+	if (!vgacon_scrollback_cur->data || !vgacon_scrollback_cur->size)
 		return;
 
 	p = (void *) (c->vc_origin + t * c->vc_size_row);
 
 	while (count--) {
-		scr_memcpyw(vgacon_scrollback + vgacon_scrollback_tail,
+		scr_memcpyw(vgacon_scrollback_cur->data +
+			    vgacon_scrollback_cur->tail,
 			    p, c->vc_size_row);
-		vgacon_scrollback_cnt++;
+
+		vgacon_scrollback_cur->cnt++;
 		p += c->vc_size_row;
-		vgacon_scrollback_tail += c->vc_size_row;
+		vgacon_scrollback_cur->tail += c->vc_size_row;
 
-		if (vgacon_scrollback_tail >= vgacon_scrollback_size)
-			vgacon_scrollback_tail = 0;
+		if (vgacon_scrollback_cur->tail >= vgacon_scrollback_cur->size)
+			vgacon_scrollback_cur->tail = 0;
 
-		if (vgacon_scrollback_cnt > vgacon_scrollback_rows)
-			vgacon_scrollback_cnt = vgacon_scrollback_rows;
+		if (vgacon_scrollback_cur->cnt > vgacon_scrollback_cur->rows)
+			vgacon_scrollback_cur->cnt = vgacon_scrollback_cur->rows;
 
-		vgacon_scrollback_cur = vgacon_scrollback_cnt;
+		vgacon_scrollback_cur->cur = vgacon_scrollback_cur->cnt;
 	}
 }
 
 static void vgacon_restore_screen(struct vc_data *c)
 {
-	vgacon_scrollback_save = 0;
+	vgacon_scrollback_cur->save = 0;
 
-	if (!vga_is_gfx && !vgacon_scrollback_restore) {
+	if (!vga_is_gfx && !vgacon_scrollback_cur->restore) {
 		scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf,
 			    c->vc_screenbuf_size > vga_vram_size ?
 			    vga_vram_size : c->vc_screenbuf_size);
-		vgacon_scrollback_restore = 1;
-		vgacon_scrollback_cur = vgacon_scrollback_cnt;
+		vgacon_scrollback_cur->restore = 1;
+		vgacon_scrollback_cur->cur = vgacon_scrollback_cur->cnt;
 	}
 }
 
@@ -258,41 +314,41 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)
 		return 1;
 	}
 
-	if (!vgacon_scrollback)
+	if (!vgacon_scrollback_cur->data)
 		return 1;
 
-	if (!vgacon_scrollback_save) {
+	if (!vgacon_scrollback_cur->save) {
 		vgacon_cursor(c, CM_ERASE);
 		vgacon_save_screen(c);
-		vgacon_scrollback_save = 1;
+		vgacon_scrollback_cur->save = 1;
 	}
 
-	vgacon_scrollback_restore = 0;
-	start = vgacon_scrollback_cur + lines;
+	vgacon_scrollback_cur->restore = 0;
+	start = vgacon_scrollback_cur->cur + lines;
 	end = start + abs(lines);
 
 	if (start < 0)
 		start = 0;
 
-	if (start > vgacon_scrollback_cnt)
-		start = vgacon_scrollback_cnt;
+	if (start > vgacon_scrollback_cur->cnt)
+		start = vgacon_scrollback_cur->cnt;
 
 	if (end < 0)
 		end = 0;
 
-	if (end > vgacon_scrollback_cnt)
-		end = vgacon_scrollback_cnt;
+	if (end > vgacon_scrollback_cur->cnt)
+		end = vgacon_scrollback_cur->cnt;
 
-	vgacon_scrollback_cur = start;
+	vgacon_scrollback_cur->cur = start;
 	count = end - start;
-	soff = vgacon_scrollback_tail - ((vgacon_scrollback_cnt - end) *
-					 c->vc_size_row);
+	soff = vgacon_scrollback_cur->tail -
+		((vgacon_scrollback_cur->cnt - end) * c->vc_size_row);
 	soff -= count * c->vc_size_row;
 
 	if (soff < 0)
-		soff += vgacon_scrollback_size;
+		soff += vgacon_scrollback_cur->size;
 
-	count = vgacon_scrollback_cnt - start;
+	count = vgacon_scrollback_cur->cnt - start;
 
 	if (count > c->vc_rows)
 		count = c->vc_rows;
@@ -306,13 +362,13 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)
 
 		count *= c->vc_size_row;
 		/* how much memory to end of buffer left? */
-		copysize = min(count, vgacon_scrollback_size - soff);
-		scr_memcpyw(d, vgacon_scrollback + soff, copysize);
+		copysize = min(count, vgacon_scrollback_cur->size - soff);
+		scr_memcpyw(d, vgacon_scrollback_cur->data + soff, copysize);
 		d += copysize;
 		count -= copysize;
 
 		if (count) {
-			scr_memcpyw(d, vgacon_scrollback, count);
+			scr_memcpyw(d, vgacon_scrollback_cur->data, count);
 			d += count;
 		}
 
@@ -327,6 +383,7 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)
 #define vgacon_scrollback_startup(...) do { } while (0)
 #define vgacon_scrollback_init(...)    do { } while (0)
 #define vgacon_scrollback_update(...)  do { } while (0)
+#define vgacon_switch_scrollback(...)  do { } while (0)
 
 static void vgacon_restore_screen(struct vc_data *c)
 {
@@ -842,7 +899,7 @@ static int vgacon_switch(struct vc_data *c)
 			vgacon_doresize(c, c->vc_cols, c->vc_rows);
 	}
 
-	vgacon_scrollback_init(c->vc_size_row);
+	vgacon_switch_scrollback(c->vc_num);
 	return 0;		/* Redrawing not needed */
 }
 
-- 
1.7.10.4


^ permalink raw reply related

* Re: [PATCH RESEND v2] console: Add persistent scrollback buffers for all VGA consoles
From: Manuel Schoelling @ 2014-06-14 23:24 UTC (permalink / raw)
  To: plagnioj
  Cc: tomi.valkeinen, geert, broonie, rdunlap, hans.verkuil,
	dh.herrmann, tiwai, gregkh, airlied, mtosatti, linux-fbdev,
	linux-kernel
In-Reply-To: <1402787715-26007-1-git-send-email-manuel.schoelling@gmx.de>

This version reuses an "old" scrollback buffer of the previous console
if memory allocation fails.

However, the issue of clearing the console using the 'clear_console'
commnad [1,2] is still unsolved. I'd prefer implementing it using a
ioctl() call but it's open for discussion ;)

[1] https://sources.debian.net/src/bash/4.2%
2Bdfsg-0.1/debian/clear_console.c
[2] http://manpages.debian.org/cgi-bin/man.cgi?query=clear_console

On So, 2014-06-15 at 01:15 +0200, Manuel Schölling wrote:
> Add a scrollback buffers for each VGA console. The benefit is that
> the scrollback history is not flushed when switching between consoles
> but is persistent.
> The buffers are allocated on demand when a new console is opened.
> 
> Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
> ---
>  drivers/video/console/Kconfig  |   19 ++++-
>  drivers/video/console/vgacon.c |  159 +++++++++++++++++++++++++++-------------
>  2 files changed, 124 insertions(+), 54 deletions(-)
> 
> diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
> index fe1cd01..05fdc2c 100644
> --- a/drivers/video/console/Kconfig
> +++ b/drivers/video/console/Kconfig
> @@ -43,9 +43,22 @@ config VGACON_SOFT_SCROLLBACK_SIZE
>         range 1 1024
>         default "64"
>         help
> -         Enter the amount of System RAM to allocate for the scrollback
> -	 buffer.  Each 64KB will give you approximately 16 80x25
> -	 screenfuls of scrollback buffer
> +	  Enter the amount of System RAM to allocate for scrollback
> +	  buffers of VGA consoles. Each 64KB will give you approximately
> +	  16 80x25 screenfuls of scrollback buffer.
> +
> +config VGACON_SOFT_SCROLLBACK_FOR_EACH_CONSOLE
> +	bool "Persistent Scrollback History for each console"
> +	depends on VGACON_SOFT_SCROLLBACK
> +	default y
> +	help
> +	  Say Y here if for each VGA console a scrollback buffer should
> +	  be allocated. The scrollback history will persist when switching
> +	  between consoles. If you say N here, scrollback is only supported
> +	  for the active VGA console and scrollback history will be flushed
> +	  when switching between consoles.
> +
> +	  If you use a RAM-constrained system, say N here.
>  
>  config MDA_CONSOLE
>  	depends on !M68K && !PARISC && ISA
> diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
> index 9d8feac..652131d 100644
> --- a/drivers/video/console/vgacon.c
> +++ b/drivers/video/console/vgacon.c
> @@ -181,70 +181,126 @@ static inline void vga_set_mem_top(struct vc_data *c)
>  
>  #ifdef CONFIG_VGACON_SOFT_SCROLLBACK
>  /* software scrollback */
> -static void *vgacon_scrollback;
> -static int vgacon_scrollback_tail;
> -static int vgacon_scrollback_size;
> -static int vgacon_scrollback_rows;
> -static int vgacon_scrollback_cnt;
> -static int vgacon_scrollback_cur;
> -static int vgacon_scrollback_save;
> -static int vgacon_scrollback_restore;
> -
> -static void vgacon_scrollback_init(int pitch)
> +struct vgacon_scrollback_info {
> +	void *data;
> +	int tail;
> +	int size;
> +	int rows;
> +	int cnt;
> +	int cur;
> +	int save;
> +	int restore;
> +};
> +static struct vgacon_scrollback_info *vgacon_scrollback_cur;
> +#ifdef CONFIG_VGACON_SOFT_SCROLLBACK_FOR_EACH_CONSOLE
> +static struct vgacon_scrollback_info vgacon_scrollbacks[MAX_NR_CONSOLES];
> +#else
> +static struct vgacon_scrollback_info vgacon_scrollbacks[1];
> +#endif
> +
> +static void vgacon_scrollback_reset(size_t reset_size)
>  {
> -	int rows = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024/pitch;
> -
> -	if (vgacon_scrollback) {
> -		vgacon_scrollback_cnt  = 0;
> -		vgacon_scrollback_tail = 0;
> -		vgacon_scrollback_cur  = 0;
> -		vgacon_scrollback_rows = rows - 1;
> -		vgacon_scrollback_size = rows * pitch;
> +	if (vgacon_scrollback_cur->data && reset_size > 0)
> +		memset(vgacon_scrollback_cur->data, 0, reset_size);
> +
> +	vgacon_scrollback_cur->cnt  = 0;
> +	vgacon_scrollback_cur->tail = 0;
> +	vgacon_scrollback_cur->cur  = 0;
> +}
> +
> +static void vgacon_scrollback_init(int vc_num)
> +{
> +	int pitch = vga_video_num_columns * 2;
> +	size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;
> +	int rows = size/pitch;
> +	void *data;
> +
> +	data = kcalloc(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE, 1024, GFP_NOWAIT);
> +	if (data) {
> +		vgacon_scrollbacks[vc_num].data = data;
> +		vgacon_scrollback_cur = &vgacon_scrollbacks[vc_num];
> +
> +		vgacon_scrollback_cur->rows = rows - 1;
> +		vgacon_scrollback_cur->size = rows * pitch;
> +
> +		vgacon_scrollback_reset(0);
> +	} else {
> +		pr_warn("VGAcon: failed to allocate memory for scrollback. Trying to reuse previous buffer.\n");
> +		/* leave vgacon_scrollback_cur untouched
> +		   but reset its content */
> +		vgacon_scrollback_reset(size);
>  	}
>  }
>  
> +static void vgacon_switch_scrollback(int vc_num)
> +{
> +#ifdef CONFIG_VGACON_SOFT_SCROLLBACK_FOR_EACH_CONSOLE
> +	if (!vgacon_scrollbacks[vc_num].data)
> +		vgacon_scrollback_init(vc_num);
> +	else
> +		vgacon_scrollback_cur = &vgacon_scrollbacks[vc_num];
> +#else
> +	vc_num = 0;
> +
> +	if (!vgacon_scrollbacks[vc_num].data)
> +		vgacon_scrollback_init(vc_num);
> +	else {
> +		size_t size = CONFIG_VGACON_SOFT_SCROLLBACK_SIZE * 1024;
> +
> +		vgacon_scrollback_reset(size);
> +	}
> +#endif
> +}
> +
>  static void vgacon_scrollback_startup(void)
>  {
> -	vgacon_scrollback = kcalloc(CONFIG_VGACON_SOFT_SCROLLBACK_SIZE, 1024, GFP_NOWAIT);
> -	vgacon_scrollback_init(vga_video_num_columns * 2);
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(vgacon_scrollbacks); ++i)
> +		vgacon_scrollbacks[i].data = NULL;
> +
> +	vgacon_scrollback_cur = &vgacon_scrollbacks[0];
> +	vgacon_scrollback_init(0);
>  }
>  
>  static void vgacon_scrollback_update(struct vc_data *c, int t, int count)
>  {
>  	void *p;
>  
> -	if (!vgacon_scrollback_size || c->vc_num != fg_console)
> +	if (!vgacon_scrollback_cur->data || !vgacon_scrollback_cur->size)
>  		return;
>  
>  	p = (void *) (c->vc_origin + t * c->vc_size_row);
>  
>  	while (count--) {
> -		scr_memcpyw(vgacon_scrollback + vgacon_scrollback_tail,
> +		scr_memcpyw(vgacon_scrollback_cur->data +
> +			    vgacon_scrollback_cur->tail,
>  			    p, c->vc_size_row);
> -		vgacon_scrollback_cnt++;
> +
> +		vgacon_scrollback_cur->cnt++;
>  		p += c->vc_size_row;
> -		vgacon_scrollback_tail += c->vc_size_row;
> +		vgacon_scrollback_cur->tail += c->vc_size_row;
>  
> -		if (vgacon_scrollback_tail >= vgacon_scrollback_size)
> -			vgacon_scrollback_tail = 0;
> +		if (vgacon_scrollback_cur->tail >= vgacon_scrollback_cur->size)
> +			vgacon_scrollback_cur->tail = 0;
>  
> -		if (vgacon_scrollback_cnt > vgacon_scrollback_rows)
> -			vgacon_scrollback_cnt = vgacon_scrollback_rows;
> +		if (vgacon_scrollback_cur->cnt > vgacon_scrollback_cur->rows)
> +			vgacon_scrollback_cur->cnt = vgacon_scrollback_cur->rows;
>  
> -		vgacon_scrollback_cur = vgacon_scrollback_cnt;
> +		vgacon_scrollback_cur->cur = vgacon_scrollback_cur->cnt;
>  	}
>  }
>  
>  static void vgacon_restore_screen(struct vc_data *c)
>  {
> -	vgacon_scrollback_save = 0;
> +	vgacon_scrollback_cur->save = 0;
>  
> -	if (!vga_is_gfx && !vgacon_scrollback_restore) {
> +	if (!vga_is_gfx && !vgacon_scrollback_cur->restore) {
>  		scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf,
>  			    c->vc_screenbuf_size > vga_vram_size ?
>  			    vga_vram_size : c->vc_screenbuf_size);
> -		vgacon_scrollback_restore = 1;
> -		vgacon_scrollback_cur = vgacon_scrollback_cnt;
> +		vgacon_scrollback_cur->restore = 1;
> +		vgacon_scrollback_cur->cur = vgacon_scrollback_cur->cnt;
>  	}
>  }
>  
> @@ -258,41 +314,41 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)
>  		return 1;
>  	}
>  
> -	if (!vgacon_scrollback)
> +	if (!vgacon_scrollback_cur->data)
>  		return 1;
>  
> -	if (!vgacon_scrollback_save) {
> +	if (!vgacon_scrollback_cur->save) {
>  		vgacon_cursor(c, CM_ERASE);
>  		vgacon_save_screen(c);
> -		vgacon_scrollback_save = 1;
> +		vgacon_scrollback_cur->save = 1;
>  	}
>  
> -	vgacon_scrollback_restore = 0;
> -	start = vgacon_scrollback_cur + lines;
> +	vgacon_scrollback_cur->restore = 0;
> +	start = vgacon_scrollback_cur->cur + lines;
>  	end = start + abs(lines);
>  
>  	if (start < 0)
>  		start = 0;
>  
> -	if (start > vgacon_scrollback_cnt)
> -		start = vgacon_scrollback_cnt;
> +	if (start > vgacon_scrollback_cur->cnt)
> +		start = vgacon_scrollback_cur->cnt;
>  
>  	if (end < 0)
>  		end = 0;
>  
> -	if (end > vgacon_scrollback_cnt)
> -		end = vgacon_scrollback_cnt;
> +	if (end > vgacon_scrollback_cur->cnt)
> +		end = vgacon_scrollback_cur->cnt;
>  
> -	vgacon_scrollback_cur = start;
> +	vgacon_scrollback_cur->cur = start;
>  	count = end - start;
> -	soff = vgacon_scrollback_tail - ((vgacon_scrollback_cnt - end) *
> -					 c->vc_size_row);
> +	soff = vgacon_scrollback_cur->tail -
> +		((vgacon_scrollback_cur->cnt - end) * c->vc_size_row);
>  	soff -= count * c->vc_size_row;
>  
>  	if (soff < 0)
> -		soff += vgacon_scrollback_size;
> +		soff += vgacon_scrollback_cur->size;
>  
> -	count = vgacon_scrollback_cnt - start;
> +	count = vgacon_scrollback_cur->cnt - start;
>  
>  	if (count > c->vc_rows)
>  		count = c->vc_rows;
> @@ -306,13 +362,13 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)
>  
>  		count *= c->vc_size_row;
>  		/* how much memory to end of buffer left? */
> -		copysize = min(count, vgacon_scrollback_size - soff);
> -		scr_memcpyw(d, vgacon_scrollback + soff, copysize);
> +		copysize = min(count, vgacon_scrollback_cur->size - soff);
> +		scr_memcpyw(d, vgacon_scrollback_cur->data + soff, copysize);
>  		d += copysize;
>  		count -= copysize;
>  
>  		if (count) {
> -			scr_memcpyw(d, vgacon_scrollback, count);
> +			scr_memcpyw(d, vgacon_scrollback_cur->data, count);
>  			d += count;
>  		}
>  
> @@ -327,6 +383,7 @@ static int vgacon_scrolldelta(struct vc_data *c, int lines)
>  #define vgacon_scrollback_startup(...) do { } while (0)
>  #define vgacon_scrollback_init(...)    do { } while (0)
>  #define vgacon_scrollback_update(...)  do { } while (0)
> +#define vgacon_switch_scrollback(...)  do { } while (0)
>  
>  static void vgacon_restore_screen(struct vc_data *c)
>  {
> @@ -842,7 +899,7 @@ static int vgacon_switch(struct vc_data *c)
>  			vgacon_doresize(c, c->vc_cols, c->vc_rows);
>  	}
>  
> -	vgacon_scrollback_init(c->vc_size_row);
> +	vgacon_switch_scrollback(c->vc_num);
>  	return 0;		/* Redrawing not needed */
>  }
>  



^ permalink raw reply

* Re: console / fbdev: fbcon support for bits_per_pixel = 1?
From: Stefan Biereigel @ 2014-06-15  7:47 UTC (permalink / raw)
  To: Bruno Prémont, Stefan Biereigel
  Cc: linux-fbdev, linux-kernel, linux-console, brian
In-Reply-To: <20140614143550.59367463@neptune.home>

Hello Bruno,

are you sure that fbcon really uses the 1bpp mode and that it works correctly? I tried to
match all var-settings to yours, and 1bpp support still seems broken. Well, a workaround
would be doing it like you are: using 8bpp shadow memory and translating it to packed
pixels (8px per byte) when doing LCD updates. I guess, for now that will be the way to go.
I'll be there to investigate further if needed.

Thank you,
Stefan

Am 14.06.2014 14:35, schrieb Bruno Prémont:
> Hi Stefan,
> 
> On Sat, 14 June 2014 Stefan Biereigel <stefan@biereigel.de> wrote:
>> CC: linux-console, linux-fbdev
>>
>> Hello Kernel Developers,
>> for a university assignment we are developing a frame buffer driver for a monochrome
>> display. We succeeded so far in making a simple "RAM frame buffer" module, which is needed
>> as the basis (we don't have read access to the RAM in the LCD).
>> We are using the system-default fb_ops (fb_sys_{read,write},
>> sys_{fillrect,copyarea,imageblit), and all is well when we use bits_per_pixel = 8. When we
>> map a console to the RAM frame buffer (con2fbmap 1 1), do strg-alt-F1, type some
>> characters there, we can then 'cat /dev/fb1' and plot the ram contents in Matlab
>> (reshaping the data to be our display geometry first), where our typed characters and the
>> console appear.
>>
>> If we however change bits_per_pixel to 1, and divide line_length by 8 (as it should
>> represent the line length in bytes), this suddenly stops working: echo and cat to fb1 work
>> as intended: We change our Matlab-Script to interpret every byte as 8 pixels, bytes
>> written into /dev/fb1 can be read out correctly. If we however map the console to fb1, no
>> console output can be seen in RAM - it is (seemingly) filled with garbage.
>>
>> We're using fbcon as the console driver, and the first frame buffer for me is intelfb. I
>> see, that the bitblitting-calls for every typed character are depth 1 and have correct
>> geometry, but the whole bitblitting-builtin seems not to work for bits_per_pixel = 1, i
>> tried it with a simple test image after the initialisation...
>>
>> Is this behavior intended or are we triggering a bug here (that no one noticed, because
>> who in the world uses monochrome framebuffers these days..). I can't see any comments that
>> monochrome consoles should not work with 1 bit per pixel. See the code below if you spot
>> some errors (ignore some missing error handling and mediocre style for now, please).
> 
> fbcon on 1bpp frambuffer worked for me with picoLCD (though I have found no userspace
> framebuffer application willing to operate at 1bpp).
> Thus I allow for 1bpp or 8bpp and convert 8bpp to 1bpp for the picolcd. As for your case,
> picoLCD is "write-only" monochrome LCD backed by in-RAM shadow framebuffer.
> 
> (see drivers/hid/hid-picolcd_fb.c)
> 
> Bruno
> 
>> Thank you for any help and input.
>> Best regards,
>> Stefan Biereigel
>>
>> 8<--- testfb.c
>>
>> #include <linux/init.h>
>> #include <linux/module.h>
>>
>> #include <linux/fb.h>
>> #include <linux/slab.h>
>> #include <linux/wait.h>
>> #include <linux/errno.h>
>> #include <linux/platform_device.h>
>>
>> #define DISPLAY_WIDTH	240
>> #define DISPLAY_HEIGHT	64
>> #define FB_MEM_SIZE 	(DISPLAY_WIDTH * DISPLAY_HEIGHT)/8
>>
>> static struct platform_device *testfb_device;
>>
>> static struct fb_ops fbops = {
>> 	.owner		= THIS_MODULE,
>> 	.fb_fillrect	= sys_fillrect,
>> 	.fb_copyarea	= sys_copyarea,
>> 	.fb_imageblit	= sys_imageblit,
>> 	.fb_read	= fb_sys_read,
>> 	.fb_write	= fb_sys_write,
>> 	.fb_sync	= NULL,
>> };
>>
>> static int __init testfb_probe (struct platform_device *pdev) {
>> 	void *fb_mem = NULL;
>> 	struct fb_info *fbinfo = NULL;
>>
>> 	fb_mem = kzalloc(FB_MEM_SIZE, GFP_KERNEL);
>>
>> 	if (!fb_mem) {
>> 		pr_err("testfb: memory allocation for framebuffer failed\n");
>> 		return(-ENOMEM);
>> 	}
>> 	else
>> 		pr_debug("testfb: allocated framebuffer memory successfully\n");
>>
>> 	fbinfo = framebuffer_alloc(0, &pdev->dev);
>>
>> 	if (!fbinfo) {
>> 		pr_err("testfb: framebuffer_alloc() failed\n");
>> 		kfree(fb_mem);
>> 		return(-1);
>> 	}
>> 	else
>> 		pr_debug("testfb: framebuffer_alloc was successful\n");
>>
>> 	fbinfo->fix.smem_start = (unsigned long) fb_mem;
>> 	fbinfo->screen_base = (char __iomem *) fb_mem;
>> 	fbinfo->fix.smem_len = FB_MEM_SIZE;
>> 	fbinfo->fbops = &fbops;
>>
>> 	fbinfo->node			= 0;				/* ?int */
>> 	fbinfo->device			= &pdev->dev;
>> 	fbinfo->flags			= FBINFO_DEFAULT;		/*  */
>> 	fbinfo->var.xres		= DISPLAY_WIDTH;		/* visible resolution */
>> 	fbinfo->var.yres		= DISPLAY_HEIGHT;		/* visible resolution */
>> 	fbinfo->var.xres_virtual	= DISPLAY_WIDTH;		/* virtual resolution */
>> 	fbinfo->var.yres_virtual	= DISPLAY_HEIGHT;		/* virtual resolution */
>> 	fbinfo->var.bits_per_pixel	= 1;				/* bits per pixel */
>> 	fbinfo->var.activate		= FB_ACTIVATE_NOW;		/* set values immediately (or vbl) */
>> 	fbinfo->var.sync		= 0;				/* ?see FB_SYNC_* */
>> 	fbinfo->var.vmode		= FB_VMODE_NONINTERLACED;	/* non interlaced, see FB_VMODE_* */
>> 	fbinfo->var.left_margin 	= 0;
>> 	fbinfo->var.right_margin 	= 0;
>> 	fbinfo->var.upper_margin 	= 0;
>> 	fbinfo->var.lower_margin 	= 0;
>> 	fbinfo->var.red.offset 		= 0;
>> 	fbinfo->var.red.length 		= fbinfo->var.bits_per_pixel;
>> 	fbinfo->var.green 		= fbinfo->var.red;
>> 	fbinfo->var.blue  		= fbinfo->var.red;
>> 	fbinfo->var.grayscale		= 1;
>> 	strcpy(fbinfo->fix.id, "testfb");				/* identifier, 16 byte */
>> 	fbinfo->fix.type		= FB_TYPE_PACKED_PIXELS;	/* pack pixels to avoid overhead */
>> 	fbinfo->fix.visual		= FB_VISUAL_MONO10;		/* Monochr. 1=Black 0=White */
>> 	fbinfo->fix.line_length		= DISPLAY_WIDTH/8;		/* length of a line in bytes */
>> 	fbinfo->fix.accel		= FB_ACCEL_NONE;		/* no hardware accelerator */
>> 	fbinfo->fix.xpanstep 		= 0;
>> 	fbinfo->fix.ypanstep		= 0;
>> 	fbinfo->fix.ywrapstep 		= 0;
>>
>> 	if (register_framebuffer(fbinfo) < 0) {
>> 		pr_err("testfb: registering framebuffer failed\n");
>> 		kfree((void *) fbinfo->fix.smem_start);
>> 		framebuffer_release(fbinfo);
>> 		return(-1);
>> 	}
>> 	else
>> 		pr_debug("testfb: registered framebuffer\n");
>>
>> 	platform_set_drvdata(pdev, fbinfo);
>>
>> 	return 0;
>> }
>>
>> static int testfb_remove(struct platform_device *pdev) {
>> 	struct fb_info *fbinfo = NULL;
>>
>> 	fbinfo = platform_get_drvdata(pdev);
>>
>> 	if (!fbinfo) {
>> 		pr_err("testfb: unable to get fbinfo from pdev\n");
>> 		return(-1);
>> 	}
>>
>> 	if (unregister_framebuffer(fbinfo) < 0)
>> 		pr_err("testfb: unregistering framebuffer failed\n");
>> 	else
>> 		pr_debug("testfb: unregistered framebuffer\n");
>>
>> 	kfree((void *) fbinfo->fix.smem_start);
>>
>> 	framebuffer_release(fbinfo);
>>
>> 	return 0;
>> }
>>
>> static struct platform_driver testfb_driver = {
>> 	.probe = testfb_probe,
>> 	.remove = testfb_remove,
>> 	.driver = {
>> 		.name = "testfb",
>> 	},
>> };
>>
>> static int __init testfb_init(void)
>> {
>> 	int ret;
>>
>> 	ret = platform_driver_register(&testfb_driver);
>> 	if (!ret) {
>> 		testfb_device = platform_device_register_simple("testfb", 0,
>> 								NULL, 0);
>>
>> 		if (IS_ERR(testfb_device)) {
>> 			platform_driver_unregister(&testfb_driver);
>> 			ret = PTR_ERR(testfb_device);
>> 		} else {
>> 			pr_info("testfb: platform_device registered\n");
>> 		}
>>
>> 	}
>>
>> 	pr_info("testfb: module loaded\n");
>> 	
>> 	return 0;
>> }
>>
>> static void __exit testfb_exit(void)
>> {
>> 	platform_device_unregister(testfb_device);
>> 	platform_driver_unregister(&testfb_driver);
>>
>> 	pr_info("testfb: module unloaded\n");
>> }
>>
>> module_init(testfb_init);
>> module_exit(testfb_exit);
>>
>> MODULE_LICENSE("GPL v2");
>> MODULE_ALIAS("testfb");
>> MODULE_AUTHOR("Brian Fonfara");
>> MODULE_DESCRIPTION("Ein Modul zum Test der Linux Framebuffer-Programmierung");
>> MODULE_DESCRIPTION("version 0.1");
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

^ permalink raw reply

* Re: console / fbdev: fbcon support for bits_per_pixel = 1?
From: Geert Uytterhoeven @ 2014-06-15  8:57 UTC (permalink / raw)
  To: Bruno Prémont
  Cc: Stefan Biereigel, Linux Fbdev development list,
	linux-kernel@vger.kernel.org, linux-console, brian
In-Reply-To: <20140614143550.59367463@neptune.home>

On Sat, Jun 14, 2014 at 2:35 PM, Bruno Prémont
<bonbons@linux-vserver.org> wrote:
>> Is this behavior intended or are we triggering a bug here (that no one noticed, because
>> who in the world uses monochrome framebuffers these days..). I can't see any comments that
>> monochrome consoles should not work with 1 bit per pixel. See the code below if you spot
>> some errors (ignore some missing error handling and mediocre style for now, please).
>
> fbcon on 1bpp frambuffer worked for me with picoLCD (though I have found no userspace

I'm not aware of 1 bpp frame buffer consoles being broken.

> framebuffer application willing to operate at 1bpp).

Xfbdev does. I revived support for monochrome (and Atari/Amiga-style
bitplanes) last year.

And of course
https://git.kernel.org/cgit/linux/kernel/git/geert/fbtest.git/

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply

* [PATCH -next 00/26] treewide: Use dma_zalloc_coherent
From: Joe Perches @ 2014-06-15 20:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: linuxppc-dev, linux-sh, linux-ide, linux-nvme, linux-crypto,
	dmaengine, dri-devel, linux-rdma, linux-arm-msm, linux-mmc,
	netdev, e1000-devel, ath10k, linux-wireless, wcn36xx, users,
	linux-scsi, linux-usb, linux-fbdev, alsa-devel

Use the zeroing function instead of dma_alloc_coherent & memset(,0,)

Joe Perches (26):
  powerpc: Use dma_zalloc_coherent
  sh: Use dma_zalloc_coherent
  ata: Use dma_zalloc_coherent
  block: Use dma_zalloc_coherent
  crypto: Use dma_zalloc_coherent
  dma: Use dma_zalloc_coherent
  gpu: Use dma_zalloc_coherent
  infiniband: Use dma_zalloc_coherent
  mmc: Use dma_zalloc_coherent
  broadcom: Use dma_zalloc_coherent
  hisilicon: Use dma_zalloc_coherent
  intel: Use dma_zalloc_coherent
  ath: Use dma_zalloc_coherent
  rt2x00: Use dma_zalloc_coherent
  bfa: Use dma_zalloc_coherent
  bnx2fc: Use dma_zalloc_coherent
  bnx2i: Use dma_zalloc_coherent
  dpt_i2o: Use dma_zalloc_coherent
  lpfc: Use dma_zalloc_coherent
  megaraid: Use dma_zalloc_coherent
  mvsas: Use dma_zalloc_coherent
  qla2xxx: Use dma_zalloc_coherent
  qla4xxx: Use dma_zalloc_coherent
  usb: Use dma_zalloc_coherent
  fbdev: Use dma_zalloc_coherent
  sound: Use dma_zalloc_coherent

 arch/powerpc/platforms/pasemi/dma_lib.c       |  8 ++--
 arch/powerpc/sysdev/fsl_rmu.c                 |  9 ++--
 arch/sh/mm/consistent.c                       |  4 +-
 drivers/ata/sata_fsl.c                        |  5 +--
 drivers/block/nvme-core.c                     |  5 +--
 drivers/crypto/amcc/crypto4xx_core.c          |  8 ++--
 drivers/crypto/ixp4xx_crypto.c                |  8 ++--
 drivers/dma/imx-sdma.c                        |  5 +--
 drivers/dma/mxs-dma.c                         |  8 ++--
 drivers/gpu/drm/drm_pci.c                     |  6 +--
 drivers/infiniband/hw/cxgb3/cxio_hal.c        |  7 ++--
 drivers/infiniband/hw/mthca/mthca_memfree.c   |  5 +--
 drivers/infiniband/hw/ocrdma/ocrdma_hw.c      | 20 ++++-----
 drivers/infiniband/hw/ocrdma/ocrdma_stats.c   |  6 +--
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c   |  8 ++--
 drivers/mmc/host/msm_sdcc.c                   |  8 ++--
 drivers/net/ethernet/broadcom/bcm63xx_enet.c  |  6 +--
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c |  5 +--
 drivers/net/ethernet/intel/ixgb/ixgb_main.c   |  6 +--
 drivers/net/wireless/ath/ath10k/pci.c         |  8 +---
 drivers/net/wireless/ath/ath10k/wmi.c         |  8 +---
 drivers/net/wireless/ath/wcn36xx/dxe.c        |  6 +--
 drivers/net/wireless/rt2x00/rt2x00mmio.c      |  8 ++--
 drivers/scsi/bfa/bfad_bsg.c                   |  6 +--
 drivers/scsi/bnx2fc/bnx2fc_hwi.c              | 59 ++++++++++++---------------
 drivers/scsi/bnx2fc/bnx2fc_tgt.c              | 51 ++++++++++-------------
 drivers/scsi/bnx2i/bnx2i_hwi.c                | 14 +++----
 drivers/scsi/dpt_i2o.c                        | 19 ++++-----
 drivers/scsi/lpfc/lpfc_bsg.c                  |  5 +--
 drivers/scsi/lpfc/lpfc_init.c                 | 22 ++++------
 drivers/scsi/lpfc/lpfc_mbox.c                 |  6 +--
 drivers/scsi/lpfc/lpfc_sli.c                  | 14 +++----
 drivers/scsi/megaraid/megaraid_sas_fusion.c   |  9 ++--
 drivers/scsi/mvsas/mv_init.c                  | 26 +++++-------
 drivers/scsi/qla2xxx/qla_init.c               | 10 ++---
 drivers/scsi/qla4xxx/ql4_init.c               |  5 +--
 drivers/scsi/qla4xxx/ql4_mbx.c                | 21 ++++------
 drivers/scsi/qla4xxx/ql4_nx.c                 |  5 +--
 drivers/scsi/qla4xxx/ql4_os.c                 | 12 +++---
 drivers/usb/dwc2/hcd_ddma.c                   | 20 ++++-----
 drivers/usb/host/uhci-hcd.c                   |  7 ++--
 drivers/video/fbdev/da8xx-fb.c                |  9 ++--
 sound/aoa/soundbus/i2sbus/core.c              | 12 ++----
 sound/sparc/dbri.c                            |  6 +--
 44 files changed, 197 insertions(+), 308 deletions(-)

-- 
1.8.1.2.459.gbcd45b4.dirty


^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox