[Mesa-dev] [PATCH] renderonly: use drmIoctl
Eric Engestrom
eric.engestrom at imgtec.com
Fri Apr 28 12:55:38 UTC 2017
On Friday, 2017-04-28 13:14:20 +0200, Philipp Zabel wrote:
> To restart interrupted system calls, use drmIoctl.
>
> Suggested-by: Emil Velikov <emil.l.velikov at gmail.com>
> Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
A quick grep shows 8 other `ioctl()`; do we want to fix them as well?
src/gallium/auxiliary/hud/hud_nic.c:128: if (ioctl(sockfd, SIOCGIWRATE, &req) == -1) {
src/gallium/auxiliary/hud/hud_nic.c:163: if (ioctl(sockfd, SIOCGIWSTATS, &req) == -1) {
src/gallium/winsys/i915/drm/i915_drm_winsys.c:27: ret = ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp));
src/gallium/winsys/radeon/drm/radeon_drm_bo.c:1305: if (ioctl(ws->fd, DRM_IOCTL_GEM_FLINK, &flink)) {
src/intel/vulkan/anv_gem.c:207: ret = ioctl(device->fd, DRM_IOCTL_I915_GEM_SET_TILING, &set_tiling);
src/intel/vulkan/anv_gem.c:257: ret = ioctl(fd, DRM_IOCTL_I915_GEM_SET_TILING, &set_tiling);
src/intel/vulkan/anv_gem.c:39: ret = ioctl(fd, request, arg);
src/mesa/drivers/dri/i965/brw_bufmgr.c:994: ret = ioctl(bufmgr->fd, DRM_IOCTL_I915_GEM_SET_TILING, &set_tiling);
> ---
> Applies on top of the "renderonly: drop resources on destroy" patch:
> https://patchwork.freedesktop.org/patch/153274/
> ---
> src/gallium/auxiliary/renderonly/renderonly.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/auxiliary/renderonly/renderonly.c b/src/gallium/auxiliary/renderonly/renderonly.c
> index f377c368e5..2fe1009016 100644
> --- a/src/gallium/auxiliary/renderonly/renderonly.c
> +++ b/src/gallium/auxiliary/renderonly/renderonly.c
> @@ -29,7 +29,6 @@
> #include <errno.h>
> #include <fcntl.h>
> #include <stdio.h>
> -#include <sys/ioctl.h>
> #include <xf86drm.h>
>
> #include "state_tracker/drm_driver.h"
> @@ -74,7 +73,7 @@ renderonly_scanout_destroy(struct renderonly_scanout *scanout,
> pipe_resource_reference(&scanout->prime, NULL);
> if (ro->kms_fd != -1) {
> destroy_dumb.handle = scanout->handle;
> - ioctl(ro->kms_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
> + drmIoctl(ro->kms_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
> }
> FREE(scanout);
> }
> @@ -99,7 +98,7 @@ renderonly_create_kms_dumb_buffer_for_resource(struct pipe_resource *rsc,
> return NULL;
>
> /* create dumb buffer at scanout GPU */
> - err = ioctl(ro->kms_fd, DRM_IOCTL_MODE_CREATE_DUMB, &create_dumb);
> + err = drmIoctl(ro->kms_fd, DRM_IOCTL_MODE_CREATE_DUMB, &create_dumb);
> if (err < 0) {
> fprintf(stderr, "DRM_IOCTL_MODE_CREATE_DUMB failed: %s\n",
> strerror(errno));
> @@ -136,7 +135,7 @@ renderonly_create_kms_dumb_buffer_for_resource(struct pipe_resource *rsc,
>
> free_dumb:
> destroy_dumb.handle = scanout->handle;
> - ioctl(ro->kms_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
> + drmIoctl(ro->kms_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
>
> free_scanout:
> FREE(scanout);
> --
> 2.11.0
>
More information about the mesa-dev
mailing list