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
This commit is contained in:
parent
ae46a57d52
commit
83be6a3ceb
|
@ -281,6 +281,12 @@ struct ast_vbios_mode_info {
|
||||||
const struct ast_vbios_enhtable *enh_table;
|
const struct ast_vbios_enhtable *enh_table;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ast_crtc_state {
|
||||||
|
struct drm_crtc_state base;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define to_ast_crtc_state(state) container_of(state, struct ast_crtc_state, base)
|
||||||
|
|
||||||
extern int ast_mode_init(struct drm_device *dev);
|
extern int ast_mode_init(struct drm_device *dev);
|
||||||
extern void ast_mode_fini(struct drm_device *dev);
|
extern void ast_mode_fini(struct drm_device *dev);
|
||||||
|
|
||||||
|
|
|
@ -884,6 +884,31 @@ static void ast_crtc_destroy(struct drm_crtc *crtc)
|
||||||
kfree(crtc);
|
kfree(crtc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct drm_crtc_state *
|
||||||
|
ast_crtc_atomic_duplicate_state(struct drm_crtc *crtc)
|
||||||
|
{
|
||||||
|
struct ast_crtc_state *new_ast_state;
|
||||||
|
|
||||||
|
if (WARN_ON(!crtc->state))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
new_ast_state = kmalloc(sizeof(*new_ast_state), GFP_KERNEL);
|
||||||
|
if (!new_ast_state)
|
||||||
|
return NULL;
|
||||||
|
__drm_atomic_helper_crtc_duplicate_state(crtc, &new_ast_state->base);
|
||||||
|
|
||||||
|
return &new_ast_state->base;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ast_crtc_atomic_destroy_state(struct drm_crtc *crtc,
|
||||||
|
struct drm_crtc_state *state)
|
||||||
|
{
|
||||||
|
struct ast_crtc_state *ast_state = to_ast_crtc_state(state);
|
||||||
|
|
||||||
|
__drm_atomic_helper_crtc_destroy_state(&ast_state->base);
|
||||||
|
kfree(ast_state);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct drm_crtc_funcs ast_crtc_funcs = {
|
static const struct drm_crtc_funcs ast_crtc_funcs = {
|
||||||
.reset = drm_atomic_helper_crtc_reset,
|
.reset = drm_atomic_helper_crtc_reset,
|
||||||
.set_config = drm_crtc_helper_set_config,
|
.set_config = drm_crtc_helper_set_config,
|
||||||
|
@ -891,8 +916,8 @@ static const struct drm_crtc_funcs ast_crtc_funcs = {
|
||||||
.destroy = ast_crtc_destroy,
|
.destroy = ast_crtc_destroy,
|
||||||
.set_config = drm_atomic_helper_set_config,
|
.set_config = drm_atomic_helper_set_config,
|
||||||
.page_flip = drm_atomic_helper_page_flip,
|
.page_flip = drm_atomic_helper_page_flip,
|
||||||
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
|
.atomic_duplicate_state = ast_crtc_atomic_duplicate_state,
|
||||||
.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
|
.atomic_destroy_state = ast_crtc_atomic_destroy_state,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int ast_crtc_init(struct drm_device *dev)
|
static int ast_crtc_init(struct drm_device *dev)
|
||||||
|
|
Loading…
Reference in New Issue