[Mesa-dev] [PATCH 3/9] dri: Change __DriverApiRec::CreateContext to take a struct for attribs
Emil Velikov
emil.l.velikov at gmail.com
Fri Nov 3 13:16:45 UTC 2017
On 3 November 2017 at 09:50, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> On 02.11.2017 20:01, Adam Jackson wrote:
>>
>> From: Neil Roberts <neil at linux.intel.com>
>>
>> Previously the CreateContext method of __DriverApiRec took a set of
>> arguments to describe the attribute values from the window system API's
>> CreateContextAttribs function. As more attributes get added this could
>> quickly get unworkable and every new attribute needs a modification for
>> every driver.
>>
>> To fix that, pass the attribute values in a struct instead. The struct
>> has a bitmask to specify which members are used. The first three members
>> (two for the GL version and one for the flags) are always set. If the
>> bit is not set in the attribute mask then it can be assumed the
>> attribute has the default value. Drivers will error if unknown bits in
>> the mask are set.
>>
>> Reviewed-by: Adam Jackson <ajax at redhat.com>
>> Signed-off-by: Neil Roberts <neil at linux.intel.com>
>> ---
>> src/gallium/state_trackers/dri/dri_context.c | 32 +++++++--------
>> src/gallium/state_trackers/dri/dri_context.h | 6 +--
>> src/mesa/drivers/dri/common/dri_util.c | 57
>> +++++++++++++++-----------
>> src/mesa/drivers/dri/common/dri_util.h | 39 +++++++++++++++---
>> src/mesa/drivers/dri/i915/intel_screen.c | 20 ++++-----
>> src/mesa/drivers/dri/i965/brw_context.c | 45 +++++++++++---------
>> src/mesa/drivers/dri/i965/brw_context.h | 6 +--
>> src/mesa/drivers/dri/nouveau/nouveau_context.c | 15 +++----
>> src/mesa/drivers/dri/nouveau/nouveau_context.h | 3 +-
>> src/mesa/drivers/dri/r200/r200_context.c | 12 ++----
>> src/mesa/drivers/dri/r200/r200_context.h | 7 +---
>> src/mesa/drivers/dri/radeon/radeon_context.c | 12 ++----
>> src/mesa/drivers/dri/radeon/radeon_context.h | 7 +---
>> src/mesa/drivers/dri/swrast/swrast.c | 16 ++++----
>> 14 files changed, 149 insertions(+), 128 deletions(-)
>>
>> diff --git a/src/gallium/state_trackers/dri/dri_context.c
>> b/src/gallium/state_trackers/dri/dri_context.c
>> index 8776aacc09..73910e1df3 100644
>> --- a/src/gallium/state_trackers/dri/dri_context.c
>> +++ b/src/gallium/state_trackers/dri/dri_context.c
>> @@ -43,11 +43,7 @@
>> GLboolean
>> dri_create_context(gl_api api, const struct gl_config * visual,
>> __DRIcontext * cPriv,
>> - unsigned major_version,
>> - unsigned minor_version,
>> - uint32_t flags,
>> - bool notify_reset,
>> - unsigned priority,
>> + const struct __DriverContextConfig *ctx_config,
>> unsigned *error,
>> void *sharedContextPrivate)
>> {
>> @@ -61,18 +57,21 @@ dri_create_context(gl_api api, const struct gl_config
>> * visual,
>> unsigned allowed_flags = __DRI_CTX_FLAG_DEBUG |
>> __DRI_CTX_FLAG_FORWARD_COMPATIBLE |
>> __DRI_CTX_FLAG_NO_ERROR;
>> + unsigned allowed_attribs = 0;
>> const __DRIbackgroundCallableExtension *backgroundCallable =
>> screen->sPriv->dri2.backgroundCallable;
>> - if (screen->has_reset_status_query)
>> + if (screen->has_reset_status_query) {
>> allowed_flags |= __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS;
>> + allowed_attribs |= __DRIVER_CONTEXT_ATTRIB_RESET_STRATEGY;
>
>
> Please be aware of Rob's series plumbing context priorities through. There
> may be a fixup required there at some point.
>
JFYI Marek's work on ARB_compatibility will cause trivial conflict in
common/dri_util.c.
I really like the introduction of __DriverContextConfig. It also
allows us to do further cleanup/simplification, at a later stage.
With Nicolai's comments and considering the Intel CI is happy, the series is
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>
-Emil
More information about the mesa-dev
mailing list