From: Peter Rosin <peda@axentia.se>
To: linux-kernel@vger.kernel.org
Cc: "Peter Rosin" <peda@axentia.se>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"David Airlie" <airlied@linux.ie>,
"Dave Airlie" <airlied@redhat.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Daniel Vetter" <daniel.vetter@intel.com>,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Sean Paul" <seanpaul@chromium.org>,
"Patrik Jakobsson" <patrik.r.jakobsson@gmail.com>,
"Ben Skeggs" <bskeggs@redhat.com>,
"Yannick Fertre" <yannick.fertre@st.com>,
"Philippe Cornu" <philippe.cornu@st.com>,
"Benjamin Gaignard" <benjamin.gaignard@linaro.org>,
"Vincent Abriou" <vincent.abriou@st.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
virtualization@lists.linux-foundation.org,
intel-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org,
"Boris Brezillon" <boris.brezillon@free-electrons.com>
Subject: [PATCH 03/11] drm: ast: remove dead code and pointless local lut storage
Date: Tue, 20 Jun 2017 21:25:27 +0200 [thread overview]
Message-ID: <1497986735-14418-4-git-send-email-peda@axentia.se> (raw)
In-Reply-To: <1497986735-14418-1-git-send-email-peda@axentia.se>
The redundant fb helpers .load_lut, .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.
Signed-off-by: Peter Rosin <peda@axentia.se>
---
drivers/gpu/drm/ast/ast_drv.h | 1 -
drivers/gpu/drm/ast/ast_fb.c | 20 --------------------
drivers/gpu/drm/ast/ast_mode.c | 26 ++++++--------------------
3 files changed, 6 insertions(+), 41 deletions(-)
diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
index 8880f0b..569a148 100644
--- a/drivers/gpu/drm/ast/ast_drv.h
+++ b/drivers/gpu/drm/ast/ast_drv.h
@@ -245,7 +245,6 @@ struct ast_connector {
struct ast_crtc {
struct drm_crtc base;
- u8 lut_r[256], lut_g[256], lut_b[256];
struct drm_gem_object *cursor_bo;
uint64_t cursor_addr;
int cursor_width, cursor_height;
diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
index 4ad4acd..dbabcac 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -255,27 +255,7 @@ static int astfb_create(struct drm_fb_helper *helper,
return ret;
}
-static void ast_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
- u16 blue, int regno)
-{
- struct ast_crtc *ast_crtc = to_ast_crtc(crtc);
- ast_crtc->lut_r[regno] = red >> 8;
- ast_crtc->lut_g[regno] = green >> 8;
- ast_crtc->lut_b[regno] = blue >> 8;
-}
-
-static void ast_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
- u16 *blue, int regno)
-{
- struct ast_crtc *ast_crtc = to_ast_crtc(crtc);
- *red = ast_crtc->lut_r[regno] << 8;
- *green = ast_crtc->lut_g[regno] << 8;
- *blue = ast_crtc->lut_b[regno] << 8;
-}
-
static const struct drm_fb_helper_funcs ast_fb_helper_funcs = {
- .gamma_set = ast_fb_gamma_set,
- .gamma_get = ast_fb_gamma_get,
.fb_probe = astfb_create,
};
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index aaef0a6..724c16b 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -63,15 +63,18 @@ static inline void ast_load_palette_index(struct ast_private *ast,
static void ast_crtc_load_lut(struct drm_crtc *crtc)
{
struct ast_private *ast = crtc->dev->dev_private;
- struct ast_crtc *ast_crtc = to_ast_crtc(crtc);
+ u16 *r, *g, *b;
int i;
if (!crtc->enabled)
return;
+ r = crtc->gamma_store;
+ g = r + crtc->gamma_size;
+ b = g + crtc->gamma_size;
+
for (i = 0; i < 256; i++)
- ast_load_palette_index(ast, i, ast_crtc->lut_r[i],
- ast_crtc->lut_g[i], ast_crtc->lut_b[i]);
+ ast_load_palette_index(ast, i, *r++ >> 8, *g++ >> 8, *b++ >> 8);
}
static bool ast_get_vbios_mode_info(struct drm_crtc *crtc, struct drm_display_mode *mode,
@@ -633,7 +636,6 @@ static const struct drm_crtc_helper_funcs ast_crtc_helper_funcs = {
.mode_set = ast_crtc_mode_set,
.mode_set_base = ast_crtc_mode_set_base,
.disable = ast_crtc_disable,
- .load_lut = ast_crtc_load_lut,
.prepare = ast_crtc_prepare,
.commit = ast_crtc_commit,
@@ -648,15 +650,6 @@ static int ast_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green,
u16 *blue, uint32_t size,
struct drm_modeset_acquire_ctx *ctx)
{
- struct ast_crtc *ast_crtc = to_ast_crtc(crtc);
- int i;
-
- /* userspace palettes are always correct as is */
- for (i = 0; i < size; i++) {
- ast_crtc->lut_r[i] = red[i] >> 8;
- ast_crtc->lut_g[i] = green[i] >> 8;
- ast_crtc->lut_b[i] = blue[i] >> 8;
- }
ast_crtc_load_lut(crtc);
return 0;
@@ -681,7 +674,6 @@ static const struct drm_crtc_funcs ast_crtc_funcs = {
static int ast_crtc_init(struct drm_device *dev)
{
struct ast_crtc *crtc;
- int i;
crtc = kzalloc(sizeof(struct ast_crtc), GFP_KERNEL);
if (!crtc)
@@ -690,12 +682,6 @@ static int ast_crtc_init(struct drm_device *dev)
drm_crtc_init(dev, &crtc->base, &ast_crtc_funcs);
drm_mode_crtc_set_gamma_size(&crtc->base, 256);
drm_crtc_helper_add(&crtc->base, &ast_crtc_helper_funcs);
-
- for (i = 0; i < 256; i++) {
- crtc->lut_r[i] = i;
- crtc->lut_g[i] = i;
- crtc->lut_b[i] = i;
- }
return 0;
}
--
2.1.4
next prev parent reply other threads:[~2017-06-20 19:25 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-20 19:25 [PATCH 00/11] improve the fb_setcmap helper Peter Rosin
2017-06-20 19:25 ` [PATCH 01/11] drm/fb-helper: do a generic fb_setcmap helper in terms of crtc .gamma_set Peter Rosin
2017-06-21 7:38 ` Daniel Vetter
2017-06-21 7:59 ` Michel Dänzer
2017-06-21 8:14 ` [Nouveau] " Daniel Vetter
2017-06-21 8:36 ` Michel Dänzer
2017-06-21 9:40 ` Peter Rosin
2017-06-22 6:36 ` Daniel Vetter
2017-06-22 8:48 ` Peter Rosin
2017-06-23 8:40 ` Daniel Vetter
2017-06-20 19:25 ` [PATCH 02/11] drm: amd: remove dead code and pointless local lut storage Peter Rosin
2017-06-20 19:25 ` Peter Rosin [this message]
2017-06-20 19:25 ` [PATCH 04/11] drm: cirrus: " Peter Rosin
2017-06-20 19:25 ` [PATCH 05/11] dmr: gma500: " Peter Rosin
2017-06-20 19:25 ` [PATCH 06/11] drm: i915: " Peter Rosin
2017-06-20 19:25 ` [PATCH 07/11] drm: mgag200: " Peter Rosin
2017-06-20 19:25 ` [PATCH 08/11] drm: nouveau: " Peter Rosin
2017-06-21 10:35 ` Peter Rosin
2017-06-20 19:25 ` [PATCH 09/11] drm: radeon: " Peter Rosin
2017-06-20 19:25 ` [PATCH 10/11] drm: stm: " Peter Rosin
2017-06-20 19:25 ` [PATCH 11/11] drm: remove unused and redundant callbacks Peter Rosin
2017-06-21 16:34 ` kbuild test robot
2017-06-22 6:37 ` Daniel Vetter
2017-06-22 7:13 ` Boris Brezillon
2017-06-21 7:40 ` [PATCH 00/11] improve the fb_setcmap helper Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1497986735-14418-4-git-send-email-peda@axentia.se \
--to=peda@axentia.se \
--cc=airlied@linux.ie \
--cc=airlied@redhat.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=benjamin.gaignard@linaro.org \
--cc=boris.brezillon@free-electrons.com \
--cc=bskeggs@redhat.com \
--cc=christian.koenig@amd.com \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=patrik.r.jakobsson@gmail.com \
--cc=philippe.cornu@st.com \
--cc=seanpaul@chromium.org \
--cc=vincent.abriou@st.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=yannick.fertre@st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).