Skip to content

Commit c6c9ab9

Browse files
ZhuChenyanXchenyanxzhu
authored andcommitted
Use dgpu for codec when dual gpu case
Also, remove TILING_Y/TILING_4 support for render formats in hybrid gpu mode. iGPU doesn't support TILING_4, dGPU doesn't support TILING_Y. When TILING_Y memory alloc by iGPU, but composite or display by dGPU, there will be blur screen issue. Do clflush when write often, otherwise it'll affect antutu video decoding score. In this case, the buffer content is not changed. So no need to write back. Tracked-On: OAM-129940 Signed-off-by: ZhuChenyanX <zhucx@intel.com>
1 parent 29d219b commit c6c9ab9

2 files changed

Lines changed: 28 additions & 29 deletions

File tree

cros_gralloc/cros_gralloc_driver.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -989,12 +989,12 @@ int cros_gralloc_driver::select_kms_driver(uint64_t gpu_grp_type)
989989

990990
int cros_gralloc_driver::select_video_driver(uint64_t gpu_grp_type)
991991
{
992-
if (gpu_grp_type & GPU_GRP_TYPE_HAS_INTEL_IGPU_BIT) {
993-
return GPU_GRP_TYPE_INTEL_IGPU_IDX;
994-
}
995992
if (gpu_grp_type & GPU_GRP_TYPE_HAS_INTEL_DGPU_BIT) {
996993
return GPU_GRP_TYPE_INTEL_DGPU_IDX;
997994
}
995+
if (gpu_grp_type & GPU_GRP_TYPE_HAS_INTEL_IGPU_BIT) {
996+
return GPU_GRP_TYPE_INTEL_IGPU_IDX;
997+
}
998998
if (gpu_grp_type & GPU_GRP_TYPE_HAS_VIRTIO_GPU_BLOB_BIT) {
999999
return GPU_GRP_TYPE_VIRTIO_GPU_BLOB_IDX;
10001000
}

i915.c

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,6 @@ static int i915_add_combinations(struct driver *drv)
303303
&metadata_x_tiled, texture_flags_video | BO_USE_CAMERA_MASK);
304304

