mesa.git
10 years agonv50/ir/gk110: add postfactor support for fmul
Ilia Mirkin [Sat, 15 Mar 2014 16:42:51 +0000 (12:42 -0400)]
nv50/ir/gk110: add postfactor support for fmul

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: set not modifier on first source of logic op
Ilia Mirkin [Sat, 15 Mar 2014 14:22:22 +0000 (10:22 -0400)]
nv50/ir/gk110: set not modifier on first source of logic op

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: use shl/shr instead of lshf/rshf so that c[] is supported
Ilia Mirkin [Fri, 14 Mar 2014 12:16:00 +0000 (08:16 -0400)]
nv50/ir/gk110: use shl/shr instead of lshf/rshf so that c[] is supported

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: add 64/128-bit fetch/export support
Ilia Mirkin [Fri, 14 Mar 2014 10:20:36 +0000 (06:20 -0400)]
nv50/ir/gk110: add 64/128-bit fetch/export support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: fix handling of OP_SUB for floating point ops
Ilia Mirkin [Fri, 14 Mar 2014 10:11:37 +0000 (06:11 -0400)]
nv50/ir/gk110: fix handling of OP_SUB for floating point ops

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: presin/preex2 take their source at bit 23
Ilia Mirkin [Fri, 14 Mar 2014 09:46:14 +0000 (05:46 -0400)]
nv50/ir/gk110: presin/preex2 take their source at bit 23

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: add implementations of div u32/s32
Ilia Mirkin [Wed, 12 Mar 2014 16:00:58 +0000 (12:00 -0400)]
nv50/ir/gk110: add implementations of div u32/s32

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: implement quadop
Ilia Mirkin [Wed, 12 Mar 2014 13:33:00 +0000 (09:33 -0400)]
nv50/ir/gk110: implement quadop

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: fill in mov from predicate
Ilia Mirkin [Tue, 11 Mar 2014 18:54:25 +0000 (14:54 -0400)]
nv50/ir/gk110: fill in mov from predicate

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: handle derivAll flag, fix useOffsets for non-txf
Ilia Mirkin [Tue, 11 Mar 2014 17:03:02 +0000 (13:03 -0400)]
nv50/ir/gk110: handle derivAll flag, fix useOffsets for non-txf

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: fix setting texture for txd/txf/txq
Ilia Mirkin [Tue, 11 Mar 2014 16:13:45 +0000 (12:13 -0400)]
nv50/ir/gk110: fix setting texture for txd/txf/txq

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: add texcsaa implementation
Ilia Mirkin [Tue, 11 Mar 2014 15:21:35 +0000 (11:21 -0400)]
nv50/ir/gk110: add texcsaa implementation

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: add pfetch support
Ilia Mirkin [Tue, 11 Mar 2014 14:48:15 +0000 (10:48 -0400)]
nv50/ir/gk110: add pfetch support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: add emit/restart implementations
Ilia Mirkin [Tue, 11 Mar 2014 14:25:29 +0000 (10:25 -0400)]
nv50/ir/gk110: add emit/restart implementations

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: add missing break in sched emit
Ilia Mirkin [Tue, 11 Mar 2014 13:38:38 +0000 (09:38 -0400)]
nv50/ir/gk110: add missing break in sched emit

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: implement partial txq support
Ilia Mirkin [Tue, 11 Mar 2014 12:30:49 +0000 (08:30 -0400)]
nv50/ir/gk110: implement partial txq support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: fill out texture instruction support
Ilia Mirkin [Tue, 11 Mar 2014 12:30:01 +0000 (08:30 -0400)]
nv50/ir/gk110: fill out texture instruction support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonv50/ir/gk110: fix control flow opcode emission, add sat flag
Ilia Mirkin [Tue, 11 Mar 2014 09:44:00 +0000 (05:44 -0400)]
nv50/ir/gk110: fix control flow opcode emission, add sat flag

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agoegl/main: Enable Linux platform extensions
Chad Versace [Thu, 23 Jan 2014 15:26:10 +0000 (07:26 -0800)]
egl/main: Enable Linux platform extensions

Enable EGL_EXT_platform_base and the Linux platform extensions layered
atop it: EGL_EXT_platform_x11, EGL_EXT_platform_wayland,
and EGL_MESA_platform_gbm.

Tested with Piglit's EGL_EXT_platform_base tests under an X11 session.
To enable running the Wayland and GBM tests, windowed Weston was running
and the kernel had render nodes enabled.

I regression tested my EGL_EXT_platform_base patch set with Piglit on
Ivybridge under X11/EGL, standalone Weston, and GBM with rendernodes. No
regressions found.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/wayland: Emit EGL_BAD_PARAMETER for eglCreatePlatformPixmapSurface
Chad Versace [Sun, 9 Feb 2014 17:13:27 +0000 (09:13 -0800)]
egl/wayland: Emit EGL_BAD_PARAMETER for eglCreatePlatformPixmapSurface

From the EGL_EXT_wayland_spec, version 3:

  It is not valid to call eglCreatePlatformPixmapSurfaceEXT with a <dpy>
  that belongs to Wayland. Any such call fails and generates
  EGL_BAD_PARAMETER.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/gbm: Emit EGL_BAD_PARAMETER for eglCreatePlatformPixmapSurface
Chad Versace [Sun, 9 Feb 2014 17:13:08 +0000 (09:13 -0800)]
egl/gbm: Emit EGL_BAD_PARAMETER for eglCreatePlatformPixmapSurface

