Skip to content

Instantly share code, notes, and snippets.

@mthierry
Created September 23, 2016 07:24
Show Gist options
  • Save mthierry/df0cda2535193bf15aaab42122317114 to your computer and use it in GitHub Desktop.
Save mthierry/df0cda2535193bf15aaab42122317114 to your computer and use it in GitHub Desktop.
linux change
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 036cd27..8c568c7 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -44,6 +44,7 @@
/* from BKL pushdown */
DEFINE_MUTEX(drm_global_mutex);
+EXPORT_SYMBOL(drm_global_mutex);
/**
* DOC: file operations
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 92bfe47..b966781 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -137,6 +137,7 @@
#include <drm/i915_drm.h>
#include "i915_drv.h"
#include "intel_mocs.h"
+#include "../drm_internal.h"
#define GEN9_LR_CONTEXT_RENDER_SIZE (22 * PAGE_SIZE)
#define GEN8_LR_CONTEXT_RENDER_SIZE (20 * PAGE_SIZE)
@@ -313,6 +314,7 @@ intel_lr_context_descriptor_update(struct i915_gem_context *ctx,
BUILD_BUG_ON(MAX_CONTEXT_HW_ID > (1<<GEN8_CTX_ID_WIDTH));
+ mutex_lock(&drm_global_mutex);
desc = ctx->desc_template; /* bits 3-4 */
desc |= engine->ctx_desc_template; /* bits 0-11 */
desc |= i915_ggtt_offset(ce->state) + LRC_PPHWSP_PN * PAGE_SIZE;
@@ -320,6 +322,7 @@ intel_lr_context_descriptor_update(struct i915_gem_context *ctx,
desc |= (u64)ctx->hw_id << GEN8_CTX_ID_SHIFT; /* bits 32-52 */
ce->lrc_desc = desc;
+ mutex_unlock(&drm_global_mutex);
}
uint64_t intel_lr_context_descriptor(struct i915_gem_context *ctx,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment