Hi! While trying to get CLUT support for the atmel_hlcdc driver, and specifically for the emulated fbdev interface, I received some push-back that my feeble in-driver attempts should be solved by the core. This is my attempt to do it right. I have obviously not tested all of this with more than a compile, but patches 1 through 5 are enough to make the atmel-hlcdc driver do what I need. The rest is just lots of removals and cleanup made possible by the improved core. Please test, I would not be surprised if I have fouled up some bit-manipulation somewhere, or if I have misunderstood something about atomics... Changes since v2: - Added patch 1/16 which factors out pseudo-palette handling. - Removed the if (cmap->start + cmap->len < cmap->start) sanity check on the assumption that the fbdev core handles it. - Added patch 4/16 which factors out atomic state and commit handling from drm_atomic_helper_legacy_gamma_set to drm_mode_gamma_set_ioctl. - Do one atomic commit for all affected crtc. - Removed a now obsolete note in include/drm/drm_crtc.h (ammended the last patch). - Cc list is getting long, so I have redused the list for the individual patches. If you would like to get the full series (or nothing at all) for the next round (if that is needed) just say so. Changes since v1: - Rebased to next-20170621 - Split 1/11 into a preparatory patch, a cleanup patch and then the meat in 3/14. - Handle pseudo-palette for FB_VISUAL_TRUECOLOR. - Removed the empty .gamma_get/.gamma_set fb helpers from the armada driver that I had somehow managed to ignore but which 0day found real quick. - Be less judgemental on drivers only providing .gamma_get and .gamma_set, but no .load_lut. That's actually a valid thing to do if you only need pseudo-palette for FB_VISUAL_TRUECOLOR. - Add a comment about colliding bitfields in the nouveau driver. - Remove gamma_set/gamma_get declarations from the radeon driver (the definitions were removed in v1). Cheers, peda Peter Rosin (16): drm/fb-helper: factor out pseudo-palette drm/fb-helper: keep the .gamma_store updated in drm_fb_helper_setcmap drm/fb-helper: remove drm_fb_helper_save_lut_atomic drm/color-mgmt: move atomic state/commit out from .gamma_set drm/fb-helper: do a generic fb_setcmap helper in terms of crtc .gamma_set drm: amd: remove dead code and pointless local lut storage drm: armada: remove dead empty functions drm: ast: remove dead code and pointless local lut storage drm: cirrus: remove dead code and pointless local lut storage drm: gma500: remove dead code and pointless local lut storage drm: i915: remove dead code and pointless local lut storage drm: mgag200: remove dead code and pointless local lut storage drm: nouveau: remove dead code and pointless local lut storage drm: radeon: remove dead code and pointless local lut storage drm: stm: remove dead code and pointless local lut storage drm: remove unused and redundant callbacks drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 24 ---- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 29 ++--- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 29 ++--- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 29 ++--- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 29 ++--- drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 25 +--- drivers/gpu/drm/armada/armada_crtc.c | 10 -- drivers/gpu/drm/armada/armada_crtc.h | 2 - drivers/gpu/drm/armada/armada_fbdev.c | 2 - drivers/gpu/drm/ast/ast_drv.h | 1 - drivers/gpu/drm/ast/ast_fb.c | 20 --- drivers/gpu/drm/ast/ast_mode.c | 28 +--- drivers/gpu/drm/cirrus/cirrus_drv.h | 8 -- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 2 - drivers/gpu/drm/cirrus/cirrus_mode.c | 73 +++-------- drivers/gpu/drm/drm_atomic_helper.c | 37 ++---- drivers/gpu/drm/drm_color_mgmt.c | 27 +++- drivers/gpu/drm/drm_fb_helper.c | 195 +++++++++++++++++----------- drivers/gpu/drm/gma500/framebuffer.c | 22 ---- drivers/gpu/drm/gma500/gma_display.c | 34 ++--- drivers/gpu/drm/gma500/gma_display.h | 2 +- drivers/gpu/drm/gma500/psb_intel_display.c | 7 +- drivers/gpu/drm/gma500/psb_intel_drv.h | 1 - drivers/gpu/drm/i915/intel_drv.h | 1 - drivers/gpu/drm/i915/intel_fbdev.c | 31 ----- drivers/gpu/drm/mgag200/mgag200_drv.h | 5 - drivers/gpu/drm/mgag200/mgag200_fb.c | 2 - drivers/gpu/drm/mgag200/mgag200_mode.c | 64 +++------ drivers/gpu/drm/nouveau/dispnv04/crtc.c | 28 ++-- drivers/gpu/drm/nouveau/nouveau_crtc.h | 3 - drivers/gpu/drm/nouveau/nouveau_fbcon.c | 22 ---- drivers/gpu/drm/nouveau/nv50_display.c | 42 ++---- drivers/gpu/drm/radeon/atombios_crtc.c | 1 - drivers/gpu/drm/radeon/radeon_connectors.c | 7 +- drivers/gpu/drm/radeon/radeon_display.c | 73 +++++------ drivers/gpu/drm/radeon/radeon_fb.c | 2 - drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 1 - drivers/gpu/drm/radeon/radeon_mode.h | 4 - drivers/gpu/drm/stm/ltdc.c | 12 -- drivers/gpu/drm/stm/ltdc.h | 1 - drivers/gpu/drm/vc4/vc4_crtc.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 2 +- include/drm/drm_atomic_helper.h | 2 +- include/drm/drm_crtc.h | 11 +- include/drm/drm_fb_helper.h | 32 ----- include/drm/drm_modeset_helper_vtables.h | 16 --- 48 files changed, 301 insertions(+), 702 deletions(-) -- 2.1.4
Peter Rosin
2017-Jul-04 10:36 UTC
[PATCH v3 04/16] drm/color-mgmt: move atomic state/commit out from .gamma_set
Handle the atomics directly in the ioctl instead, in preparation for the fb_setcmap helper needing to commit the gamma map for several crtc in one commit. Signed-off-by: Peter Rosin <peda at axentia.se> --- drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 2 +- drivers/gpu/drm/ast/ast_mode.c | 2 +- drivers/gpu/drm/cirrus/cirrus_mode.c | 2 +- drivers/gpu/drm/drm_atomic_helper.c | 37 +++++++------------------------- drivers/gpu/drm/drm_color_mgmt.c | 27 ++++++++++++++++++++++- drivers/gpu/drm/gma500/gma_display.c | 2 +- drivers/gpu/drm/gma500/gma_display.h | 2 +- drivers/gpu/drm/mgag200/mgag200_mode.c | 2 +- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 2 +- drivers/gpu/drm/nouveau/nv50_display.c | 2 +- drivers/gpu/drm/radeon/radeon_display.c | 2 +- drivers/gpu/drm/vc4/vc4_crtc.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 2 +- include/drm/drm_atomic_helper.h | 2 +- include/drm/drm_crtc.h | 3 +-- 20 files changed, 52 insertions(+), 49 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c index 9f78c03..31c977b 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c @@ -2622,7 +2622,7 @@ static void dce_v10_0_cursor_reset(struct drm_crtc *crtc) static int dce_v10_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, uint32_t size, - struct drm_modeset_acquire_ctx *ctx) + struct drm_crtc_state *state) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); int i; diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c index 4bcf01d..cf42640 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c @@ -2642,7 +2642,7 @@ static void dce_v11_0_cursor_reset(struct drm_crtc *crtc) static int dce_v11_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, uint32_t size, - struct drm_modeset_acquire_ctx *ctx) + struct drm_crtc_state *state) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); int i; diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c index fd134a4..045014d 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c @@ -2494,7 +2494,7 @@ static void dce_v6_0_cursor_reset(struct drm_crtc *crtc) static int dce_v6_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, uint32_t size, - struct drm_modeset_acquire_ctx *ctx) + struct drm_crtc_state *state) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); int i; diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c index a9e8695..ee9389f 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c @@ -2473,7 +2473,7 @@ static void dce_v8_0_cursor_reset(struct drm_crtc *crtc) static int dce_v8_0_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, uint32_t size, - struct drm_modeset_acquire_ctx *ctx) + struct drm_crtc_state *state) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); int i; diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c index 90bb083..f194dfc 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c @@ -166,7 +166,7 @@ static void dce_virtual_bandwidth_update(struct amdgpu_device *adev) static int dce_virtual_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, uint32_t size, - struct drm_modeset_acquire_ctx *ctx) + struct drm_crtc_state *state) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); int i; diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index aaef0a6..6f0335b 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -646,7 +646,7 @@ static void ast_crtc_reset(struct drm_crtc *crtc) 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 drm_crtc_state *state) { struct ast_crtc *ast_crtc = to_ast_crtc(crtc); int i; diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c index 53f6f0f..2b4c2c3 100644 --- a/drivers/gpu/drm/cirrus/cirrus_mode.c +++ b/drivers/gpu/drm/cirrus/cirrus_mode.c @@ -328,7 +328,7 @@ static void cirrus_crtc_commit(struct drm_crtc *crtc) */ static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, uint32_t size, - struct drm_modeset_acquire_ctx *ctx) + struct drm_crtc_state *state) { struct cirrus_crtc *cirrus_crtc = to_cirrus_crtc(crtc); int i; diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 86d3093..3045f51 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3599,7 +3599,7 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_destroy_state); * @green: green correction table * @blue: green correction table * @size: size of the tables - * @ctx: lock acquire context + * @state: atomic CRTC state object to manipulate * * Implements support for legacy gamma correction table for drivers * that support color management through the DEGAMMA_LUT/GAMMA_LUT @@ -3609,28 +3609,19 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_destroy_state); int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, uint32_t size, - struct drm_modeset_acquire_ctx *ctx) + struct drm_crtc_state *state) { struct drm_device *dev = crtc->dev; struct drm_mode_config *config = &dev->mode_config; - struct drm_atomic_state *state; - struct drm_crtc_state *crtc_state; - struct drm_property_blob *blob = NULL; + struct drm_property_blob *blob; struct drm_color_lut *blob_data; int i, ret = 0; - state = drm_atomic_state_alloc(crtc->dev); - if (!state) - return -ENOMEM; - blob = drm_property_create_blob(dev, sizeof(struct drm_color_lut) * size, NULL); - if (IS_ERR(blob)) { - ret = PTR_ERR(blob); - blob = NULL; - goto fail; - } + if (IS_ERR(blob)) + return PTR_ERR(blob); /* Prepare GAMMA_LUT with the legacy values. */ blob_data = (struct drm_color_lut *) blob->data; @@ -3640,33 +3631,21 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, blob_data[i].blue = blue[i]; } - state->acquire_ctx = ctx; - crtc_state = drm_atomic_get_crtc_state(state, crtc); - if (IS_ERR(crtc_state)) { - ret = PTR_ERR(crtc_state); - goto fail; - } - /* Reset DEGAMMA_LUT and CTM properties. */ - ret = drm_atomic_crtc_set_property(crtc, crtc_state, + ret = drm_atomic_crtc_set_property(crtc, state, config->degamma_lut_property, 0); if (ret) goto fail; - ret = drm_atomic_crtc_set_property(crtc, crtc_state, + ret = drm_atomic_crtc_set_property(crtc, state, config->ctm_property, 0); if (ret) goto fail; - ret = drm_atomic_crtc_set_property(crtc, crtc_state, + ret = drm_atomic_crtc_set_property(crtc, state, config->gamma_lut_property, blob->base.id); - if (ret) - goto fail; - - ret = drm_atomic_commit(state); fail: - drm_atomic_state_put(state); drm_property_blob_put(blob); return ret; } diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c index 3eda500..864efe8 100644 --- a/drivers/gpu/drm/drm_color_mgmt.c +++ b/drivers/gpu/drm/drm_color_mgmt.c @@ -21,6 +21,7 @@ */ #include <drm/drmP.h> +#include <drm/drm_atomic.h> #include <drm/drm_crtc.h> #include <drm/drm_color_mgmt.h> @@ -218,9 +219,12 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_mode_crtc_lut *crtc_lut = data; + struct drm_crtc_state *crtc_state = NULL; + struct drm_atomic_state *state = NULL; struct drm_crtc *crtc; void *r_base, *g_base, *b_base; int size; + int atomic; struct drm_modeset_acquire_ctx ctx; int ret = 0; @@ -238,12 +242,28 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, if (crtc_lut->gamma_size != crtc->gamma_size) return -EINVAL; + atomic = drm_drv_uses_atomic_modeset(dev); + if (atomic) { + state = drm_atomic_state_alloc(dev); + if (!state) + return -ENOMEM; + } drm_modeset_acquire_init(&ctx, 0); retry: ret = drm_modeset_lock_all_ctx(dev, &ctx); if (ret) goto out; + if (atomic) { + state->acquire_ctx = &ctx; + + crtc_state = drm_atomic_get_crtc_state(state, crtc); + if (IS_ERR(crtc_state)) { + ret = PTR_ERR(crtc_state); + goto out; + } + } + size = crtc_lut->gamma_size * (sizeof(uint16_t)); r_base = crtc->gamma_store; if (copy_from_user(r_base, (void __user *)(unsigned long)crtc_lut->red, size)) { @@ -264,7 +284,10 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, } ret = crtc->funcs->gamma_set(crtc, r_base, g_base, b_base, - crtc->gamma_size, &ctx); + crtc->gamma_size, crtc_state); + + if (!ret && atomic) + ret = drm_atomic_commit(state); out: if (ret == -EDEADLK) { @@ -273,6 +296,8 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, } drm_modeset_drop_locks(&ctx); drm_modeset_acquire_fini(&ctx); + if (atomic) + drm_atomic_state_put(state); return ret; diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c index e7fd356..ccf8c33 100644 --- a/drivers/gpu/drm/gma500/gma_display.c +++ b/drivers/gpu/drm/gma500/gma_display.c @@ -178,7 +178,7 @@ void gma_crtc_load_lut(struct drm_crtc *crtc) int gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, u32 size, - struct drm_modeset_acquire_ctx *ctx) + struct drm_crtc_state *state) { struct gma_crtc *gma_crtc = to_gma_crtc(crtc); int i; diff --git a/drivers/gpu/drm/gma500/gma_display.h b/drivers/gpu/drm/gma500/gma_display.h index 239c374..c07b34f 100644 --- a/drivers/gpu/drm/gma500/gma_display.h +++ b/drivers/gpu/drm/gma500/gma_display.h @@ -74,7 +74,7 @@ extern int gma_crtc_cursor_move(struct drm_crtc *crtc, int x, int y); extern void gma_crtc_load_lut(struct drm_crtc *crtc); extern int gma_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, u32 size, - struct drm_modeset_acquire_ctx *ctx); + struct drm_crtc_state *state); extern void gma_crtc_dpms(struct drm_crtc *crtc, int mode); extern void gma_crtc_prepare(struct drm_crtc *crtc); extern void gma_crtc_commit(struct drm_crtc *crtc); diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index f4b5358..2141796 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c @@ -1397,7 +1397,7 @@ static void mga_crtc_commit(struct drm_crtc *crtc) */ static int mga_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, uint32_t size, - struct drm_modeset_acquire_ctx *ctx) + struct drm_crtc_state *state) { struct mga_crtc *mga_crtc = to_mga_crtc(crtc); int i; diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c index 4b4b0b4..f562824 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c @@ -789,7 +789,7 @@ nv_crtc_disable(struct drm_crtc *crtc) static int nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t size, - struct drm_modeset_acquire_ctx *ctx) + struct drm_crtc_state *state) { struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); int i; diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index e3132a2..f13fa74 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c @@ -2232,7 +2232,7 @@ nv50_head_help = { static int nv50_head_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t size, - struct drm_modeset_acquire_ctx *ctx) + struct drm_crtc_state *state) { struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); u32 i; diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 17d3daf..0ea575d 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c @@ -233,7 +233,7 @@ void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, static int radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, uint32_t size, - struct drm_modeset_acquire_ctx *ctx) + struct drm_crtc_state *state) { struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); int i; diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 403bbd5..fcc8dac 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -301,7 +301,7 @@ vc4_crtc_lut_load(struct drm_crtc *crtc) static int vc4_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t size, - struct drm_modeset_acquire_ctx *ctx) + struct drm_crtc_state *state) { struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc); u32 i; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 3d94ea6..d75c5da 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@ -1914,7 +1914,7 @@ static int vmw_du_update_layout(struct vmw_private *dev_priv, unsigned num, int vmw_du_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t size, - struct drm_modeset_acquire_ctx *ctx) + struct drm_crtc_state *state) { struct vmw_private *dev_priv = vmw_priv(crtc->dev); int i; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h index 5f8d678..9b2d8d3 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h @@ -255,7 +255,7 @@ void vmw_du_crtc_restore(struct drm_crtc *crtc); int vmw_du_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t size, - struct drm_modeset_acquire_ctx *ctx); + struct drm_crtc_state *state); int vmw_du_connector_set_property(struct drm_connector *connector, struct drm_property *property, uint64_t val); diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index f0a8678..a91e063 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -177,7 +177,7 @@ void drm_atomic_helper_connector_destroy_state(struct drm_connector *connector, int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, uint32_t size, - struct drm_modeset_acquire_ctx *ctx); + struct drm_crtc_state *state); /** * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 629a5fe..d442d30 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -368,8 +368,7 @@ struct drm_crtc_funcs { * hooks. */ int (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, - uint32_t size, - struct drm_modeset_acquire_ctx *ctx); + uint32_t size, struct drm_crtc_state *state); /** * @destroy: -- 2.1.4
Peter Rosin
2017-Jul-04 10:36 UTC
[PATCH v3 09/16] drm: cirrus: remove dead code and pointless local lut storage
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 at axentia.se> --- drivers/gpu/drm/cirrus/cirrus_drv.h | 8 ---- drivers/gpu/drm/cirrus/cirrus_fbdev.c | 2 - drivers/gpu/drm/cirrus/cirrus_mode.c | 71 ++++++++--------------------------- 3 files changed, 16 insertions(+), 65 deletions(-) diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.h b/drivers/gpu/drm/cirrus/cirrus_drv.h index 8690352..be2d7e48 100644 --- a/drivers/gpu/drm/cirrus/cirrus_drv.h +++ b/drivers/gpu/drm/cirrus/cirrus_drv.h @@ -96,7 +96,6 @@ struct cirrus_crtc { struct drm_crtc base; - u8 lut_r[256], lut_g[256], lut_b[256]; int last_dpms; bool enabled; }; @@ -180,13 +179,6 @@ cirrus_bo(struct ttm_buffer_object *bo) #define to_cirrus_obj(x) container_of(x, struct cirrus_gem_object, base) #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT) - /* cirrus_mode.c */ -void cirrus_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, - u16 blue, int regno); -void cirrus_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, - u16 *blue, int regno); - - /* cirrus_main.c */ int cirrus_device_init(struct cirrus_device *cdev, struct drm_device *ddev, diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c index 7fa58ee..1fedab0 100644 --- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c +++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c @@ -265,8 +265,6 @@ static int cirrus_fbdev_destroy(struct drm_device *dev, } static const struct drm_fb_helper_funcs cirrus_fb_helper_funcs = { - .gamma_set = cirrus_crtc_fb_gamma_set, - .gamma_get = cirrus_crtc_fb_gamma_get, .fb_probe = cirrusfb_create, }; diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c index 2b4c2c3..92ff7de 100644 --- a/drivers/gpu/drm/cirrus/cirrus_mode.c +++ b/drivers/gpu/drm/cirrus/cirrus_mode.c @@ -31,25 +31,6 @@ * This file contains setup code for the CRTC. */ -static void cirrus_crtc_load_lut(struct drm_crtc *crtc) -{ - struct cirrus_crtc *cirrus_crtc = to_cirrus_crtc(crtc); - struct drm_device *dev = crtc->dev; - struct cirrus_device *cdev = dev->dev_private; - int i; - - if (!crtc->enabled) - return; - - for (i = 0; i < CIRRUS_LUT_SIZE; i++) { - /* VGA registers */ - WREG8(PALETTE_INDEX, i); - WREG8(PALETTE_DATA, cirrus_crtc->lut_r[i]); - WREG8(PALETTE_DATA, cirrus_crtc->lut_g[i]); - WREG8(PALETTE_DATA, cirrus_crtc->lut_b[i]); - } -} - /* * The DRM core requires DPMS functions, but they make little sense in our * case and so are just stubs @@ -330,15 +311,25 @@ static int cirrus_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, u16 *blue, uint32_t size, struct drm_crtc_state *state) { - struct cirrus_crtc *cirrus_crtc = to_cirrus_crtc(crtc); + struct drm_device *dev = crtc->dev; + struct cirrus_device *cdev = dev->dev_private; + u16 *r, *g, *b; int i; - for (i = 0; i < size; i++) { - cirrus_crtc->lut_r[i] = red[i]; - cirrus_crtc->lut_g[i] = green[i]; - cirrus_crtc->lut_b[i] = blue[i]; + if (!crtc->enabled) + return 0; + + r = crtc->gamma_store; + g = r + crtc->gamma_size; + b = g + crtc->gamma_size; + + for (i = 0; i < CIRRUS_LUT_SIZE; i++) { + /* VGA registers */ + WREG8(PALETTE_INDEX, i); + WREG8(PALETTE_DATA, *r++ >> 8); + WREG8(PALETTE_DATA, *g++ >> 8); + WREG8(PALETTE_DATA, *b++ >> 8); } - cirrus_crtc_load_lut(crtc); return 0; } @@ -365,7 +356,6 @@ static const struct drm_crtc_helper_funcs cirrus_helper_funcs = { .mode_set_base = cirrus_crtc_mode_set_base, .prepare = cirrus_crtc_prepare, .commit = cirrus_crtc_commit, - .load_lut = cirrus_crtc_load_lut, }; /* CRTC setup */ @@ -373,7 +363,6 @@ static void cirrus_crtc_init(struct drm_device *dev) { struct cirrus_device *cdev = dev->dev_private; struct cirrus_crtc *cirrus_crtc; - int i; cirrus_crtc = kzalloc(sizeof(struct cirrus_crtc) + (CIRRUSFB_CONN_LIMIT * sizeof(struct drm_connector *)), @@ -387,37 +376,9 @@ static void cirrus_crtc_init(struct drm_device *dev) drm_mode_crtc_set_gamma_size(&cirrus_crtc->base, CIRRUS_LUT_SIZE); cdev->mode_info.crtc = cirrus_crtc; - for (i = 0; i < CIRRUS_LUT_SIZE; i++) { - cirrus_crtc->lut_r[i] = i; - cirrus_crtc->lut_g[i] = i; - cirrus_crtc->lut_b[i] = i; - } - drm_crtc_helper_add(&cirrus_crtc->base, &cirrus_helper_funcs); } -/** Sets the color ramps on behalf of fbcon */ -void cirrus_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, - u16 blue, int regno) -{ - struct cirrus_crtc *cirrus_crtc = to_cirrus_crtc(crtc); - - cirrus_crtc->lut_r[regno] = red; - cirrus_crtc->lut_g[regno] = green; - cirrus_crtc->lut_b[regno] = blue; -} - -/** Gets the color ramps on behalf of fbcon */ -void cirrus_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, - u16 *blue, int regno) -{ - struct cirrus_crtc *cirrus_crtc = to_cirrus_crtc(crtc); - - *red = cirrus_crtc->lut_r[regno]; - *green = cirrus_crtc->lut_g[regno]; - *blue = cirrus_crtc->lut_b[regno]; -} - static void cirrus_encoder_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) -- 2.1.4
Peter Rosin
2017-Jul-04 10:37 UTC
[Nouveau] [PATCH v3 13/16] drm: nouveau: remove dead code and pointless local lut storage
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 at axentia.se> --- drivers/gpu/drm/nouveau/dispnv04/crtc.c | 26 ++++++++------------- drivers/gpu/drm/nouveau/nouveau_crtc.h | 3 --- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 22 ------------------ drivers/gpu/drm/nouveau/nv50_display.c | 40 +++++++++++---------------------- 4 files changed, 22 insertions(+), 69 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c index f562824..b233412 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c @@ -764,13 +764,18 @@ nv_crtc_gamma_load(struct drm_crtc *crtc) struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); struct drm_device *dev = nv_crtc->base.dev; struct rgb { uint8_t r, g, b; } __attribute__((packed)) *rgbs; + u16 *r, *g, *b; int i; rgbs = (struct rgb *)nv04_display(dev)->mode_reg.crtc_reg[nv_crtc->index].DAC; + r = crtc->gamma_store; + g = r + crtc->gamma_size; + b = g + crtc->gamma_size; + for (i = 0; i < 256; i++) { - rgbs[i].r = nv_crtc->lut.r[i] >> 8; - rgbs[i].g = nv_crtc->lut.g[i] >> 8; - rgbs[i].b = nv_crtc->lut.b[i] >> 8; + rgbs[i].r = *r++ >> 8; + rgbs[i].g = *g++ >> 8; + rgbs[i].b = *b++ >> 8; } nouveau_hw_load_state_palette(dev, nv_crtc->index, &nv04_display(dev)->mode_reg); @@ -792,13 +797,6 @@ nv_crtc_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, struct drm_crtc_state *state) { struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); - int i; - - for (i = 0; i < size; i++) { - nv_crtc->lut.r[i] = r[i]; - nv_crtc->lut.g[i] = g[i]; - nv_crtc->lut.b[i] = b[i]; - } /* We need to know the depth before we upload, but it's possible to * get called before a framebuffer is bound. If this is the case, @@ -1095,7 +1093,6 @@ static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = { .mode_set = nv_crtc_mode_set, .mode_set_base = nv04_crtc_mode_set_base, .mode_set_base_atomic = nv04_crtc_mode_set_base_atomic, - .load_lut = nv_crtc_gamma_load, .disable = nv_crtc_disable, }; @@ -1103,17 +1100,12 @@ int nv04_crtc_create(struct drm_device *dev, int crtc_num) { struct nouveau_crtc *nv_crtc; - int ret, i; + int ret; nv_crtc = kzalloc(sizeof(*nv_crtc), GFP_KERNEL); if (!nv_crtc) return -ENOMEM; - for (i = 0; i < 256; i++) { - nv_crtc->lut.r[i] = i << 8; - nv_crtc->lut.g[i] = i << 8; - nv_crtc->lut.b[i] = i << 8; - } nv_crtc->lut.depth = 0; nv_crtc->index = crtc_num; diff --git a/drivers/gpu/drm/nouveau/nouveau_crtc.h b/drivers/gpu/drm/nouveau/nouveau_crtc.h index 050fcf3..b7a18fb 100644 --- a/drivers/gpu/drm/nouveau/nouveau_crtc.h +++ b/drivers/gpu/drm/nouveau/nouveau_crtc.h @@ -61,9 +61,6 @@ struct nouveau_crtc { struct { struct nouveau_bo *nvbo; - uint16_t r[256]; - uint16_t g[256]; - uint16_t b[256]; int depth; } lut; diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 2665a07..f770784 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c @@ -278,26 +278,6 @@ nouveau_fbcon_accel_init(struct drm_device *dev) info->fbops = &nouveau_fbcon_ops; } -static void nouveau_fbcon_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, - u16 blue, int regno) -{ - struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); - - nv_crtc->lut.r[regno] = red; - nv_crtc->lut.g[regno] = green; - nv_crtc->lut.b[regno] = blue; -} - -static void nouveau_fbcon_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, - u16 *blue, int regno) -{ - struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); - - *red = nv_crtc->lut.r[regno]; - *green = nv_crtc->lut.g[regno]; - *blue = nv_crtc->lut.b[regno]; -} - static void nouveau_fbcon_zfill(struct drm_device *dev, struct nouveau_fbdev *fbcon) { @@ -467,8 +447,6 @@ void nouveau_fbcon_gpu_lockup(struct fb_info *info) } static const struct drm_fb_helper_funcs nouveau_fbcon_helper_funcs = { - .gamma_set = nouveau_fbcon_gamma_set, - .gamma_get = nouveau_fbcon_gamma_get, .fb_probe = nouveau_fbcon_create, }; diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index f13fa74..93c66c0 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c @@ -2204,28 +2204,29 @@ nv50_head_lut_load(struct drm_crtc *crtc) struct nv50_disp *disp = nv50_disp(crtc->dev); struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); void __iomem *lut = nvbo_kmap_obj_iovirtual(nv_crtc->lut.nvbo); + u16 *r, *g, *b; int i; - for (i = 0; i < 256; i++) { - u16 r = nv_crtc->lut.r[i] >> 2; - u16 g = nv_crtc->lut.g[i] >> 2; - u16 b = nv_crtc->lut.b[i] >> 2; + r = crtc->gamma_store; + g = r + crtc->gamma_size; + b = g + crtc->gamma_size; + for (i = 0; i < 256; i++) { if (disp->disp->oclass < GF110_DISP) { - writew(r + 0x0000, lut + (i * 0x08) + 0); - writew(g + 0x0000, lut + (i * 0x08) + 2); - writew(b + 0x0000, lut + (i * 0x08) + 4); + writew((*r++ >> 2) + 0x0000, lut + (i * 0x08) + 0); + writew((*g++ >> 2) + 0x0000, lut + (i * 0x08) + 2); + writew((*b++ >> 2) + 0x0000, lut + (i * 0x08) + 4); } else { - writew(r + 0x6000, lut + (i * 0x20) + 0); - writew(g + 0x6000, lut + (i * 0x20) + 2); - writew(b + 0x6000, lut + (i * 0x20) + 4); + /* 0x6000 interferes with the 14-bit color??? */ + writew((*r++ >> 2) + 0x6000, lut + (i * 0x20) + 0); + writew((*g++ >> 2) + 0x6000, lut + (i * 0x20) + 2); + writew((*b++ >> 2) + 0x6000, lut + (i * 0x20) + 4); } } } static const struct drm_crtc_helper_funcs nv50_head_help = { - .load_lut = nv50_head_lut_load, .atomic_check = nv50_head_atomic_check, }; @@ -2234,15 +2235,6 @@ nv50_head_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t size, struct drm_crtc_state *state) { - struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); - u32 i; - - for (i = 0; i < size; i++) { - nv_crtc->lut.r[i] = r[i]; - nv_crtc->lut.g[i] = g[i]; - nv_crtc->lut.b[i] = b[i]; - } - nv50_head_lut_load(crtc); return 0; } @@ -2340,19 +2332,13 @@ nv50_head_create(struct drm_device *dev, int index) struct nv50_base *base; struct nv50_curs *curs; struct drm_crtc *crtc; - int ret, i; + int ret; head = kzalloc(sizeof(*head), GFP_KERNEL); if (!head) return -ENOMEM; head->base.index = index; - for (i = 0; i < 256; i++) { - head->base.lut.r[i] = i << 8; - head->base.lut.g[i] = i << 8; - head->base.lut.b[i] = i << 8; - } - ret = nv50_base_new(drm, head, &base); if (ret == 0) ret = nv50_curs_new(drm, head, &curs); -- 2.1.4
Daniel Vetter
2017-Jul-05 06:08 UTC
[Intel-gfx] [PATCH v3 00/16] improve the fb_setcmap helper
On Tue, Jul 04, 2017 at 12:36:56PM +0200, Peter Rosin wrote:> Hi! > > While trying to get CLUT support for the atmel_hlcdc driver, and > specifically for the emulated fbdev interface, I received some > push-back that my feeble in-driver attempts should be solved > by the core. This is my attempt to do it right. > > I have obviously not tested all of this with more than a compile, > but patches 1 through 5 are enough to make the atmel-hlcdc driver > do what I need. The rest is just lots of removals and cleanup made > possible by the improved core. > > Please test, I would not be surprised if I have fouled up some > bit-manipulation somewhere, or if I have misunderstood something > about atomics... > > Changes since v2: > - Added patch 1/16 which factors out pseudo-palette handling. > - Removed the if (cmap->start + cmap->len < cmap->start) > sanity check on the assumption that the fbdev core handles it. > - Added patch 4/16 which factors out atomic state and commit > handling from drm_atomic_helper_legacy_gamma_set to > drm_mode_gamma_set_ioctl. > - Do one atomic commit for all affected crtc. > - Removed a now obsolete note in include/drm/drm_crtc.h (ammended > the last patch). > - Cc list is getting long, so I have redused the list for the > individual patches. If you would like to get the full series > (or nothing at all) for the next round (if that is needed) just > say so.Is this still on top of my locking rework? I tried to apply patches 1-3, but there's minor conflicts ... -Daniel> > Changes since v1: > > - Rebased to next-20170621 > - Split 1/11 into a preparatory patch, a cleanup patch and then > the meat in 3/14. > - Handle pseudo-palette for FB_VISUAL_TRUECOLOR. > - Removed the empty .gamma_get/.gamma_set fb helpers from the > armada driver that I had somehow managed to ignore but which > 0day found real quick. > - Be less judgemental on drivers only providing .gamma_get and > .gamma_set, but no .load_lut. That's actually a valid thing > to do if you only need pseudo-palette for FB_VISUAL_TRUECOLOR. > - Add a comment about colliding bitfields in the nouveau driver. > - Remove gamma_set/gamma_get declarations from the radeon driver > (the definitions were removed in v1). > > Cheers, > peda > > Peter Rosin (16): > drm/fb-helper: factor out pseudo-palette > drm/fb-helper: keep the .gamma_store updated in drm_fb_helper_setcmap > drm/fb-helper: remove drm_fb_helper_save_lut_atomic > drm/color-mgmt: move atomic state/commit out from .gamma_set > drm/fb-helper: do a generic fb_setcmap helper in terms of crtc > .gamma_set > drm: amd: remove dead code and pointless local lut storage > drm: armada: remove dead empty functions > drm: ast: remove dead code and pointless local lut storage > drm: cirrus: remove dead code and pointless local lut storage > drm: gma500: remove dead code and pointless local lut storage > drm: i915: remove dead code and pointless local lut storage > drm: mgag200: remove dead code and pointless local lut storage > drm: nouveau: remove dead code and pointless local lut storage > drm: radeon: remove dead code and pointless local lut storage > drm: stm: remove dead code and pointless local lut storage > drm: remove unused and redundant callbacks > > drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 24 ---- > drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - > drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 29 ++--- > drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 29 ++--- > drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 29 ++--- > drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 29 ++--- > drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 25 +--- > drivers/gpu/drm/armada/armada_crtc.c | 10 -- > drivers/gpu/drm/armada/armada_crtc.h | 2 - > drivers/gpu/drm/armada/armada_fbdev.c | 2 - > drivers/gpu/drm/ast/ast_drv.h | 1 - > drivers/gpu/drm/ast/ast_fb.c | 20 --- > drivers/gpu/drm/ast/ast_mode.c | 28 +--- > drivers/gpu/drm/cirrus/cirrus_drv.h | 8 -- > drivers/gpu/drm/cirrus/cirrus_fbdev.c | 2 - > drivers/gpu/drm/cirrus/cirrus_mode.c | 73 +++-------- > drivers/gpu/drm/drm_atomic_helper.c | 37 ++---- > drivers/gpu/drm/drm_color_mgmt.c | 27 +++- > drivers/gpu/drm/drm_fb_helper.c | 195 +++++++++++++++++----------- > drivers/gpu/drm/gma500/framebuffer.c | 22 ---- > drivers/gpu/drm/gma500/gma_display.c | 34 ++--- > drivers/gpu/drm/gma500/gma_display.h | 2 +- > drivers/gpu/drm/gma500/psb_intel_display.c | 7 +- > drivers/gpu/drm/gma500/psb_intel_drv.h | 1 - > drivers/gpu/drm/i915/intel_drv.h | 1 - > drivers/gpu/drm/i915/intel_fbdev.c | 31 ----- > drivers/gpu/drm/mgag200/mgag200_drv.h | 5 - > drivers/gpu/drm/mgag200/mgag200_fb.c | 2 - > drivers/gpu/drm/mgag200/mgag200_mode.c | 64 +++------ > drivers/gpu/drm/nouveau/dispnv04/crtc.c | 28 ++-- > drivers/gpu/drm/nouveau/nouveau_crtc.h | 3 - > drivers/gpu/drm/nouveau/nouveau_fbcon.c | 22 ---- > drivers/gpu/drm/nouveau/nv50_display.c | 42 ++---- > drivers/gpu/drm/radeon/atombios_crtc.c | 1 - > drivers/gpu/drm/radeon/radeon_connectors.c | 7 +- > drivers/gpu/drm/radeon/radeon_display.c | 73 +++++------ > drivers/gpu/drm/radeon/radeon_fb.c | 2 - > drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 1 - > drivers/gpu/drm/radeon/radeon_mode.h | 4 - > drivers/gpu/drm/stm/ltdc.c | 12 -- > drivers/gpu/drm/stm/ltdc.h | 1 - > drivers/gpu/drm/vc4/vc4_crtc.c | 2 +- > drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 2 +- > drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 2 +- > include/drm/drm_atomic_helper.h | 2 +- > include/drm/drm_crtc.h | 11 +- > include/drm/drm_fb_helper.h | 32 ----- > include/drm/drm_modeset_helper_vtables.h | 16 --- > 48 files changed, 301 insertions(+), 702 deletions(-) > > -- > 2.1.4 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx-- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Peter Rosin
2017-Jul-05 08:09 UTC
[Nouveau] [Intel-gfx] [PATCH v3 00/16] improve the fb_setcmap helper
On 2017-07-05 08:08, Daniel Vetter wrote:> On Tue, Jul 04, 2017 at 12:36:56PM +0200, Peter Rosin wrote: >> Hi! >> >> While trying to get CLUT support for the atmel_hlcdc driver, and >> specifically for the emulated fbdev interface, I received some >> push-back that my feeble in-driver attempts should be solved >> by the core. This is my attempt to do it right. >> >> I have obviously not tested all of this with more than a compile, >> but patches 1 through 5 are enough to make the atmel-hlcdc driver >> do what I need. The rest is just lots of removals and cleanup made >> possible by the improved core. >> >> Please test, I would not be surprised if I have fouled up some >> bit-manipulation somewhere, or if I have misunderstood something >> about atomics... >> >> Changes since v2: >> - Added patch 1/16 which factors out pseudo-palette handling. >> - Removed the if (cmap->start + cmap->len < cmap->start) >> sanity check on the assumption that the fbdev core handles it. >> - Added patch 4/16 which factors out atomic state and commit >> handling from drm_atomic_helper_legacy_gamma_set to >> drm_mode_gamma_set_ioctl. >> - Do one atomic commit for all affected crtc. >> - Removed a now obsolete note in include/drm/drm_crtc.h (ammended >> the last patch). >> - Cc list is getting long, so I have redused the list for the >> individual patches. If you would like to get the full series >> (or nothing at all) for the next round (if that is needed) just >> say so. > > Is this still on top of my locking rework? I tried to apply patches 1-3, > but there's minor conflicts ... > -Danielv3 has the same base as v2. I collected your locking rework sometime after june 21, you have perhaps changed things since? I saw an update of that dpms patch you Cc me, but figured there were no significant changes that I needed to handle since I didn't get the full set this time either. A bad assumption it seems... Anyway, the base I have for v3 (and v2) is linux next-20170621 plus the following locking rework commits (in reverse order): Author: Thierry Reding <treding at nvidia.com> Date: Wed Jun 21 20:28:15 2017 +0200 Subject: drm/hisilicon: Remove custom FB helper deferred setup Author: Thierry Reding <treding at nvidia.com> Date: Wed Jun 21 20:28:14 2017 +0200 Subject: drm/exynos: Remove custom FB helper deferred setup Author: Thierry Reding <treding at nvidia.com> Date: Wed Jun 21 20:28:13 2017 +0200 Subject: drm/fb-helper: Support deferred setup Author: Daniel Vetter <daniel.vetter at ffwll.ch> Date: Wed Jun 21 20:28:12 2017 +0200 Subject: drm/fb-helper: Split dpms handling into legacy and atomic paths Author: Daniel Vetter <daniel.vetter at ffwll.ch> Date: Wed Jun 21 20:28:11 2017 +0200 Subject: drm/fb-helper: Stop using mode_config.mutex for internals Author: Daniel Vetter <daniel.vetter at ffwll.ch> Date: Wed Jun 21 20:28:10 2017 +0200 Subject: drm/fb-helper: Push locking into restore_fbdev_mode_atomic|legacy Author: Daniel Vetter <daniel.vetter at ffwll.ch> Date: Wed Jun 21 20:28:09 2017 +0200 Subject: drm/fb-helper: Push locking into pan_display_atomic|legacy Author: Daniel Vetter <daniel.vetter at ffwll.ch> Date: Wed Jun 21 20:28:08 2017 +0200 Subject: drm/fb-helper: Drop locking from the vsync wait ioctl code Author: Daniel Vetter <daniel.vetter at ffwll.ch> Date: Wed Jun 21 20:28:07 2017 +0200 Subject: drm/fb-helper: Push locking in fb_is_bound Author: Thierry Reding <treding at nvidia.com> Date: Wed Jun 21 20:28:06 2017 +0200 Subject: drm/fb-helper: Add top-level lock Author: Daniel Vetter <daniel.vetter at ffwll.ch> Date: Wed Jun 21 20:28:05 2017 +0200 Subject: drm/i915: Drop FBDEV #ifdev in mst code Author: Thierry Reding <treding at nvidia.com> Date: Wed Jun 21 20:28:04 2017 +0200 Subject: drm/fb-helper: Push down modeset lock into FB helpers Cheers, peda
Maybe Matching Threads
- [Intel-gfx] [PATCH v3 00/16] improve the fb_setcmap helper
- [Intel-gfx] [PATCH v3 00/16] improve the fb_setcmap helper
- [Intel-gfx] [PATCH v3 00/16] improve the fb_setcmap helper
- [PATCH v3 00/16] improve the fb_setcmap helper
- [PATCH v3 00/16] improve the fb_setcmap helper