[PATCH 1/3] drm: add driver hook for create blob limitations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allow drivers with blob limitations to run checks before blobs
are created. This can be used to limit how much memory can be
allocated based on driver requirements.

Signed-off-by: Steve Cohen <cohens@xxxxxxxxxxxxxx>
---
 drivers/gpu/drm/drm_property.c | 7 +++++++
 include/drm/drm_drv.h          | 9 +++++++++
 2 files changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
index 892ce63..507a8a1 100644
--- a/drivers/gpu/drm/drm_property.c
+++ b/drivers/gpu/drm/drm_property.c
@@ -793,6 +793,13 @@ int drm_mode_createblob_ioctl(struct drm_device *dev,
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
 		return -EOPNOTSUPP;
 
+	if (dev->driver->createblob_check) {
+		ret = dev->driver->createblob_check(
+				dev, out_resp->length, file_priv);
+		if (ret)
+			return ret;
+	}
+
 	blob = drm_property_create_blob(dev, out_resp->length, NULL);
 	if (IS_ERR(blob))
 		return PTR_ERR(blob);
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 8976afe..73b39b89 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -776,6 +776,15 @@ struct drm_driver {
 	int (*dma_quiescent) (struct drm_device *);
 	int (*context_dtor) (struct drm_device *dev, int context);
 	int dev_priv_size;
+
+	/**
+	 * @createblob_check: driver check for creating blob properties
+	 *
+	 * Hook for checking blob limitations imposed by drivers
+	 */
+	int (*createblob_check) (struct drm_device *dev,
+				 size_t length,
+				 struct drm_file *file_priv);
 };
 
 extern unsigned int drm_debug;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux