mesa.git
6 years agoetnaviv: Don't try to use the index buffer if size is zero
Tomeu Vizoso [Fri, 19 May 2017 10:40:44 +0000 (12:40 +0200)]
etnaviv: Don't try to use the index buffer if size is zero

If info->index_size is zero, info->index will point to uninitialized
memory.

Fatal signal 11 (SIGSEGV), code 2, fault addr 0xab5d07a3 in tid 20456 (surfaceflinger)

lst: Remove useless indexbuf conditional in the index_size != 0 case.

Fixes: 330d0607ed60 ("gallium: remove pipe_index_buffer and set_index_buffer")
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
6 years agoi965: Always scissor on Gen4-5 instead of disabling guardband.
Kenneth Graunke [Thu, 11 May 2017 07:03:05 +0000 (00:03 -0700)]
i965: Always scissor on Gen4-5 instead of disabling guardband.

See commit ece0e535a44c228dd994861592deb155c14740d8.  This makes
Gen4-5 follow the behavior we use on Gen6+.  It seems to have
worked out there.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Unify Gen4-5 and Gen6 SF_VIEWPORT/CLIP_VIEWPORT code.
Kenneth Graunke [Thu, 11 May 2017 06:27:43 +0000 (23:27 -0700)]
i965: Unify Gen4-5 and Gen6 SF_VIEWPORT/CLIP_VIEWPORT code.

This brings the improved guardbanding we implemented on Gen6+
back to the older Gen4-5 code.  It also deletes piles of code.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Make a set_scissor_bits helper function.
Kenneth Graunke [Thu, 11 May 2017 06:53:05 +0000 (23:53 -0700)]
i965: Make a set_scissor_bits helper function.

Gen4-5 include a single SCISSOR_RECT in SF_VIEWPORT.

Making a helper function will allow us to reuse this code for Gen4-5.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Use GENX(packet_length) rather than hardcoded dword counts.
Kenneth Graunke [Thu, 11 May 2017 06:55:47 +0000 (23:55 -0700)]
i965: Use GENX(packet_length) rather than hardcoded dword counts.

This is clearer and less likely to break in the future.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Move the scissoring code up near the viewport code.
Kenneth Graunke [Thu, 11 May 2017 06:49:27 +0000 (23:49 -0700)]
i965: Move the scissoring code up near the viewport code.

These are fairly related.  Gen4-5 combine the scissor rectangle and
SF_VIEWPORT.  Co-locating them will allow me to avoid forward
declarations of helper functions in a few patches.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agogenxml: Make a SCISSOR_RECT structure on Gen4-5.
Kenneth Graunke [Thu, 11 May 2017 06:37:23 +0000 (23:37 -0700)]
genxml: Make a SCISSOR_RECT structure on Gen4-5.

Gen6+ support multiple scissor rectangles, and define a SCISSOR_RECT
structure containing their dimensions.  On Gen4-5, those same fields
exist in SF_VIEWPORT.

This patch extracts the SF_VIEWPORT fields into a SCISSOR_RECT
structure.  Although not a named concept on Gen4-5, it works just
as well, and gives us a consistent SCISSOR_RECT structure across
all generations, making it easier to reuse code.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Replace brw->gen and devinfo->gen with GEN_GEN.
Kenneth Graunke [Thu, 11 May 2017 05:55:27 +0000 (22:55 -0700)]
i965: Replace brw->gen and devinfo->gen with GEN_GEN.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Rework Sandybridge 3DSTATE_VIEWPORT_STATE_POINTERS.
Kenneth Graunke [Thu, 11 May 2017 02:39:36 +0000 (19:39 -0700)]
i965: Rework Sandybridge 3DSTATE_VIEWPORT_STATE_POINTERS.

On Gen7+ we emit 3DSTATE_VIEWPORT_STATE_POINTERS_{SF_CL,CC} when
emitting a new viewport.

This patch makes us take the same approach on Sandybridge - but because
we have a combined command, we just set the appropriate "change" bits.
This eliminates an atom, some dirty flagging, and some brw->*.vp_offset
writes.  It does mean we'll emit two 3DSTATE_VIEWPORT_STATE_POINTERS
instead of one if both change, but that's probably fine.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Port CC_VIEWPORT to genxml.
Kenneth Graunke [Thu, 11 May 2017 03:39:26 +0000 (20:39 -0700)]
i965: Port CC_VIEWPORT to genxml.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Ignore INTEL_SCALAR_* debug variables on Gen10+.
Kenneth Graunke [Sat, 13 May 2017 19:11:40 +0000 (12:11 -0700)]
i965: Ignore INTEL_SCALAR_* debug variables on Gen10+.

