if (perf_cfg)
return perf_cfg->n_queries;
- if (!oa_metrics_kernel_support(brw->screen->driScrnPriv->fd, devinfo))
+ if (!oa_metrics_kernel_support(brw->screen->fd, devinfo))
return 0;
perf_cfg = gen_perf_new(ctx);
perf_cfg->vtbl.bo_busy = (bo_busy_t)brw_bo_busy;
gen_perf_init_context(perf_ctx, perf_cfg, brw, brw->bufmgr, devinfo,
- brw->hw_ctx, brw->screen->driScrnPriv->fd);
- gen_perf_init_metrics(perf_cfg, devinfo, brw->screen->driScrnPriv->fd);
+ brw->hw_ctx, brw->screen->fd);
+ gen_perf_init_metrics(perf_cfg, devinfo, brw->screen->fd);
return perf_cfg->n_queries;
}
brw_get_graphics_reset_status(struct gl_context *ctx)
{
struct brw_context *brw = brw_context(ctx);
- __DRIscreen *dri_screen = brw->screen->driScrnPriv;
struct drm_i915_reset_stats stats = { .ctx_id = brw->hw_ctx };
/* If hardware contexts are not being used (or
if (brw->reset_count != 0)
return GL_NO_ERROR;
- if (drmIoctl(dri_screen->fd, DRM_IOCTL_I915_GET_RESET_STATS, &stats) != 0)
+ if (drmIoctl(brw->screen->fd, DRM_IOCTL_I915_GET_RESET_STATS, &stats) != 0)
return GL_NO_ERROR;
/* A reset was observed while a batch from this context was executing.
void
brw_check_for_reset(struct brw_context *brw)
{
- __DRIscreen *dri_screen = brw->screen->driScrnPriv;
struct drm_i915_reset_stats stats = { .ctx_id = brw->hw_ctx };
- if (drmIoctl(dri_screen->fd, DRM_IOCTL_I915_GET_RESET_STATS, &stats) != 0)
+ if (drmIoctl(brw->screen->fd, DRM_IOCTL_I915_GET_RESET_STATS, &stats) != 0)
return;
if (stats.batch_active > 0 || stats.batch_pending > 0)
}
if (brw->need_flush_throttle) {
- __DRIscreen *dri_screen = brw->screen->driScrnPriv;
- drmCommandNone(dri_screen->fd, DRM_I915_GEM_THROTTLE);
+ drmCommandNone(brw->screen->fd, DRM_I915_GEM_THROTTLE);
brw->need_flush_throttle = false;
}
}
static int
submit_batch(struct brw_context *brw, int in_fence_fd, int *out_fence_fd)
{
- __DRIscreen *dri_screen = brw->screen->driScrnPriv;
struct intel_batchbuffer *batch = &brw->batch;
int ret = 0;
batch->exec_bos[index] = tmp_bo;
}
- ret = execbuffer(dri_screen->fd, batch, brw->hw_ctx,
+ ret = execbuffer(brw->screen->fd, batch, brw->hw_ctx,
4 * USED_BATCH(*batch),
in_fence_fd, out_fence_fd, flags);
gp.param = param;
gp.value = value;
- if (drmIoctl(screen->driScrnPriv->fd, DRM_IOCTL_I915_GETPARAM, &gp) == -1) {
+ if (drmIoctl(screen->fd, DRM_IOCTL_I915_GETPARAM, &gp) == -1) {
ret = -errno;
if (ret != -EINVAL)
_mesa_warning(NULL, "drm_i915_getparam: %d", ret);
static bool
intel_init_bufmgr(struct intel_screen *screen)
{
- __DRIscreen *dri_screen = screen->driScrnPriv;
-
if (getenv("INTEL_NO_HW") != NULL)
screen->no_hw = true;
break;
}
- screen->bufmgr = brw_bufmgr_init(&screen->devinfo, dri_screen->fd, bo_reuse);
+ screen->bufmgr = brw_bufmgr_init(&screen->devinfo, screen->fd, bo_reuse);
if (screen->bufmgr == NULL) {
fprintf(stderr, "[%s:%u] Error initializing buffer manager.\n",
__func__, __LINE__);
/* Don't bother with error checking - if the execbuf fails, the
* value won't be written and we'll just report that there's no access.
*/
- __DRIscreen *dri_screen = screen->driScrnPriv;
- drmIoctl(dri_screen->fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
+ drmIoctl(screen->fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
/* Check whether the value got written. */
void *results_map = brw_bo_map(NULL, results, MAP_READ);
return NULL;
}
+ screen->fd = dri_screen->fd;
if (!intel_init_bufmgr(screen))
return NULL;
screen->max_gtt_map_object_size = gtt_size / 4;
}
- screen->aperture_threshold = get_aperture_size(dri_screen->fd) * 3 / 4;
+ screen->aperture_threshold = get_aperture_size(screen->fd) * 3 / 4;
screen->hw_has_swizzling = intel_detect_swizzling(screen);
screen->hw_has_timestamp = intel_detect_timestamp(screen);
struct drm_i915_reset_stats stats;
memset(&stats, 0, sizeof(stats));
- const int ret = drmIoctl(dri_screen->fd, DRM_IOCTL_I915_GET_RESET_STATS, &stats);
+ const int ret = drmIoctl(screen->fd, DRM_IOCTL_I915_GET_RESET_STATS, &stats);
screen->has_context_reset_notification =
(ret != -1 || errno != EINVAL);
/** Bytes of aperture usage beyond which execbuf is likely to fail. */
uint64_t aperture_threshold;
+ /** DRM fd associated with this screen. Not owned by this object. Do not close. */
+ int fd;
+
bool no_hw;
bool hw_has_swizzling;
bool has_exec_fence; /**< I915_PARAM_HAS_EXEC_FENCE */