Skip to content

Commit bbd1e3a

Browse files
drm: sti: use generic zpos for plane
remove private zpos property and use instead the generic new. zpos range is now fixed per plane type and normalized before being using in mixer. Signed-off-by: Benjamin Gaignard <[email protected]> Cc: Inki Dae <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Ville Syrjala <[email protected]> Cc: Joonyoung Shim <[email protected]> Cc: Seung-Woo Kim <[email protected]> Cc: Andrzej Hajda <[email protected]> Cc: Krzysztof Kozlowski <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Tobias Jakobi <[email protected]> Cc: Gustavo Padovan <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Laurent Pinchart <[email protected]>
1 parent 44d1240 commit bbd1e3a

File tree

6 files changed

+38
-68
lines changed

6 files changed

+38
-68
lines changed

drivers/gpu/drm/sti/sti_cursor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ struct drm_plane_funcs sti_cursor_plane_helpers_funcs = {
349349
.update_plane = drm_atomic_helper_update_plane,
350350
.disable_plane = drm_atomic_helper_disable_plane,
351351
.destroy = sti_cursor_destroy,
352-
.set_property = sti_plane_set_property,
353-
.reset = drm_atomic_helper_plane_reset,
352+
.set_property = drm_atomic_helper_plane_set_property,
353+
.reset = sti_plane_reset,
354354
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
355355
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
356356
.late_register = sti_cursor_late_register,

drivers/gpu/drm/sti/sti_gdp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,8 +886,8 @@ struct drm_plane_funcs sti_gdp_plane_helpers_funcs = {
886886
.update_plane = drm_atomic_helper_update_plane,
887887
.disable_plane = drm_atomic_helper_disable_plane,
888888
.destroy = sti_gdp_destroy,
889-
.set_property = sti_plane_set_property,
890-
.reset = drm_atomic_helper_plane_reset,
889+
.set_property = drm_atomic_helper_plane_set_property,
890+
.reset = sti_plane_reset,
891891
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
892892
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
893893
.late_register = sti_gdp_late_register,

drivers/gpu/drm/sti/sti_hqvdp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,8 +1254,8 @@ struct drm_plane_funcs sti_hqvdp_plane_helpers_funcs = {
12541254
.update_plane = drm_atomic_helper_update_plane,
12551255
.disable_plane = drm_atomic_helper_disable_plane,
12561256
.destroy = sti_hqvdp_destroy,
1257-
.set_property = sti_plane_set_property,
1258-
.reset = drm_atomic_helper_plane_reset,
1257+
.set_property = drm_atomic_helper_plane_set_property,
1258+
.reset = sti_plane_reset,
12591259
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
12601260
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
12611261
.late_register = sti_hqvdp_late_register,

drivers/gpu/drm/sti/sti_mixer.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,10 @@ static void sti_mixer_set_background_area(struct sti_mixer *mixer,
239239

240240
int sti_mixer_set_plane_depth(struct sti_mixer *mixer, struct sti_plane *plane)
241241
{
242-
int plane_id, depth = plane->zorder;
242+
int plane_id, depth = plane->drm_plane.state->normalized_zpos;
243243
unsigned int i;
244244
u32 mask, val;
245245

246-
if ((depth < 1) || (depth > GAM_MIXER_NB_DEPTH_LEVEL))
247-
return 1;
248-
249246
switch (plane->desc) {
250247
case STI_GDP_0:
251248
plane_id = GAM_DEPTH_GDP0_ID;
@@ -278,8 +275,8 @@ int sti_mixer_set_plane_depth(struct sti_mixer *mixer, struct sti_plane *plane)
278275
break;
279276
}
280277

281-
mask |= GAM_DEPTH_MASK_ID << (3 * (depth - 1));
282-
plane_id = plane_id << (3 * (depth - 1));
278+
mask |= GAM_DEPTH_MASK_ID << (3 * depth);
279+
plane_id = plane_id << (3 * depth);
283280

284281
DRM_DEBUG_DRIVER("%s %s depth=%d\n", sti_mixer_to_str(mixer),
285282
sti_plane_to_str(plane), depth);

drivers/gpu/drm/sti/sti_plane.c

Lines changed: 28 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@
1414
#include "sti_drv.h"
1515
#include "sti_plane.h"
1616

17-
/* (Background) < GDP0 < GDP1 < HQVDP0 < GDP2 < GDP3 < (ForeGround) */
18-
enum sti_plane_desc sti_plane_default_zorder[] = {
19-
STI_GDP_0,
20-
STI_GDP_1,
21-
STI_HQVDP_0,
22-
STI_GDP_2,
23-
STI_GDP_3,
24-
};
25-
2617
const char *sti_plane_to_str(struct sti_plane *plane)
2718
{
2819
switch (plane->desc) {
@@ -96,59 +87,46 @@ void sti_plane_update_fps(struct sti_plane *plane,
9687
plane->fps_info.fips_str);
9788
}
9889

99-
int sti_plane_set_property(struct drm_plane *drm_plane,
100-
struct drm_property *property,
101-
uint64_t val)
90+
static int sti_plane_get_default_zpos(enum drm_plane_type type)
10291
{
103-
struct drm_device *dev = drm_plane->dev;
104-
struct sti_private *private = dev->dev_private;
105-
struct sti_plane *plane = to_sti_plane(drm_plane);
106-
107-
DRM_DEBUG_DRIVER("\n");
108-
109-
if (property == private->plane_zorder_property) {
110-
plane->zorder = val;
92+
switch (type) {
93+
case DRM_PLANE_TYPE_PRIMARY:
11194
return 0;
95+
case DRM_PLANE_TYPE_OVERLAY:
96+
return 1;
97+
case DRM_PLANE_TYPE_CURSOR:
98+
return 7;
11299
}
100+
return 0;
101+
}
113102

114-
return -EINVAL;
103+
void sti_plane_reset(struct drm_plane *plane)
104+
{
105+
drm_atomic_helper_plane_reset(plane);
106+
plane->state->zpos = sti_plane_get_default_zpos(plane->type);
115107
}
116108

117-
static void sti_plane_attach_zorder_property(struct drm_plane *drm_plane)
109+
static void sti_plane_attach_zorder_property(struct drm_plane *drm_plane,
110+
enum drm_plane_type type)
118111
{
119-
struct drm_device *dev = drm_plane->dev;
120-
struct sti_private *private = dev->dev_private;
121-
struct sti_plane *plane = to_sti_plane(drm_plane);
122-
struct drm_property *prop;
123-
124-
prop = private->plane_zorder_property;
125-
if (!prop) {
126-
prop = drm_property_create_range(dev, 0, "zpos", 1,
127-
GAM_MIXER_NB_DEPTH_LEVEL);
128-
if (!prop)
129-
return;
130-
131-
private->plane_zorder_property = prop;
112+
int zpos = sti_plane_get_default_zpos(type);
113+
114+
switch (type) {
115+
case DRM_PLANE_TYPE_PRIMARY:
116+
case DRM_PLANE_TYPE_OVERLAY:
117+
drm_plane_create_zpos_property(drm_plane, zpos, 0, 6);
118+
break;
119+
case DRM_PLANE_TYPE_CURSOR:
120+
drm_plane_create_zpos_immutable_property(drm_plane, zpos);
121+
break;
132122
}
133-
134-
drm_object_attach_property(&drm_plane->base, prop, plane->zorder);
135123
}
136124

137125
void sti_plane_init_property(struct sti_plane *plane,
138126
enum drm_plane_type type)
139127
{
140-
unsigned int i;
141-
142-
for (i = 0; i < ARRAY_SIZE(sti_plane_default_zorder); i++)
143-
if (sti_plane_default_zorder[i] == plane->desc)
144-
break;
145-
146-
plane->zorder = i + 1;
147-
148-
if (type == DRM_PLANE_TYPE_OVERLAY)
149-
sti_plane_attach_zorder_property(&plane->drm_plane);
128+
sti_plane_attach_zorder_property(&plane->drm_plane, type);
150129

151-
DRM_DEBUG_DRIVER("drm plane:%d mapped to %s with zorder:%d\n",
152-
plane->drm_plane.base.id,
153-
sti_plane_to_str(plane), plane->zorder);
130+
DRM_DEBUG_DRIVER("drm plane:%d mapped to %s\n",
131+
plane->drm_plane.base.id, sti_plane_to_str(plane));
154132
}

drivers/gpu/drm/sti/sti_plane.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,12 @@ struct sti_fps_info {
6666
* @plane: drm plane it is bound to (if any)
6767
* @desc: plane type & id
6868
* @status: to know the status of the plane
69-
* @zorder: plane z-order
7069
* @fps_info: frame per second info
7170
*/
7271
struct sti_plane {
7372
struct drm_plane drm_plane;
7473
enum sti_plane_desc desc;
7574
enum sti_plane_status status;
76-
int zorder;
7775
struct sti_fps_info fps_info;
7876
};
7977

@@ -82,10 +80,7 @@ void sti_plane_update_fps(struct sti_plane *plane,
8280
bool new_frame,
8381
bool new_field);
8482

85-
int sti_plane_set_property(struct drm_plane *drm_plane,
86-
struct drm_property *property,
87-
uint64_t val);
88-
8983
void sti_plane_init_property(struct sti_plane *plane,
9084
enum drm_plane_type type);
85+
void sti_plane_reset(struct drm_plane *plane);
9186
#endif

0 commit comments

Comments
 (0)