Skip to content

Commit

Permalink
INTERNAL: Enable the low context priority setting
Browse files Browse the repository at this point in the history
Add the mechanism in EGL and vulkan.

Tracked-On: OAM-112246
Signed-off-by: HeYue <[email protected]>
  • Loading branch information
yhe39 authored and buildslave committed Sep 26, 2023
1 parent bfd7541 commit 159df0b
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/egl/drivers/dri2/egl_dri2.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
#include "util/driconf.h"
#include "util/u_math.h"
#include "pipe/p_screen.h"
#include "common/intel_check.h"

#define NUM_ATTRIBS 12

Expand Down Expand Up @@ -1430,6 +1431,10 @@ dri2_create_context(_EGLDisplay *disp, _EGLConfig *conf,
else
dri_config = NULL;

if (intel_lower_ctx_priority()) {
dri2_ctx->base.ContextPriority = EGL_CONTEXT_PRIORITY_LOW_IMG;
}

if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
&num_attribs))
goto cleanup;
Expand Down
17 changes: 17 additions & 0 deletions src/intel/common/intel_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,20 @@ bool intel_is_dgpu_render() {
get_pid_name(process_id, process_name);
return (use_dgpu_render(process_name) || is_target_process(process_name));
}

bool intel_lower_ctx_priority()
{
pid_t process_id = getpid();
char process_name[BUF_SIZE];
get_pid_name(process_id, process_name);

   char lower_pri[BUF_SIZE];
   char vendor_buf[PROPERTY_VALUE_MAX];
   sprintf(lower_pri, "persist.vendor.intel.lowPir.%s",process_name);
   if (property_get(lower_pri, vendor_buf, NULL) > 0) {
      if (vendor_buf[0] == '1') {
         return true;
      }
   }
return false;
}
1 change: 1 addition & 0 deletions src/intel/common/intel_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
extern "C" {
#endif
bool intel_is_dgpu_render();
bool intel_lower_ctx_priority();
#ifdef __cplusplus
}
#endif
Expand Down
9 changes: 9 additions & 0 deletions src/intel/vulkan/anv_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -3245,6 +3245,15 @@ anv_device_setup_context(struct anv_device *device,
}
}

if (intel_lower_ctx_priority()) {
int ret = anv_gem_set_context_param(device->fd, device->context_id,
I915_CONTEXT_PARAM_PRIORITY,
VK_QUEUE_GLOBAL_PRIORITY_LOW_KHR);
if (ret != 0) {
goto fail_context;
}
}

return result;

fail_context:
Expand Down

0 comments on commit 159df0b

Please sign in to comment.