Skip to content

Commit 83be6a3

Browse files
committed
drm/ast: Introduce struct ast_crtc_state
AST-specific CRTC state can be placed in the new struct ast_crtc_state. The atomic check functions of the CRTC and the primary plane will store the VBIOS mode info and the framebuffer format here. The CRTC will consume these during atomic_flush(). Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20191202111557.15176-6-tzimmermann@suse.de
1 parent ae46a57 commit 83be6a3

2 files changed

Lines changed: 33 additions & 2 deletions

File tree

‎drivers/gpu/drm/ast/ast_drv.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,12 @@ struct ast_vbios_mode_info {
281281
const struct ast_vbios_enhtable *enh_table;
282282
};
283283

284+
struct ast_crtc_state {
285+
struct drm_crtc_state base;
286+
};
287+
288+
#define to_ast_crtc_state(state) container_of(state, struct ast_crtc_state, base)
289+
284290
extern int ast_mode_init(struct drm_device *dev);
285291
extern void ast_mode_fini(struct drm_device *dev);
286292

‎drivers/gpu/drm/ast/ast_mode.c‎

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,15 +884,40 @@ static void ast_crtc_destroy(struct drm_crtc *crtc)
884884
kfree(crtc);
885885
}
886886

887+
static struct drm_crtc_state *
888+
ast_crtc_atomic_duplicate_state(struct drm_crtc *crtc)
889+
{
890+
struct ast_crtc_state *new_ast_state;
891+
892+
if (WARN_ON(!crtc->state))
893+
return NULL;
894+
895+
new_ast_state = kmalloc(sizeof(*new_ast_state), GFP_KERNEL);
896+
if (!new_ast_state)
897+
return NULL;
898+
__drm_atomic_helper_crtc_duplicate_state(crtc, &new_ast_state->base);
899+
900+
return &new_ast_state->base;
901+
}
902+
903+
static void ast_crtc_atomic_destroy_state(struct drm_crtc *crtc,
904+
struct drm_crtc_state *state)
905+
{
906+
struct ast_crtc_state *ast_state = to_ast_crtc_state(state);
907+
908+
__drm_atomic_helper_crtc_destroy_state(&ast_state->base);
909+
kfree(ast_state);
910+
}
911+
887912
static const struct drm_crtc_funcs ast_crtc_funcs = {
888913
.reset = drm_atomic_helper_crtc_reset,
889914
.set_config = drm_crtc_helper_set_config,
890915
.gamma_set = drm_atomic_helper_legacy_gamma_set,
891916
.destroy = ast_crtc_destroy,
892917
.set_config = drm_atomic_helper_set_config,
893918
.page_flip = drm_atomic_helper_page_flip,
894-
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
895-
.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
919+
.atomic_duplicate_state = ast_crtc_atomic_duplicate_state,
920+
.atomic_destroy_state = ast_crtc_atomic_destroy_state,
896921
};
897922

898923
static int ast_crtc_init(struct drm_device *dev)

0 commit comments

Comments
 (0)