14 #include <drm/exynos_drm.h>
20 #define to_exynos_plane(x) container_of(x, struct exynos_plane, base)
56 static int exynos_plane_get_size(
int start,
unsigned length,
unsigned last)
63 size =
min_t(
unsigned, end, last);
64 }
else if (start <= last) {
65 size =
min_t(
unsigned, last - start, length);
73 unsigned int crtc_w,
unsigned int crtc_h,
79 unsigned int actual_w;
80 unsigned int actual_h;
84 DRM_DEBUG_KMS(
"[%d] %s\n", __LINE__, __func__);
87 for (i = 0; i <
nr; i++) {
91 DRM_LOG_KMS(
"buffer is null\n");
98 DRM_DEBUG_KMS(
"buffer: %d, vaddr = 0x%lx, dma_addr = 0x%lx\n",
99 i, (
unsigned long)overlay->
vaddr[i],
100 (
unsigned long)overlay->
dma_addr[i]);
103 actual_w = exynos_plane_get_size(crtc_x, crtc_w, crtc->
mode.hdisplay);
104 actual_h = exynos_plane_get_size(crtc_y, crtc_h, crtc->
mode.vdisplay);
123 overlay->
fb_x = src_x;
124 overlay->
fb_y = src_y;
145 DRM_DEBUG_KMS(
"overlay : offset_x/y(%d,%d), width/height(%d,%d)",
168 DRM_DEBUG_KMS(
"[%d] %s\n", __LINE__, __func__);
192 unsigned int crtc_w,
unsigned int crtc_h,
198 DRM_DEBUG_KMS(
"[%d] %s\n", __LINE__, __func__);
201 crtc_w, crtc_h, src_x >> 16, src_y >> 16,
202 src_w >> 16, src_h >> 16);
214 static int exynos_disable_plane(
struct drm_plane *plane)
216 DRM_DEBUG_KMS(
"[%d] %s\n", __LINE__, __func__);
223 static void exynos_plane_destroy(
struct drm_plane *plane)
227 DRM_DEBUG_KMS(
"[%d] %s\n", __LINE__, __func__);
229 exynos_disable_plane(plane);
234 static int exynos_plane_set_property(
struct drm_plane *plane,
242 DRM_DEBUG_KMS(
"[%d] %s\n", __LINE__, __func__);
253 .update_plane = exynos_update_plane,
254 .disable_plane = exynos_disable_plane,
255 .destroy = exynos_plane_destroy,
256 .set_property = exynos_plane_set_property,
259 static void exynos_plane_attach_zpos_property(
struct drm_plane *plane)
265 DRM_DEBUG_KMS(
"[%d] %s\n", __LINE__, __func__);
283 struct exynos_plane *exynos_plane;
286 DRM_DEBUG_KMS(
"[%d] %s\n", __LINE__, __func__);
288 exynos_plane = kzalloc(
sizeof(
struct exynos_plane),
GFP_KERNEL);
290 DRM_ERROR(
"failed to allocate plane\n");
295 &exynos_plane_funcs, formats,
ARRAY_SIZE(formats),
298 DRM_ERROR(
"failed to initialize plane\n");
306 exynos_plane_attach_zpos_property(&exynos_plane->
base);
308 return &exynos_plane->
base;