-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set subslice mask according to the per-context sseu value. #271
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,9 +13,24 @@ $ make headers_install INSTALL_HDR_PATH=/path/to/install | |
|
||
The last update was done at the following kernel commit : | ||
|
||
commit 9235dd441af43599b9cdcce599a3da4083fcad3c | ||
Merge: d7563c5 36b486b | ||
Author: Dave Airlie <[email protected]> | ||
Date: Mon Nov 19 11:07:52 2018 +1000 | ||
commit 16065fcdd19ddb9e093192914ac863884f308766 | ||
Author: Gerd Hoffmann <[email protected]> | ||
Date: Fri Feb 8 15:04:09 2019 +0100 | ||
|
||
Merge branch 'drm-next-4.21' of git://people.freedesktop.org/~agd5f/linux into drm-next | ||
drm/virtio: do NOT reuse resource ids | ||
|
||
Bisected guest kernel changes crashing qemu. Landed at | ||
"6c1cd97bda drm/virtio: fix resource id handling". Looked again, and | ||
noticed we where not only leaking *some* ids, but *all* ids. The old | ||
code never ever called virtio_gpu_resource_id_put(). | ||
|
||
So, commit 6c1cd97bda effectively makes the linux kernel starting | ||
re-using IDs after releasing them, and apparently virglrenderer can't | ||
deal with that. Oops. | ||
|
||
This patch puts a temporary stopgap into place for the 5.0 release. | ||
|
||
Signed-off-by: Gerd Hoffmann <[email protected]> | ||
Reviewed-by: Dave Airlie <[email protected]> | ||
Signed-off-by: Dave Airlie <[email protected]> | ||
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4187,6 +4187,124 @@ mos_get_reset_stats(struct mos_linux_context *ctx, | |
return ret; | ||
} | ||
|
||
unsigned int mos_hweight8(uint8_t w) | ||
{ | ||
uint32_t i, weight = 0; | ||
|
||
for (i=0; i<8; i++) | ||
{ | ||
weight += !!((w) & (1UL << i)); | ||
} | ||
return weight; | ||
} | ||
|
||
uint8_t mos_switch_off_n_bits(uint8_t in_mask, int n) | ||
{ | ||
int i,count; | ||
uint8_t bi,out_mask; | ||
|
||
assert (n>0 && n<=8); | ||
|
||
out_mask = in_mask; | ||
count = n; | ||
for(i=0; i<8; i++) | ||
{ | ||
bi = 1UL<<i; | ||
if (bi & in_mask) | ||
{ | ||
out_mask &= ~bi; | ||
count--; | ||
} | ||
if (count==0) | ||
{ | ||
break; | ||
} | ||
} | ||
return out_mask; | ||
} | ||
|
||
int | ||
mos_get_context_param_sseu(struct mos_linux_context *ctx, | ||
struct drm_i915_gem_context_param_sseu *sseu) | ||
{ | ||
struct mos_bufmgr_gem *bufmgr_gem; | ||
struct drm_i915_gem_context_param context_param; | ||
int ret; | ||
|
||
if (ctx == nullptr) | ||
return -EINVAL; | ||
|
||
bufmgr_gem = (struct mos_bufmgr_gem *)ctx->bufmgr; | ||
memset(&context_param, 0, sizeof(context_param)); | ||
context_param.ctx_id = ctx->ctx_id; | ||
context_param.param = I915_CONTEXT_PARAM_SSEU; | ||
context_param.value = (uint64_t) sseu; | ||
context_param.size = sizeof(struct drm_i915_gem_context_param_sseu); | ||
|
||
ret = drmIoctl(bufmgr_gem->fd, | ||
DRM_IOCTL_I915_GEM_CONTEXT_GETPARAM, | ||
&context_param); | ||
|
||
return ret; | ||
} | ||
|
||
int | ||
mos_set_context_param_sseu(struct mos_linux_context *ctx, | ||
struct drm_i915_gem_context_param_sseu sseu) | ||
{ | ||
struct mos_bufmgr_gem *bufmgr_gem; | ||
struct drm_i915_gem_context_param context_param; | ||
int ret; | ||
|
||
if (ctx == nullptr) | ||
return -EINVAL; | ||
|
||
bufmgr_gem = (struct mos_bufmgr_gem *)ctx->bufmgr; | ||
memset(&context_param, 0, sizeof(context_param)); | ||
context_param.ctx_id = ctx->ctx_id; | ||
context_param.param = I915_CONTEXT_PARAM_SSEU; | ||
context_param.value = (uint64_t) &sseu; | ||
context_param.size = sizeof(struct drm_i915_gem_context_param_sseu); | ||
|
||
ret = drmIoctl(bufmgr_gem->fd, | ||
DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, | ||
&context_param); | ||
|
||
return ret; | ||
} | ||
|
||
int | ||
mos_get_subslice_mask(int fd, unsigned int *subslice_mask) | ||
{ | ||
drm_i915_getparam_t gp; | ||
int ret; | ||
|
||
memclear(gp); | ||
gp.value = (int*)subslice_mask; | ||
gp.param = I915_PARAM_SUBSLICE_MASK; | ||
ret = drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); | ||
if (ret) | ||
return -errno; | ||
|
||
return 0; | ||
} | ||
|
||
int | ||
mos_get_slice_mask(int fd, unsigned int *slice_mask) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same. This function also looks unused. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At the beginning, this PR included the changes to upgrade the SKL slice shutdown with this upstream SSEU uAPI. This function was used for that purpose. If we do not need SKL slice shutdown anymore on master branch, it can be removed. Again, it's also a thin wrapper of the uAPI and could be useful in the future. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see the point to keep the code which we don't exercise. This will give us a burden to support. I would drop. And if it is needed by someone - let him bring the whole bunch of code to support SKL slice shutdown rather than few functions for it. |
||
{ | ||
drm_i915_getparam_t gp; | ||
int ret; | ||
|
||
memclear(gp); | ||
gp.value = (int*)slice_mask; | ||
gp.param = I915_PARAM_SLICE_MASK; | ||
ret = drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); | ||
if (ret) | ||
return -errno; | ||
|
||
return 0; | ||
} | ||
|
||
int | ||
mos_get_context_param(struct mos_linux_context *ctx, | ||
uint32_t size, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see you use this function. Do we really need it? Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was used at the beginning and then removed later. But it is a thin wrapper of the uAPI, maybe it can be useful in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the point to keep the code which we don't exercise. This will give us a burden to support. I would drop.