2019-06-04 15:11:33 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2017-11-10 21:27:25 +07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017 NVIDIA CORPORATION. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TEGRA_PLANE_H
|
|
|
|
#define TEGRA_PLANE_H 1
|
|
|
|
|
|
|
|
#include <drm/drm_plane.h>
|
|
|
|
|
|
|
|
struct tegra_bo;
|
2017-12-14 19:37:53 +07:00
|
|
|
struct tegra_dc;
|
2017-11-10 21:27:25 +07:00
|
|
|
|
|
|
|
struct tegra_plane {
|
|
|
|
struct drm_plane base;
|
2017-12-14 19:37:53 +07:00
|
|
|
struct tegra_dc *dc;
|
2017-11-13 17:08:13 +07:00
|
|
|
unsigned int offset;
|
2017-11-10 21:27:25 +07:00
|
|
|
unsigned int index;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tegra_cursor {
|
|
|
|
struct tegra_plane base;
|
|
|
|
|
|
|
|
struct tegra_bo *bo;
|
|
|
|
unsigned int width;
|
|
|
|
unsigned int height;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct tegra_plane *to_tegra_plane(struct drm_plane *plane)
|
|
|
|
{
|
|
|
|
return container_of(plane, struct tegra_plane, base);
|
|
|
|
}
|
|
|
|
|
2018-05-04 21:39:59 +07:00
|
|
|
struct tegra_plane_legacy_blending_state {
|
|
|
|
bool alpha;
|
|
|
|
bool top;
|
|
|
|
};
|
|
|
|
|
2017-11-10 21:27:25 +07:00
|
|
|
struct tegra_plane_state {
|
|
|
|
struct drm_plane_state base;
|
|
|
|
|
2019-10-28 19:37:17 +07:00
|
|
|
struct sg_table *sgt[3];
|
|
|
|
dma_addr_t iova[3];
|
|
|
|
|
2017-11-10 21:27:25 +07:00
|
|
|
struct tegra_bo_tiling tiling;
|
|
|
|
u32 format;
|
|
|
|
u32 swap;
|
2017-12-20 15:39:14 +07:00
|
|
|
|
2018-03-19 23:20:46 +07:00
|
|
|
bool bottom_up;
|
|
|
|
|
2017-12-20 15:39:14 +07:00
|
|
|
/* used for legacy blending support only */
|
2018-05-04 21:39:59 +07:00
|
|
|
struct tegra_plane_legacy_blending_state blending[2];
|
2017-12-20 15:39:14 +07:00
|
|
|
bool opaque;
|
2017-11-10 21:27:25 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct tegra_plane_state *
|
|
|
|
to_tegra_plane_state(struct drm_plane_state *state)
|
|
|
|
{
|
|
|
|
if (state)
|
|
|
|
return container_of(state, struct tegra_plane_state, base);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern const struct drm_plane_funcs tegra_plane_funcs;
|
|
|
|
|
2019-10-28 19:37:17 +07:00
|
|
|
int tegra_plane_prepare_fb(struct drm_plane *plane,
|
|
|
|
struct drm_plane_state *state);
|
|
|
|
void tegra_plane_cleanup_fb(struct drm_plane *plane,
|
|
|
|
struct drm_plane_state *state);
|
|
|
|
|
2017-11-10 21:27:25 +07:00
|
|
|
int tegra_plane_state_add(struct tegra_plane *plane,
|
|
|
|
struct drm_plane_state *state);
|
|
|
|
|
|
|
|
int tegra_plane_format(u32 fourcc, u32 *format, u32 *swap);
|
|
|
|
bool tegra_plane_format_is_yuv(unsigned int format, bool *planar);
|
2018-05-04 21:39:59 +07:00
|
|
|
int tegra_plane_setup_legacy_state(struct tegra_plane *tegra,
|
|
|
|
struct tegra_plane_state *state);
|
2017-11-10 21:27:25 +07:00
|
|
|
|
|
|
|
#endif /* TEGRA_PLANE_H */
|