mesa.git
7 years agointel/blorp: Add support for binding an actual stencil buffer
Jason Ekstrand [Fri, 7 Oct 2016 05:10:34 +0000 (22:10 -0700)]
intel/blorp: Add support for binding an actual stencil buffer

While we're here, we also make depth without HiZ work.

v2:
 - Use the correct surface type for 1-D on SKL+
 - Set QPitch on BDW+

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/blorp: Move CLEAR_PARAMS setup into emit_depth_stencil_config
Jason Ekstrand [Fri, 7 Oct 2016 23:58:34 +0000 (16:58 -0700)]
intel/blorp: Move CLEAR_PARAMS setup into emit_depth_stencil_config

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/genxml: Add a uint MOCS field to 3DSTATE_STENCIL_BUFFER
Jason Ekstrand [Fri, 7 Oct 2016 05:13:57 +0000 (22:13 -0700)]
intel/genxml: Add a uint MOCS field to 3DSTATE_STENCIL_BUFFER

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agointel/blorp: Make the Z component of the primitive adjustable
Jason Ekstrand [Fri, 7 Oct 2016 05:03:12 +0000 (22:03 -0700)]
intel/blorp: Make the Z component of the primitive adjustable

We want to be able to start doing slow depth clears with blorp.  This
allows us to adjust the depth we're clearing to.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi915: workaround multiple intelFenceExtension definitions
Emil Velikov [Fri, 14 Oct 2016 18:09:08 +0000 (19:09 +0100)]
i915: workaround multiple intelFenceExtension definitions

Due to conflicting symbol names (between i915 and i965) in the
megadriver, we use a set of defines in i915/intel_screen.h.

With a recent commit we've introduced a symbol intelFenceExtension which
has different implementation for each driver, yet we forgot to add the
define.

Fixes: d11515ff1b3 ("i915/sync: Implement DRI2_Fence extension")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98264
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs/specs: Update allocated EGL enum values
Chad Versace [Thu, 13 Oct 2016 21:44:17 +0000 (14:44 -0700)]
docs/specs: Update allocated EGL enum values

Document the EGL enum ranges for Mesa and those values allocated by the
following extensions:

    EGL_MESA_drm_image
    EGL_MESA_platform_gbm
    EGL_MESA_platform_surfaceless
    EGL_WL_bind_wayland_display

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodoc/specs: Reference the Khronos registry XML
Chad Versace [Thu, 13 Oct 2016 21:32:13 +0000 (14:32 -0700)]
doc/specs: Reference the Khronos registry XML

Years ago Khronos replaced the registry's spec files with newfangled XML
files.  Update the reference in doc/specs/enum.txt accordingly.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl: Move old EGL_MESA_screen_surface spec
Chad Versace [Thu, 13 Oct 2016 21:19:51 +0000 (14:19 -0700)]
egl: Move old EGL_MESA_screen_surface spec

It was the lone file in src/egl/docs. Move it to where the other specs
live, in $MESA_TOP/docs/specs.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl: Implement EGL_MESA_platform_surfaceless
Chad Versace [Wed, 12 Oct 2016 22:48:15 +0000 (15:48 -0700)]
egl: Implement EGL_MESA_platform_surfaceless

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl: Don't advertise unsupported platform extensions
Chad Versace [Wed, 12 Oct 2016 22:52:12 +0000 (15:52 -0700)]
egl: Don't advertise unsupported platform extensions

Mesa's set of supported platform extensions depends on the autoconf
option --with-egl-platforms=foo,bar,baz. If --with-egl-platforms lacks
foo, then eglGetPlatformDisplay(EGL_PLATFORM_FOO, ...) unconditonally
fails.

So, if --with-egl-platforms lacks foo, then remove
EGL_VENDOR_platform_foo from the EGL client extension string.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs: Add EGL_MESA_platform_surfaceless.txt (v2)
Chad Versace [Fri, 23 Sep 2016 04:36:17 +0000 (21:36 -0700)]
docs: Add EGL_MESA_platform_surfaceless.txt (v2)

v2:
    - Assign enum values.
    - Define interactions with EGL_EXT_platform_base and EGL 1.4.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi965: Sort some extension names
Ian Romanick [Thu, 1 Sep 2016 19:05:42 +0000 (12:05 -0700)]
i965: Sort some extension names

Trivial.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
7 years agoscons: Fix the Python dependency scanner.
Jose Fonseca [Fri, 14 Oct 2016 15:51:56 +0000 (16:51 +0100)]
scons: Fix the Python dependency scanner.

