Skip to content

Instantly share code, notes, and snippets.

@tiagovignatti
Created July 23, 2015 13:23
Show Gist options
  • Save tiagovignatti/18ea9b244f01fef0e8da to your computer and use it in GitHub Desktop.
Save tiagovignatti/18ea9b244f01fef0e8da to your computer and use it in GitHub Desktop.
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index e1790af..a7737e0 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -39,7 +39,8 @@
#include <drm/drmP.h>
#include <drm/drm_core.h>
-unsigned int drm_debug = 0; /* 1 to enable debug output */
+unsigned int drm_debug = 15; /* 1 to enable debug output */
+//unsigned int drm_debug = 0; /* 1 to enable debug output */
EXPORT_SYMBOL(drm_debug);
diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
index 5d0f65d..6478e93 100644
--- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
@@ -199,7 +199,7 @@ static int i915_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *
{
struct drm_i915_gem_object *obj = dma_buf_to_obj(dma_buf);
struct drm_device *dev = obj->base.dev;
-
+#if 0
if (obj->base.size < vma->vm_end - vma->vm_start)
return -EINVAL;
@@ -212,6 +212,24 @@ static int i915_gem_dmabuf_mmap(struct dma_buf *dma_buf, struct vm_area_struct *
vma->vm_ops->open(vma);
return 0;
+#else
+ int ret;
+
+ if (INTEL_INFO(dev)->gen < 6)
+ return -EINVAL;
+
+ if (!obj->base.filp)
+ return -EINVAL;
+
+ /* TODO: double check whether we need to wrap the following with
+ * {begin,end}_cpu_access for coherent mapping. */
+
+ ret = obj->base.filp->f_op->mmap(obj->base.filp, vma);
+ fput(vma->vm_file);
+ vma->vm_file = get_file(obj->base.filp);
+
+ return ret;
+#endif
}
static int i915_gem_begin_cpu_access(struct dma_buf *dma_buf, size_t start, size_t length, enum dma_data_direction direction)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment