[PATCH RFC 105/111] staging: etnaviv: prune dumb buffer support
Christian Gmeiner
christian.gmeiner at gmail.com
Tue Apr 7 00:37:58 PDT 2015
2015-04-02 17:30 GMT+02:00 Lucas Stach <l.stach at pengutronix.de>:
> Dumb buffers must be only used as backing storage for scanout
> only surfaces. Any acceleration operation on them is not allowed.
>
> So there is no point in having dumb buffer support in a driver
> that isn't able to drive any scanout hardware.
>
> Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
> ---
> drivers/staging/etnaviv/etnaviv_drv.c | 3 ---
> drivers/staging/etnaviv/etnaviv_drv.h | 12 ------------
> drivers/staging/etnaviv/etnaviv_gem.c | 31 -------------------------------
> 3 files changed, 46 deletions(-)
>
> diff --git a/drivers/staging/etnaviv/etnaviv_drv.c b/drivers/staging/etnaviv/etnaviv_drv.c
> index 799793ea0b38..d01af1290bb2 100644
> --- a/drivers/staging/etnaviv/etnaviv_drv.c
> +++ b/drivers/staging/etnaviv/etnaviv_drv.c
> @@ -536,9 +536,6 @@ static struct drm_driver etnaviv_drm_driver = {
> .set_busid = drm_platform_set_busid,
> .gem_free_object = etnaviv_gem_free_object,
> .gem_vm_ops = &vm_ops,
> - .dumb_create = msm_gem_dumb_create,
> - .dumb_map_offset = msm_gem_dumb_map_offset,
> - .dumb_destroy = drm_gem_dumb_destroy,
> .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
> .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
> .gem_prime_export = drm_gem_prime_export,
> diff --git a/drivers/staging/etnaviv/etnaviv_drv.h b/drivers/staging/etnaviv/etnaviv_drv.h
> index 4dfcd03c80ef..8d835a5e2e2a 100644
> --- a/drivers/staging/etnaviv/etnaviv_drv.h
> +++ b/drivers/staging/etnaviv/etnaviv_drv.h
> @@ -80,10 +80,6 @@ int etnaviv_gem_get_iova_locked(struct etnaviv_gpu *gpu,
> int etnaviv_gem_get_iova(struct etnaviv_gpu *gpu, struct drm_gem_object *obj,
> int id, uint32_t *iova);
> void etnaviv_gem_put_iova(struct drm_gem_object *obj);
> -int msm_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
> - struct drm_mode_create_dumb *args);
> -int msm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
> - uint32_t handle, uint64_t *offset);
> struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj);
> void *msm_gem_prime_vmap(struct drm_gem_object *obj);
> void msm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
> @@ -146,12 +142,4 @@ static inline bool fence_completed(struct drm_device *dev, uint32_t fence)
> return fence_after_eq(priv->completed_fence, fence);
> }
>
> -static inline int align_pitch(int width, int bpp)
> -{
> - int bytespp = (bpp + 7) / 8;
> -
> - /* adreno needs pitch aligned to 32 pixels: */
> - return bytespp * ALIGN(width, 32);
> -}
> -
> #endif /* __ETNAVIV_DRV_H__ */
> diff --git a/drivers/staging/etnaviv/etnaviv_gem.c b/drivers/staging/etnaviv/etnaviv_gem.c
> index 04594dad27e2..e396ee90bc5e 100644
> --- a/drivers/staging/etnaviv/etnaviv_gem.c
> +++ b/drivers/staging/etnaviv/etnaviv_gem.c
> @@ -368,37 +368,6 @@ void etnaviv_gem_put_iova(struct drm_gem_object *obj)
> */
> }
>
> -int msm_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
> - struct drm_mode_create_dumb *args)
> -{
> - args->pitch = align_pitch(args->width, args->bpp);
> - args->size = PAGE_ALIGN(args->pitch * args->height);
> - /* TODO: re-check flags */
> - return etnaviv_gem_new_handle(dev, file, args->size,
> - ETNA_BO_WC, &args->handle);
> -}
> -
> -int msm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
> - uint32_t handle, uint64_t *offset)
> -{
> - struct drm_gem_object *obj;
> - int ret = 0;
> -
> - /* GEM does all our handle to object mapping */
> - obj = drm_gem_object_lookup(dev, file, handle);
> - if (obj == NULL) {
> - ret = -ENOENT;
> - goto fail;
> - }
> -
> - *offset = msm_gem_mmap_offset(obj);
> -
> - drm_gem_object_unreference_unlocked(obj);
> -
> -fail:
> - return ret;
> -}
> -
> void *etnaviv_gem_vaddr_locked(struct drm_gem_object *obj)
> {
> struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
> --
> 2.1.4
>
And this one is also quite similar to this one:
https://github.com/austriancoder/linux/commit/cf8e8813ba730334195bc3c74017a29d114e41d1
Except yours also removes align_pitch(..), which is good.
greets
--
Christian Gmeiner, MSc
https://soundcloud.com/christian-gmeiner
More information about the dri-devel
mailing list