@@ -680,6 +680,30 @@ static void msm_disable_vblank(struct drm_device *dev, unsigned int pipe)
vblank_ctrl_queue_work(priv, pipe, false);
}
+static int msm_createblob_check (struct drm_device *dev, size_t length,
+ struct drm_file *file_priv)
+{
+ struct msm_drm_private *priv = dev->dev_private;
+ struct msm_kms *kms = priv->kms;
+ unsigned int count = 0;
+ struct drm_property_blob *blob;
+
+ if (!kms)
+ return -EINVAL;
+
+ if (!kms->funcs->createblob_check)
+ return 0;
+
+ mutex_lock(&dev->mode_config.blob_lock);
+ list_for_each_entry(blob, &file_priv->blobs, head_file) {
+ if (count < UINT_MAX)
+ count++;
+ }
+ mutex_unlock(&dev->mode_config.blob_lock);
+
+ return kms->funcs->createblob_check(count, length);
+}
+
/*
* DRM ioctls:
*/
@@ -1011,6 +1035,7 @@ static struct drm_driver msm_driver = {
.gem_prime_vmap = msm_gem_prime_vmap,
.gem_prime_vunmap = msm_gem_prime_vunmap,
.gem_prime_mmap = msm_gem_prime_mmap,
+ .createblob_check = msm_createblob_check,
#ifdef CONFIG_DEBUG_FS
.debugfs_init = msm_debugfs_init,
#endif
@@ -126,6 +126,7 @@ struct msm_kms_funcs {
/* debugfs: */
int (*debugfs_init)(struct msm_kms *kms, struct drm_minor *minor);
#endif
+ int (*createblob_check)(unsigned int count, size_t length);
};
struct msm_kms;
Allow msm_kms devices to register a hook to check blob count and blob size limitations before a new blob is created. Signed-off-by: Steve Cohen <cohens@codeaurora.org> --- drivers/gpu/drm/msm/msm_drv.c | 25 +++++++++++++++++++++++++ drivers/gpu/drm/msm/msm_kms.h | 1 + 2 files changed, 26 insertions(+)