Scalar mode has been default since Broadwell, and vector mode is getting
increasingly unmaintained.  There are a few things that don't even fully
work in vector mode on Skylake, but we've never cared because nobody
uses it.  There's no point in porting it forward to new platforms.

So, just ignore the debug options to force it on.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agomesa: add KHR_no_error support for glBindBufferRange()
Timothy Arceri [Mon, 22 May 2017 05:47:02 +0000 (15:47 +1000)]
mesa: add KHR_no_error support for glBindBufferRange()

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agomesa: create bind_buffer_range() helper
Timothy Arceri [Mon, 22 May 2017 05:47:01 +0000 (15:47 +1000)]
mesa: create bind_buffer_range() helper

This will help us add KHR_no_error support.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agomesa: convert mesa_bind_buffer_range_transform_feedback() to a validate function
Timothy Arceri [Mon, 22 May 2017 05:47:00 +0000 (15:47 +1000)]
mesa: convert mesa_bind_buffer_range_transform_feedback() to a validate function

This allows some tidy up and also makes it so we can add KHR_no_error
support.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agomesa: create _mesa_bind_buffer_range_xfb() helper
Timothy Arceri [Mon, 22 May 2017 05:46:59 +0000 (15:46 +1000)]
mesa: create _mesa_bind_buffer_range_xfb() helper

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agomesa: split bind_atomic_buffer() in two
Timothy Arceri [Mon, 22 May 2017 05:46:58 +0000 (15:46 +1000)]
mesa: split bind_atomic_buffer() in two

This will help us add KHR_no_error support.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agomesa: split bind_buffer_range_shader_storage_buffer() in two
Timothy Arceri [Mon, 22 May 2017 05:46:57 +0000 (15:46 +1000)]
mesa: split bind_buffer_range_shader_storage_buffer() in two

This will help us implement KHR_no_error support.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agomesa: split bind_buffer_range_uniform_buffer() in two
Timothy Arceri [Mon, 22 May 2017 05:46:56 +0000 (15:46 +1000)]
mesa: split bind_buffer_range_uniform_buffer() in two

This will help us implement KHR_no_error support.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agomesa: add KHR_no_error support for glVertexArrayVertexBuffer()
Timothy Arceri [Mon, 22 May 2017 05:46:55 +0000 (15:46 +1000)]
mesa: add KHR_no_error support for glVertexArrayVertexBuffer()

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agomesa: add KHR_no_error support for glBindVertexBuffer()
Timothy Arceri [Mon, 22 May 2017 05:46:54 +0000 (15:46 +1000)]
mesa: add KHR_no_error support for glBindVertexBuffer()

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agomesa: split vertex_array_vertex_buffer() in two
Timothy Arceri [Mon, 22 May 2017 05:46:53 +0000 (15:46 +1000)]
mesa: split vertex_array_vertex_buffer() in two

This will allow us to skip the error checkes when adding
KHR_no_error support.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
6 years agoradv: Reserve space for descriptor and push constant user SGPR setting.
Bas Nieuwenhuizen [Sun, 28 May 2017 22:18:56 +0000 (00:18 +0200)]
radv: Reserve space for descriptor and push constant user SGPR setting.

flush_compute_state doesn't reserve a large chunk, so these need their own reservation.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver"
6 years agoamd/common: set vcn dec as hw decode as well
Leo Liu [Fri, 5 May 2017 14:54:01 +0000 (10:54 -0400)]
amd/common: set vcn dec as hw decode as well

Recommit after issue resolved by the previous patch.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
6 years agoamd/common: add vcn dec ip info query for amdgpu version 3.17
Leo Liu [Wed, 3 May 2017 18:06:35 +0000 (14:06 -0400)]
amd/common: add vcn dec ip info query for amdgpu version 3.17

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoglthread/gallium: require safe_glthread to start glthread
Gregory Hainaut [Mon, 29 May 2017 11:18:28 +0000 (13:18 +0200)]
glthread/gallium: require safe_glthread to start glthread

Print an error message for the user if the requirement isn't met, or
we're not thread safe.

v2: based on Nicolai feedbacks
Check the DRI extension version

v3: based on Emil feedbacks
improve commit and error messages.
use backgroundCallable variable to improve readability

v5: based on Emil feedbacks
Properly check the function pointer

Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl: implement __DRIbackgroundCallableExtension.isThreadSafe
Gregory Hainaut [Mon, 29 May 2017 11:18:27 +0000 (13:18 +0200)]
egl: implement __DRIbackgroundCallableExtension.isThreadSafe