From the EGL_MESA_platform_gbm spec, version 5:

  It is not valid to call eglCreatePlatformPixmapSurfaceEXT with a <dpy>
  that belongs to the GBM platform. Any such call fails and generates
  EGL_BAD_PARAMETER.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/main: Stop using EGLNative types internally
Chad Versace [Tue, 7 Jan 2014 22:54:51 +0000 (14:54 -0800)]
egl/main: Stop using EGLNative types internally

Internally, much of the EGL code uses EGLNativeDisplayType,
EGLNativeWindowType, and EGLPixmapType. However, the EGLNative type
often does not match the variable's actual type.

The concept of EGLNative types are a bad match for Linux, as explained
below. And the EGL platform extensions don't use EGLNative types at all.
Those extensions attempt to solve cross-platform issues by moving the
EGL API away from the EGLNative types.

The core of the problem is that eglplatform.h can define each EGLNative
type once only, but Linux supports multiple EGL platforms.

To work around the problem, Mesa's eglplatform.h contains multiple
definitions of each EGLNative type, selected by feature macros. Mesa
expects EGL clients to set the feature macro approrpiately. But the
feature macros don't work when a single codebase must be built with
support for multiple EGL platforms, *such as Mesa itself*.

When building libEGL, autotools chooses the EGLNative typedefs based on
the first element of '--with-egl-platforms'. For example,
'--with-egl-platforms=x11,drm,wayland' defines the following:

    typedef Display* EGLNativeDisplayType;
    typedef Window   EGLNativeWindowType;
    typedef Pixmap   EGLNativePixmapType;

Clearly, this doesn't work well for Wayland and GBM.  Mesa works around
the problem by casting the EGLNative types to different things in
different files.

For sanity's sake, and to prepare for the EGL platform extensions, this
patch removes from egl/main and egl/dri2 all internal use of the
EGLNative types. It replaces them with 'void*' and checks each explicit
cast with a static assertion. Also, the patch touches egl_gallium the
minimal amount to keep it compatible with eglapi.h.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl: Add STATIC_ASSERT() macro
Chad Versace [Tue, 7 Jan 2014 22:23:49 +0000 (14:23 -0800)]
egl: Add STATIC_ASSERT() macro

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglCreateImageKHR by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch eglCreateImageKHR by display, not driver

Add dri2_egl_display_vtbl::create_image, set it for each platform, and
let egl_dri2 dispatch eglCreateImageKHR to that.

To remove ambiguity, rename egl_dri2.c:dri2_create_image() to
dri2_create_image_from_dri().

This prepares for the EGL platform extensions.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2/x11: Don't clobber _EGLDriver::API
Chad Versace [Wed, 29 Jan 2014 03:38:39 +0000 (19:38 -0800)]
egl/dri2/x11: Don't clobber _EGLDriver::API

dri2_initialize_x11_swrast() does a strange thing. For some extensions
it doesn't support, it sets the corresponding functions in
_EGLDriver::API to NULL. The intention here is clear, but misplaced.

NULL or not, the function pointers never get called because their
extensions aren't supported.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglCreateWaylandBufferFromImageWL by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch eglCreateWaylandBufferFromImageWL by display, not driver

Add dri2_egl_display_vtbl::create_wayland_buffer_from_image, set it for
each platform, and let egl_dri2 dispatch
eglCreateWaylandBufferFromImageWL to that.

This prepares for the EGL platform extensions.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Consolidate eglTerminate
Chad Versace [Wed, 29 Jan 2014 02:53:56 +0000 (18:53 -0800)]
egl/dri2: Consolidate eglTerminate

egl_dri2.c:dri2_terminate() handled terminating X11 and DRM displays.
The Wayland platform implemented its own dri2_wl_terminate(), which was
nearly a copy of the common one.

To implement the EGL platform extensions, we either need to dispatch
eglTerminate per display or define a common implementation for all
platforms. This patch chooses consolidation.  It removes
dri2_wl_terminate() by folding it into the common dri2_terminate().

It was necessary to invert the `if (disp->PlatformDisplay == NULL)` and
the switch statement because, unlike DRM and X11, Wayland's terminator
performed action even when EGL didn't own the native display. In the
inversion, I replaced `disp->PlatformDisplay == NULL` with
`dri2_dpy->own_device` because the two expressions are synonymous, but
the latter's meaning is clearer.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2/x11: Set dri2_dpy->own_device
Chad Versace [Wed, 29 Jan 2014 02:52:00 +0000 (18:52 -0800)]
egl/dri2/x11: Set dri2_dpy->own_device

When the user calls eglGetDisplay(EGL_DEFAULT_DISPLAY), the Wayland and
DRM platforms set dri2_dpy->own_device=true. This patch makes the X11
platform do the same for consistency.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglPostSubBufferNV by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch eglPostSubBufferNV by display, not driver

Add dri2_egl_display_vtbl::post_sub_buffer, set it for each
platform, and let egl_dri2 dispatch eglPostSubBufferNV to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglSwapBuffersRegionNOK by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch eglSwapBuffersRegionNOK by display, not driver

Add dri2_egl_display_vtbl::swap_buffers_region, set it for each
platform, and let egl_dri2 dispatch eglSwapBuffersRegionNOK to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglCopyBuffers by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch eglCopyBuffers by display, not driver

Add dri2_egl_display_vtbl::copy_buffers, set it for each
platform, and let egl_dri2 dispatch eglCopyBuffers to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch API.QueryBufferAge by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch API.QueryBufferAge by display, not driver

Add dri2_egl_display_vtbl::query_buffer_age, set it for each
platform, and let egl_dri2 dispatch API.QueryBufferAge to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglDestroySurface by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch eglDestroySurface by display, not driver

Add dri2_egl_display_vtbl::destroy_surface, set it for each
platform, and let egl_dri2 dispatch eglDestroySurface to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglCreatePbufferSurface by display, not driver
Chad Versace [Wed, 29 Jan 2014 01:03:03 +0000 (17:03 -0800)]
egl/dri2: Dispatch eglCreatePbufferSurface by display, not driver

Add dri2_egl_display_vtbl::create_pbuffer_surface, set it for each
platform, and let egl_dri2 dispatch eglCreatePbufferSurface to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglCreatePixmapSurface by display, not driver
Chad Versace [Wed, 29 Jan 2014 00:45:07 +0000 (16:45 -0800)]
egl/dri2: Dispatch eglCreatePixmapSurface by display, not driver

Add dri2_egl_display_vtbl::create_pbuffer_surface, set it for each
platform, and let egl_dri2 dispatch eglCreatePixmapSurface to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglCreateWindowSurface by display, not driver
Chad Versace [Wed, 29 Jan 2014 00:39:09 +0000 (16:39 -0800)]
egl/dri2: Dispatch eglCreateWindowSurface by display, not driver

Add dri2_egl_display_vtbl::create_window_surface, set it for each
platform, and let egl_dri2 dispatch eglCreateWindowSurface to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglSwapBuffersWithDamage by display, not driver
Chad Versace [Wed, 29 Jan 2014 00:26:44 +0000 (16:26 -0800)]
egl/dri2: Dispatch eglSwapBuffersWithDamage by display, not driver

Add dri2_egl_display_vtbl::swap_buffers_with_damage, set it for each
platform, and let egl_dri2 dispatch eglSwapBuffersWithDamageEXT to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglSwapBuffers by display, not driver
Chad Versace [Wed, 29 Jan 2014 00:21:21 +0000 (16:21 -0800)]
egl/dri2: Dispatch eglSwapBuffers  by display, not driver

Add dri2_egl_display_vtbl::swap_buffers, set it for each platform, and
let egl_dri2 dispatch eglSwapBuffers to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Dispatch eglSwapInterval by display, not driver
Chad Versace [Tue, 28 Jan 2014 20:34:19 +0000 (12:34 -0800)]
egl/dri2: Dispatch eglSwapInterval by display, not driver

Add dri2_egl_display_vtbl::swap_interval, set it for each platform, and
let egl_dri2 dispatch eglSwapInterval to that.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/wl,x11: Call dri2_swap_interval() statically
Chad Versace [Tue, 28 Jan 2014 00:42:10 +0000 (16:42 -0800)]
egl/wl,x11: Call dri2_swap_interval() statically

Don't call it through the driver dispatch table. Just call it
statically.

This prepares for the EGL platform extensions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Put platform func names into proper namespaces
Chad Versace [Tue, 28 Jan 2014 20:47:38 +0000 (12:47 -0800)]
egl/dri2: Put platform func names into proper namespaces

Each of the egl_dri2 platforms (except Android) prefix their function
names with "dri2", not "dri2_${platform}". This means many function
names have three separate definitions in the egl_dri2 directory: one in
each of platform_drm.c, platform_wayland.c, and platform_x11.c. For
example, each of the three files defines dri2_create_window_surface().

The name collisions make it difficult to review patches for correctness
("Is this patch hunk calling a platform_x11 function or a global
egl_dri2 function?"), complicate debugging, and confuse code navigation
tools.

For each function in platform_x11.c prefixed with 'dri2', this patch
changes its prefix to 'dri2_x11'. Likewise for platform_drm.c and
'dri2_drm'; and platform_wayland.c and 'dri2_wl'.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl/dri2: Move dri2_egl_display virtual funcs to vtbl
Chad Versace [Tue, 28 Jan 2014 19:41:46 +0000 (11:41 -0800)]
egl/dri2: Move dri2_egl_display virtual funcs to vtbl

dri2_egl_display has only one virtual function, 'authenticate'.  Define
dri2_egl_display::vtbl and move 'authenticate' there.

This prepares for the EGL platform extensions, which will add many
more virtual functions to dri2_egl_display.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agoegl: Update to revision 24567 of eglext.h
Chad Versace [Tue, 7 Jan 2014 20:23:06 +0000 (12:23 -0800)]
egl: Update to revision 24567 of eglext.h

This pulls in EGL_EXT_platform_base, EGL_EXT_platform_wayland,
EGL_EXT_platform_x11, and EGL_MESA_platform_gbm.

This patch has a lot of churn because Khronos recently changed its
method of generating headers. Khronos now generates it headers from XML.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
10 years agowinsys/radeon: Store GPU virtual memory addresses of BOs in a hash table
Michel Dänzer [Thu, 13 Mar 2014 01:25:10 +0000 (10:25 +0900)]
winsys/radeon: Store GPU virtual memory addresses of BOs in a hash table

This allows retrieving the existing BO and incrementing its reference count,
instead of creating a separate winsys representation for it, when the kernel
reports that the BO was already assigned a virtual memory address.

This fixes problems with XWayland using radeonsi and the
xf86-video-wlglamor driver, which calls GEM flink outside of the radeon
winsys code and creates BOs from the flinked names using the same DRM file
descriptor.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agotargets/dri-ilo: make the driver installable
Chia-I Wu [Sat, 15 Mar 2014 15:18:35 +0000 (23:18 +0800)]
targets/dri-ilo: make the driver installable

install-gallium-links.mk fails to create the compat link for ilo_dri.so
because it looks for dri_LTLIBRARIES instead of noinst_LTLIBRARIES.  Fix this
by switching to dri_LTLIBRARIES (and make the driver installable).

Since pci_id_driver_map.h and the DDX both tell libGL.so to look for "i965",
ilo_dri.so will never be loaded even enabled and installed.  The change should
not create any more confusion.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agomesa: mark GL_RGB9_E5 as not color-renderable
Marek Olšák [Sun, 9 Mar 2014 13:18:45 +0000 (14:18 +0100)]
mesa: mark GL_RGB9_E5 as not color-renderable

The GL 4.4 spec says it's not color-renderable and not accepted
by RenderBufferStorage. The EXT_texture_shared_exponent spec says
it's not color-renderable but it's accepted by RenderBufferStorageEXT.
This seems to be a bug in the extension spec.

Let's do what GL 4.4 says.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoradeonsi/compute: Fix memory leak
Aaron Watry [Wed, 12 Mar 2014 18:26:10 +0000 (13:26 -0500)]
radeonsi/compute: Fix memory leak

Free shader buffer object for all kernels when deleting compute state.

Signed-off-by: Aaron Watry <awatry@gmail.com>
10 years agost/mesa: remove _NEW_POLYGON dependency from vertex shader
Marek Olšák [Tue, 4 Mar 2014 00:45:48 +0000 (01:45 +0100)]
st/mesa: remove _NEW_POLYGON dependency from vertex shader

We can just check the polygon mode when updating the edge flag state.
Also, we can just flag ST_NEW_VERTEX_PROGRAM directly, which makes
ST_NEW_EDGEFLAGS_DATA useless.

10 years agost/mesa: implement zero-stride edge flag by culling primitives
Marek Olšák [Tue, 4 Mar 2014 00:11:49 +0000 (01:11 +0100)]
st/mesa: implement zero-stride edge flag by culling primitives

This was unimplemented.

10 years agost/mesa: fix per-vertex edge flags and GLSL support (v2)
Marek Olšák [Mon, 3 Mar 2014 00:04:22 +0000 (01:04 +0100)]
st/mesa: fix per-vertex edge flags and GLSL support (v2)

This fixes piglit/gl-2.0-edgeflag.

v2: use StrideB to recognize per-vertex edge flags

Cc: mesa-stable@lists.freedesktop.org
10 years agoi965/fs: Invalidate live intervals when demoting uniforms to pull params.
Kenneth Graunke [Tue, 11 Mar 2014 06:55:21 +0000 (23:55 -0700)]
i965/fs: Invalidate live intervals when demoting uniforms to pull params.

Normally, nothing uses live intervals at this point, so this isn't
necessary.  However, dump_instructions() calculates them and uses them
to show register pressure.  So, calling dump_instructions() in this area
of the code would segfault due to the arrays being the wrong size.

This is not a candidate for stable branches because it only serves to
fix internal debugging code that you manually have to invoke by altering
the source code or using gdb.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965/fs: Print "+reladdr" on variably-indexed uniform arrays.
Kenneth Graunke [Tue, 11 Mar 2014 07:11:42 +0000 (00:11 -0700)]
i965/fs: Print "+reladdr" on variably-indexed uniform arrays.

Previously, dump_instruction() would print output such as:
   {  2}    3: mov vgrf1:F, u0:F
   {  3}    4: mov vgrf7:F, u0:F
   {  4}    5: mov vgrf8:F, u0:F
which looked like either a scalar access or perhaps a constant-indexed
access of element 0, when it was really a variable index.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965: Fix register types in dump_instructions(), again.
Kenneth Graunke [Tue, 11 Mar 2014 07:04:35 +0000 (00:04 -0700)]
i965: Fix register types in dump_instructions(), again.

In commit e57d77280efcbfd6579a88f071426653287ef833, I fixed this for
destinations in the Vec4 backend, and sources in the scalar backend.
But not both types in both backends.

To prevent this mess from continuing, make the reg_encoding table
static, so only the disassembler can use it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965/fs: Fix register comparisons in saturate propagation.
Kenneth Graunke [Wed, 12 Mar 2014 00:11:36 +0000 (17:11 -0700)]
i965/fs: Fix register comparisons in saturate propagation.

opt_saturate_propagation_local compares scan_inst->dst.reg/reg_offset
with inst->src[0].reg/reg_offset, and ensures that scan_inst->dst.file
is GRF.  But nothing ensured that inst->src[0].file was GRF.

In the following program, this resulted in u1:F matching vgrf1:UW,
and a saturate being incorrectly propagated from instruction 8 to
instruction 1.

{  1}    0: add vgrf0:UW, hw_reg1+8:UW, hw_reg0:V
{  1}    1: add vgrf1:UW, hw_reg1+10:UW, hw_reg0:V
{  1}    2: linterp vgrf6:F, hw_reg2:F, hw_reg3:F, hw_reg0:F
{  2}    3: linterp vgrf27:F, hw_reg2:F, hw_reg3:F, hw_reg0+16:F
{  4}    4: mov vgrf10+0.0:F, vgrf6:F
{  3}    5: mov vgrf10+1.0:F, vgrf27:F
{  6}    6: tex vgrf8+0.0:F, vgrf10+0.0:F
{  5}    7: mov vgrf32:F, u1:F
{  5}    8: mov.sat vgrf12:F, u1:F

From shader-db:
   total instructions in shared programs: 1841932 -> 1841957 (0.00%)
   instructions in affected programs:     5823 -> 5848 (0.43%)
I inspected two of the 25 hurt shaders, and concluded that they were
both hitting this bug, and not legitimately optimized.

This fixes bugs in Left 4 Dead 2 and Team Fortress 2, possibly among
others.  The optimization pass didn't exist in 10.0, so this is only
a candidate for 10.1.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Improve debug output and variable names for opt_dead_code_local.
Eric Anholt [Thu, 6 Mar 2014 07:03:42 +0000 (23:03 -0800)]
glsl: Improve debug output and variable names for opt_dead_code_local.

I know this code has confused others, and it confused me 3 years later,
too.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
10 years agoi965: Add support for GL_ARB_buffer_storage.
Eric Anholt [Tue, 25 Feb 2014 22:25:46 +0000 (14:25 -0800)]
i965: Add support for GL_ARB_buffer_storage.

It turns out we can allow COHERENT storage/mappings all the time,
regardless of LLC vs non-LLC.  It just means never using temporary
mappings to avoid GPU stalls, and on non-LLC we have to use the GTT intead
of CPU mappings.  If we were to use CPU maps on non-LLC (which might be
useful if apps end up using buffer_storage on PBO reads, to avoid WC read
slowness), those would be PERSISTENT but not COHERENT, but doing that
would require us driving the clflushes from userspace somehow.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Always use CPU mappings for BOs on LLC platforms.
Eric Anholt [Thu, 27 Feb 2014 18:05:39 +0000 (10:05 -0800)]
i965: Always use CPU mappings for BOs on LLC platforms.

It looks like there's no big difference for write-only workloads, but
using a CPU map means that if they happen to read without having set the
MAP_READ_BIT, they get 100x the performance for those reads.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Drop the system-memory temporary allocations for flush explicit.
Eric Anholt [Tue, 25 Feb 2014 19:50:44 +0000 (11:50 -0800)]
i965: Drop the system-memory temporary allocations for flush explicit.

While in expected usage patterns nobody will ever hit this path, doubling
our bandwidth used seems like a waste, and it cost us extra code too.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Switch mapping modes for non-explicit-flush blit-temporary maps.
Eric Anholt [Tue, 25 Feb 2014 20:15:31 +0000 (12:15 -0800)]
i965: Switch mapping modes for non-explicit-flush blit-temporary maps.

On LLC, it should always be better to use a cached mapping than the GTT.
On non-LLC, it seems pretty silly to try to optimize read performance for
the INVALIDATE_RANGE_BIT case.  This will make the buffer_storage logic
easier.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agogallivm: optimize repeat linear npot code in the aos int path
Jeff Muizelaar [Sat, 15 Feb 2014 00:47:12 +0000 (01:47 +0100)]
gallivm: optimize repeat linear npot code in the aos int path

Similar to the other cases, shift some weight/coord calculations to int
space. This should be slightly faster (on x86 sse it should actually safe one
instruction, and generally int instructions are cheaper).

10 years agogallivm: use correct rounding for nearest wrap mode (in the aos int path)
Roland Scheidegger [Sat, 15 Feb 2014 02:45:00 +0000 (03:45 +0100)]
gallivm: use correct rounding for nearest wrap mode (in the aos int path)

The previous code used coords which were calculated as
(int) (f_coord * tex_size * 256) >> 8.
This is not only unnecessarily complex but can give the wrong texel due to
rounding for negative coords (as an example, after denormalization coords
from -1.0 to 0.0 should give -1, but this will give -1 for numbers from
-1.0-1/256 - 0.0-1/256.
Instead, juse use ifloor, dropping the shift stuff.
Unfortunately, this will most likely be slower - with arch rounding available
it shouldn't be too bad (trades a int shift for a round but also saves an int
mul (which is shared by all coords) but otherwise it's a mess.

10 years agogallivm: use correct rounding for linear wrap mode (in the aos int path)
Jeff Muizelaar [Sat, 15 Feb 2014 01:34:39 +0000 (02:34 +0100)]
gallivm: use correct rounding for linear wrap mode (in the aos int path)

The previous method for converting coords to ints was sligthly inaccurate
(effectively losing 1bit from the 8bit lerp weight). This is probably
especially noticeable when trying to draw a pixel-aligned texture.
As an example, for a 100x100 texture after dernormalization the texture
coords in this case would turn up as
0.5, 1.5, 2.5, 3.5, 4.5, ...
After the mul by 256, conversion to int and 128 subtraction, they end up as
0, 256, 512, 768, 1024, ...
which gets us the correct coords/weights of
0/0, 1/0, 2/0, 3/0, 4/0, ...
But even LSB errors (which are unavoidable) in the input coords may cause
these coords/weights to be wrong, e.g. for a coord of 3.49999 we'd get a
coord/weight of 2/255 instead.

Fix this by using round-to-nearest int instead of FPToSi (trunc). Should be
equally fast on x86 sse though other archs probably suffer a little.

10 years agoglapi: restore _glthread_GetID() function
Brian Paul [Fri, 14 Mar 2014 16:13:16 +0000 (10:13 -0600)]
glapi: restore _glthread_GetID() function

This partially reverts patch 02cb04c68f.  This fixes an unresolved
symbol error when using older builds of libGL.

Tested-by: Chia-I Wu <olv@lunarg.com>
10 years agoradeonsi: flush the dma ring in si_flush_from_st
Niels Ole Salscheider [Thu, 13 Mar 2014 19:07:14 +0000 (20:07 +0100)]
radeonsi: flush the dma ring in si_flush_from_st

Signed-off-by: Niels Ole Salscheider <niels_ole@salscheider-online.de>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agoradeon: Move DMA ring creation to common code
Niels Ole Salscheider [Thu, 13 Mar 2014 19:07:13 +0000 (20:07 +0100)]
radeon: Move DMA ring creation to common code

Signed-off-by: Niels Ole Salscheider <niels_ole@salscheider-online.de>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agomesa: return v.value_int64 when the requested type is TYPE_INT64
Emil Velikov [Thu, 13 Mar 2014 06:35:52 +0000 (06:35 +0000)]
mesa: return v.value_int64 when the requested type is TYPE_INT64

Fixes "Operands don't affect result" defect reported by Coverity.

Cc: "9.2 10.0 10.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agonvc0: minor cleanups in stream output handling
Emil Velikov [Wed, 12 Mar 2014 17:09:38 +0000 (17:09 +0000)]
nvc0: minor cleanups in stream output handling

Constify the offsets parameter to silence gcc warning 'assignment
from incompatible pointer type' due to function prototype miss-match.

Use a boolean changed as a shorthand for target != current_target.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonouveau: honor fread return value in the nouveau_compiler
Emil Velikov [Wed, 12 Mar 2014 16:58:26 +0000 (16:58 +0000)]
nouveau: honor fread return value in the nouveau_compiler

There is little point of continuing if fread returns zero, as it
indicates that either the file is empty or cannot be read from.
Bail out if fread returns zero after closing the file.

Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agonouveau: typecast the prime_fd handle when calling nouveau_bo_set_prime
Emil Velikov [Wed, 12 Mar 2014 16:35:10 +0000 (16:35 +0000)]
nouveau: typecast the prime_fd handle when calling nouveau_bo_set_prime

Core drm defines that the handle is of type int, while all drivers
treat it as uint internally. Typecast the value to silence gcc
warning messages and be consistent amongst all drivers.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
10 years agonv50: add missing brackets when handling the samplers array
Emil Velikov [Wed, 12 Mar 2014 16:22:15 +0000 (16:22 +0000)]
nv50: add missing brackets when handling the samplers array

Commit 3805a864b1d(nv50: assert before trying to out-of-bounds access
samplers) introduced a series of asserts as a precausion of a previous
illegal memory access.

Although it failed to encapsulate loop within nv50_sampler_state_delete
effectively failing to clear the sampler state, apart from exadurating
the illegal memory access issue.

Fixes gcc warning "array subscript is above array bounds" and
"Nesting level does not match indentation" and "Out-of-bounds read"
defects reported by Coverity.

Cc: "10.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agoi965: Fix build warning of unused variable
Anuj Phogat [Wed, 26 Feb 2014 02:32:54 +0000 (18:32 -0800)]
i965: Fix build warning of unused variable

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agodri3: Add GLX_EXT_buffer_age support
Adel Gadllah [Mon, 24 Feb 2014 19:44:42 +0000 (20:44 +0100)]
dri3: Add GLX_EXT_buffer_age support

v2: Indent according to Mesa style, reuse sbc instead of making a new
    swap_count field, and actually get a usable back before returning the
    age of the back (fixing updated piglit tests).  Changes by anholt.

Signed-off-by: Adel Gadllah <adel.gadllah@gmail.com>
Reviewed-by: Robert Bragg <robert@sixbynine.org> (v1)
Reviewed-by: Adel Gadllah <adel.gadllah@gmail.com> (v2)
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agodri3: Prefer the last chosen back when finding a new one.
Eric Anholt [Fri, 7 Mar 2014 23:56:06 +0000 (15:56 -0800)]
dri3: Prefer the last chosen back when finding a new one.

With the buffer_age code, I need to be able to potentially call this more
than once per frame, and it would be bad if a new special event showing up
meant I chose a different back mid-frame.  Now, once we've chosen a back
for the frame, another find_back will choose it again since we know that
it won't have ->busy set until swap.

Note that this makes find_back return a buffer id instead of a backbuffer
index.  That's kind of a silly distinction anyway, since it's an identity
mapping between the two (it's the front buffer that is at an offset).

Reviewed-By: Adel Gadllah <adel.gadllah@gmail.com>
10 years agoAdd the EGL_MESA_configless_context extension
Neil Roberts [Fri, 7 Mar 2014 18:05:47 +0000 (18:05 +0000)]
Add the EGL_MESA_configless_context extension

This extension provides a way for an application to render to multiple
surfaces with different buffer formats without having to use multiple
contexts. An EGLContext can be created without an EGLConfig by passing
EGL_NO_CONFIG_MESA. In that case there are no restrictions on the surfaces
that can be used with the context apart from that they must be using the same
EGLDisplay.

_mesa_initialze_context can now take a NULL gl_config which will mark the
context as ‘configless’. It will memset the visual to zero in that case.
Previously the i965 and i915 drivers were explicitly creating a zeroed visual
whenever 0 is passed for the EGLConfig. Mesa needs to be aware that the
context is configless because it affects the initial value to use for
glDrawBuffer. The first time the context is bound it will set the initial
value for configless contexts depending on whether the framebuffer used is
double-buffered.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoeglCreateContext: Remove the check for whether config == 0
Neil Roberts [Fri, 7 Mar 2014 18:05:46 +0000 (18:05 +0000)]
eglCreateContext: Remove the check for whether config == 0

In eglCreateContext there is a check for whether the config parameter is zero
and in this case it will avoid reporting an error if the
EGL_KHR_surfacless_context extension is supported. However there is nothing in
that extension which says you can create a context without a config and Mesa
breaks if you try this so it is probably better to leave it reporting an
error.

The original check was added in b90a3e7d8b1bc based on the API-specific
extensions EGL_KHR_surfaceless_opengl/gles1/gles2. This was later changed to
refer to EGL_KHR_surfacless_context in b50703aea5. Perhaps the original
extensions specified a configless context but the new one does not.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoFix the initial value of glDrawBuffers for GLES
Neil Roberts [Fri, 7 Mar 2014 18:05:45 +0000 (18:05 +0000)]
Fix the initial value of glDrawBuffers for GLES

Under GLES 3 it is not valid to pass GL_FRONT to glDrawBuffers. Instead,
GL_BACK has a magic interpretation which means it will render to the front
buffer on single-buffered contexts and the back buffer on double-buffered. We
were incorrectly setting the initial value to GL_FRONT for single-buffered
contexts. This probably doesn't really matter at the moment except that
presumably it would be exposed in the API via glGetIntegerv.

When we switch to configless contexts this is more important because in that
case we always want to rely on the magic interpretation of GL_BACK in order to
automatically switch between the front and back buffer when a new surface with
a different number of buffers is bound. We also do this for GLES 1 and 2
because the internal value doesn't matter in that case and it is convenient to
use the same code to have the magic interpretation of GL_BACK.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoUse the magic behaviour of GL_BACK in GLES 1 and 2 as well as 3
Neil Roberts [Fri, 7 Mar 2014 18:05:44 +0000 (18:05 +0000)]
Use the magic behaviour of GL_BACK in GLES 1 and 2 as well as 3

In GLES 3 it is not possible to select rendering to the front buffer and
instead selecting GL_BACK has the magic interpretation that it is either the
front buffer on single-buffered configs or the back buffer on double-buffered.
GLES 1 and 2 have no way of selecting the draw buffer at all. In that case we
were initialising the draw buffer to either GL_FRONT or GL_BACK depending on
the context's config and then leaving it at that.

When we switch to having configless contexts we ideally want Mesa to
automatically switch between the front and back buffer whenever a double-
or single-buffered surface is bound. To make this happen we can just allow
the magic behaviour from GLES 3 in GLES 1 and 2 as well. It shouldn't matter
what the internal value of the draw buffer is in GLES 1 and 2 because there
is no way to query it from the external API.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoglsl: Fix typo
Ian Romanick [Mon, 10 Feb 2014 21:48:26 +0000 (13:48 -0800)]
glsl: Fix typo

Remove extra "any" and re-word-wrap the comment.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agoglsl: Rewrite unrolled link_invalidate_variable_locations calls as a loop
Ian Romanick [Wed, 12 Feb 2014 00:37:56 +0000 (16:37 -0800)]
glsl: Rewrite unrolled link_invalidate_variable_locations calls as a loop

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
10 years agodocs: Import 10.0.4 release notes, add news item.
Carl Worth [Wed, 12 Mar 2014 17:21:53 +0000 (10:21 -0700)]
docs: Import 10.0.4 release notes, add news item.

10 years agomesa: Release gl_debug_state when destroying context.
Mike Stroyan [Tue, 11 Mar 2014 23:07:00 +0000 (17:07 -0600)]
mesa: Release gl_debug_state when destroying context.

Commit 6e8d04a caused a leak by allocating ctx->Debug but never freeing it.
Release the memory in _mesa_free_errors_data when destroying a context.
Use FREE to match CALLOC_STRUCT from _mesa_get_debug_state.

Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agor600g: compute memory pool size is given in dw
Niels Ole Salscheider [Mon, 3 Mar 2014 19:28:55 +0000 (20:28 +0100)]
r600g: compute memory pool size is given in dw

Multiply the dw value by 4 in order to map the complete buffer.

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Niels Ole Salscheider <niels_ole@salscheider-online.de>
10 years agometa: Always restore the framebuffers and current renderbuffer.
Eric Anholt [Mon, 3 Mar 2014 19:14:42 +0000 (11:14 -0800)]
meta: Always restore the framebuffers and current renderbuffer.

The few paths that were playing with framebuffers and renderbuffer were
saving and restoring them.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Drop intel_check_front_buffer_rendering().
Eric Anholt [Mon, 3 Mar 2014 18:39:08 +0000 (10:39 -0800)]
i965: Drop intel_check_front_buffer_rendering().

This was being applied in a subset of the places that
intel_prepare_render() was called, to set the same flag that
intel_prepare_render() was setting.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965: Drop broken front_buffer_reading/drawing optimization.
Eric Anholt [Mon, 3 Mar 2014 18:43:10 +0000 (10:43 -0800)]
i965: Drop broken front_buffer_reading/drawing optimization.

The flag wasn't getting updated correctly when the ctx->DrawBuffer or
ctx->ReadBuffer changed.  It usually ended up working out because most
apps only have one window system framebuffer, or if they have more than
one and they have any front read/drawing, they will have called
glReadBuffer()/glDrawBuffer() on it when they get started on the new
buffer.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agointel: When checking for updating front buffer reading, use the right fb.
Eric Anholt [Mon, 3 Mar 2014 18:13:46 +0000 (10:13 -0800)]
intel: When checking for updating front buffer reading, use the right fb.

It's the ctx->ReadBuffer that gets read from, not the ctx->DrawBuffer.
So, if you happened to have a ctx->ReadBuffer that was the winsys buffer,
and it had previously been intel_prepare_render()ed but not invalidated
since then, and you called glReadBuffer() to switch to front buffer
instead of back buffer reading on the winsys fbo while your drawbuffer was
a user FBO, you'd never get the front buffer's miptree fetched, and
segfault.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agor600g,radeonsi: attempt to fix racy multi-context apps calling BufferData
Marek Olšák [Sat, 8 Mar 2014 22:34:36 +0000 (23:34 +0100)]
r600g,radeonsi: attempt to fix racy multi-context apps calling BufferData

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75061

v2: minimize the window where cs_buf != new_buf

10 years agor600g,radeonsi: fix broken buffer download
Marek Olšák [Sun, 9 Mar 2014 00:03:40 +0000 (01:03 +0100)]
r600g,radeonsi: fix broken buffer download

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g,radeonsi: use a fallback in dma_copy instead of failing
Marek Olšák [Sat, 8 Mar 2014 14:15:41 +0000 (15:15 +0100)]
r600g,radeonsi: use a fallback in dma_copy instead of failing

v2: - allow byte-aligned DMA buffer copies on Evergreen
    - fix piglit/texsubimage regression
    - use the fallback for 3D copies (depth > 1) as well

10 years agoradeonsi: small cleanup in get_param
Marek Olšák [Sun, 9 Mar 2014 21:29:20 +0000 (22:29 +0100)]
radeonsi: small cleanup in get_param

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoradeonsi: set correct alignment for texture buffers and constant buffers
Marek Olšák [Sun, 9 Mar 2014 19:05:54 +0000 (20:05 +0100)]
radeonsi: set correct alignment for texture buffers and constant buffers

I think these are all equivalent to vertex buffer fetches which should be
dword-aligned. Scalar loads are also dword-aligned.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g, radeonsi: fix primitives-generated query with disabled streamout
Marek Olšák [Sun, 9 Mar 2014 21:12:26 +0000 (22:12 +0100)]
r600g, radeonsi: fix primitives-generated query with disabled streamout

Buffers are disabled by VGT_STRMOUT_BUFFER_CONFIG, but the query only works
if VGT_STRMOUT_CONFIG.STREAMOUT_0_EN is enabled.

This moves VGT_STRMOUT_CONFIG to its own state. The register is set to 1
if either streamout or the primitives-generated query is enabled.

However, the primitives-emitted query is also incremented, so it's disabled
by setting VGT_STRMOUT_BUFFER_SIZE to 0 when there is no buffer bound.

This fixes piglit:
  ARB_transform_feedback2/counting with pause
  EXT_transform_feedback/primgen-query transform-feedback-disabled

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g,radeonsi: don't add streamout.num_dw_for_end twice
Marek Olšák [Sun, 9 Mar 2014 21:10:27 +0000 (22:10 +0100)]
r600g,radeonsi: don't add streamout.num_dw_for_end twice

It's already added in need_cs_space.

Also don't calculate anything if there are no buffers.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g,radeonsi: fix MAX_TEXTURE_3D_LEVELS and MAX_TEXTURE_ARRAY_LAYERS limits
Marek Olšák [Sun, 9 Mar 2014 19:03:57 +0000 (20:03 +0100)]
r600g,radeonsi: fix MAX_TEXTURE_3D_LEVELS and MAX_TEXTURE_ARRAY_LAYERS limits

CB_COLORi_VIEW.SLICE_MAX can be at most 2047.

This fixes the maxlayers piglit test.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agost/dri: flush drawable textures before unreferencing
Marek Olšák [Fri, 7 Mar 2014 16:25:05 +0000 (17:25 +0100)]
st/dri: flush drawable textures before unreferencing

This fixes piglit/fbo-sys-blit with fast clear on radeonsi.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoradeonsi: implement fast color clear
Marek Olšák [Thu, 6 Mar 2014 01:44:07 +0000 (02:44 +0100)]
radeonsi: implement fast color clear

This works for both multi-sample and single-sample color buffers.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g: move fast color clear code to a common place
Marek Olšák [Thu, 6 Mar 2014 01:38:57 +0000 (02:38 +0100)]
r600g: move fast color clear code to a common place

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g,radeonsi: move CMASK register values from r600_surface to r600_texture
Marek Olšák [Thu, 6 Mar 2014 01:14:42 +0000 (02:14 +0100)]
r600g,radeonsi: move CMASK register values from r600_surface to r600_texture

When doing fast clear for single-sample color buffers for the first time,
a CMASK buffer has to be allocated and the CMASK state in all pipe_surfaces
referencing the color buffer must be updated. Updating all surfaces is kinda
silly, so let's move the values to r600_texture instead.

This is only for Evergreen and later. R600-R700 don't have fast clear.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoradeonsi: convert the framebuffer state to atom-based
Marek Olšák [Wed, 5 Mar 2014 23:28:14 +0000 (00:28 +0100)]
radeonsi: convert the framebuffer state to atom-based

This looks like r600g. The shared Cayman MSAA code is used here.

The real motivation for this is that I need the ability to change values
of color registers after the framebuffer state is set. The PM4 state cannot
be modified easily after it's generated. With this, I can just change
r600_surface::cb_color_xxx and set framebuffer.atom.dirty=true and it's done.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g: move cayman MSAA setup to a common place
Marek Olšák [Tue, 4 Mar 2014 18:46:55 +0000 (19:46 +0100)]
r600g: move cayman MSAA setup to a common place

I will use this in radeonsi.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>