modulefinder wasn't searching for dependencies in the script dir.

It's not capable of detecting the sys.path manipulations scripts do
internally neither.

This change fixes the first issue, and hacks around the second.

Honestly, I've come to the conclusion that automatic Python dependency it will always be
too brittle.   I think we should start manually typing the dependencies
like we do in automake.  At very least it will enable any person to
eyeball and spot/fix missing dependencies, without dig into SCons internals.

7 years agopipe_loader_sw: Don't invoke Unix close() on Windows.
Jose Fonseca [Fri, 23 Sep 2016 11:55:18 +0000 (12:55 +0100)]
pipe_loader_sw: Don't invoke Unix close() on Windows.

Trivial.

7 years agoRevert "egl/dri2: rework dri2_make_current code flow"
Emil Velikov [Fri, 14 Oct 2016 15:07:33 +0000 (16:07 +0100)]
Revert "egl/dri2: rework dri2_make_current code flow"

This reverts commit 675719817e7bf7c5b9da22c02252aca77a41338d.

7 years agoi915: store reference to the context within struct intel_fence (v2)
Mauro Rossi [Sat, 16 Jul 2016 00:02:58 +0000 (02:02 +0200)]
i915: store reference to the context within struct intel_fence (v2)

Porting of the corresponding patch for i965.

Here follows the original commit message by Tomasz Figa:

"As the spec allows for {server,client}_wait_sync to be called without
currently bound context, while our implementation requires context
pointer.

v2: Add a mutex and acquire it for the duration of
    brw_fence_client_wait() and brw_fence_is_completed() as suggested
    by Chad."

NOTE: in i915 all references to 'brw' are replaced by 'intel'

Marshmallow-x86 boots ok with the following results of Android CTS.

Android CTS 6.0_r7 build:2906653
Session     Pass       Fail     Not Executed
0(EGL)      1410       24       0
1(GLES2)    13832      82       0

I get the same results as per i965GM.

[Emil Velikov: Include Mauro's test results]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi915/sync: Implement DRI2_Fence extension
Mauro Rossi [Thu, 14 Jul 2016 03:33:16 +0000 (05:33 +0200)]
i915/sync: Implement DRI2_Fence extension

Here is the porting of corresponding patch for i965,
i.e. commit c636284 i965/sync: Implement DRI2_Fence extension

Here follows part of original commit message by Chad Versace:

"This enables EGL_KHR_fence_sync and EGL_KHR_wait_sync."

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi915/sync: Replace prefix 'intel_sync' -> 'intel_gl_sync'
Mauro Rossi [Thu, 14 Jul 2016 03:33:15 +0000 (05:33 +0200)]
i915/sync: Replace prefix 'intel_sync' -> 'intel_gl_sync'

This is the porting of corresponding patch for i965,
i.e. commit 2516d83 i965/sync: Replace prefix 'intel_sync' -> 'intel_gl_sync'

The only difference compared to i965 one is that intel_check_sync() was renamed
to intel_gl_check_sync() here, as it is more appropriate.

Here follows original commit message by Chad Versace:

"I'm about to implement DRI2_Fenc in intel_syncobj.c.  To prevent
madness, we need to prefix functions for GL_ARB_sync with 'gl' and
functions for DRI2_Fence with 'dri'. Otherwise, the file will become
a jumble of similiarly named functions.

For example:
    old-name:      intel_client_wait_sync()
    new-name:      intel_gl_client_wait_sync()
    soon-to-come:  intel_dri_client_wait_sync()

I wrote this renaming commit separately from the commit that implements
DRI2_Fence because I wanted the latter diff to be reviewable."

[Emil Velikov: rename the outstanding intel_sync instances]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl/drm: set eglError and provide an error message on failure
Emil Velikov [Thu, 25 Aug 2016 14:52:58 +0000 (15:52 +0100)]
egl/drm: set eglError and provide an error message on failure

v2: Remove gratuitous newline/semicolon (Eric)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/x11: attribute for dri2_add_config failure
Emil Velikov [Thu, 25 Aug 2016 14:24:44 +0000 (15:24 +0100)]
egl/x11: attribute for dri2_add_config failure

... in dri2_x11_add_configs_for_visuals().

Currently the latter does not consider that, thus in such cases it adds
"empty" configs in the list.

Properly account for things and as we do that we can reuse count,
instead of calling _eglGetArraySize to determine if we've added any
configs.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/wayland: introduce dri2_wl_add_configs_for_visuals() helper
Emil Velikov [Thu, 25 Aug 2016 13:55:06 +0000 (14:55 +0100)]
egl/wayland: introduce dri2_wl_add_configs_for_visuals() helper

Analogous to previous commits - with an extra bonus.

Current code, apart from not attributing the lack of 'per visual'
and overall configs also overwrites the newly added config.

Namely if the dpy supports two or more of the supported formats
(XRGB8888, ARGB8888 and RGB565) earlier configs will be overwritten
and the the final one will be stored, since the we use the same index
for all three in our dri2_add_config call.

v2: Use correct comparison in loop conditional (Eric)
    Use valid C initializer (Gurchetan)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/surfaceless: tweak surfaceless_add_configs_for_visuals()
Emil Velikov [Thu, 25 Aug 2016 13:35:39 +0000 (14:35 +0100)]
egl/surfaceless: tweak surfaceless_add_configs_for_visuals()

Analogous to previous commit.

v2: Use correct comparison in loop conditional (Eric)
    Use valid C initializer (Gurchetan)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/android: tweak droid_add_configs_for_visuals()
Emil Velikov [Thu, 25 Aug 2016 13:28:48 +0000 (14:28 +0100)]
egl/android: tweak droid_add_configs_for_visuals()

Iterate over the driver_configs first in order to cut down the number of
getConfigAttrib() calls by a factor of 5.

While we're here, also drop the sentinel of the visuals array. We
already know its size so we can use that and save a few bytes.

v2: Use correct comparison in loop conditional (Eric)
    Use valid C initializer (Gurchetan)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/drm: introduce drm_add_configs_for_visuals() helper
Emil Velikov [Thu, 25 Aug 2016 13:00:50 +0000 (14:00 +0100)]
egl/drm: introduce drm_add_configs_for_visuals() helper

Factor out and rework the existing code so that it prints a debug
message if we have zero configs for any visual.

As a nice side effect we now provide a correct (sequential ID) when
creating a config (via dri2_add_config).

v2: Use correct comparison in loop conditional (Eric)
    Use valid C initializer (Gurchetan)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/surfaceless: print out a message on zero configs for given format
Emil Velikov [Thu, 25 Aug 2016 12:32:41 +0000 (13:32 +0100)]
egl/surfaceless: print out a message on zero configs for given format

Currently we print a debug message if the total configs is non-zero only
to do the same (at an error level) as we return from the function.

Rework the message to print if we're missing a config for the given
format.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/dri2: set WL_bind_wayland_display in a consistent way
Emil Velikov [Thu, 25 Aug 2016 12:15:43 +0000 (13:15 +0100)]
egl/dri2: set WL_bind_wayland_display in a consistent way

Introduce a helper and use it throughout the platform code. This allows
us to reduce the amount of ifdef(s) and (potentially) use
kms_swrast_dri.so for !drm platforms (namely wayland and x11).

Note: in the future as other platforms (android, surfaceless) support
the extension they can reuse the helper.

v2: Rebase, check for device_name.
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/android: remove duplicate KHR_image_base set
Emil Velikov [Thu, 25 Aug 2016 12:04:18 +0000 (13:04 +0100)]
egl/android: remove duplicate KHR_image_base set

The core egl/dri2 already sets the extension bit _only_ when possible -
which in Android's case is always.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoloader/dri3: constify the loader_dri3_vtable
Emil Velikov [Thu, 25 Aug 2016 10:08:30 +0000 (11:08 +0100)]
loader/dri3: constify the loader_dri3_vtable

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/dri2: micro optimise dri2_bind_extensions()
Emil Velikov [Thu, 25 Aug 2016 08:51:54 +0000 (09:51 +0100)]
egl/dri2: micro optimise dri2_bind_extensions()

Do not loop over all matches if we've already found one.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/dri2: annotate dri2_extension_match instances as const data
Emil Velikov [Wed, 24 Aug 2016 23:52:36 +0000 (00:52 +0100)]
egl/dri2: annotate dri2_extension_match instances as const data

v2: Rebase.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/dri2: use dri2_bind_extensions to manage the optional extensions
Emil Velikov [Wed, 24 Aug 2016 23:51:05 +0000 (00:51 +0100)]
egl/dri2: use dri2_bind_extensions to manage the optional extensions

v2: dri2_bind_extensions() now takes optional as an argument.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agogbm: rename gbm_dri_device::{,loader_}extensions
Emil Velikov [Wed, 24 Aug 2016 23:42:56 +0000 (00:42 +0100)]
gbm: rename gbm_dri_device::{,loader_}extensions

To align with the name used in the EGL and GLX loaders.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/dri2: add support for optional extensions in dri2_bind_extensions()
Emil Velikov [Wed, 24 Aug 2016 23:16:01 +0000 (00:16 +0100)]
egl/dri2: add support for optional extensions in dri2_bind_extensions()

Will allow us to reuse the function for optional extensions and fold a
bit of code.

v2: Make dri2_bind_extensions::optional flag an argument to
dri2_bind_extensions (Kristian).

Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl/dri2: coding style cleanup
Emil Velikov [Wed, 24 Aug 2016 23:12:13 +0000 (00:12 +0100)]
egl/dri2: coding style cleanup

Consistently indent with space rather than a mix of tab and
spaces.

v2: Keep the structs properly aligned (Eric).

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl/x11: don't crash if dri2_dpy->conn is NULL
Emil Velikov [Wed, 24 Aug 2016 22:57:16 +0000 (23:57 +0100)]
egl/x11: don't crash if dri2_dpy->conn is NULL

The dri3 version of commits 60e9c35b3a0 and 6de9a03bed4.

While using xcb_connect() guarantees that we always get a non NULL
return value, XGetXCBConnection() does/can not.

CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/dri2: rework dri2_egl_display::extensions storage
Emil Velikov [Wed, 24 Aug 2016 22:32:27 +0000 (23:32 +0100)]
egl/dri2: rework dri2_egl_display::extensions storage

Remove the error prone fixed size array.
While we're here also rename to loader_extensions like in the GLX code.

v2: Rebase. Keep image_loader_extension within the wayland_drm
dri2_loader_extensions list.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/dri2: remove unused dri2_egl_display::{dri2,swrast}_loader_extension
Emil Velikov [Tue, 16 Aug 2016 17:47:52 +0000 (18:47 +0100)]
egl/dri2: remove unused dri2_egl_display::{dri2,swrast}_loader_extension

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/x11: don't populate dri2_dpy->swrast_loader_extension
Emil Velikov [Tue, 16 Aug 2016 17:44:19 +0000 (18:44 +0100)]
egl/x11: don't populate dri2_dpy->swrast_loader_extension

Analogous to earlier commits.

Note: the actual version of the extension is 1, since it does not
implement .putImage2.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/wayland: don't populate dri2_dpy->swrast_loader_extension
Emil Velikov [Tue, 16 Aug 2016 17:39:14 +0000 (18:39 +0100)]
egl/wayland: don't populate dri2_dpy->swrast_loader_extension

Similar to the dri2 one - the extension stored in struct
dri2_egl_display is unused.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/x11: don't populate dri2_dpy->dri2_loader_extension
Emil Velikov [Tue, 16 Aug 2016 17:29:34 +0000 (18:29 +0100)]
egl/x11: don't populate dri2_dpy->dri2_loader_extension

Analogous to the earlier android and wayland patches. As we're here we
can drop exposing the old version of the extension.

Any dri loader/driver interface use lower bound checking thus exposing
dri2 loader v3 to a v2 capable driver is perfectly normal.

v2: Preserve compat with dri2_minor < 1. The driver does not know if
there is a protocol to manage getBuffersWithFormat(). It's up-to the
loader to expose the vfunc if there is one. (Kristian)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/wayland: don't populate dri2_dpy->dri2_loader_extension
Emil Velikov [Tue, 16 Aug 2016 17:21:48 +0000 (18:21 +0100)]
egl/wayland: don't populate dri2_dpy->dri2_loader_extension

Analogous to the earlier android patch.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/surfaceless: trivial coding style fixes
Emil Velikov [Tue, 16 Aug 2016 17:08:13 +0000 (18:08 +0100)]
egl/surfaceless: trivial coding style fixes

Remove a few gratious blank lines and use the correct level of
indentation.

Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/surfaceless: don't check the mask(s) prior to calling dri2_add_config
Emil Velikov [Tue, 16 Aug 2016 16:56:34 +0000 (17:56 +0100)]
egl/surfaceless: don't check the mask(s) prior to calling dri2_add_config

The latter already does it for us.

As we're here annotate the masks as const and use unsigned for the
index(es).

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/surfaceless: remove unused dri2_loader_extension implementation
Emil Velikov [Tue, 16 Aug 2016 16:33:41 +0000 (17:33 +0100)]
egl/surfaceless: remove unused dri2_loader_extension implementation

Earlier commit introduced support for image_loader and left the
dri2_loader code dangling/unused. Let's remove it.

Fixes: 63c5d5c6c46 ("Added pbuffer hooks for surfaceless platform")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
7 years agoegl/android: don't populate dri2_dpy->dri2_loader_extension
Emil Velikov [Tue, 16 Aug 2016 16:23:23 +0000 (17:23 +0100)]
egl/android: don't populate dri2_dpy->dri2_loader_extension

The extension stored in struct dri2_egl_display isn't used, thus we can
create a static const instance of the extension and point extensions[]
to it.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl/dri2: rework dri2_make_current code flow
Emil Velikov [Tue, 16 Aug 2016 12:47:25 +0000 (13:47 +0100)]
egl/dri2: rework dri2_make_current code flow

Fold duplicate conditional blocks and add a few extra comments ;-)

v2: Bring back the explicit "unbind" logic (Eric), remove NULL derefs.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl/dri2: drop NULL checks prior to dri2_destroy_surface
Emil Velikov [Tue, 16 Aug 2016 12:24:48 +0000 (13:24 +0100)]
egl/dri2: drop NULL checks prior to dri2_destroy_surface

The function already have the respective check within.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl/dri2: call static functions directly, not via _EGLDriver::API
Emil Velikov [Thu, 18 Aug 2016 15:33:39 +0000 (16:33 +0100)]
egl/dri2: call static functions directly, not via _EGLDriver::API

The indirection is meant to be used by the core EGL implementation in
main. Not in the drivers themselves.

Move the dri2_destroy_surface definition to avoid forward declaration of
the static function.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoegl/dri2: use dri2_egl_display inline wrapper where possible
Emil Velikov [Fri, 15 Jul 2016 11:47:37 +0000 (12:47 +0100)]
egl/dri2: use dri2_egl_display inline wrapper where possible

This way the only places that reference DriverData are the ones that
manipulate it.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoegl/dri2: bail out on NULL dpy in dri2_display_release()
Emil Velikov [Thu, 18 Aug 2016 15:43:36 +0000 (16:43 +0100)]
egl/dri2: bail out on NULL dpy in dri2_display_release()

Currently all callers are careful enough not to do that, yet that will
not be the case in the future.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoegl/dri2: move surface refcounting out of the platform code
Emil Velikov [Tue, 16 Aug 2016 12:04:37 +0000 (13:04 +0100)]
egl/dri2: move surface refcounting out of the platform code

All the platforms are duplicating what should be a driver/dri2 thing -
refcounting. Just fold it accordingly.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoegl/dri2: coding style fix
Emil Velikov [Tue, 16 Aug 2016 10:03:33 +0000 (11:03 +0100)]
egl/dri2: coding style fix

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoegl/dri2: non-shared glapi cleanups
Emil Velikov [Tue, 16 Aug 2016 15:33:49 +0000 (16:33 +0100)]
egl/dri2: non-shared glapi cleanups

For a while now we require shared glapi for EGL, thus we can drop a
few bits from the olden days. Namely - dlopen(NULL...) is not possible,
error out at build stage if so and drop the guard around dlclose().

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoegl/dri2: glFlush is not optional, treat it as such
Emil Velikov [Tue, 16 Aug 2016 13:25:19 +0000 (14:25 +0100)]
egl/dri2: glFlush is not optional, treat it as such

The documentation is clear - one must glFlush the old context on
eglMakeCurrent. Thus keeping it optional is not something we should be
doing. Furthermore if we cannot get the entry point we're likely having
a broken setup/stack.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoaubinator: replace pragma once with ifndef guard
Emil Velikov [Tue, 11 Oct 2016 17:26:26 +0000 (18:26 +0100)]
aubinator: replace pragma once with ifndef guard

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Sirisha Gandikota<sirisha.gandikota@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: error out if anv_genX.h is included by !anv_private.h
Emil Velikov [Tue, 11 Oct 2016 17:26:25 +0000 (18:26 +0100)]
anv: error out if anv_genX.h is included by !anv_private.h

Update the comment to reflect the correct filename and add a guard to
catch incorrect inclusion of the header.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: use correct header guards
Emil Velikov [Tue, 11 Oct 2016 17:26:24 +0000 (18:26 +0100)]
anv: use correct header guards

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agointel/genxml: use correct header guards
Emil Velikov [Tue, 11 Oct 2016 17:26:23 +0000 (18:26 +0100)]
intel/genxml: use correct header guards

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agointel/common: use correct header guards
Emil Velikov [Tue, 11 Oct 2016 17:26:22 +0000 (18:26 +0100)]
intel/common: use correct header guards

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agointel/blorp: use correct header guards
Emil Velikov [Tue, 11 Oct 2016 17:26:21 +0000 (18:26 +0100)]
intel/blorp: use correct header guards