v2:
bump version

v3:
Add code comment
s/IsGlThread/IsThread/ (and variation)
Include X11/Xlibint.h protected by ifdef

v5: based on Daniel feedback
Move non X11 code outside of X11 define
Always return true for Wayland

Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoglx: implement __DRIbackgroundCallableExtension.isThreadSafe
Gregory Hainaut [Mon, 29 May 2017 11:18:26 +0000 (13:18 +0200)]
glx: implement __DRIbackgroundCallableExtension.isThreadSafe

v2:
bump version

v3:
Add code comment
s/IsGlThread/IsThread/ (and variation)

v4:
DRI3 doesn't hit X through GL call so it is always safe

Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agodri: Extend __DRIbackgroundCallableExtensionRec to include a callback that checks...
Gregory Hainaut [Mon, 29 May 2017 11:18:25 +0000 (13:18 +0200)]
dri: Extend __DRIbackgroundCallableExtensionRec to include a callback that checks for thread safety

DRI-drivers could call Xlib functions, for example to allocate a new back
buffer.

When glthread is enabled, the driver runs mostly on a separate thread.
Therefore we need to guarantee the thread safety between libX11 calls
from the applications (not aware of the extra thread) and the ones from
the driver.

See discussion thread:
   https://lists.freedesktop.org/archives/mesa-dev/2017-April/152547.html

Fortunately, Xlib allows to lock display to ensure thread safety but
XInitThreads must be called first by the application to initialize the lock
function pointer. This patch will allow to check XInitThreads was called
to allow glthread on GLX or EGL platform.

Note: a tentative was done to port libX11 code to XCB but it didn't solve fully
thread safety.
See discussion thread:
   https://lists.freedesktop.org/archives/mesa-dev/2017-April/153137.html

Note: Nvidia forces the driver to call XInitThreads. Quoting their manpage:
"The NVIDIA OpenGL driver will automatically attempt to enable Xlib
thread-safe mode if needed. However, it might not be possible in some
situations, such as when the NVIDIA OpenGL driver library is dynamically
loaded after Xlib has been loaded and initialized. If that is the case,
threaded optimizations will stay disabled unless the application is
modified to call XInitThreads() before initializing Xlib or to link
directly against the NVIDIA OpenGL driver library. Alternatively, using
the LD_PRELOAD environment variable to include the NVIDIA OpenGL driver
library should also achieve the desired result."

v2: based on Nicolai and Matt feedback
Use C style comment

v3: based on Emil feedback
split the patch in 3
s/isGlThreadSafe/isThreadSafe/

v5: based on Marek comment
Add a comment that isThreadSafe is supported by extension v2

Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl/wayland: use the image_driver alongside the image_loader
Emil Velikov [Thu, 11 May 2017 21:49:04 +0000 (22:49 +0100)]
egl/wayland: use the image_driver alongside the image_loader

Analogous to earlier commits - image_driver and image_loader are meant
to be used hand in hand.

v2: Rebase

Cc: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl/wayland: set the resize_callback if the flush extension is available
Emil Velikov [Fri, 12 May 2017 13:22:51 +0000 (14:22 +0100)]
egl/wayland: set the resize_callback if the flush extension is available

Strictly speaking __DRI_DRI2 implies __DRI2_FLUSH. Although since we're
using the latter in the callback, we want to use the correct guard.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl/wayland: select the format based on the interface used
Emil Velikov [Fri, 12 May 2017 13:19:59 +0000 (14:19 +0100)]
egl/wayland: select the format based on the interface used

Rather than misleadingly depending on DRI2 for the WL_DRM vs WL_SHM
formats, use the wl_drm and wl_shm interface respectively.

Fixes: a1727aa75ed ("egl/wayland: Don't use DRM format codes for SHM")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl/surfaceless: use the image_driver for image_loader
Emil Velikov [Thu, 11 May 2017 21:31:49 +0000 (22:31 +0100)]
egl/surfaceless: use the image_driver for image_loader

Analogous to previous commit.

Cc: Chad Versace <chadversary@chromium.org>
Cc: Gurchetan Singh <gurchetansingh@chromium.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl/android: use the image_driver alongside the image_loader
Emil Velikov [Mon, 8 May 2017 17:39:12 +0000 (18:39 +0100)]
egl/android: use the image_driver alongside the image_loader

They are meant to be used together. Otherwise we'll need workarounds
like egl/wayland. Namely register an image_loader_extension even thought
we should be using only DRI2.

v2: Add missing the bracket to fix the build (Tapani).

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agoegl/x11: flatten codeflow
Emil Velikov [Mon, 22 May 2017 17:23:03 +0000 (18:23 +0100)]
egl/x11: flatten codeflow

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl/x11: check for dri2_dpy->flush before using the flush extension
Emil Velikov [Fri, 12 May 2017 14:25:00 +0000 (15:25 +0100)]
egl/x11: check for dri2_dpy->flush before using the flush extension

Analogous to earlier commit.

Note that the dri2_x11_post_sub_buffer and dri2_x11_swap_buffers_region
paths already implicitly require __DRI2_FLUSH. The corresponding
extensions (NV_post_sub_buffer and NOK_swap_region) are enabled only
with DRI2.

v2: Split cosmetic changes into separate patch.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl/drm: flatten codeflow
Emil Velikov [Mon, 22 May 2017 16:28:12 +0000 (17:28 +0100)]
egl/drm: flatten codeflow

Rework the code to return early and drop an indentation level.
It should be easier to read.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl/drm: check for dri2_dpy->flush before using the flush extension
Emil Velikov [Fri, 12 May 2017 14:11:27 +0000 (15:11 +0100)]
egl/drm: check for dri2_dpy->flush before using the flush extension

The current __DRI_DRI2 imples __DRI2_FLUSH. At the same time, one can
use __DRI_IMAGE_DRIVER alongside the latter, so the current check is
confusing at best.

Check for what we use.

v2: Split out from whitespace changes

Reviewed-by: Chad Versace <chadversary@chromium.org> (v1)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl: annotate dri2_egl_display_vtbl as const data
Emil Velikov [Mon, 15 May 2017 15:14:17 +0000 (16:14 +0100)]
egl: annotate dri2_egl_display_vtbl as const data

With the final place that modifies the vtbl removed as of last commit we
can annotate the symbols accordingly.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoegl/wayland: don't modify the vtbl if an extension is not available
Emil Velikov [Mon, 15 May 2017 15:14:16 +0000 (16:14 +0100)]
egl/wayland: don't modify the vtbl if an extension is not available

With previous commit we'll error out should one be using the extension
when it's not available. Thus we no longer need to modify the vtbl.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoegl: error out on eglCreateWaylandBufferFromImageWL
Emil Velikov [Mon, 15 May 2017 15:14:15 +0000 (16:14 +0100)]
egl: error out on eglCreateWaylandBufferFromImageWL

Currently f one does the silly thing by probing the entry point w/o
checking the extension they will attempt to use the extension even
though it cannot work.
That is due our of of an assert which gets removed in release builds.

Simply error out if the extension is not enabled. Thus we can
apply some cleanups with next commits.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agogbm: manage only the required set of DRI extensions
Emil Velikov [Thu, 11 May 2017 15:46:51 +0000 (16:46 +0100)]
gbm: manage only the required set of DRI extensions

Currently GBM attempts to know all the extensions that might be required
by EGL/DRM [at some later stage].

That is a bit unclear and we often forget to update GBM as EGL gets
attention.

To avoid that, simply let EGL manage it's own required extensions based
on the base primitive (screen) we provide it.

v2: Rework the approach - GBM should not dive into EGL/DRM.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
6 years agoegl/drm: use dri2_setup_extensions() over the extensions provided by GBM
Emil Velikov [Thu, 11 May 2017 15:34:47 +0000 (16:34 +0100)]
egl/drm: use dri2_setup_extensions() over the extensions provided by GBM

Allows us to keep things in sync easier and lets us simplify the
interface between the two even further.

v2: Don't set GBM's extensions.

Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
6 years agoegl: refactor dri2_create_screen() into three separate functions
Emil Velikov [Thu, 11 May 2017 15:20:04 +0000 (16:20 +0100)]
egl: refactor dri2_create_screen() into three separate functions

Split the create_screen into:
 - create screen
 - setup/bind extensions
 - setup screen

This will allow us to reuse the latter two on egl/drm. Said platform
does create its own screen and attempts to reinvent the later two
functions itself.

Since the GBM ones tend to get out of sync quite often, and there is no
distinct reason why it does so we'll drop them with latter commits.

v2: disp -> dpy for the Android platform.
v3: use correct goto label (Rob)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
6 years agoegl/x11: make use of the dri2_display_destroy() helper
Emil Velikov [Thu, 11 May 2017 16:33:33 +0000 (17:33 +0100)]
egl/x11: make use of the dri2_display_destroy() helper

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
6 years agoegl/wayland: make use of the dri2_display_destroy() helper
Emil Velikov [Thu, 11 May 2017 16:26:48 +0000 (17:26 +0100)]
egl/wayland: make use of the dri2_display_destroy() helper

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
6 years agoegl/surfaceless: make use of the dri2_display_destroy() helper
Emil Velikov [Thu, 11 May 2017 16:22:35 +0000 (17:22 +0100)]
egl/surfaceless: make use of the dri2_display_destroy() helper

Cc: Chad Versace <chadversary@chromium.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Rob Herring <robh@kernel.org>
6 years agoegl/drm: make use of the dri2_display_destroy() helper
Emil Velikov [Thu, 11 May 2017 16:21:13 +0000 (17:21 +0100)]
egl/drm: make use of the dri2_display_destroy() helper

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
6 years agoegl/android: make use of dri2_display_destroy() helper
Emil Velikov [Thu, 11 May 2017 16:18:13 +0000 (17:18 +0100)]
egl/android: make use of dri2_display_destroy() helper

v2: disp -> dpy (Tapani)

Cc: Tomasz Figa <tfiga@chromium.org>
Cc: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
6 years agoegl: split out a dri2_display_destroy() helper
Emil Velikov [Thu, 11 May 2017 16:13:33 +0000 (17:13 +0100)]
egl: split out a dri2_display_destroy() helper

Within dri2_display_release() we already tear down all the display
specifics. Within the platform specific dri initialize however we badly
and partially duplicate that.

Let's stop that by fleshing out the required functionality into a helper
and using it throughout the codebase.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Rob Herring <robh@kernel.org>
6 years agoegl: check for driver_configs in dri2_display_release
Tapani Pälli [Fri, 12 May 2017 09:18:32 +0000 (12:18 +0300)]
egl: check for driver_configs in dri2_display_release

With later commits we'll split and reuse the destroy side of the
function for the initialize_foo error path.

In such cases, driver_configs may be NULL leading to a crash.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
[Emil Velikov: reword commit message]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
6 years agogbm: remove unneeded gbm_drm_device abstraction
Emil Velikov [Tue, 9 May 2017 17:47:20 +0000 (18:47 +0100)]
gbm: remove unneeded gbm_drm_device abstraction

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
6 years agogbm: move gbm_drm_device::driver_name to gbm_dri_device
Emil Velikov [Tue, 9 May 2017 17:41:50 +0000 (18:41 +0100)]
gbm: move gbm_drm_device::driver_name to gbm_dri_device

The former already keeps track of the DRI module opened, based on the
driver_name provided. So let's keep them together.

As a nice bonus this Will allows us to remove the gbm_drm_device all
together with next patch.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
6 years agogbm: remove "struct gbm_drm_bo" abstraction
Emil Velikov [Tue, 9 May 2017 17:36:47 +0000 (18:36 +0100)]
gbm: remove "struct gbm_drm_bo" abstraction

The struct is a simple wraper around gbm_bo and brings no actual
benefit.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
6 years agogbm: remove unused gbm_dri_device::loader
Emil Velikov [Thu, 11 May 2017 15:52:30 +0000 (16:52 +0100)]
gbm: remove unused gbm_dri_device::loader

