aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/sti
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-08-02 18:40:24 -0400
committerDave Airlie <airlied@redhat.com>2016-08-02 18:40:24 -0400
commit586efded6b8beb932e9a356f351b0c681503358f (patch)
tree1c9af56fa0d2c70bf93cf5a02429f4b5b7d11007 /drivers/gpu/drm/sti
parentdfd2e9ab6a7db56a5f5bb55f71485a92613c8e11 (diff)
parent2fc4d838aaf2607216eda5ce9dba18fa14422a31 (diff)
Merge branch 'generic-zpos-v8' of http://git.linaro.org/people/benjamin.gaignard/kernel into drm-next
Merge generic ZPOS property support, this was backed up behind some other changes I didn't have a stable branch point for. Now they are merged to Linus tree this pull is just drm patches. * 'generic-zpos-v8' of http://git.linaro.org/people/benjamin.gaignard/kernel: drm: rcar: use generic code for managing zpos plane property drm/exynos: use generic code for managing zpos plane property drm: sti: use generic zpos for plane drm: add generic zpos property
Diffstat (limited to 'drivers/gpu/drm/sti')
-rw-r--r--drivers/gpu/drm/sti/sti_cursor.c4
-rw-r--r--drivers/gpu/drm/sti/sti_gdp.c4
-rw-r--r--drivers/gpu/drm/sti/sti_hqvdp.c4
-rw-r--r--drivers/gpu/drm/sti/sti_mixer.c9
-rw-r--r--drivers/gpu/drm/sti/sti_plane.c78
-rw-r--r--drivers/gpu/drm/sti/sti_plane.h7
6 files changed, 38 insertions, 68 deletions
diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index a263bbba4119..3b53f7f2e3fc 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -349,8 +349,8 @@ struct drm_plane_funcs sti_cursor_plane_helpers_funcs = {
349 .update_plane = drm_atomic_helper_update_plane, 349 .update_plane = drm_atomic_helper_update_plane,
350 .disable_plane = drm_atomic_helper_disable_plane, 350 .disable_plane = drm_atomic_helper_disable_plane,
351 .destroy = sti_cursor_destroy, 351 .destroy = sti_cursor_destroy,
352 .set_property = sti_plane_set_property, 352 .set_property = drm_atomic_helper_plane_set_property,
353 .reset = drm_atomic_helper_plane_reset, 353 .reset = sti_plane_reset,
354 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, 354 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
355 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, 355 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
356 .late_register = sti_cursor_late_register, 356 .late_register = sti_cursor_late_register,
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index bf63086a3dc8..b8d942ca45e8 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -886,8 +886,8 @@ struct drm_plane_funcs sti_gdp_plane_helpers_funcs = {
886 .update_plane = drm_atomic_helper_update_plane, 886 .update_plane = drm_atomic_helper_update_plane,
887 .disable_plane = drm_atomic_helper_disable_plane, 887 .disable_plane = drm_atomic_helper_disable_plane,
888 .destroy = sti_gdp_destroy, 888 .destroy = sti_gdp_destroy,
889 .set_property = sti_plane_set_property, 889 .set_property = drm_atomic_helper_plane_set_property,
890 .reset = drm_atomic_helper_plane_reset, 890 .reset = sti_plane_reset,
891 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, 891 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
892 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, 892 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
893 .late_register = sti_gdp_late_register, 893 .late_register = sti_gdp_late_register,
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index b03232247966..b5ee783e3e7c 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -1254,8 +1254,8 @@ struct drm_plane_funcs sti_hqvdp_plane_helpers_funcs = {
1254 .update_plane = drm_atomic_helper_update_plane, 1254 .update_plane = drm_atomic_helper_update_plane,
1255 .disable_plane = drm_atomic_helper_disable_plane, 1255 .disable_plane = drm_atomic_helper_disable_plane,
1256 .destroy = sti_hqvdp_destroy, 1256 .destroy = sti_hqvdp_destroy,
1257 .set_property = sti_plane_set_property, 1257 .set_property = drm_atomic_helper_plane_set_property,
1258 .reset = drm_atomic_helper_plane_reset, 1258 .reset = sti_plane_reset,
1259 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, 1259 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
1260 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, 1260 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
1261 .late_register = sti_hqvdp_late_register, 1261 .late_register = sti_hqvdp_late_register,
diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
index 1885c7ab5a8b..7d9aea805eab 100644
--- a/drivers/gpu/drm/sti/sti_mixer.c
+++ b/drivers/gpu/drm/sti/sti_mixer.c
@@ -239,13 +239,10 @@ static void sti_mixer_set_background_area(struct sti_mixer *mixer,
239 239
240int sti_mixer_set_plane_depth(struct sti_mixer *mixer, struct sti_plane *plane) 240int sti_mixer_set_plane_depth(struct sti_mixer *mixer, struct sti_plane *plane)
241{ 241{
242 int plane_id, depth = plane->zorder; 242 int plane_id, depth = plane->drm_plane.state->normalized_zpos;
243 unsigned int i; 243 unsigned int i;
244 u32 mask, val; 244 u32 mask, val;
245 245
246 if ((depth < 1) || (depth > GAM_MIXER_NB_DEPTH_LEVEL))
247 return 1;
248
249 switch (plane->desc) { 246 switch (plane->desc) {
250 case STI_GDP_0: 247 case STI_GDP_0:
251 plane_id = GAM_DEPTH_GDP0_ID; 248 plane_id = GAM_DEPTH_GDP0_ID;
@@ -278,8 +275,8 @@ int sti_mixer_set_plane_depth(struct sti_mixer *mixer, struct sti_plane *plane)
278 break; 275 break;
279 } 276 }
280 277
281 mask |= GAM_DEPTH_MASK_ID << (3 * (depth - 1)); 278 mask |= GAM_DEPTH_MASK_ID << (3 * depth);
282 plane_id = plane_id << (3 * (depth - 1)); 279 plane_id = plane_id << (3 * depth);
283 280
284 DRM_DEBUG_DRIVER("%s %s depth=%d\n", sti_mixer_to_str(mixer), 281 DRM_DEBUG_DRIVER("%s %s depth=%d\n", sti_mixer_to_str(mixer),
285 sti_plane_to_str(plane), depth); 282 sti_plane_to_str(plane), depth);
diff --git a/drivers/gpu/drm/sti/sti_plane.c b/drivers/gpu/drm/sti/sti_plane.c
index 0cf3335ef37c..ca4b3719a64a 100644
--- a/drivers/gpu/drm/sti/sti_plane.c
+++ b/drivers/gpu/drm/sti/sti_plane.c
@@ -14,15 +14,6 @@
14#include "sti_drv.h" 14#include "sti_drv.h"
15#include "sti_plane.h" 15#include "sti_plane.h"
16 16
17/* (Background) < GDP0 < GDP1 < HQVDP0 < GDP2 < GDP3 < (ForeGround) */
18enum 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
26const char *sti_plane_to_str(struct sti_plane *plane) 17const char *sti_plane_to_str(struct sti_plane *plane)
27{ 18{
28 switch (plane->desc) { 19 switch (plane->desc) {
@@ -96,59 +87,46 @@ void sti_plane_update_fps(struct sti_plane *plane,
96 plane->fps_info.fips_str); 87 plane->fps_info.fips_str);
97} 88}
98 89
99int sti_plane_set_property(struct drm_plane *drm_plane, 90static int sti_plane_get_default_zpos(enum drm_plane_type type)
100 struct drm_property *property,
101 uint64_t val)
102{ 91{
103 struct drm_device *dev = drm_plane->dev; 92 switch (type) {
104 struct sti_private *private = dev->dev_private; 93 case DRM_PLANE_TYPE_PRIMARY:
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;
111 return 0; 94 return 0;
95 case DRM_PLANE_TYPE_OVERLAY:
96 return 1;
97 case DRM_PLANE_TYPE_CURSOR:
98 return 7;
112 } 99 }
100 return 0;
101}
113 102
114 return -EINVAL; 103void 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);
115} 107}
116 108
117static void sti_plane_attach_zorder_property(struct drm_plane *drm_plane) 109static void sti_plane_attach_zorder_property(struct drm_plane *drm_plane,
110 enum drm_plane_type type)
118{ 111{
119 struct drm_device *dev = drm_plane->dev; 112 int zpos = sti_plane_get_default_zpos(type);
120 struct sti_private *private = dev->dev_private; 113
121 struct sti_plane *plane = to_sti_plane(drm_plane); 114 switch (type) {
122 struct drm_property *prop; 115 case DRM_PLANE_TYPE_PRIMARY:
123 116 case DRM_PLANE_TYPE_OVERLAY:
124 prop = private->plane_zorder_property; 117 drm_plane_create_zpos_property(drm_plane, zpos, 0, 6);
125 if (!prop) { 118 break;
126 prop = drm_property_create_range(dev, 0, "zpos", 1, 119 case DRM_PLANE_TYPE_CURSOR:
127 GAM_MIXER_NB_DEPTH_LEVEL); 120 drm_plane_create_zpos_immutable_property(drm_plane, zpos);
128 if (!prop) 121 break;
129 return;
130
131 private->plane_zorder_property = prop;
132 } 122 }
133
134 drm_object_attach_property(&drm_plane->base, prop, plane->zorder);
135} 123}
136 124
137void sti_plane_init_property(struct sti_plane *plane, 125void sti_plane_init_property(struct sti_plane *plane,
138 enum drm_plane_type type) 126 enum drm_plane_type type)
139{ 127{
140 unsigned int i; 128 sti_plane_attach_zorder_property(&plane->drm_plane, type);
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);
150 129
151 DRM_DEBUG_DRIVER("drm plane:%d mapped to %s with zorder:%d\n", 130 DRM_DEBUG_DRIVER("drm plane:%d mapped to %s\n",
152 plane->drm_plane.base.id, 131 plane->drm_plane.base.id, sti_plane_to_str(plane));
153 sti_plane_to_str(plane), plane->zorder);
154} 132}
diff --git a/drivers/gpu/drm/sti/sti_plane.h b/drivers/gpu/drm/sti/sti_plane.h
index e0ea1dd3bb88..ce3e8d6c88bb 100644
--- a/drivers/gpu/drm/sti/sti_plane.h
+++ b/drivers/gpu/drm/sti/sti_plane.h
@@ -66,14 +66,12 @@ struct sti_fps_info {
66 * @plane: drm plane it is bound to (if any) 66 * @plane: drm plane it is bound to (if any)
67 * @desc: plane type & id 67 * @desc: plane type & id
68 * @status: to know the status of the plane 68 * @status: to know the status of the plane
69 * @zorder: plane z-order
70 * @fps_info: frame per second info 69 * @fps_info: frame per second info
71 */ 70 */
72struct sti_plane { 71struct sti_plane {
73 struct drm_plane drm_plane; 72 struct drm_plane drm_plane;
74 enum sti_plane_desc desc; 73 enum sti_plane_desc desc;
75 enum sti_plane_status status; 74 enum sti_plane_status status;
76 int zorder;
77 struct sti_fps_info fps_info; 75 struct sti_fps_info fps_info;
78}; 76};
79 77
@@ -82,10 +80,7 @@ void sti_plane_update_fps(struct sti_plane *plane,
82 bool new_frame, 80 bool new_frame,
83 bool new_field); 81 bool new_field);
84 82
85int sti_plane_set_property(struct drm_plane *drm_plane,
86 struct drm_property *property,
87 uint64_t val);
88
89void sti_plane_init_property(struct sti_plane *plane, 83void sti_plane_init_property(struct sti_plane *plane,
90 enum drm_plane_type type); 84 enum drm_plane_type type);
85void sti_plane_reset(struct drm_plane *plane);
91#endif 86#endif