Avoid the discouraged use of pragma once and a missing guard for
blorp_genX_exec.h.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoisl: use ifndef header guards
Emil Velikov [Tue, 11 Oct 2016 17:26:20 +0000 (18:26 +0100)]
isl: use ifndef header guards

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoisl: make locally used functions static
Emil Velikov [Tue, 11 Oct 2016 17:26:19 +0000 (18:26 +0100)]
isl: make locally used functions static

Signed-off-by: Emil Velikov <emil.velikov@collabra.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoisl: trivial include-what-you-want cleanups
Emil Velikov [Tue, 11 Oct 2016 17:26:18 +0000 (18:26 +0100)]
isl: trivial include-what-you-want cleanups

Noticed while skimming through the files.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoisl/gen7: remove unneeded ISL_DEV_GEN check
Emil Velikov [Tue, 11 Oct 2016 17:26:17 +0000 (18:26 +0100)]
isl/gen7: remove unneeded ISL_DEV_GEN check

The function gen7_format_needs_valign2 has two callers - the gen7 only
gen7_choose_valign_el() and isl_gen6_filter_tiling(). The latter of
which already guarding the invocation appropriately.

To be extra cautious add a couple of asserts alongside the removal of the
runtime check.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoisl: prefix non-static API with isl_
Emil Velikov [Tue, 11 Oct 2016 17:26:16 +0000 (18:26 +0100)]
isl: prefix non-static API with isl_

The rest of ISL already follows this approach. Be consistent and resolve
the final references.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoisl/gen6: correctly check msaa layout samples count
Emil Velikov [Tue, 11 Oct 2016 17:26:15 +0000 (18:26 +0100)]
isl/gen6: correctly check msaa layout samples count

Samples == 1 is a valid value, so returning false is plain wrong.
Seeming copy/paste typo introduced since day 1.

Fixes: afdadec77f5 ("isl: Implement isl_surf_init() for gen4-gen9")
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoautomake: add radv to the `make distcheck' hooks
Emil Velikov [Wed, 12 Oct 2016 18:05:33 +0000 (19:05 +0100)]
automake: add radv to the `make distcheck' hooks

Will allow us to catch issues (as fixed with previous patches) rather
than release a broken tarball.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoradv: move AMDGPU_LIBS later in the link chain
Emil Velikov [Wed, 12 Oct 2016 18:05:32 +0000 (19:05 +0100)]
radv: move AMDGPU_LIBS later in the link chain

At the moment (albeit unlikely) one could get link-time issues, since
libdrm_amdgpu.so is before it's users in the link chain.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoradv: correct variable name VISIBILITY_{, C}FLAGS
Emil Velikov [Wed, 12 Oct 2016 18:05:31 +0000 (19:05 +0100)]
radv: correct variable name VISIBILITY_{, C}FLAGS

The letter C was missing, thus in turn all the internal symbols were
exported.

As a result we hide ~150 symbols and cut ~36K from libvulkan_radeon.so.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoamd/addrlib: hide private symbols via VISIBILITY_CXXFLAGS
Emil Velikov [Wed, 12 Oct 2016 18:05:30 +0000 (19:05 +0100)]
amd/addrlib: hide private symbols via VISIBILITY_CXXFLAGS

Private/internal symbols should not be exported. Using the CXXFLAGS cuts
~300 exported symbols and ~23K from libvulkan_radeon.so.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agointel: automake: replace direct basename $@ invokation with $(@F)
Emil Velikov [Wed, 12 Oct 2016 18:05:29 +0000 (19:05 +0100)]
intel: automake: replace direct basename $@ invokation with $(@F)

Use the shorthand make variable(s) as elsewhere in the build.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agogallium: annotate sw_driver_descriptor instance as const data
Emil Velikov [Tue, 11 Oct 2016 18:39:27 +0000 (19:39 +0100)]
gallium: annotate sw_driver_descriptor instance as const data

Already treated and handled as such.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agogallium: annotate drm_driver_descriptor instance as const data
Emil Velikov [Tue, 11 Oct 2016 18:39:26 +0000 (19:39 +0100)]
gallium: annotate drm_driver_descriptor instance as const data

Already treated and handled as such.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agogallium: rename drm_driver_descriptor::{, driver_}name
Emil Velikov [Tue, 11 Oct 2016 18:39:25 +0000 (19:39 +0100)]
gallium: rename drm_driver_descriptor::{, driver_}name

Historically we use "device name" for the name of the kernel module and
"driver name" for the dri/other driver.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agogallium: remove unused drm_driver_descriptor::driver_name
Emil Velikov [Tue, 11 Oct 2016 18:39:24 +0000 (19:39 +0100)]
gallium: remove unused drm_driver_descriptor::driver_name

Likely unused since day 1, although I've only checked back until the
st/dri unification with commit 29ca7d2c948 ("st/dri: merge dri/drm and
dri/sw backends")

Based on the comment, referencing drmOpenByName it's not something we
want to bring back.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agogallium: fix drm_driver_descriptor::name comment
Emil Velikov [Tue, 11 Oct 2016 18:39:23 +0000 (19:39 +0100)]
gallium: fix drm_driver_descriptor::name comment

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agomesa_glinterop: allow building without X and related headers
Emil Velikov [Wed, 12 Oct 2016 17:49:36 +0000 (18:49 +0100)]
mesa_glinterop: allow building without X and related headers

This commit effectively reverts c10dcb2ce837922c6ee4e191e6d6202098a5ee10
and fixes the typedef redefinition which inspired it.

In order to prevent requiring X packages at build time earlier commit
forward declared the required X/GLX typedefs. Since that approach
introduced typedef redefinition (a C11 feature) it was reverted.

To avoid the redefinition while _not_ mandating X and related headers
forward declare the structs and use those through the header.

As anyone uses the mesa interop header they ensure that the X (or others
in terms of EGL) headers are included, which ensures that everything is
resolved within the compilation unit.

Cc: Vinson Lee <vlee@freedesktop.org>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Cc: Tapani Pälli <tapani.palli@intel.com>
Cc: Chih-Wei Huang <cwhuang@android-x86.org>
Fixes: c10dcb2ce837 ("Revert "mesa_glinterop: remove inclusion of GLX
header"")
Fixes: 8472045b16b3 ("mesa_glinterop: remove inclusion of GLX header")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96770
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agost/va: Fix H.264 PicOrderCnt value
Mark Thompson [Wed, 12 Oct 2016 22:54:03 +0000 (23:54 +0100)]
st/va: Fix H.264 PicOrderCnt value

TopFieldPicOrderCnt is exactly the PicOrderCnt value for a frame - see
H.264 section 8.2.1.

Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agost/va: Baseline profile is not supported
Mark Thompson [Wed, 12 Oct 2016 22:53:35 +0000 (23:53 +0100)]
st/va: Baseline profile is not supported

Constrained baseline profile is supported, so use that instead.  This
matches what the encoder already does (constraint_set1_flag is always
set in the output bitstream).

Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agost/va: Return surface formats depending on config chroma format
Mark Thompson [Wed, 12 Oct 2016 22:53:01 +0000 (23:53 +0100)]
st/va: Return surface formats depending on config chroma format

This makes the supported format actually match the configuration, and
allows the user to observe that NV12 is supported for video processing
where previously they couldn't (though it did always work if they
blindly tried to use it anyway).

Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agost/va: Save surface chroma format in config
Mark Thompson [Wed, 12 Oct 2016 22:52:30 +0000 (23:52 +0100)]
st/va: Save surface chroma format in config

Both YUV420 and RGB32 configurations are supported, so we need to be
able to distinguish which is being used.

Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agost/va: Return more useful config attributes
Mark Thompson [Wed, 12 Oct 2016 22:52:01 +0000 (23:52 +0100)]
st/va: Return more useful config attributes

The encoder attributes are needed for a user of the encoder to be
able to configure it sensibly without internal knowledge.

Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agoglx: Perform check for valid fbconfig against proper X-Screen.
Mario Kleiner [Tue, 11 Oct 2016 18:42:03 +0000 (20:42 +0200)]
glx: Perform check for valid fbconfig against proper X-Screen.

Commit cf804b4455fac9e585b3600a8318caaced9c23de
('glx: fix crash with bad fbconfig') introduced a check
in glXCreateNewContext() if the given config is a valid
fbconfig.

Unfortunately the check always checks the given config against
the fbconfigs of the DefaultScreen(dpy), instead of the
actual X-Screen specified in the config config->screen.

This leads to failure whenever a GL context is created
on a non-DefaultScreen(dpy), e.g., on X-Screen 1 of
a multi-x-screen setup, where the default screen is
typically 0.

Fix this by using config->screen instead of DefaultScreen(dpy).

Tested to fix context creation failure on a dual-x-screen setup.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: "11.2 12.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoswr: [rasterizer core] don't construct pArContext on non-ar builds
Tim Rowley [Fri, 14 Oct 2016 01:57:05 +0000 (20:57 -0500)]
swr: [rasterizer core] don't construct pArContext on non-ar builds