Introduced back in 2012 with fd6acb97fb9 ("gbm: Create hooks for
dri2_loader_extension in dri backend") and hasn't been used since.

Seemingly a copy/paste thinko from development stage.

Cc: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
6 years agoradv: automake: list shared libraries after the static ones
Emil Velikov [Fri, 19 May 2017 17:43:15 +0000 (18:43 +0100)]
radv: automake: list shared libraries after the static ones

Analogous to previous commit - the compiler can discard xcb + wayland
libs, since there is no user (the static libraries) before it on the
command line.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
6 years agoanv: automake: list shared libraries after the static ones
Emil Velikov [Fri, 19 May 2017 17:43:14 +0000 (18:43 +0100)]
anv: automake: list shared libraries after the static ones

The compiler can discard the shared ones from the link chain, since
there is no user (the static libraries) before it on the command line.

Cc: mesa-stable@lists.freedesktop.org
Reported-by: Laurent Carlier <lordheavym@gmail.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
6 years agomesa: add KHR_no_error support for glBindImageTextures()
Samuel Pitoiset [Thu, 25 May 2017 09:19:52 +0000 (11:19 +0200)]
mesa: add KHR_no_error support for glBindImageTextures()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: add KHR_no_error support for glBindImageTexture()
Samuel Pitoiset [Tue, 23 May 2017 21:45:49 +0000 (23:45 +0200)]
mesa: add KHR_no_error support for glBindImageTexture()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: add bind_image_texture() helper
Samuel Pitoiset [Tue, 23 May 2017 21:45:48 +0000 (23:45 +0200)]
mesa: add bind_image_texture() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: add set_image_binding() helper
Samuel Pitoiset [Tue, 23 May 2017 21:45:47 +0000 (23:45 +0200)]
mesa: add set_image_binding() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: remove unused layered parameter from validate_bind_image_texture()
Samuel Pitoiset [Tue, 23 May 2017 21:45:46 +0000 (23:45 +0200)]
mesa: remove unused layered parameter from validate_bind_image_texture()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa: add KHR_no_error support for glActiveTexture()
Samuel Pitoiset [Thu, 25 May 2017 10:18:45 +0000 (12:18 +0200)]
mesa: add KHR_no_error support for glActiveTexture()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agoradeonsi: use ac_build_buffer_load for shader buffer loads
Marek Olšák [Fri, 19 May 2017 13:47:23 +0000 (15:47 +0200)]
radeonsi: use ac_build_buffer_load for shader buffer loads

and document why we can't use SMEM yet.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoradeonsi: move building llvm.SI.load.const into ac_build_buffer_load
Marek Olšák [Fri, 19 May 2017 13:02:34 +0000 (15:02 +0200)]
radeonsi: move building llvm.SI.load.const into ac_build_buffer_load

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoradeonsi: rename readonly_memory -> can_speculate
Marek Olšák [Thu, 25 May 2017 14:13:54 +0000 (16:13 +0200)]
radeonsi: rename readonly_memory -> can_speculate

This is more accurate.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoradeonsi: fix a crash in si_destroy_context if we fail early
Marek Olšák [Wed, 24 May 2017 16:17:38 +0000 (18:17 +0200)]
radeonsi: fix a crash in si_destroy_context if we fail early

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoutil: slab_destroy_child should check whether it's been initialized
Marek Olšák [Wed, 24 May 2017 16:16:41 +0000 (18:16 +0200)]
util: slab_destroy_child should check whether it's been initialized

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoradv: Also signal fence if vkAcquireNextImageKHR returns VK_SUBOPTIMAL_KHR.
Bas Nieuwenhuizen [Wed, 24 May 2017 18:23:04 +0000 (20:23 +0200)]
radv: Also signal fence if vkAcquireNextImageKHR returns VK_SUBOPTIMAL_KHR.

It is a successful return.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agofreedreno: fix fence creation fail if no rendering
Rob Clark [Fri, 26 May 2017 14:18:31 +0000 (10:18 -0400)]
freedreno: fix fence creation fail if no rendering

Android tries to create a FENCE_FD fence without any rendering.  And
then falls over when that fails.  So just always create an initial
batch.

Fixes: e4ad8695 ("freedreno: fix crash when flush() but no rendering")
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agoradeonsi: drop useless memcmp() check in si_set_blend_color()
Samuel Pitoiset [Thu, 25 May 2017 23:42:53 +0000 (01:42 +0200)]
radeonsi: drop useless memcmp() check in si_set_blend_color()

cso_set_blend_color() already checks if the old state is different.
Only Nine uses pipe::set_blend_color() directly but I guess it
should use the cache too.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agollvmpipe: add LP_NEW_GS flag for updating vertex info
Roland Scheidegger [Sat, 27 May 2017 02:34:14 +0000 (04:34 +0200)]
llvmpipe: add LP_NEW_GS flag for updating vertex info

The vertex information we compute here is really dependent on the last
stage before FS. It just happened to work most of the time because new
GS tend to come with new VS and/or FS...
(The LP_NEW_GS flag was previously set but never used.)

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
6 years agosvga: document some incorrect VGPU10 shader translation issues
Brian Paul [Thu, 25 May 2017 16:22:33 +0000 (10:22 -0600)]
svga: document some incorrect VGPU10 shader translation issues

We have a few mistakes in our shader translation code, but the virtual
GPU is forgiving.

Reviewed-by: Michal Krol <michal@vmware.com>
Reviewed-by: Neha Bhende<bhenden@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
6 years agoi965/copy_image: Use the blitter on gen5
Jason Ekstrand [Fri, 26 May 2017 19:23:05 +0000 (12:23 -0700)]
i965/copy_image: Use the blitter on gen5

This was just an accidental typo in the refactoring.  The intention was
to try the blitter on gen4-5, not just gen4.

Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agoosmesa: link with libunwind if enabled (v2)
Alexandre Demers [Fri, 26 May 2017 03:09:00 +0000 (21:09 -0600)]
osmesa: link with libunwind if enabled (v2)

Fixes linking error in libOSmesa when using libunwind.

CXXLD    libOSMesa.la
src/gallium/auxiliary/.libs/libgallium.a(u_debug_stack.o): In function `symbol_name_cached':
./src/gallium/auxiliary/util/u_debug_stack.c:87: undefined reference to `_ULx86_64_get_proc_name'
src/gallium/auxiliary/.libs/libgallium.a(u_debug_stack.o): In function `debug_backtrace_capture':
./src/gallium/auxiliary/util/u_debug_stack.c:114: undefined reference to `_Ux86_64_getcontext'
./src/gallium/auxiliary/util/u_debug_stack.c:115: undefined reference to `_ULx86_64_init_local'
./src/gallium/auxiliary/util/u_debug_stack.c:117: undefined reference to `_ULx86_64_step'
./src/gallium/auxiliary/util/u_debug_stack.c:123: undefined reference to `_ULx86_64_get_reg'
./src/gallium/auxiliary/util/u_debug_stack.c:124: undefined reference to `_ULx86_64_get_proc_info'
./src/gallium/auxiliary/util/u_debug_stack.c:120: undefined reference to `_ULx86_64_step'
collect2: error: ld returned 1 exit status

v2 : Fixes title and adds the original error it is fixing.

Signed-off-by: Alexandre Demers <alexandre.f.demers@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agoi965/blorp: Support copyteximage on gen4-5
Jason Ekstrand [Sat, 13 May 2017 18:10:46 +0000 (11:10 -0700)]
i965/blorp: Support copyteximage on gen4-5

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Use blorp for CopyImageSubData on gen4-5
Jason Ekstrand [Sat, 13 May 2017 17:59:03 +0000 (10:59 -0700)]
i965: Use blorp for CopyImageSubData on gen4-5

We keep the blit path because it's probably faster when it works.
However, now that we can use blorp, we can delete that nasty CPU
fall-back path.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Round copy size to the nearest block in intel_miptree_copy
Jason Ekstrand [Sat, 13 May 2017 18:02:22 +0000 (11:02 -0700)]
i965: Round copy size to the nearest block in intel_miptree_copy

The width and height of the copy don't have to be aligned to the block
size if they specify the right or bottom edges of the image.  (See also
the comment and asserts right above).  We need to round them up when we
do the division in order to get it 100% right.

Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "17.0 17.1" <mesa-stable@lists.freedesktop.org>
6 years agoi965: Use BLORP for color clears on gen4-5
Jason Ekstrand [Sat, 13 May 2017 00:14:18 +0000 (17:14 -0700)]
i965: Use BLORP for color clears on gen4-5

We don't support replicated data clears yet.  Those take a bit more work
and enabling replicated data clears in its own commit is probably better
for bisectibility anyway.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Use blorp for color blits on gen4-5
Jason Ekstrand [Fri, 12 May 2017 23:32:17 +0000 (16:32 -0700)]
i965: Use blorp for color blits on gen4-5

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/blorp: Assert that no one tries to blit combined depth stencil
Jason Ekstrand [Sat, 13 May 2017 05:52:55 +0000 (22:52 -0700)]
intel/blorp: Assert that no one tries to blit combined depth stencil

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Add blorp support for gen4-5
Jason Ekstrand [Fri, 9 Sep 2016 23:30:24 +0000 (16:30 -0700)]
i965: Add blorp support for gen4-5

Due to complications with things such as URB setup on gen4-5, it's
easier to keep gen4 support in blorp completely internal to i965.  This
makes things a bit awkward because that means there's a file in i965
that includes blorp_priv.h but it's either that or have a file in blorp
that includes brw_context.h.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/blorp: Set additional brw_wm_prog_key fields on gen4-5
Jason Ekstrand [Fri, 12 May 2017 19:03:47 +0000 (12:03 -0700)]
intel/blorp: Set additional brw_wm_prog_key fields on gen4-5

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/gen4: Expose the guts of URB recalculation as a helper
Jason Ekstrand [Fri, 12 May 2017 05:23:36 +0000 (22:23 -0700)]
i965/gen4: Expose the guts of URB recalculation as a helper

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/blorp: Add support for gen4-5 SF programs
Jason Ekstrand [Sat, 13 May 2017 03:24:46 +0000 (20:24 -0700)]
intel/blorp: Add support for gen4-5 SF programs

As part of enabling support for SF programs, we plumb the SF URB size
through to emit_urb_config.  For now, it's always zero but, on gen4, it
may be something larger.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/blorp: Make convert_to_single_slice available outside blorp_blit
Jason Ekstrand [Tue, 16 May 2017 16:28:31 +0000 (09:28 -0700)]
intel/blorp: Make convert_to_single_slice available outside blorp_blit

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/blorp: Use designated initializers to set up VERTEX_ELEMENTS
Jason Ekstrand [Fri, 12 May 2017 23:22:58 +0000 (16:22 -0700)]
intel/blorp: Use designated initializers to set up VERTEX_ELEMENTS

We also add a slot variable and use it as an iterator.  This will make
it much easier to conditionally put something between the header and the
vertex position.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/blorp: Rename emit_viewport_state to emit_cc_viewport
Jason Ekstrand [Fri, 12 May 2017 04:56:05 +0000 (21:56 -0700)]
intel/blorp: Rename emit_viewport_state to emit_cc_viewport

The real point of this packet is that it sets up CC_VIEWPORT so that
name is a bit better.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/blorp: Make the common genX_blorp_exec code gen4-safe
Jason Ekstrand [Sat, 18 Mar 2017 17:33:25 +0000 (10:33 -0700)]
intel/blorp: Make the common genX_blorp_exec code gen4-safe

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/blorp: Re-arrange blorp_genX_exec.h
Jason Ekstrand [Fri, 12 May 2017 04:05:49 +0000 (21:05 -0700)]
intel/blorp: Re-arrange blorp_genX_exec.h

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/blorp: Don't use ffma directly
Jason Ekstrand [Fri, 12 May 2017 18:55:51 +0000 (11:55 -0700)]
intel/blorp: Don't use ffma directly

It isn't supported prior to gen6 and, on gen6+, NIR will fuse the fmul
and fadd into an ffma automatically for us anyway.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/blorp: Delete isl_to_gen_ds_surfype
Jason Ekstrand [Fri, 12 May 2017 04:01:18 +0000 (21:01 -0700)]
intel/blorp: Delete isl_to_gen_ds_surfype

It's no longer used.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/blorp: Pull the pipeline bits of blorp_exec into a helper
Jason Ekstrand [Fri, 12 May 2017 02:12:46 +0000 (19:12 -0700)]
intel/blorp: Pull the pipeline bits of blorp_exec into a helper

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/blorp/blit: Add support for normalized coordinates
Jason Ekstrand [Sat, 13 May 2017 05:16:05 +0000 (22:16 -0700)]
intel/blorp/blit: Add support for normalized coordinates

Gen5 and earlier can't do non-normalized coordinates so we need to
compensate in the shader.  Fortunately, it's pretty easy plumb through.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Move clip program compilation to the compiler
Jason Ekstrand [Sat, 18 Mar 2017 19:02:45 +0000 (12:02 -0700)]
i965: Move clip program compilation to the compiler

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965: Move SF compilation to the compiler
Jason Ekstrand [Sat, 18 Mar 2017 18:23:39 +0000 (11:23 -0700)]
i965: Move SF compilation to the compiler

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/clip: Make brw_clip_prog_key::interp_mode an array
Jason Ekstrand [Mon, 20 Mar 2017 04:20:28 +0000 (21:20 -0700)]
i965/clip: Make brw_clip_prog_key::interp_mode an array

Having it be a pointer means that we end up caching clip programs based
on a pointer to wm_prog_data rather than the actual interpolation modes.
We've been caching one clip program per FS ever since 91d61fbf7cb61a44a
where Timothy rewrote brw_setup_vue_interpolation().

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoi965/sf: make brw_sf_prog_key::interp_mode an array
Jason Ekstrand [Mon, 20 Mar 2017 22:25:21 +0000 (15:25 -0700)]
i965/sf: make brw_sf_prog_key::interp_mode an array

Having it be a pointer means that we end up caching clip programs based
on a pointer to wm_prog_data rather than the actual interpolation modes.
We've been caching one clip program per FS ever since 91d61fbf7cb61a44a
where Timothy rewrote brw_setup_vue_interpolation().

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/compiler: Make brw_disasm take const assembly
Jason Ekstrand [Sat, 18 Mar 2017 18:23:34 +0000 (11:23 -0700)]
intel/compiler: Make brw_disasm take const assembly

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agointel/decoder: Handle the BLT ring in gen_group_get_length
Jason Ekstrand [Tue, 16 May 2017 22:00:49 +0000 (15:00 -0700)]
intel/decoder: Handle the BLT ring in gen_group_get_length

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agointel/decoder: Handle gen4 VF_STATISTICS and PIPELINE_SELECT
Jason Ekstrand [Tue, 16 May 2017 03:40:40 +0000 (20:40 -0700)]
intel/decoder: Handle gen4 VF_STATISTICS and PIPELINE_SELECT

These need special handling because they have no "DWord Length"
parameter and they have an unusual bias of 1.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>