summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/intel_tex.c
AgeCommit message (Collapse)AuthorFilesLines
2020-04-21replace malloc macros in imports.h with u_memory.h versionsDylan Baker1-0/+1
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
2018-02-21i965/miptree: Loosen the format check in miptree_match_imageJason Ekstrand1-1/+1
This function is used to determine when we need to re-allocate a miptree. Since we do nothing different in miptree allocation for sRGB vs. linear, loosening this should be safe and may lead to less copying and reallocating in some odd cases. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Chad Versace <chadversary@chromium.org>
2017-10-12meta: Delete the PBO texture upload/download pathJason Ekstrand1-63/+0
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2017-08-30i965: drop brw->gen in favor of devinfo->genLionel Landwerlin1-1/+2
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2017-08-19i965/tex: Don't pass samples to miptree_create_for_teximageJason Ekstrand1-1/+1
In 76e2f390f9863a35, when Topi switched num_samples from 0 to 1 for single-sampled, he accidentally switched the last parameter in the call to miptree_create_for_teximage from 0 to 1 thinking it was num_samples when it was actually layout_flags. Switching from 0 to 1 added the MIPTREE_LAYOUT_ACCELERATED_UPLOAD flag which causes us to allocate a busy BO instead of an idle one. This caused the subsequent CPU upload to consistently stall. The end result was a 15% performance drop in the SynMark v7 DrvRes microbenchmark. This restores the old behavior and fixes the performance regression. Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com> Fixes: 76e2f390f9863a356d1419982dec705260d67eff Bugzilla: https://bugs.freedesktop.org/102260 Cc: mesa-stable@lists.freedesktop.org
2017-08-07i965/miptree: Rework create flagsJason Ekstrand1-2/+2
The only one of the three remaining flags that has anything whatsoever to do with layout is TILING_NONE. This commit renames them to MIPTREE_CREATE_*, documents the meaning of each flag, and makes the create functions take an actual enum type so GDB will print them nicely. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2017-08-07i965/miptree: Delete MIPTREE_LAYOUT_TILING_(Y|ANY)Jason Ekstrand1-1/+1
The only force tiling flag we really care about is LAYOUT_TILING_NONE. The others don't actually do anything but add confusion. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2017-07-22i965/miptree: Check tex image allocation failuresTopi Pohjolainen1-0/+2
allowing graceful failure instead of crash on assert later on. This can be hit, for example, on SNB when trying to allocate 8kx8k CUBE_MAP against isl: x-tiled buffer size becomes 2421161984 exceeding the maximum of 1 << 31 == 2147483648. Another way to hit this on SNB is with multisampling of over 64-bit formats. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
2017-07-20i965/miptree: Use num_samples of 1 instead of 0 for single-sampledTopi Pohjolainen1-2/+2
Patch moves "assert(brw->num_samples <= 16)" from emit_3dstate_multisample2() to upload_multisample_state(). Latter is the only caller of the former and passes "brw->num_samples" as argument. Therefore it is clearer to assert in the caller. Possible bug fix in genX(emit_3dstate_multisample2) which doesn't have a case for num_samples == 0 in the switch statement. It should be noted that intel_miptree_map()/unmap() now checks additionally for "mt->surf.samples == 1" in order to support gen6 stencil which is already transitioned to ISL. This will go away in next patch when native miptrees start to use isl_surf::samples as well. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
2017-07-13i965: Add a "write" parameter to intel_bufferobj_buffer.Kenneth Graunke1-1/+2
This doesn't do anything yet, but soon we'll want to know whether an access to a buffer section may write that data, or simply reads it. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2017-06-22i965: Rename some vague format members of brw_contextChad Versace1-1/+1
I'm swimming in a vortex of formats. Mesa formats, isl formats, DRI formats, GL formats, etc. It's easy to misinterpret the following brw_context members unless you've recently read their definition. In upcoming patches, I change them from embedded arrays to simple pointers; after that, even their definition doesn't help, because the MESA_FORMAT_COUNT hint will no longer be present. Rename them to prevent further confusion. While we're renaming, choose shorter names too. -format_supported_as_render_target +mesa_format_supports_render -render_target_format +mesa_to_isl_render_format Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2017-04-10i965/drm: Rename drm_bacon_bo to brw_bo.Kenneth Graunke1-1/+1
The bacon is all gone. This renames both the class and the related functions. We're about to run indent on the bufmgr code, so no need to worry about fixing bad indentation. Acked-by: Jason Ekstrand <jason@jlekstrand.net>
2017-04-10i965/drm: Use our internal libdrm (drm_bacon) rather than the real one.Kenneth Graunke1-1/+1
Now we can actually test our changes. Acked-by: Jason Ekstrand <jason@jlekstrand.net>
2016-09-20i965: Rename intelScreen to screen.Kenneth Graunke1-2/+2
"intelScreen" is wordy and also doesn't fit our style guidelines. "screen" is shorter, which is nice, because we use it fairly often. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2016-08-19i965: Roll intel_reg.h into brw_defines.hJason Ekstrand1-1/+1
More than half of the stuff in intel_reg.h had nothing whatsoever to do with registers and really belongs in brw_defines.h anyway. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-07-20i965/miptree: Enforce that height == 1 for 1-D array texturesJason Ekstrand1-0/+2
The GL API and mesa internals do this differently than we do. In GL, there is no depth parameter for 1-D arrays and height is used. In the i965 miptree code we do the sane thing and make height == 1 and use depth for number of slices. This makes for a mismatch every time we create a 1-D array texture from GL. Instead of actually solving this problem, we just said "1-D is hard, let's make sure it works no matter which way we pass the parameters" and called it a day. This commit fixes the one GL -> i965 transition point where we weren't already handling 1-D array textures to do the right thing and then replaces the magic fixup code with an assert that you're doing the right thing. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Reviewed-by: Chris Forbes <chrisforbes@google.com> Cc: "12.0 11.2 11.1" <mesa-stable@lists.freedesktop.org>
2016-07-07i965: Emit SNB write cache flush W/A from brw_emit_pipe_control_flush.Francisco Jerez1-8/+0
Shouldn't cause any functional changes at this point, but we have forgotten to apply this workaround several times in the past, make sure it doesn't happen again. Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
2016-07-01i965: intel_texture_barrier reimplementedAlejandro Piñeiro1-1/+20
Fixes: GL44-CTS.texture_barrier_ARB.same-texel-rw-multipass On Haswell, Broadwell and Skylake (note that in order to execute that test, it is needed to override GL and GLSL versions). On gen6 this test was already working without this change. It keeps working after it. This commit replaces the call to brw_emit_mi_flush for gen6+ with two calls to brw_emit_pipe_control_flush: * The first one with RENDER_TARGET_FLUSH and CS_STALL set to initiate a render cache flush after any concurrent rendering completes and cause the CS to stop parsing commands until the render cache becomes coherent with memory. * The second one have TEXTURE_CACHE_INVALIDATE set (and no CS stall) to clean up any stale data from the sampler caches before rendering continues. Didn't touch gen4-5, basically because I don't have a way to test them. More info on commits: 0aa4f99f562a05880a779707cbcd46be459863bf 72473658c51d5e074ce219c1e6385a4cce29f467 Thanks to Curro to help to tracking this down, as the root case was a hw race condition. v2: use two calls to pipe_control_flush instead of a combination of gen7_emit_cs_stall_flush and brw_emit_mi_flush calls (Curro) v3: no need to const cache invalidation (Curro) Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2015-09-23i965: add ARB_texture_barrier supportIlia Mirkin1-0/+9
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-08-06i965: Rename MIPTREE_LAYOUT_ALLOC_* -> MIPTREE_LAYOUT_TILING_*.Matt Turner1-1/+1
Ben suggested that I rename MIPTREE_LAYOUT_ALLOC_ANY_TILED since it needed to include no tiling at all, but the name MIPTREE_LAYOUT_ALLOC_ANY is pretty nondescriptive. We can avoid confusion by replacing "ALLOC" with "TILING" in the identifiers. Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
2015-07-16i965: Push miptree tiling request into flagsBen Widawsky1-1/+1
With the last few patches a way was provided to influence lower layer miptree layout and allocation decisions via flags (replacing bools). For simplicity, I chose not to touch the tiling requests because the change was slightly less mechanical than replacing the bools. The goal is to organize the code so we can continue to add new parameters and tiling types while minimizing risk to the existing code, and not having to constantly add new function parameters. v2: Rebased on Anuj's recent Yf/Ys changes Fix non-msrt MCS allocation (was only happening in gen8 case before) v3: small fix in assertion requested by Chad v4: Use parens to get the order right from v3. Signed-off-by: Ben Widawsky <ben@bwidawsk.net> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2015-07-16Revert "i965: Push miptree tiling request into flags"Ben Widawsky1-1/+1
This reverts commit 51e8d549e110f86cb7107cf712843aebd956fb9a.
2015-07-16i965: Push miptree tiling request into flagsBen Widawsky1-1/+1
With the last few patches a way was provided to influence lower layer miptree layout and allocation decisions via flags (replacing bools). For simplicity, I chose not to touch the tiling requests because the change was slightly less mechanical than replacing the bools. The goal is to organize the code so we can continue to add new parameters and tiling types while minimizing risk to the existing code, and not having to constantly add new function parameters. v2: Rebased on Anuj's recent Yf/Ys changes Fix non-msrt MCS allocation (was only happening in gen8 case before) v3: small fix in assertion requested by Chad Signed-off-by: Ben Widawsky <ben@bwidawsk.net> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> (v2) Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> (v2) Reviewed-by: Chad Versace <chad.versace@intel.com> (v2)
2015-06-12i965: Consolidate certain miptree params to flagsBen Widawsky1-5/+3
I think pretty much everyone agrees that having more than a single bool as a function argument is bordering on a bad idea. What sucks about the current code is in several instances it's necessary to propagate these boolean selections down to lower layers of the code. This requires plumbing (mechanical, but still churn) pretty much all of the miptree functions each time. By introducing the flags paramater, it is possible to add miptree constraints very easily. The use of this, as is already the case, is sometimes we have some information at the time we create the miptree that needs to be known all the way at the lowest levels of the create/allocation, disable_aux_buffers is currently one such example. There will be another example coming up in a few patches. v2: Tab fix. (Ben) Long line fixes (Topi) Use anonymous enum instead of #define for layout flags (Chad) Use 'X != 0' instead of !!X (everyone except Chad) v3: Some non-trivial conflict resolution on top of Anuj's patches. Signed-off-by: Ben Widawsky <ben@bwidawsk.net> Cc: "Pohjolainen, Topi" <topi.pohjolainen@intel.com> Reviewed-by: Chad Versace <chad.versace@intel.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2015-04-14i965: replace __FUNCTION__ with __func__Marius Predut1-5/+5
Consistently just use C99's __func__ everywhere. No functional changes. Acked-by: Matt Turner <mattst88@gmail.com> Signed-off-by: Marius Predut <marius.predut@intel.com>
2015-04-13i965: Change intel_miptree_create_for_bo() signatureChad Versace1-1/+2
Add parameter 'bool disable_aux_buffers'. This is a refactor patch. The patch changes no behavior because the new parameter is false in every call. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
2015-01-28i965/tex: Don't create read-write textures with non-renderable formatsJason Ekstrand1-0/+5
I haven't actually seen this bug in the wild, but it's possible that someone could ask to do a S3TC PBO download or something. This protects us from accidentally creating a render target with a compressed or otherwise non-renderable format. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-01-22i965: Implement SetTextureStorageForBufferObjectJason Ekstrand1-0/+57
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2015-01-08main: Changed _mesa_alloc_texture_storage to _mesa_AllocTextureStorage_sw.Laura Ekstrand1-1/+1
In order to implement ARB_DIRECT_STATE_ACCESS, many GL API functions must now rely on a backend that both traditional and DSA functions can use. For instance, _mesa_TexStorage2D and _mesa_TextureStorage2D both call a backend function _mesa_texture_storage that takes a context and a texture object as arguments. The backend is named _mesa_texture_storage so that Meta can call it and avoid looking up the context and the texture object. However, backend names often look very close to the names of software fallbacks (ie. _mesa_alloc_texture_storage). For this reason, software fallbacks have been renamed for clarity to have the form _mesa_[Driver function name]_sw. Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2014-12-22i965: Fix intel_miptree_map() signature to be more 64-bit safeChad Versace1-2/+5
This patch should diminish the likelihood of pointer arithmetic overflow bugs, like the one fixed by b69c7c5dac. Change the type of parameter 'out_stride' from int to ptrdiff_t. The logic is that if you call intel_miptree_map() and use the value of 'out_stride', then you must be doing pointer arithmetic on 'out_ptr'. Using ptrdiff_t instead of int should make a little bit harder to hit overflow bugs. As a side-effect, some function-scope variables needed to be retyped to avoid compilation errors. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2014-08-15i965: Allow forcing miptree->array_layout = ALL_SLICES_AT_EACH_LODJordan Justen1-1/+2
gen6 does not support multiple miplevels with separate stencil/hiz. Therefore we need to layout its miptree with no mipmap spacing between the slices of each miplevel. v3: * Use new array_layout enum Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2014-06-26i965: Handle miptree creation failure in intel_alloc_texture_storage()Juha-Pekka Heikkila1-0/+3
Check intel_miptree_create() return value before using it as a pointer. Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-04-10i965: Adjust map/unmap code for MinLevel/MinLayerChris Forbes1-3/+8
This allows core mesa's TexSubImage paths etc to work correctly with views which have nonzero MinLevel or MinLayer. Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Eric Anholt <eric@anholt.net>
2014-04-10i965: Add _Format to intel_texobj.Chris Forbes1-0/+9
This is the actual mesa_format to use. In non-view cases this is always the same as the mt's format. V4: Comment style Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Eric Anholt <eric@anholt.net>
2014-04-10i965: Add driver hook for TextureViewChris Forbes1-0/+41
We need to wire the original texture's mt into the view. All the hard work of setting up an appropriate tree of gl_texture_image structures has already been done by core mesa. Signed-off-by: Chris Forbes <chrisf@ijw.co.nz> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Eric Anholt <eric@anholt.net>
2013-12-05i965: Drop trailing whitespace from the rest of the driver.Kenneth Graunke1-1/+1
Performed via: $ for file in *; do sed -i 's/ *//g'; done Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2013-09-30i965: Add a real native TexStorage path.Eric Anholt1-0/+63
We originally had a path just did the loop and called ctx->Driver.AllocTextureImageBuffer(), which I moved into Mesa core. But we can do better, avoiding incorrect miptree size guesses and later texture validations by just directly allocating the miptree and setting it to all the images. v2: drop debug printf. Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
2013-07-30mesa: default DEPTH_TEXTURE_MODE should be RED in the core profileMarek Olšák1-1/+1
Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-07-09i965: Move intel_context::intelScreen to brw_context.Kenneth Graunke1-2/+1
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Chris Forbes <chrisf@ijw.co.nz> Acked-by: Paul Berry <stereotype441@gmail.com> Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
2013-07-09i965: Pass brw_context to functions rather than intel_context.Kenneth Graunke1-5/+6
This makes brw_context available in every function that used intel_context. This makes it possible to start migrating fields from intel_context to brw_context. Surprisingly, this actually removes some code, as functions that use OUT_BATCH don't need to declare "intel"; they just use "brw." Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Chris Forbes <chrisf@ijw.co.nz> Acked-by: Paul Berry <stereotype441@gmail.com> Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
2013-07-09i965: Replace #include "intel_context.h" with brw_context.h.Kenneth Graunke1-1/+1
brw_context.h includes intel_context.h, but additionally makes the brw_context structure available. Switching this allows us to start using brw_context in more places. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Chris Forbes <chrisf@ijw.co.nz> Acked-by: Paul Berry <stereotype441@gmail.com> Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
2013-06-26i965: Move the remaining intel code to the i965 directory.Eric Anholt1-1/+189
Now that i915's forked off, they don't need to live in a shared directory. Acked-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Chad Versace <chad.versace@linux.intel.com> Acked-by: Adam Jackson <ajax@redhat.com> (and I hear second hand that idr is OK with it, too)
2007-12-16[965] Move to using shared texture management code.Eric Anholt1-316/+1
This removes the delayed texture upload optimization from 965, in exchange for bringing us closer to PBO support. It also disables SGIS_generate_mipmap, which didn't seem to be working before anyway, according to the lodbias demo.
2007-11-20[965] Replace 965 texture format code with common code.Eric Anholt1-0/+1
The only functional difference should be that 965 now gets the optimization where textures default to 16bpp when the screen is 16bpp.
2006-08-09Add Intel i965G/Q DRI driver.Eric Anholt1-0/+315
This driver comes from Tungsten Graphics, with a few further modifications by Intel.