mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2026-05-01 06:58:00 +02:00
intel: introduce to_bo_gem() helper
...to minimise misuse of bo_gem. If the variable is declared at the top of the function and then used for two (or more) different contexts this can cause confusion and errors. Just introduce a wrapper, which can be used in a once off situations. Suggested-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
94425f6272
commit
0ec7f4423d
1 changed files with 9 additions and 6 deletions
|
|
@ -276,6 +276,11 @@ static void drm_intel_gem_bo_unreference(drm_intel_bo *bo);
|
|||
|
||||
static void drm_intel_gem_bo_free(drm_intel_bo *bo);
|
||||
|
||||
static inline drm_intel_bo_gem *to_bo_gem(drm_intel_bo *bo)
|
||||
{
|
||||
return (drm_intel_bo_gem *)bo;
|
||||
}
|
||||
|
||||
static unsigned long
|
||||
drm_intel_gem_bo_tile_size(drm_intel_bufmgr_gem *bufmgr_gem, unsigned long size,
|
||||
uint32_t *tiling_mode)
|
||||
|
|
@ -2116,11 +2121,10 @@ drm_intel_gem_bo_exec(drm_intel_bo *bo, int used,
|
|||
drm_clip_rect_t * cliprects, int num_cliprects, int DR4)
|
||||
{
|
||||
drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr;
|
||||
drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
|
||||
struct drm_i915_gem_execbuffer execbuf;
|
||||
int ret, i;
|
||||
|
||||
if (bo_gem->has_error)
|
||||
if (to_bo_gem(bo)->has_error)
|
||||
return -ENOMEM;
|
||||
|
||||
pthread_mutex_lock(&bufmgr_gem->lock);
|
||||
|
|
@ -2165,7 +2169,7 @@ drm_intel_gem_bo_exec(drm_intel_bo *bo, int used,
|
|||
drm_intel_gem_dump_validation_list(bufmgr_gem);
|
||||
|
||||
for (i = 0; i < bufmgr_gem->exec_count; i++) {
|
||||
bo_gem = (drm_intel_bo_gem *) bufmgr_gem->exec_bos[i];
|
||||
drm_intel_bo_gem *bo_gem = to_bo_gem(bufmgr_gem->exec_bos[i]);
|
||||
|
||||
bo_gem->idle = false;
|
||||
|
||||
|
|
@ -2185,12 +2189,11 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
|
|||
unsigned int flags)
|
||||
{
|
||||
drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr;
|
||||
drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo;
|
||||
struct drm_i915_gem_execbuffer2 execbuf;
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
||||
if (bo_gem->has_error)
|
||||
if (to_bo_gem(bo)->has_error)
|
||||
return -ENOMEM;
|
||||
|
||||
switch (flags & 0x7) {
|
||||
|
|
@ -2263,7 +2266,7 @@ skip_execution:
|
|||
drm_intel_gem_dump_validation_list(bufmgr_gem);
|
||||
|
||||
for (i = 0; i < bufmgr_gem->exec_count; i++) {
|
||||
bo_gem = (drm_intel_bo_gem *) bufmgr_gem->exec_bos[i];
|
||||
drm_intel_bo_gem *bo_gem = to_bo_gem(bufmgr_gem->exec_bos[i]);
|
||||
|
||||
bo_gem->idle = false;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue