Commit fe6fbe9a authored by Laurent Pinchart's avatar Laurent Pinchart

drm: rcar-du: Store the number of CRTCs per group in the group structure

The number of CRTCs in a group is only used to implement plane
initialization for now, but is also needed to implement pre-association
of planes to CRTCs. Store it in the group structure instead of computing
it on demand.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
parent c8af99b6
...@@ -25,6 +25,7 @@ struct rcar_du_device; ...@@ -25,6 +25,7 @@ struct rcar_du_device;
* @dev: the DU device * @dev: the DU device
* @mmio_offset: registers offset in the device memory map * @mmio_offset: registers offset in the device memory map
* @index: group index * @index: group index
* @num_crtcs: number of CRTCs in this group (1 or 2)
* @use_count: number of users of the group (rcar_du_group_(get|put)) * @use_count: number of users of the group (rcar_du_group_(get|put))
* @used_crtcs: number of CRTCs currently in use * @used_crtcs: number of CRTCs currently in use
* @lock: protects the dptsr_planes field and the DPTSR register * @lock: protects the dptsr_planes field and the DPTSR register
...@@ -36,6 +37,7 @@ struct rcar_du_group { ...@@ -36,6 +37,7 @@ struct rcar_du_group {
unsigned int mmio_offset; unsigned int mmio_offset;
unsigned int index; unsigned int index;
unsigned int num_crtcs;
unsigned int use_count; unsigned int use_count;
unsigned int used_crtcs; unsigned int used_crtcs;
......
...@@ -763,6 +763,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu) ...@@ -763,6 +763,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
rgrp->dev = rcdu; rgrp->dev = rcdu;
rgrp->mmio_offset = mmio_offsets[i]; rgrp->mmio_offset = mmio_offsets[i];
rgrp->index = i; rgrp->index = i;
rgrp->num_crtcs = min(rcdu->num_crtcs - 2 * i, 2U);
/* Pre-associate all hardware planes with the first CRTC in the /* Pre-associate all hardware planes with the first CRTC in the
* group. * group.
......
...@@ -391,7 +391,6 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp) ...@@ -391,7 +391,6 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)
{ {
struct rcar_du_device *rcdu = rgrp->dev; struct rcar_du_device *rcdu = rgrp->dev;
unsigned int num_planes; unsigned int num_planes;
unsigned int num_crtcs;
unsigned int crtcs; unsigned int crtcs;
unsigned int i; unsigned int i;
int ret; int ret;
...@@ -399,13 +398,12 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp) ...@@ -399,13 +398,12 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)
/* Create one primary plane per CRTC in this group and seven overlay /* Create one primary plane per CRTC in this group and seven overlay
* planes. * planes.
*/ */
num_crtcs = min(rcdu->num_crtcs - 2 * rgrp->index, 2U); num_planes = rgrp->num_crtcs + 7;
num_planes = num_crtcs + 7;
crtcs = ((1 << rcdu->num_crtcs) - 1) & (3 << (2 * rgrp->index)); crtcs = ((1 << rcdu->num_crtcs) - 1) & (3 << (2 * rgrp->index));
for (i = 0; i < num_planes; ++i) { for (i = 0; i < num_planes; ++i) {
enum drm_plane_type type = i < num_crtcs enum drm_plane_type type = i < rgrp->num_crtcs
? DRM_PLANE_TYPE_PRIMARY ? DRM_PLANE_TYPE_PRIMARY
: DRM_PLANE_TYPE_OVERLAY; : DRM_PLANE_TYPE_OVERLAY;
struct rcar_du_plane *plane = &rgrp->planes[i]; struct rcar_du_plane *plane = &rgrp->planes[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment