Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1699595

Re: [PATCH 2/6] drm/tinydrm: add helpers for ST7586 controllers

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/6] drm/tinydrm: add helpers for ST7586 controllers
Date 2017-07-30 20:20 +0200
Message-ID <u90YO-3NX-3@gated-at.bofh.it> (permalink)
References <u8Frj-6FJ-3@gated-at.bofh.it> <u8Frk-6FJ-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Jul 29, 2017 at 10:17 PM, David Lechner <david@lechnology.com> wrote:
> This adds helper functions and support for ST7586 controllers. These
> controllers have an unusual memory layout where 3 pixels are packed into
> 1 byte.
>
> +-------+-----------------+
> | bit   | 7 6 5 4 3 2 1 0 |
> +-------+-----------------+
> | pixel | 0 0 0 1 1 1 2 2 |
> +-------+-----------------+
>
> So, there are a nuber of places in the tinydrm pipline where this format

number

> needs to be taken into consideration.

> + * tinydrm_rgb565_to_st7586 - Convert RGB565 to ST7586 clip buffer

How this can be generic tinydrm helper?
Why driver can't handle it by its own and avoid spreading stuff into
generic header?

> +void tinydrm_rgb565_to_st7586(u8 *dst, void *vaddr,

> + * tinydrm_xrgb8888_to_st7586 - Convert XRGB8888 to ST7586 clip buffer

> +void tinydrm_xrgb8888_to_st7586(u8 *dst, void *vaddr,

Ditto.

> -       switch (fb->format->format) {
> -       case DRM_FORMAT_RGB565:
> -               if (swap)
> -                       tinydrm_swab16(dst, src, fb, clip);
> -               else
> -                       tinydrm_memcpy(dst, src, fb, clip);
> +       switch (pixel_fmt) {
> +       case MIPI_DCS_PIXEL_FMT_16BIT:
> +               switch (fb->format->format) {
> +               case DRM_FORMAT_RGB565:
> +                       if (swap)
> +                               tinydrm_swab16(dst, src, fb, clip);
> +                       else
> +                               tinydrm_memcpy(dst, src, fb, clip);
> +                       break;

Can't you use some other approach? Callbacks? Plugins?

> +       switch (mipi->pixel_fmt) {
> +       case MIPI_DCS_PIXEL_FMT_16BIT:
> +               len = width * height * sizeof(u16);
> +               break;
> +       case MIPI_DCS_PIXEL_FMT_ST7586_332:
> +               width = (width + 2) / 3;
> +               len = width * height;
> +               break;

Ditto.

> +       case MIPI_DCS_PIXEL_FMT_ST7586_332:
> +               /* 3 pixels per byte */
> +               bufsize = (mode->vdisplay + 2) / 3 * mode->hdisplay;
> +               break;

Ditto.

> -       if (cmd == MIPI_DCS_WRITE_MEMORY_START && !mipi->swap_bytes)
> +       if (cmd == MIPI_DCS_WRITE_MEMORY_START && !mipi->swap_bytes &&
> +           mipi->pixel_fmt != MIPI_DCS_PIXEL_FMT_ST7586_332)

Ditto.

If we allow this we end up to have 100500 LOCs in tinydrm-helpers.c
which will have nothing to do with the framework itself.



-- 
With Best Regards,
Andy Shevchenko

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display David Lechner <david@lechnology.com> - 2017-07-29 21:20 +0200
  [PATCH 4/6] drm/tinydrm: mipi-panel: refactor to use driver id David Lechner <david@lechnology.com> - 2017-07-29 21:20 +0200
    Re: [PATCH 4/6] drm/tinydrm: mipi-panel: refactor to use driver id Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-30 20:30 +0200
  [PATCH 5/6] drm/tinydrm: add support for LEGO MINDSTORMS EV3 LCD David Lechner <david@lechnology.com> - 2017-07-29 21:20 +0200
    Re: [PATCH 5/6] drm/tinydrm: add support for LEGO MINDSTORMS EV3 LCD Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-30 20:30 +0200
  [PATCH 3/6] drm/tinydrm: rename mi028qt module to mipi-panel David Lechner <david@lechnology.com> - 2017-07-29 21:20 +0200
    Re: [PATCH 3/6] drm/tinydrm: rename mi028qt module to mipi-panel David Lechner <david@lechnology.com> - 2017-07-29 21:40 +0200
  [PATCH 6/6] ARM: dts: da850-lego-ev3: Add node for LCD display David Lechner <david@lechnology.com> - 2017-07-29 21:20 +0200
  [PATCH 2/6] drm/tinydrm: add helpers for ST7586 controllers David Lechner <david@lechnology.com> - 2017-07-29 21:20 +0200
    Re: [PATCH 2/6] drm/tinydrm: add helpers for ST7586 controllers Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-30 20:20 +0200
  Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display David Lechner <david@lechnology.com> - 2017-07-29 21:50 +0200
    Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display Noralf Trønnes <noralf@tronnes.org> - 2017-07-30 19:20 +0200
      Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display David Lechner <david@lechnology.com> - 2017-08-01 19:00 +0200
        Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display Noralf Trønnes <noralf@tronnes.org> - 2017-08-01 20:10 +0200
          Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display David Lechner <david@lechnology.com> - 2017-08-02 00:30 +0200
            Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display Noralf Trønnes <noralf@tronnes.org> - 2017-08-02 10:10 +0200
              Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display David Lechner <david@lechnology.com> - 2017-08-02 18:10 +0200
                Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display Daniel Vetter <daniel@ffwll.ch> - 2017-08-03 12:10 +0200
            Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display Noralf Trønnes <noralf@tronnes.org> - 2017-08-03 16:10 +0200
              Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display David Lechner <david@lechnology.com> - 2017-08-03 17:20 +0200
                Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-08-03 19:10 +0200
                Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-08-03 19:20 +0200
                Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display Noralf Trønnes <noralf@tronnes.org> - 2017-08-03 22:20 +0200
                Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display David Lechner <david@lechnology.com> - 2017-08-04 03:10 +0200
                Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display David Lechner <david@lechnology.com> - 2017-08-04 03:20 +0200
  Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display Noralf Trønnes <noralf@tronnes.org> - 2017-07-30 19:20 +0200
  Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-30 20:30 +0200
    Re: [PATCH 0/6] Support for LEGO MINDSTORMS EV3 LCD display Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-30 20:30 +0200

csiph-web