[Mesa-dev] [PATCH kmscube] cube-tex: make use of modifiers
Emil Velikov
emil.l.velikov at gmail.com
Wed Mar 21 11:06:26 UTC 2018
On 21 March 2018 at 02:07, Rob Clark <robdclark at gmail.com> wrote:
> On Tue, Mar 20, 2018 at 2:45 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> On 20 March 2018 at 18:02, Christian Gmeiner
>> <christian.gmeiner at gmail.com> wrote:
>>> Fixes rendering issues with mode rgba on etnaviv. I have applied
>>> the same change for nv12 variants but they are not supported on
>>> etnaviv.
>>>
>>> Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
>>> ---
>>> cube-tex.c | 32 ++++++++++++++++++++++++--------
>>> 1 file changed, 24 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/cube-tex.c b/cube-tex.c
>>> index 9e38ae8..dba19ff 100644
>>> --- a/cube-tex.c
>>> +++ b/cube-tex.c
>>> @@ -213,7 +213,7 @@ static const char *fragment_shader_source_2img =
>>>
>>> static const uint32_t texw = 512, texh = 512;
>>>
>>> -static int get_fd_rgba(uint32_t *pstride)
>>> +static int get_fd_rgba(uint32_t *pstride, uint64_t *modifier)
>>> {
>>> struct gbm_bo *bo;
>>> void *map_data = NULL;
>>> @@ -234,6 +234,7 @@ static int get_fd_rgba(uint32_t *pstride)
>>> gbm_bo_unmap(bo, map_data);
>>>
>>> fd = gbm_bo_get_fd(bo);
>>> + *modifier = gbm_bo_get_modifier(bo);
>>>
>> Based on the existing gbm_bo_get_modifier handling there should be a guard here:
>>
>> #ifdef HAVE_GBM_MODIFIERS
>> *modifier = ...
>> #else
>> *modifier = DRM_FORMAT_MOD_INVALID;
>> #endif
>>
>
> We probably *could* just require new enough version of gbm. But a
> similar issue came up with $blob gles driver that did not support
> gbm_bo_map(), and I'd suggested that we could probably start doing
> __attribute__((weak)) fallbacks for new gbm fxns which returned errors
> (or in this case DRM_FORMAT_MOD_LINEAR ?) to avoid making these things
> build time configs..
>
The weak trick sounds like a plan IMHO. I do recall suggesting that
with the recent xcb-dri3 thingy ;-)
Also just remembered - we must check for the EGL extension
EGL_EXT_image_dma_buf_import_modifiers before using
EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT and friends.
-Emil
More information about the mesa-dev
mailing list