[Mesa-stable] [Mesa-dev] [PATCH 2/2] i965: Set tiling on BOs imported with modifiers
Jason Ekstrand
jason at jlekstrand.net
Mon Jan 22 18:03:17 UTC 2018
On January 22, 2018 09:10:52 Kristian Høgsberg <hoegsberg at gmail.com> wrote:
> On Sun, Jan 21, 2018 at 8:05 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
>> We need this to ensure that GTT maps work on buffers we get from Vulkan
>> on the off chance that someone does a readpixels or something. Soon, we
>> will be removing GTT maps from i965 entirely and this can be reverted.
>> None the less, it's needed for stable.
>>
>> Cc: mesa-stable at lists.freedesktop.org
>> Cc: Kenneth Graunke <kenneth at whitecape.org>
>> ---
>> src/mesa/drivers/dri/i965/intel_screen.c | 11 ++++++++++-
>> 1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c
>> b/src/mesa/drivers/dri/i965/intel_screen.c
>> index b563bbf..e877f93 100644
>> --- a/src/mesa/drivers/dri/i965/intel_screen.c
>> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
>> @@ -1043,7 +1043,16 @@ intel_create_image_from_fds_common(__DRIscreen
>> *dri_screen,
>>
>> image->planar_format = f;
>>
>> - image->bo = brw_bo_gem_create_from_prime(screen->bufmgr, fds[0]);
>> + if (modifier != DRM_FORMAT_MOD_INVALID) {
>> + const struct isl_drm_modifier_info *mod_info =
>> + isl_drm_modifier_get_info(modifier);
>
> You need to handle mod_info == NULL for unknown modifiers.
The code above this checks that the modifier is supported and bails if it
isn't.
> Kristian
>
>> + uint32_t tiling = isl_tiling_to_i915_tiling(mod_info->tiling);
>> + image->bo = brw_bo_gem_create_from_prime_tiled(screen->bufmgr, fds[0],
>> + tiling, strides[0]);
>> + } else {
>> + image->bo = brw_bo_gem_create_from_prime(screen->bufmgr, fds[0]);
>> + }
>> +
>> if (image->bo == NULL) {
>> free(image);
>> return NULL;
>> --
>> 2.5.0.400.gff86faf
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-stable
mailing list