From: Ilija Hadzic <ihadzic@research.bell-labs.com> To: dri-devel@lists.freedesktop.org Subject: [PATCH 03/19] drm: use drm_mode_group in drm_mode_getplane_res Date: Thu, 12 Apr 2012 14:19:28 -0400 [thread overview] Message-ID: <1334254784-3200-4-git-send-email-ihadzic@research.bell-labs.com> (raw) In-Reply-To: <1334254784-3200-1-git-send-email-ihadzic@research.bell-labs.com> drm_mode_group structure now tracks planes, so use it in in drm_mode_getplane_res(ources) IOCTL. Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com> --- drivers/gpu/drm/drm_crtc.c | 46 +++++++++++++++++++++++++++++++++---------- 1 files changed, 35 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 29ede0a..eafb49d 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -1564,7 +1564,6 @@ int drm_mode_getplane_res(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_mode_get_plane_res *plane_resp = data; - struct drm_mode_config *config; struct drm_plane *plane; uint32_t __user *plane_ptr; int copied = 0, ret = 0; @@ -1573,25 +1572,50 @@ int drm_mode_getplane_res(struct drm_device *dev, void *data, return -EINVAL; mutex_lock(&dev->mode_config.mutex); - config = &dev->mode_config; /* * This ioctl is called twice, once to determine how much space is * needed, and the 2nd time to fill it. */ - if (config->num_plane && - (plane_resp->count_planes >= config->num_plane)) { - plane_ptr = (uint32_t __user *)(unsigned long)plane_resp->plane_id_ptr; + plane_ptr = (uint32_t __user *)(unsigned long)plane_resp->plane_id_ptr; + if (file_priv->minor->type == DRM_MINOR_CONTROL) { + struct drm_mode_config *config = &dev->mode_config; - list_for_each_entry(plane, &config->plane_list, head) { - if (put_user(plane->base.id, plane_ptr + copied)) { - ret = -EFAULT; - goto out; + if (config->num_plane && + (plane_resp->count_planes >= config->num_plane)) { + list_for_each_entry(plane, &config->plane_list, head) { + if (put_user(plane->base.id, + plane_ptr + copied)) { + ret = -EFAULT; + goto out; + } + copied++; + } + } + plane_resp->count_planes = config->num_plane; + } else { + int i; + struct drm_mode_group *mode_group = + &file_priv->minor->mode_group; + + if (mode_group->num_planes && + (plane_resp->count_planes >= mode_group->num_planes)) { + int start; + + start = mode_group->num_crtcs; + start += mode_group->num_encoders; + start += mode_group->num_connectors; + for (i = start; i < start + mode_group->num_planes; i++) { + if (put_user(mode_group->id_list[i], + plane_ptr + copied)) { + ret = -EFAULT; + goto out; + } + copied++; } - copied++; } + plane_resp->count_planes = mode_group->num_planes; } - plane_resp->count_planes = config->num_plane; out: mutex_unlock(&dev->mode_config.mutex); -- 1.7.8.5
next prev parent reply other threads:[~2012-04-12 18:20 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-04-12 18:19 [RFC v2] Revive the work on render-nodes branch Ilija Hadzic 2012-04-12 18:19 ` [PATCH 01/19] drm: simplify dereferencing of node type Ilija Hadzic 2012-04-12 18:19 ` [PATCH 02/19] drm: track planes in drm_mode_group structure Ilija Hadzic 2012-04-12 18:19 ` Ilija Hadzic [this message] 2012-04-12 18:19 ` [PATCH 04/19] drm: do not push inode down into drm_open_helper Ilija Hadzic 2012-04-12 18:19 ` [PATCH 05/19] drm: move dev_mapping to the minor node Ilija Hadzic 2012-04-20 10:04 ` Dave Airlie 2012-04-30 14:48 ` Ilija Hadzic 2012-04-30 16:39 ` Dave Airlie 2012-04-30 16:52 ` Ilija Hadzic 2012-04-30 17:53 ` Dave Airlie 2012-04-30 18:04 ` Dave Airlie 2012-05-15 20:48 ` Ilija Hadzic 2012-04-12 18:19 ` [PATCH 06/19] drm: add support for render nodes Ilija Hadzic 2012-04-12 18:19 ` [PATCH 07/19] drm: initial multiple nodes ioctl work Ilija Hadzic 2012-04-20 10:15 ` Dave Airlie 2012-04-12 18:19 ` [PATCH 08/19] drm: separate render node descriptor from minor Ilija Hadzic 2012-04-12 18:19 ` [PATCH 09/19] drm: cleanup render node ioctls Ilija Hadzic 2012-04-12 18:19 ` [PATCH 10/19] drm: only allow render node ioctls through control node Ilija Hadzic 2012-04-12 18:19 ` [PATCH 11/19] drm: do not remove a render node in use Ilija Hadzic 2012-04-12 18:19 ` [PATCH 12/19] drm: allocate correct id_list size for a render node Ilija Hadzic 2012-04-12 18:19 ` [PATCH 13/19] drm: add drm_mode_group_fini function Ilija Hadzic 2012-04-12 18:19 ` [PATCH 14/19] drm: properly free id_list when a render node is removed Ilija Hadzic 2012-04-12 18:19 ` [PATCH 15/19] drm: call drm_mode_group_fini on primary node Ilija Hadzic 2012-04-12 18:19 ` [PATCH 16/19] drm: more elaborate check for resource count Ilija Hadzic 2012-04-12 18:19 ` [PATCH 17/19] drm: validate id list when creating a render node Ilija Hadzic 2012-04-12 18:19 ` [PATCH 18/19] drm: keep track of which node holds which resource Ilija Hadzic 2012-04-12 18:19 ` [PATCH 19/19] drm: hold mutex in critical sections of render-node code Ilija Hadzic 2012-04-12 18:55 ` [RFC v2] Revive the work on render-nodes branch Ville Syrjälä 2012-04-12 19:09 ` Ilija Hadzic 2012-04-20 10:20 ` Dave Airlie 2012-04-20 13:46 ` Daniel Vetter 2012-04-30 15:16 ` Ilija Hadzic 2012-04-30 19:01 ` Kristian Høgsberg
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1334254784-3200-4-git-send-email-ihadzic@research.bell-labs.com \ --to=ihadzic@research.bell-labs.com \ --cc=dri-devel@lists.freedesktop.org \ --subject='Re: [PATCH 03/19] drm: use drm_mode_group in drm_mode_getplane_res' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.