305305
if (i915_has_tile4(i915)) {
306-
// in dual gpu case, only alloc x-tiling for dgpu for render
307-
if ((drv->gpu_grp_type & GPU_GRP_TYPE_HAS_INTEL_IGPU_BIT) ||
308-
(drv->gpu_grp_type & GPU_GRP_TYPE_HAS_VIRTIO_GPU_BLOB_BIT)) {
309-
return 0;
310-
}
311-
312306
struct format_metadata metadata_4_tiled = { .tiling = I915_TILING_4,
313307
.priority = 3,
314308
.modifier = I915_FORMAT_MOD_4_TILED };
@@ -325,22 +319,22 @@ static int i915_add_combinations(struct driver *drv)
325319
drv_add_combination(drv, DRM_FORMAT_NV12, &metadata_4_tiled, nv12_usage);
326320
drv_add_combination(drv, DRM_FORMAT_P010, &metadata_4_tiled, p010_usage);
327321
drv_add_combination(drv, DRM_FORMAT_P010_INTEL, &metadata_4_tiled, p010_usage);
328-
drv_add_combinations(drv, render_formats, ARRAY_SIZE(render_formats),
329-
&metadata_4_tiled, render_not_linear);
330-
drv_add_combinations(drv, scanout_render_formats,
331-
ARRAY_SIZE(scanout_render_formats), &metadata_4_tiled,
332-
render_not_linear);
333-
drv_add_combinations(drv, source_formats, ARRAY_SIZE(source_formats), &metadata_4_tiled,
334-
texture_flags | BO_USE_NON_GPU_HW);
322+
drv_add_combinations(drv, source_formats, ARRAY_SIZE(source_formats), &metadata_4_tiled,
323+
texture_flags | BO_USE_NON_GPU_HW);
335324

325+
// in dual gpu case, only alloc x-tiling for dgpu for render
326+
if (!(drv->gpu_grp_type & GPU_GRP_TYPE_HAS_INTEL_IGPU_BIT) &&
327+
!(drv->gpu_grp_type & GPU_GRP_TYPE_HAS_VIRTIO_GPU_BLOB_BIT)) {
328+
drv_add_combinations(drv, render_formats, ARRAY_SIZE(render_formats),
329+
&metadata_4_tiled, render_not_linear);
330+
drv_add_combinations(drv, scanout_render_formats,
331+
ARRAY_SIZE(scanout_render_formats), &metadata_4_tiled,
332+
render_not_linear);
333+
}
336334
} else {
337335
struct format_metadata metadata_y_tiled = { .tiling = I915_TILING_Y,
338336
.priority = 3,
339337
.modifier = I915_FORMAT_MOD_Y_TILED };
340-
if ((drv->gpu_grp_type & GPU_GRP_TYPE_HAS_INTEL_DGPU_BIT) ||
341-
(drv->gpu_grp_type & GPU_GRP_TYPE_HAS_VIRTIO_GPU_BLOB_P2P_BIT)) {
342-
return 0;
343-
}
344338
/* Support y-tiled NV12 and P010 for libva */
345339
#ifdef I915_SCANOUT_Y_TILED
346340
const uint64_t nv12_usage =
@@ -355,17 +349,20 @@ static int i915_add_combinations(struct driver *drv)
355349
drv_add_combination(drv, DRM_FORMAT_NV12, &metadata_y_tiled, nv12_usage);
356350
drv_add_combination(drv, DRM_FORMAT_P010, &metadata_y_tiled, p010_usage);
357351
drv_add_combination(drv, DRM_FORMAT_P010_INTEL, &metadata_y_tiled, p010_usage);
358-
drv_add_combinations(drv, render_formats, ARRAY_SIZE(render_formats),
359-
&metadata_y_tiled, render_not_linear);
360-
/* Y-tiled scanout isn't available on old platforms so we add
361-
* |scanout_render_formats| without that USE flag.
362-
*/
363-
drv_add_combinations(drv, scanout_render_formats,
364-
ARRAY_SIZE(scanout_render_formats), &metadata_y_tiled,
365-
scanout_and_render_not_linear);
366352
drv_add_combinations(drv, source_formats, ARRAY_SIZE(source_formats), &metadata_y_tiled,
367353
texture_flags | BO_USE_NON_GPU_HW);
368354

355+
if (!(drv->gpu_grp_type & GPU_GRP_TYPE_HAS_INTEL_DGPU_BIT) &&
356+
!(drv->gpu_grp_type & GPU_GRP_TYPE_HAS_VIRTIO_GPU_BLOB_P2P_BIT)) {
357+
drv_add_combinations(drv, render_formats, ARRAY_SIZE(render_formats),
358+
&metadata_y_tiled, render_not_linear);
359+
/* Y-tiled scanout isn't available on old platforms so we add
360+
* |scanout_render_formats| without that USE flag.
361+
*/
362+
drv_add_combinations(drv, scanout_render_formats,
363+
ARRAY_SIZE(scanout_render_formats), &metadata_y_tiled,
364+
scanout_and_render_not_linear);
365+
}
369366
}
370367
return 0;
371368
}
@@ -1265,7 +1262,9 @@ static int i915_bo_invalidate(struct bo *bo, struct mapping *mapping)
12651262
static int i915_bo_flush(struct bo *bo, struct mapping *mapping)
12661263
{
12671264
struct i915_device *i915 = bo->drv->priv;
1268-
if (!i915->has_llc && bo->meta.tiling == I915_TILING_NONE)
1265+
if (!i915->has_llc
1266+
&& (bo->meta.tiling == I915_TILING_NONE)
1267+
&& (bo->meta.use_flags & BO_USE_SW_WRITE_OFTEN))
12691268
i915_clflush(mapping->vma->addr, mapping->vma->length);
12701269

12711270
return 0;

0 commit comments

Comments
 (0)