Stops debug directory being created on non-ar builds.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer core] remove WorkerWaitForThreadEvent bucket
Tim Rowley [Fri, 14 Oct 2016 01:56:54 +0000 (20:56 -0500)]
swr: [rasterizer core] remove WorkerWaitForThreadEvent bucket

Cause of bucket stop capture hang, as threads get stuck in level 1.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer core] move binner functionality to separate file
Tim Rowley [Thu, 13 Oct 2016 17:30:34 +0000 (12:30 -0500)]
swr: [rasterizer core] move binner functionality to separate file

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer scripts] add DEBUG_OUTPUT_DIR knob
Tim Rowley [Thu, 13 Oct 2016 15:32:58 +0000 (10:32 -0500)]
swr: [rasterizer scripts] add DEBUG_OUTPUT_DIR knob

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer core] fix comment typo
Tim Rowley [Thu, 13 Oct 2016 14:44:06 +0000 (09:44 -0500)]
swr: [rasterizer core] fix comment typo

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer core/sim] 8x2 backend + 16-wide tile clear/load/store
Tim Rowley [Tue, 11 Oct 2016 17:57:29 +0000 (12:57 -0500)]
swr: [rasterizer core/sim] 8x2 backend + 16-wide tile clear/load/store

Work in progress (disabled).

USE_8x2_TILE_BACKEND define in knobs.h enables AVX512 code paths
(emulated on non-AVX512 HW).

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer archrast] fix event file issue with saving data
Tim Rowley [Tue, 11 Oct 2016 17:42:35 +0000 (12:42 -0500)]
swr: [rasterizer archrast] fix event file issue with saving data

Also, tagging stats with draw id to correlate these events with
draw/dispatch events.

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agoswr: [rasterizer common] fix assert index
Eric Engestrom [Wed, 12 Oct 2016 21:13:29 +0000 (22:13 +0100)]
swr: [rasterizer common] fix assert index

Fixes: b3bd8bb611bb465d2e5e ("swr: [rasterizer core] add support
       for "RAW" surface format")
CovID: 1373647
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Tim Rowley <timothy.o.rowley@intel.com>
7 years agodocs: mark GL 4.4/4.5 extension groups as DONE for nvc0
Ilia Mirkin [Fri, 14 Oct 2016 01:42:54 +0000 (21:42 -0400)]
docs: mark GL 4.4/4.5 extension groups as DONE for nvc0

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonv50: enable ARB_enhanced_layouts
Ilia Mirkin [Fri, 14 Oct 2016 01:39:42 +0000 (21:39 -0400)]
nv50: enable ARB_enhanced_layouts

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonvc0/ir: be more careful about preserving modifiers in SHLADD creation
Ilia Mirkin [Wed, 12 Oct 2016 17:30:57 +0000 (13:30 -0400)]
nvc0/ir: be more careful about preserving modifiers in SHLADD creation

src2 was being given the wrong modifier, and we were not properly
managing the modifier on the SHL source either.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agomesa: fix indentation in vertex_attrib_binding()
Brian Paul [Fri, 7 Oct 2016 21:31:34 +0000 (15:31 -0600)]
mesa: fix indentation in vertex_attrib_binding()

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
7 years agomesa: add sanity check assertion in update_array_format
Brian Paul [Fri, 7 Oct 2016 21:21:58 +0000 (15:21 -0600)]
mesa: add sanity check assertion in update_array_format

At most, one of the normalized, integer, doubles bools can be true.

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
7 years agomesa: remove needless cast in update_array()
Brian Paul [Fri, 7 Oct 2016 21:09:20 +0000 (15:09 -0600)]
mesa: remove needless cast in update_array()

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
7 years agomesa: simplify update_array() with a vao local var
Brian Paul [Fri, 7 Oct 2016 21:08:50 +0000 (15:08 -0600)]
mesa: simplify update_array() with a vao local var

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
7 years agovbo: simplify some code in check_draw_elements_data()
Brian Paul [Fri, 7 Oct 2016 21:03:55 +0000 (15:03 -0600)]
vbo: simplify some code in check_draw_elements_data()

Use the 'vao' local var in more places.

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
7 years agomesa: rename gl_vertex_attrib_array gl_array_attributes
Brian Paul [Thu, 6 Oct 2016 23:30:20 +0000 (17:30 -0600)]
mesa: rename gl_vertex_attrib_array gl_array_attributes

The structure contains the attributes of a vertex array.  The old name
was kind of confusing.

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>