Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/i915/overlay: Introduce i915_overlay_obj_lookup()

Extract the BO lookup and tiling check into a new
helper called i915_overlay_obj_lookup(). This will have to
move to the i915 side of the parent vs. display driver split.

There is a slight change here in that we now do the tiling
check before taking the modeset locks, but those locks don't
protect the BO tiling stuff in any way, so nothing is really
different here.

Note that the hardware should support X-tiled scanout also
for the overlay, but I guess no one ever bothered to hook
it up and test it. So the check should stay at least for now.

v2: Correctly handle the ERR_PTR returned by
i915_overlay_obj_lookup() (Jani)

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/20260226100738.29997-7-ville.syrjala@linux.intel.com

+23 -10
+23 -10
drivers/gpu/drm/i915/display/intel_overlay.c
··· 1125 1125 return 0; 1126 1126 } 1127 1127 1128 + static struct drm_i915_gem_object * 1129 + i915_overlay_obj_lookup(struct drm_device *drm, 1130 + struct drm_file *file_priv, 1131 + u32 handle) 1132 + { 1133 + struct drm_i915_gem_object *bo; 1134 + 1135 + bo = i915_gem_object_lookup(file_priv, handle); 1136 + if (!bo) 1137 + return ERR_PTR(-ENOENT); 1138 + 1139 + if (i915_gem_object_is_tiled(bo)) { 1140 + drm_dbg(drm, "buffer used for overlay image can not be tiled\n"); 1141 + i915_gem_object_put(bo); 1142 + return ERR_PTR(-EINVAL); 1143 + } 1144 + 1145 + return bo; 1146 + } 1147 + 1128 1148 int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data, 1129 1149 struct drm_file *file_priv) 1130 1150 { ··· 1175 1155 return -ENOENT; 1176 1156 crtc = to_intel_crtc(drmmode_crtc); 1177 1157 1178 - new_bo = i915_gem_object_lookup(file_priv, params->bo_handle); 1179 - if (!new_bo) 1180 - return -ENOENT; 1158 + new_bo = i915_overlay_obj_lookup(dev, file_priv, params->bo_handle); 1159 + if (IS_ERR(new_bo)) 1160 + return PTR_ERR(new_bo); 1181 1161 1182 1162 drm_modeset_lock_all(dev); 1183 - 1184 - if (i915_gem_object_is_tiled(new_bo)) { 1185 - drm_dbg_kms(display->drm, 1186 - "buffer used for overlay image can not be tiled\n"); 1187 - ret = -EINVAL; 1188 - goto out_unlock; 1189 - } 1190 1163 1191 1164 ret = intel_overlay_recover_from_interrupt(overlay); 1192 1165 if (ret != 0)