Laurent Pinchart | 4bf8e19 | 2013-06-19 13:54:11 +0200 | [diff] [blame] | 1 | /* |
| 2 | * rcar_du_plane.h -- R-Car Display Unit Planes |
| 3 | * |
| 4 | * Copyright (C) 2013 Renesas Corporation |
| 5 | * |
| 6 | * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | */ |
| 13 | |
| 14 | #ifndef __RCAR_DU_PLANE_H__ |
| 15 | #define __RCAR_DU_PLANE_H__ |
| 16 | |
Laurent Pinchart | ae425b6 | 2013-06-16 21:02:49 +0200 | [diff] [blame] | 17 | #include <linux/mutex.h> |
| 18 | |
| 19 | #include <drm/drmP.h> |
| 20 | #include <drm/drm_crtc.h> |
| 21 | |
Laurent Pinchart | 4bf8e19 | 2013-06-19 13:54:11 +0200 | [diff] [blame] | 22 | struct rcar_du_format_info; |
Laurent Pinchart | cb2025d | 2013-06-16 21:01:02 +0200 | [diff] [blame^] | 23 | struct rcar_du_group; |
Laurent Pinchart | 4bf8e19 | 2013-06-19 13:54:11 +0200 | [diff] [blame] | 24 | |
| 25 | /* The RCAR DU has 8 hardware planes, shared between KMS planes and CRTCs. As |
| 26 | * using KMS planes requires at least one of the CRTCs being enabled, no more |
| 27 | * than 7 KMS planes can be available. We thus create 7 KMS planes and |
| 28 | * 9 software planes (one for each KMS planes and one for each CRTC). |
| 29 | */ |
| 30 | |
| 31 | #define RCAR_DU_NUM_KMS_PLANES 7 |
| 32 | #define RCAR_DU_NUM_HW_PLANES 8 |
| 33 | #define RCAR_DU_NUM_SW_PLANES 9 |
| 34 | |
| 35 | struct rcar_du_plane { |
Laurent Pinchart | cb2025d | 2013-06-16 21:01:02 +0200 | [diff] [blame^] | 36 | struct rcar_du_group *group; |
Laurent Pinchart | 4bf8e19 | 2013-06-19 13:54:11 +0200 | [diff] [blame] | 37 | struct drm_crtc *crtc; |
| 38 | |
| 39 | bool enabled; |
| 40 | |
| 41 | int hwindex; /* 0-based, -1 means unused */ |
| 42 | unsigned int alpha; |
| 43 | unsigned int colorkey; |
| 44 | unsigned int zpos; |
| 45 | |
| 46 | const struct rcar_du_format_info *format; |
| 47 | |
| 48 | unsigned long dma[2]; |
| 49 | unsigned int pitch; |
| 50 | |
| 51 | unsigned int width; |
| 52 | unsigned int height; |
| 53 | |
| 54 | unsigned int src_x; |
| 55 | unsigned int src_y; |
| 56 | unsigned int dst_x; |
| 57 | unsigned int dst_y; |
| 58 | }; |
| 59 | |
Laurent Pinchart | ae425b6 | 2013-06-16 21:02:49 +0200 | [diff] [blame] | 60 | struct rcar_du_planes { |
| 61 | struct rcar_du_plane planes[RCAR_DU_NUM_SW_PLANES]; |
| 62 | unsigned int free; |
| 63 | struct mutex lock; |
| 64 | |
| 65 | struct drm_property *alpha; |
| 66 | struct drm_property *colorkey; |
| 67 | struct drm_property *zpos; |
| 68 | }; |
| 69 | |
Laurent Pinchart | cb2025d | 2013-06-16 21:01:02 +0200 | [diff] [blame^] | 70 | int rcar_du_planes_init(struct rcar_du_group *rgrp); |
| 71 | int rcar_du_planes_register(struct rcar_du_group *rgrp); |
Laurent Pinchart | 7fe99fd | 2013-06-16 19:18:31 +0200 | [diff] [blame] | 72 | |
Laurent Pinchart | 4bf8e19 | 2013-06-19 13:54:11 +0200 | [diff] [blame] | 73 | void rcar_du_plane_setup(struct rcar_du_plane *plane); |
| 74 | void rcar_du_plane_update_base(struct rcar_du_plane *plane); |
| 75 | void rcar_du_plane_compute_base(struct rcar_du_plane *plane, |
| 76 | struct drm_framebuffer *fb); |
| 77 | int rcar_du_plane_reserve(struct rcar_du_plane *plane, |
| 78 | const struct rcar_du_format_info *format); |
| 79 | void rcar_du_plane_release(struct rcar_du_plane *plane); |
| 80 | |
| 81 | #endif /* __RCAR_DU_PLANE_H__ */ |