aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorJoonyoung Shim <jy0922.shim@samsung.com>2012-06-27 01:27:06 -0400
committerInki Dae <inki.dae@samsung.com>2012-07-26 22:13:54 -0400
commit00ae67cf26fad3889e71e3bdbec012b1f938dc0e (patch)
tree577465229758f7095b4cc132f7f3e0badd8a806c /drivers/gpu/drm
parent4070d212eb54ec9f204646d95c17d95ad812a008 (diff)
drm/exynos: add property for plane zpos
The exynos drm driver used a specific ioctl - DRM_EXYNOS_PLANE_SET_ZPOS to set zpos of plane. It can be substitute to property of plane. This patch adds a property for plane zpos and removes DRM_EXYNOS_PLANE_SET_ZPOS ioctl. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.c2
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.h1
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_plane.c92
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_plane.h2
4 files changed, 48 insertions, 49 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index e313dc23e2a8..ebacec6f1e48 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -224,8 +224,6 @@ static struct drm_ioctl_desc exynos_ioctls[] = {
224 exynos_drm_gem_mmap_ioctl, DRM_UNLOCKED | DRM_AUTH), 224 exynos_drm_gem_mmap_ioctl, DRM_UNLOCKED | DRM_AUTH),
225 DRM_IOCTL_DEF_DRV(EXYNOS_GEM_GET, 225 DRM_IOCTL_DEF_DRV(EXYNOS_GEM_GET,
226 exynos_drm_gem_get_ioctl, DRM_UNLOCKED), 226 exynos_drm_gem_get_ioctl, DRM_UNLOCKED),
227 DRM_IOCTL_DEF_DRV(EXYNOS_PLANE_SET_ZPOS, exynos_plane_set_zpos_ioctl,
228 DRM_UNLOCKED | DRM_AUTH),
229 DRM_IOCTL_DEF_DRV(EXYNOS_VIDI_CONNECTION, 227 DRM_IOCTL_DEF_DRV(EXYNOS_VIDI_CONNECTION,
230 vidi_connection_ioctl, DRM_UNLOCKED | DRM_AUTH), 228 vidi_connection_ioctl, DRM_UNLOCKED | DRM_AUTH),
231 DRM_IOCTL_DEF_DRV(EXYNOS_G2D_GET_VER, 229 DRM_IOCTL_DEF_DRV(EXYNOS_G2D_GET_VER,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index 277653d5fda0..1bd681c9642f 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -235,6 +235,7 @@ struct exynos_drm_private {
235 * this array is used to be aware of which crtc did it request vblank. 235 * this array is used to be aware of which crtc did it request vblank.
236 */ 236 */
237 struct drm_crtc *crtc[MAX_CRTC]; 237 struct drm_crtc *crtc[MAX_CRTC];
238 struct drm_property *plane_zpos_property;
238}; 239};
239 240
240/* 241/*
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 232e323d93c8..f018c9d32639 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -150,7 +150,6 @@ static int exynos_disable_plane(struct drm_plane *plane)
150 exynos_drm_encoder_plane_disable); 150 exynos_drm_encoder_plane_disable);
151 151
152 exynos_plane->enabled = false; 152 exynos_plane->enabled = false;
153 exynos_plane->overlay.zpos = DEFAULT_ZPOS;
154 153
155 return 0; 154 return 0;
156} 155}
@@ -166,26 +165,66 @@ static void exynos_plane_destroy(struct drm_plane *plane)
166 kfree(exynos_plane); 165 kfree(exynos_plane);
167} 166}
168 167
168static int exynos_plane_set_property(struct drm_plane *plane,
169 struct drm_property *property,
170 uint64_t val)
171{
172 struct drm_device *dev = plane->dev;
173 struct exynos_plane *exynos_plane = to_exynos_plane(plane);
174 struct exynos_drm_private *dev_priv = dev->dev_private;
175
176 DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
177
178 if (property == dev_priv->plane_zpos_property) {
179 exynos_plane->overlay.zpos = val;
180 return 0;
181 }
182
183 return -EINVAL;
184}
185
169static struct drm_plane_funcs exynos_plane_funcs = { 186static struct drm_plane_funcs exynos_plane_funcs = {
170 .update_plane = exynos_update_plane, 187 .update_plane = exynos_update_plane,
171 .disable_plane = exynos_disable_plane, 188 .disable_plane = exynos_disable_plane,
172 .destroy = exynos_plane_destroy, 189 .destroy = exynos_plane_destroy,
190 .set_property = exynos_plane_set_property,
173}; 191};
174 192
193static void exynos_plane_attach_zpos_property(struct drm_plane *plane)
194{
195 struct drm_device *dev = plane->dev;
196 struct exynos_drm_private *dev_priv = dev->dev_private;
197 struct drm_property *prop;
198
199 DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
200
201 prop = dev_priv->plane_zpos_property;
202 if (!prop) {
203 prop = drm_property_create_range(dev, 0, "zpos", 0,
204 MAX_PLANE - 1);
205 if (!prop)
206 return;
207
208 dev_priv->plane_zpos_property = prop;
209 }
210
211 drm_object_attach_property(&plane->base, prop, 0);
212}
213
175struct drm_plane *exynos_plane_init(struct drm_device *dev, 214struct drm_plane *exynos_plane_init(struct drm_device *dev,
176 unsigned int possible_crtcs, bool priv) 215 unsigned int possible_crtcs, bool priv)
177{ 216{
178 struct exynos_plane *exynos_plane; 217 struct exynos_plane *exynos_plane;
179 int err; 218 int err;
180 219
220 DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
221
181 exynos_plane = kzalloc(sizeof(struct exynos_plane), GFP_KERNEL); 222 exynos_plane = kzalloc(sizeof(struct exynos_plane), GFP_KERNEL);
182 if (!exynos_plane) { 223 if (!exynos_plane) {
183 DRM_ERROR("failed to allocate plane\n"); 224 DRM_ERROR("failed to allocate plane\n");
184 return NULL; 225 return NULL;
185 } 226 }
186 227
187 exynos_plane->overlay.zpos = DEFAULT_ZPOS;
188
189 err = drm_plane_init(dev, &exynos_plane->base, possible_crtcs, 228 err = drm_plane_init(dev, &exynos_plane->base, possible_crtcs,
190 &exynos_plane_funcs, formats, ARRAY_SIZE(formats), 229 &exynos_plane_funcs, formats, ARRAY_SIZE(formats),
191 priv); 230 priv);
@@ -195,47 +234,10 @@ struct drm_plane *exynos_plane_init(struct drm_device *dev,
195 return NULL; 234 return NULL;
196 } 235 }
197 236
198 return &exynos_plane->base; 237 if (priv)
199} 238 exynos_plane->overlay.zpos = DEFAULT_ZPOS;
200 239 else
201int exynos_plane_set_zpos_ioctl(struct drm_device *dev, void *data, 240 exynos_plane_attach_zpos_property(&exynos_plane->base);
202 struct drm_file *file_priv)
203{
204 struct drm_exynos_plane_set_zpos *zpos_req = data;
205 struct drm_mode_object *obj;
206 struct drm_plane *plane;
207 struct exynos_plane *exynos_plane;
208 int ret = 0;
209
210 DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
211
212 if (!drm_core_check_feature(dev, DRIVER_MODESET))
213 return -EINVAL;
214 241
215 if (zpos_req->zpos < 0 || zpos_req->zpos >= MAX_PLANE) { 242 return &exynos_plane->base;
216 if (zpos_req->zpos != DEFAULT_ZPOS) {
217 DRM_ERROR("zpos not within limits\n");
218 return -EINVAL;
219 }
220 }
221
222 mutex_lock(&dev->mode_config.mutex);
223
224 obj = drm_mode_object_find(dev, zpos_req->plane_id,
225 DRM_MODE_OBJECT_PLANE);
226 if (!obj) {
227 DRM_DEBUG_KMS("Unknown plane ID %d\n",
228 zpos_req->plane_id);
229 ret = -EINVAL;
230 goto out;
231 }
232
233 plane = obj_to_plane(obj);
234 exynos_plane = to_exynos_plane(plane);
235
236 exynos_plane->overlay.zpos = zpos_req->zpos;
237
238out:
239 mutex_unlock(&dev->mode_config.mutex);
240 return ret;
241} 243}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.h b/drivers/gpu/drm/exynos/exynos_drm_plane.h
index 47fd555e0fd7..c9dad86c9158 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.h
@@ -17,5 +17,3 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
17void exynos_plane_commit(struct drm_plane *plane); 17void exynos_plane_commit(struct drm_plane *plane);
18struct drm_plane *exynos_plane_init(struct drm_device *dev, 18struct drm_plane *exynos_plane_init(struct drm_device *dev,
19 unsigned int possible_crtcs, bool priv); 19 unsigned int possible_crtcs, bool priv);
20int exynos_plane_set_zpos_ioctl(struct drm_device *dev, void *data,
21 struct drm_file *file_priv);