[PATCH] vmwgfx: add dumb ioctl support
Jakob Bornecrantz
jakob at vmware.com
Tue Aug 28 08:06:03 PDT 2012
Thanks for doing this.
With an exception of a comment below all 3 patches are
Reviewed-by: Jakob Bornecrantz <jakob at vmware.com>
----- Original Message -----
> From: Dave Airlie <airlied at redhat.com>
>
> Testing and works with the -modesetting driver at least so far.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 5 +++
> drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 10 +++++
> drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 73
> ++++++++++++++++++++++++++++++++
> 3 files changed, 88 insertions(+)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> index 4d9edea..4d13bf7 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> @@ -1154,6 +1154,11 @@ static struct drm_driver driver = {
> .open = vmw_driver_open,
> .preclose = vmw_preclose,
> .postclose = vmw_postclose,
> +
> + .dumb_create = vmw_dumb_create,
> + .dumb_map_offset = vmw_dumb_map_offset,
> + .dumb_destroy = vmw_dumb_destroy,
> +
> .fops = &vmwgfx_driver_fops,
> .name = VMWGFX_DRIVER_NAME,
> .desc = VMWGFX_DRIVER_DESC,
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
> b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
> index d0f2c07..29c984f 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
> @@ -645,6 +645,16 @@ int vmw_kms_readback(struct vmw_private
> *dev_priv,
> int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
> struct drm_file *file_priv);
>
> +int vmw_dumb_create(struct drm_file *file_priv,
> + struct drm_device *dev,
> + struct drm_mode_create_dumb *args);
> +
> +int vmw_dumb_map_offset(struct drm_file *file_priv,
> + struct drm_device *dev, uint32_t handle,
> + uint64_t *offset);
> +int vmw_dumb_destroy(struct drm_file *file_priv,
> + struct drm_device *dev,
> + uint32_t handle);
> /**
> * Overlay control - vmwgfx_overlay.c
> */
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
> b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
> index 22bf9a2..5761775 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
> @@ -1917,3 +1917,76 @@ err_ref:
> vmw_resource_unreference(&res);
> return ret;
> }
> +
> +
> +int vmw_dumb_create(struct drm_file *file_priv,
> + struct drm_device *dev,
> + struct drm_mode_create_dumb *args)
> +{
> + struct vmw_private *dev_priv = vmw_priv(dev);
> + struct vmw_master *vmaster = vmw_master(file_priv->master);
> + struct vmw_user_dma_buffer *vmw_user_bo;
> + struct ttm_buffer_object *tmp;
> + int ret;
> +
> + args->pitch = args->width * args->bpp / 8;
> + args->size = args->pitch * args->height;
We talked about this on IRC, it should probably be
(args->bpp + 7) / 8
Cheers, Jakob.
More information about the dri-devel
mailing list