Skip to content

Commit 00ae67c

Browse files
Joonyoung Shimdaeinki
authored andcommitted
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>
1 parent 4070d21 commit 00ae67c

5 files changed

Lines changed: 48 additions & 58 deletions

File tree

‎drivers/gpu/drm/exynos/exynos_drm_drv.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,6 @@ static struct drm_ioctl_desc exynos_ioctls[] = {
224224
exynos_drm_gem_mmap_ioctl, DRM_UNLOCKED | DRM_AUTH),
225225
DRM_IOCTL_DEF_DRV(EXYNOS_GEM_GET,
226226
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),
229227
DRM_IOCTL_DEF_DRV(EXYNOS_VIDI_CONNECTION,
230228
vidi_connection_ioctl, DRM_UNLOCKED | DRM_AUTH),
231229
DRM_IOCTL_DEF_DRV(EXYNOS_G2D_GET_VER,

‎drivers/gpu/drm/exynos/exynos_drm_drv.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ struct exynos_drm_private {
235235
* this array is used to be aware of which crtc did it request vblank.
236236
*/
237237
struct drm_crtc *crtc[MAX_CRTC];
238+
struct drm_property *plane_zpos_property;
238239
};
239240

240241
/*

‎drivers/gpu/drm/exynos/exynos_drm_plane.c‎

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ static int exynos_disable_plane(struct drm_plane *plane)
150150
exynos_drm_encoder_plane_disable);
151151

152152
exynos_plane->enabled = false;
153-
exynos_plane->overlay.zpos = DEFAULT_ZPOS;
154153

155154
return 0;
156155
}
@@ -166,26 +165,66 @@ static void exynos_plane_destroy(struct drm_plane *plane)
166165
kfree(exynos_plane);
167166
}
168167

168+
static 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+
169186
static struct drm_plane_funcs exynos_plane_funcs = {
170187
.update_plane = exynos_update_plane,
171188
.disable_plane = exynos_disable_plane,
172189
.destroy = exynos_plane_destroy,
190+
.set_property = exynos_plane_set_property,
173191
};
174192

193+
static 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+
175214
struct drm_plane *exynos_plane_init(struct drm_device *dev,
176215
unsigned int possible_crtcs, bool priv)
177216
{
178217
struct exynos_plane *exynos_plane;
179218
int err;
180219

220+
DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
221+
181222
exynos_plane = kzalloc(sizeof(struct exynos_plane), GFP_KERNEL);
182223
if (!exynos_plane) {
183224
DRM_ERROR("failed to allocate plane\n");
184225
return NULL;
185226
}
186227

187-
exynos_plane->overlay.zpos = DEFAULT_ZPOS;
188-
189228
err = drm_plane_init(dev, &exynos_plane->base, possible_crtcs,
190229
&exynos_plane_funcs, formats, ARRAY_SIZE(formats),
191230
priv);
@@ -195,47 +234,10 @@ struct drm_plane *exynos_plane_init(struct drm_device *dev,
195234
return NULL;
196235
}
197236

198-
return &exynos_plane->base;
199-
}
200-
201-
int exynos_plane_set_zpos_ioctl(struct drm_device *dev, void *data,
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;
237+
if (priv)
238+
exynos_plane->overlay.zpos = DEFAULT_ZPOS;
239+
else
240+
exynos_plane_attach_zpos_property(&exynos_plane->base);
214241

215-
if (zpos_req->zpos < 0 || zpos_req->zpos >= MAX_PLANE) {
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-
238-
out:
239-
mutex_unlock(&dev->mode_config.mutex);
240-
return ret;
242+
return &exynos_plane->base;
241243
}

‎drivers/gpu/drm/exynos/exynos_drm_plane.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,3 @@ int exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc,
1717
void exynos_plane_commit(struct drm_plane *plane);
1818
struct drm_plane *exynos_plane_init(struct drm_device *dev,
1919
unsigned int possible_crtcs, bool priv);
20-
int exynos_plane_set_zpos_ioctl(struct drm_device *dev, void *data,
21-
struct drm_file *file_priv);

‎include/drm/exynos_drm.h‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@ struct drm_exynos_vidi_connection {
107107
uint64_t edid;
108108
};
109109

110-
struct drm_exynos_plane_set_zpos {
111-
__u32 plane_id;
112-
__s32 zpos;
113-
};
114-
115110
/* memory type definitions. */
116111
enum e_drm_exynos_gem_mem_type {
117112
/* Physically Continuous memory and used as default. */
@@ -164,7 +159,6 @@ struct drm_exynos_g2d_exec {
164159
#define DRM_EXYNOS_GEM_MMAP 0x02
165160
/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
166161
#define DRM_EXYNOS_GEM_GET 0x04
167-
#define DRM_EXYNOS_PLANE_SET_ZPOS 0x06
168162
#define DRM_EXYNOS_VIDI_CONNECTION 0x07
169163

170164
/* G2D */
@@ -184,9 +178,6 @@ struct drm_exynos_g2d_exec {
184178
#define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
185179
DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
186180

187-
#define DRM_IOCTL_EXYNOS_PLANE_SET_ZPOS DRM_IOWR(DRM_COMMAND_BASE + \
188-
DRM_EXYNOS_PLANE_SET_ZPOS, struct drm_exynos_plane_set_zpos)
189-
190181
#define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \
191182
DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
192183

0 commit comments

Comments
 (0)