]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm: gma500: remove dead code and pointless local lut storage
authorPeter Rosin <peda@axentia.se>
Thu, 13 Jul 2017 16:25:32 +0000 (18:25 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 4 Aug 2017 09:35:51 +0000 (11:35 +0200)
The redundant fb helpers .gamma_set and .gamma_get are no longer
used. Remove the dead code and hook up the crtc .gamma_set
to use the crtc gamma_store directly instead of duplicating that
info locally.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20170713162538.22788-9-peda@axentia.se
drivers/gpu/drm/gma500/framebuffer.c
drivers/gpu/drm/gma500/gma_display.c
drivers/gpu/drm/gma500/psb_intel_display.c
drivers/gpu/drm/gma500/psb_intel_drv.h

index 7da70b6c83f0163b30b64b4cde74662ff2db132c..2570c7f647a637f3ea5eabf4030e77888116a33b 100644 (file)
@@ -479,26 +479,6 @@ static struct drm_framebuffer *psb_user_framebuffer_create
        return psb_framebuffer_create(dev, cmd, r);
 }
 
-static void psbfb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
-                                                       u16 blue, int regno)
-{
-       struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
-
-       gma_crtc->lut_r[regno] = red >> 8;
-       gma_crtc->lut_g[regno] = green >> 8;
-       gma_crtc->lut_b[regno] = blue >> 8;
-}
-
-static void psbfb_gamma_get(struct drm_crtc *crtc, u16 *red,
-                                       u16 *green, u16 *blue, int regno)
-{
-       struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
-
-       *red = gma_crtc->lut_r[regno] << 8;
-       *green = gma_crtc->lut_g[regno] << 8;
-       *blue = gma_crtc->lut_b[regno] << 8;
-}
-
 static int psbfb_probe(struct drm_fb_helper *helper,
                                struct drm_fb_helper_surface_size *sizes)
 {
@@ -525,8 +505,6 @@ static int psbfb_probe(struct drm_fb_helper *helper,
 }
 
 static const struct drm_fb_helper_funcs psb_fb_helper_funcs = {
-       .gamma_set = psbfb_gamma_set,
-       .gamma_get = psbfb_gamma_get,
        .fb_probe = psbfb_probe,
 };
 
index e7fd356acf2e2e7613127388c4f3900961a2f866..f3c48a2be71b87088e81becf739786bd7dc94755 100644 (file)
@@ -144,33 +144,32 @@ void gma_crtc_load_lut(struct drm_crtc *crtc)
        struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
        const struct psb_offset *map = &dev_priv->regmap[gma_crtc->pipe];
        int palreg = map->palette;
+       u16 *r, *g, *b;
        int i;
 
        /* The clocks have to be on to load the palette. */
        if (!crtc->enabled)
                return;
 
+       r = crtc->gamma_store;
+       g = r + crtc->gamma_size;
+       b = g + crtc->gamma_size;
+
        if (gma_power_begin(dev, false)) {
                for (i = 0; i < 256; i++) {
                        REG_WRITE(palreg + 4 * i,
-                                 ((gma_crtc->lut_r[i] +
-                                 gma_crtc->lut_adj[i]) << 16) |
-                                 ((gma_crtc->lut_g[i] +
-                                 gma_crtc->lut_adj[i]) << 8) |
-                                 (gma_crtc->lut_b[i] +
-                                 gma_crtc->lut_adj[i]));
+                                 (((*r++ >> 8) + gma_crtc->lut_adj[i]) << 16) |
+                                 (((*g++ >> 8) + gma_crtc->lut_adj[i]) << 8) |
+                                 ((*b++ >> 8) + gma_crtc->lut_adj[i]));
                }
                gma_power_end(dev);
        } else {
                for (i = 0; i < 256; i++) {
                        /* FIXME: Why pipe[0] and not pipe[..._crtc->pipe]? */
                        dev_priv->regs.pipe[0].palette[i] =
-                                 ((gma_crtc->lut_r[i] +
-                                 gma_crtc->lut_adj[i]) << 16) |
-                                 ((gma_crtc->lut_g[i] +
-                                 gma_crtc->lut_adj[i]) << 8) |
-                                 (gma_crtc->lut_b[i] +
-                                 gma_crtc->lut_adj[i]);
+                               (((*r++ >> 8) + gma_crtc->lut_adj[i]) << 16) |
+                               (((*g++ >> 8) + gma_crtc->lut_adj[i]) << 8) |
+                               ((*b++ >> 8) + gma_crtc->lut_adj[i]);
                }
 
        }
@@ -180,15 +179,6 @@ int gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue,
                       u32 size,
                       struct drm_modeset_acquire_ctx *ctx)
 {
-       struct gma_crtc *gma_crtc = to_gma_crtc(crtc);
-       int i;
-
-       for (i = 0; i < size; i++) {
-               gma_crtc->lut_r[i] = red[i] >> 8;
-               gma_crtc->lut_g[i] = green[i] >> 8;
-               gma_crtc->lut_b[i] = blue[i] >> 8;
-       }
-
        gma_crtc_load_lut(crtc);
 
        return 0;
index 7b6c849250984149f871ea9075b995def2291021..8762efaef2839ca5b1582f0a195025d7e382ef90 100644 (file)
@@ -518,13 +518,8 @@ void psb_intel_crtc_init(struct drm_device *dev, int pipe,
        gma_crtc->pipe = pipe;
        gma_crtc->plane = pipe;
 
-       for (i = 0; i < 256; i++) {
-               gma_crtc->lut_r[i] = i;
-               gma_crtc->lut_g[i] = i;
-               gma_crtc->lut_b[i] = i;
-
+       for (i = 0; i < 256; i++)
                gma_crtc->lut_adj[i] = 0;
-       }
 
        gma_crtc->mode_dev = mode_dev;
        gma_crtc->cursor_addr = 0;
index 6a10215fc42d4f6ca2877390721253a34cb2338c..e8e4ea14b12ba4f2bb8474e7941b9eec858f7cfe 100644 (file)
@@ -172,7 +172,6 @@ struct gma_crtc {
        int plane;
        uint32_t cursor_addr;
        struct gtt_range *cursor_gt;
-       u8 lut_r[256], lut_g[256], lut_b[256];
        u8 lut_adj[256];
        struct psb_intel_framebuffer *fbdev_fb;
        /* a mode_set for fbdev users on this crtc */