It's not used anywhere and it lets us revert the changes to msm_fb to match upstream.
Signed-off-by: Sean Paul <seanp...@chromium.org> --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 279 ------------------------ drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 69 ------ drivers/gpu/drm/msm/msm_drv.h | 3 - drivers/gpu/drm/msm/msm_fb.c | 4 +- 4 files changed, 3 insertions(+), 352 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 30da3e047384..ddba0873466b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -698,134 +698,6 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) return ret; } -/** - * struct dpu_kms_fbo_fb - framebuffer creation list - * @list: list of framebuffer attached to framebuffer object - * @fb: Pointer to framebuffer attached to framebuffer object - */ -struct dpu_kms_fbo_fb { - struct list_head list; - struct drm_framebuffer *fb; -}; - -struct drm_framebuffer *dpu_kms_fbo_create_fb(struct drm_device *dev, - struct dpu_kms_fbo *fbo) -{ - struct drm_framebuffer *fb = NULL; - struct dpu_kms_fbo_fb *fbo_fb; - struct drm_mode_fb_cmd2 mode_cmd = {0}; - u32 base_offset = 0; - int i, ret; - - if (!dev) { - DPU_ERROR("invalid drm device node\n"); - return NULL; - } - - fbo_fb = kzalloc(sizeof(struct dpu_kms_fbo_fb), GFP_KERNEL); - if (!fbo_fb) - return NULL; - - mode_cmd.pixel_format = fbo->pixel_format; - mode_cmd.width = fbo->width; - mode_cmd.height = fbo->height; - mode_cmd.flags = fbo->flags; - - for (i = 0; i < fbo->nplane; i++) { - mode_cmd.offsets[i] = base_offset; - mode_cmd.pitches[i] = fbo->layout.plane_pitch[i]; - mode_cmd.modifier[i] = fbo->modifier[i]; - base_offset += fbo->layout.plane_size[i]; - DPU_DEBUG("offset[%d]:%x\n", i, mode_cmd.offsets[i]); - } - - fb = msm_framebuffer_init(dev, &mode_cmd, fbo->bo); - if (IS_ERR(fb)) { - ret = PTR_ERR(fb); - fb = NULL; - DPU_ERROR("failed to allocate fb %d\n", ret); - goto fail; - } - - /* need to take one reference for gem object */ - for (i = 0; i < fbo->nplane; i++) - drm_gem_object_get(fbo->bo[i]); - - DPU_DEBUG("register private fb:%d\n", fb->base.id); - - INIT_LIST_HEAD(&fbo_fb->list); - fbo_fb->fb = fb; - drm_framebuffer_get(fbo_fb->fb); - list_add_tail(&fbo_fb->list, &fbo->fb_list); - - return fb; - -fail: - kfree(fbo_fb); - return NULL; -} - -static void dpu_kms_fbo_destroy(struct dpu_kms_fbo *fbo) -{ - struct msm_drm_private *priv; - struct dpu_kms *dpu_kms; - struct drm_device *dev; - struct dpu_kms_fbo_fb *curr, *next; - int i; - - if (!fbo) { - DPU_ERROR("invalid drm device node\n"); - return; - } - dev = fbo->dev; - - if (!dev || !dev->dev_private) { - DPU_ERROR("invalid drm device node\n"); - return; - } - priv = dev->dev_private; - - if (!priv->kms) { - DPU_ERROR("invalid kms handle\n"); - return; - } - dpu_kms = to_dpu_kms(priv->kms); - - DPU_DEBUG("%dx%d@%c%c%c%c/%llx/%x\n", fbo->width, fbo->height, - fbo->pixel_format >> 0, fbo->pixel_format >> 8, - fbo->pixel_format >> 16, fbo->pixel_format >> 24, - fbo->modifier[0], fbo->flags); - - list_for_each_entry_safe(curr, next, &fbo->fb_list, list) { - DPU_DEBUG("unregister private fb:%d\n", curr->fb->base.id); - drm_framebuffer_unregister_private(curr->fb); - drm_framebuffer_put(curr->fb); - list_del(&curr->list); - kfree(curr); - } - - for (i = 0; i < fbo->layout.num_planes; i++) { - if (fbo->bo[i]) { - mutex_lock(&dev->struct_mutex); - drm_gem_object_put(fbo->bo[i]); - mutex_unlock(&dev->struct_mutex); - fbo->bo[i] = NULL; - } - } - - if (fbo->dma_buf) { - dma_buf_put(fbo->dma_buf); - fbo->dma_buf = NULL; - } - -#ifdef CONFIG_ION - if (dpu_kms->iclient && fbo->ihandle) { - ion_free(dpu_kms->iclient, fbo->ihandle); - fbo->ihandle = NULL; - } -#endif -} - #ifdef CONFIG_ION static void dpu_kms_set_gem_flags(struct msm_gem_object *msm_obj, uint32_t flags) @@ -835,157 +707,6 @@ static void dpu_kms_set_gem_flags(struct msm_gem_object *msm_obj, } #endif -struct dpu_kms_fbo *dpu_kms_fbo_alloc(struct drm_device *dev, u32 width, - u32 height, u32 pixel_format, u64 modifier[4], u32 flags) -{ - struct msm_drm_private *priv; - struct dpu_kms *dpu_kms; - struct dpu_kms_fbo *fbo; - int i, ret; - - if (!dev || !dev->dev_private) { - DPU_ERROR("invalid drm device node\n"); - return NULL; - } - priv = dev->dev_private; - - if (!priv->kms) { - DPU_ERROR("invalid kms handle\n"); - return NULL; - } - dpu_kms = to_dpu_kms(priv->kms); - - DPU_DEBUG("%dx%d@%c%c%c%c/%llx/%x\n", width, height, - pixel_format >> 0, pixel_format >> 8, - pixel_format >> 16, pixel_format >> 24, - modifier[0], flags); - - fbo = kzalloc(sizeof(struct dpu_kms_fbo), GFP_KERNEL); - if (!fbo) - return NULL; - - atomic_set(&fbo->refcount, 0); - INIT_LIST_HEAD(&fbo->fb_list); - fbo->dev = dev; - fbo->width = width; - fbo->height = height; - fbo->pixel_format = pixel_format; - fbo->flags = flags; - for (i = 0; i < ARRAY_SIZE(fbo->modifier); i++) - fbo->modifier[i] = modifier[i]; - fbo->nplane = drm_format_num_planes(fbo->pixel_format); - fbo->fmt = dpu_get_dpu_format_ext(fbo->pixel_format, fbo->modifier[0]); - if (!fbo->fmt) { - ret = -EINVAL; - DPU_ERROR("failed to find pixel format\n"); - goto done; - } - - ret = dpu_format_get_plane_sizes(fbo->fmt, fbo->width, fbo->height, - &fbo->layout, fbo->layout.plane_pitch); - if (ret) { - DPU_ERROR("failed to get plane sizes\n"); - goto done; - } - - /* allocate backing buffer object */ - if (dpu_kms->iclient) { -#ifdef CONFIG_ION - u32 heap_id = ION_HEAP(ION_SYSTEM_HEAP_ID); - - fbo->ihandle = ion_alloc(dpu_kms->iclient, - fbo->layout.total_size, SZ_4K, heap_id, 0); - if (IS_ERR_OR_NULL(fbo->ihandle)) { - DPU_ERROR("failed to alloc ion memory\n"); - ret = PTR_ERR(fbo->ihandle); - fbo->ihandle = NULL; - goto done; - } - - fbo->dma_buf = ion_share_dma_buf(dpu_kms->iclient, - fbo->ihandle); - if (IS_ERR(fbo->dma_buf)) { - DPU_ERROR("failed to share ion memory\n"); - ret = -ENOMEM; - fbo->dma_buf = NULL; - goto done; - } - - fbo->bo[0] = dev->driver->gem_prime_import(dev, - fbo->dma_buf); - if (IS_ERR(fbo->bo[0])) { - DPU_ERROR("failed to import ion memory\n"); - ret = PTR_ERR(fbo->bo[0]); - fbo->bo[0] = NULL; - goto done; - } - - /* insert extra bo flags */ - dpu_kms_set_gem_flags(to_msm_bo(fbo->bo[0]), MSM_BO_KEEPATTRS); -#endif - } else { - fbo->bo[0] = msm_gem_new(dev, fbo->layout.total_size, - MSM_BO_SCANOUT | MSM_BO_WC); - if (IS_ERR(fbo->bo[0])) { - DPU_ERROR("failed to new gem buffer\n"); - ret = PTR_ERR(fbo->bo[0]); - fbo->bo[0] = NULL; - goto done; - } - } - - mutex_lock(&dev->struct_mutex); - for (i = 1; i < fbo->layout.num_planes; i++) { - fbo->bo[i] = fbo->bo[0]; - drm_gem_object_get(fbo->bo[i]); - } - mutex_unlock(&dev->struct_mutex); - -done: - if (ret) { - dpu_kms_fbo_destroy(fbo); - kfree(fbo); - fbo = NULL; - } else { - dpu_kms_fbo_reference(fbo); - } - - return fbo; -} - -int dpu_kms_fbo_reference(struct dpu_kms_fbo *fbo) -{ - if (!fbo) { - DPU_ERROR("invalid parameters\n"); - return -EINVAL; - } - - DPU_DEBUG("%pS refcount:%d\n", __builtin_return_address(0), - atomic_read(&fbo->refcount)); - - atomic_inc(&fbo->refcount); - - return 0; -} - -void dpu_kms_fbo_unreference(struct dpu_kms_fbo *fbo) -{ - if (!fbo) { - DPU_ERROR("invalid parameters\n"); - return; - } - - DPU_DEBUG("%pS refcount:%d\n", __builtin_return_address(0), - atomic_read(&fbo->refcount)); - - if (!atomic_read(&fbo->refcount)) { - DPU_ERROR("invalid refcount\n"); - return; - } else if (atomic_dec_return(&fbo->refcount) == 0) { - dpu_kms_fbo_destroy(fbo); - } -} - #ifdef CONFIG_DEBUG_FS static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor) { diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h index 4f86a51affdc..6308bd84e6a9 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h @@ -110,37 +110,6 @@ struct dpu_irq { struct dentry *debugfs_file; }; -/** - * struct dpu_kms_fbo - framebuffer memory object - * @refcount: reference/usage count of this object - * @dev: Pointer to containing drm device - * @width: width of the framebuffer - * @height: height of the framebuffer - * @flags: drm framebuffer flags - * @modifier: pixel format modifier of the framebuffer - * @fmt: Pointer to dpu format descriptor - * @layout: dpu format layout descriptor - * @ihandle: framebuffer object ion handle - * @dma_buf: framebuffer object dma buffer - * @bo: per plane buffer object - * @fb_list: llist of fb created from this buffer object - */ -struct dpu_kms_fbo { - atomic_t refcount; - struct drm_device *dev; - u32 width, height; - u32 pixel_format; - u32 flags; - u64 modifier[4]; - int nplane; - const struct dpu_format *fmt; - struct dpu_hw_fmt_layout layout; - struct ion_handle *ihandle; - struct dma_buf *dma_buf; - struct drm_gem_object *bo[4]; - struct list_head fb_list; -}; - struct dpu_kms { struct msm_kms base; struct drm_device *dev; @@ -426,44 +395,6 @@ void dpu_kms_info_stop(struct dpu_kms_info *info); int dpu_enable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); void dpu_disable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); -/** - * dpu_kms_fbo_create_fb - create framebuffer from given framebuffer object - * @dev: Pointer to drm device - * @fbo: Pointer to framebuffer object - * return: Pointer to drm framebuffer on success; NULL on error - */ -struct drm_framebuffer *dpu_kms_fbo_create_fb(struct drm_device *dev, - struct dpu_kms_fbo *fbo); - -/** - * dpu_kms_fbo_alloc - create framebuffer object with given format parameters - * @dev: pointer to drm device - * @width: width of framebuffer - * @height: height of framebuffer - * @pixel_format: pixel format of framebuffer - * @modifier: pixel format modifier - * @flags: DRM_MODE_FB flags - * return: Pointer to framebuffer memory object on success; NULL on error - */ -struct dpu_kms_fbo *dpu_kms_fbo_alloc(struct drm_device *dev, - u32 width, u32 height, u32 pixel_format, - u64 modifiers[4], u32 flags); - -/** - * dpu_kms_fbo_reference - increment reference count of given framebuffer object - * @fbo: Pointer to framebuffer memory object - * return: 0 on success; error code otherwise - */ -int dpu_kms_fbo_reference(struct dpu_kms_fbo *fbo); - -/** - * dpu_kms_fbo_unreference - decrement reference count of given framebuffer - * object - * @fbo: Pointer to framebuffer memory object - * return: 0 on success; error code otherwise - */ -void dpu_kms_fbo_unreference(struct dpu_kms_fbo *fbo); - void dpu_kms_encoder_enable(struct drm_encoder *encoder); /** diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 4a2f87fe11a9..c370a962d0a3 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -339,9 +339,6 @@ uint32_t msm_framebuffer_iova(struct drm_framebuffer *fb, uint32_t msm_framebuffer_phys(struct drm_framebuffer *fb, int plane); struct drm_gem_object *msm_framebuffer_bo(struct drm_framebuffer *fb, int plane); const struct msm_format *msm_framebuffer_format(struct drm_framebuffer *fb); -struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, - const struct drm_mode_fb_cmd2 *mode_cmd, - struct drm_gem_object **bos); struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev, struct drm_file *file, const struct drm_mode_fb_cmd2 *mode_cmd); struct drm_framebuffer * msm_alloc_stolen_fb(struct drm_device *dev, diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c index 32e0f33ff43b..ce604a6ab599 100644 --- a/drivers/gpu/drm/msm/msm_fb.c +++ b/drivers/gpu/drm/msm/msm_fb.c @@ -29,6 +29,8 @@ struct msm_framebuffer { }; #define to_msm_framebuffer(x) container_of(x, struct msm_framebuffer, base) +static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, + const struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_object **bos); static int msm_framebuffer_create_handle(struct drm_framebuffer *fb, struct drm_file *file_priv, @@ -161,7 +163,7 @@ struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev, return ERR_PTR(ret); } -struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, +static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, const struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_object **bos) { struct msm_drm_private *priv = dev->dev_private; -- Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno