diff options
author | Keith Whitwell <keithw@vmware.com> | 2010-04-10 16:05:54 +0100 |
---|---|---|
committer | Keith Whitwell <keithw@vmware.com> | 2010-04-10 16:05:54 +0100 |
commit | 287c94ea4987033f9c99a2f91c5750c9083504ca (patch) | |
tree | a3c1d20522d0ba4a259a5c83e2126affd7aba83c /src/gallium/drivers/i965 | |
parent | e7f1e5ca648d6c96d056d3ae8eab65e98f47f311 (diff) |
Squashed commit of the following:
commit 0189cb2fde9f5d7326fd4bfbc2e52db4cce73b3e
Author: Keith Whitwell <keithw@vmware.com>
Date: Sat Apr 10 12:48:43 2010 +0100
gallium: don't use generic get_transfer func for textures
It doesn't know and can't fill in the stride value.
commit 65bc6f88fd9ce8ff90175b250e580bef2739ea35
Author: Chia-I Wu <olv@lunarg.com>
Date: Sat Apr 10 13:49:34 2010 +0800
i915g: Initialize screen surface function.
commit eb56e64986790aa2fa35534ce652b78656b0c3c5
Merge: f8b0a7f e7f1e5c
Author: Keith Whitwell <keithw@vmware.com>
Date: Sat Apr 10 00:38:43 2010 +0100
Merge commit 'origin/master' into gallium-resources
Conflicts:
src/gallium/drivers/r300/r300_texture.c
commit f8b0a7f6a3a98fd36ce90a81073ec8c8f09b684c
Merge: a3c9980 f43c679
Author: Keith Whitwell <keithw@vmware.com>
Date: Sat Apr 10 00:35:09 2010 +0100
Merge commit 'origin/master' into gallium-resources
Conflicts:
src/gallium/drivers/r300/r300_texture.c
commit a3c99807de37dc2c072f1d75ed3a11da333bc9a1
Author: unknown <michal@.(none)>
Date: Fri Apr 9 18:51:39 2010 +0200
scons: Add missing sources.
commit 927cec79cedb457efa9e6f335727cfcb8e4908e2
Author: Roland Scheidegger <sroland@vmware.com>
Date: Fri Apr 9 18:07:56 2010 +0200
gallium: fix another compile warning after merge. Hmpf.
commit 52953cd7b0e51deafecb812bdc40f9e45f9ac62a
Author: Roland Scheidegger <sroland@vmware.com>
Date: Fri Apr 9 18:02:11 2010 +0200
gallium: fix comment
commit 7c8763aa6cfc74adf1ea49c2bab25ca17b32575f
Author: unknown <michal@.(none)>
Date: Fri Apr 9 18:05:20 2010 +0200
util: Fix type cast.
commit 9d0086411a104b7cc9297aac0d1f82853118d7bf
Author: unknown <michal@.(none)>
Date: Fri Apr 9 18:04:33 2010 +0200
libgl-gdi: Use proper unwrap functions for resources.
commit 251a5cdd18ba31c690ef61f133dfc65cd4a45cf8
Author: Roland Scheidegger <sroland@vmware.com>
Date: Fri Apr 9 17:51:23 2010 +0200
gallium: more comments fixup
commit 8f3f9d5e1e9c0de98a3dfb19e81250d2c32ee4e9
Author: Roland Scheidegger <sroland@vmware.com>
Date: Fri Apr 9 17:48:18 2010 +0200
gallium: another fix after merge
commit 41f00a32ee5be91512c048bacb89ede0e04bc08d
Author: Roland Scheidegger <sroland@vmware.com>
Date: Fri Apr 9 17:44:30 2010 +0200
gallium: more pipe_texture/resource fixes after merge
commit faf53328d1154c51d8a59513f2bfcae62272b0bf
Author: Roland Scheidegger <sroland@vmware.com>
Date: Fri Apr 9 17:44:24 2010 +0200
gallium: fix comments for changed USAGE flags
commit fdcb17bea4b0798d316b56deea69832f41142adf
Author: Roland Scheidegger <sroland@vmware.com>
Date: Fri Apr 9 16:40:07 2010 +0200
gallium/pb: pb uses PB_USAGE_ flags, not PIPE_TRANSFER_ (same value anyway)
commit c95f7278ecc6db417ec1053279f2a8172c47aee9
Author: Keith Whitwell <keithw@vmware.com>
Date: Fri Apr 9 13:44:35 2010 +0100
llvmpipe: fix merge glitches
commit 28f8b8683175149a381be5eff263d4c20568bce7
Author: Keith Whitwell <keithw@vmware.com>
Date: Fri Apr 9 13:41:39 2010 +0100
r300g: update after merge for pipe_resources
commit 248c93cbc066ba6e3fadd94c5fcf3bdbb373d8fd
Author: Keith Whitwell <keithw@vmware.com>
Date: Fri Apr 9 13:41:20 2010 +0100
st/mesa: fix old pipe_texture usages
commit a563b1c5c2cb57b3ef28a3654d9b477460d13ced
Author: Keith Whitwell <keithw@vmware.com>
Date: Fri Apr 9 13:40:56 2010 +0100
r300g: remove unused variable
commit 734500131d828c9dfd68c5fa26b3e6b07e086d2d
Author: Keith Whitwell <keithw@vmware.com>
Date: Fri Apr 9 13:40:36 2010 +0100
nv50: fix compiler warning
commit efd402e13037e5c3e29759fa5b1c754c6d65d0e2
Merge: fec8a1d 5452615
Author: Keith Whitwell <keithw@vmware.com>
Date: Fri Apr 9 13:33:57 2010 +0100
Merge commit 'origin/master' into gallium-resources
Conflicts:
src/gallium/drivers/cell/ppu/cell_screen.c
src/gallium/drivers/cell/ppu/cell_texture.c
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_render.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/r300/r300_transfer.c
src/gallium/state_trackers/egl/common/egl_g3d.h
src/gallium/state_trackers/egl/kms/native_kms.c
src/gallium/state_trackers/egl/x11/native_dri2.c
src/gallium/state_trackers/egl/x11/native_ximage.c
commit fec8a1db13fac04ef56f6ece799d1f20aa3011db
Author: Marek Olšák <maraeo@gmail.com>
Date: Sat Apr 3 07:58:34 2010 +0200
util: fix assertion failures in pipe_buffer_flush_mapped_range
commit 1ff3984c2edce9927744f3cce3e7b07778990170
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Apr 8 17:44:54 2010 +0200
docs: fix transfer_map description
commit 20bf14be8ac6438cb1afa38212e306fc06a5ed40
Author: Keith Whitwell <keithw@vmware.com>
Date: Thu Apr 8 14:39:13 2010 +0100
util: fix up several uses of pipe_map_buffer_range
This function used to return a pointer to where the start of the
actual buffer would have been, even though only the requested range is
being mapped.
In the resources change, the function was modified to use a transfer
internally, and started returning the pointer to the beginning of the
transfer, ie the mapped range.
Some users of the function were changed to reflect this new behaviour,
some were not. Since then the function has reverted to its original
behaviour, matching master.
This change restores some of the users of the map_buffer_range helper
to expect the old/original behaviour.
commit 33179a86058b68b518f40971030db337dc26fe6e
Author: Keith Whitwell <keithw@vmware.com>
Date: Thu Apr 8 14:38:54 2010 +0100
mesa/st: fix up several uses of pipe_map_buffer_range
This function used to return a pointer to where the start of the
actual buffer would have been, even though only the requested range is
being mapped.
In the resources change, the function was modified to use a transfer
internally, and started returning the pointer to the beginning of the
transfer, ie the mapped range.
Some users of the function were changed to reflect this new behaviour,
some were not. Since then the function has reverted to its original
behaviour, matching master.
This change restores some of the users of the map_buffer_range helper
to expect the old/original behaviour.
commit 3f5363d4dc9d7ad48467ae82d58d5f3d9bd10698
Author: Keith Whitwell <keithw@vmware.com>
Date: Wed Apr 7 17:26:52 2010 +0100
util: map_range and flush_range have offsets relative to start of buffer
commit 7eb1bfb97a790c73188d6b616d54fb3849e69b1e
Author: Keith Whitwell <keithw@vmware.com>
Date: Wed Apr 7 17:26:08 2010 +0100
nv50: fix compiler warning
commit d040daff0642dd791ac38e9b353dc251b03fc873
Author: Keith Whitwell <keithw@vmware.com>
Date: Wed Apr 7 17:25:58 2010 +0100
nvfx: fix compiler warning
commit 49ec01dffb8e99ab3ff8f856287db7b4df3efed6
Author: Chia-I Wu <olv@lunarg.com>
Date: Mon Apr 5 11:58:53 2010 +0800
mesa/es: Fixes for gallium-resources.
commit 47c87ada452be45766928a01b6d69da63e3a5f5e
Author: Marek Olšák <maraeo@gmail.com>
Date: Sat Apr 3 05:19:20 2010 +0200
r300g: fix transfers for textures created from winsys handles
commit 5f2701fddaef9c18d85c049311c2819c49cc1ae0
Author: Luca Barbieri <luca@luca-barbieri.com>
Date: Sat Apr 3 03:52:38 2010 +0200
nouveau: don't use the staging usage
Maybe it could make sense, but for now dynamic is enough.
None of these avoid uncached reads from GART on AGP cards.
commit 0db20fa49e008f35911007fa7ed9be1d678a2161
Author: Luca Barbieri <luca@luca-barbieri.com>
Date: Sat Apr 3 03:27:19 2010 +0200
i965: add brw_resource.c to Makefile
commit b94f3e7389cbd1b6465de3c04e8059ce73f1ea1f
Author: Luca Barbieri <luca@luca-barbieri.com>
Date: Sat Apr 3 01:48:33 2010 +0200
nouveau: fix for gallium-resources
commit a01ff99a19986e6beb7903431e60a074945b09bc
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Apr 1 19:26:35 2010 +0200
gallium: fix missing includes
commit 26aeded562ce947a6deeb867fe22bf8daf7b1a1a
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Apr 1 19:19:18 2010 +0200
gallium: remove video interface and related stuff
These interfaces weren't quite was needed, and building disabled for a while.
Some code actually build since some branch merge, and were now not fully
converted to gallium-resources.
See http://www.mail-archive.com/mesa3d-dev@lists.sourceforge.net/msg09619.html
for a discussion of this. Video related work is done in origin/pipe-video
branch.
commit c64285aea45997a276fb141d7badc8a04f617c7c
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Apr 1 18:45:54 2010 +0200
python: fixes for resource changes
doesn't look quite ok yet, but sort of compiles.
commit 03d4d5a41f5cf158a358fd705c695e1c987a328f
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Apr 1 18:34:46 2010 +0200
gallium: s/u_box_orgin_2d/u_box_origin_2d
commit 2444f023142bcaf7bd310b44794580f273254408
Author: Marek Olšák <maraeo@gmail.com>
Date: Thu Apr 1 03:26:50 2010 +0200
r300g: fix segfault when the transfers functions are used
Still broken.
commit 6f09bf4066ab651b323c131bb07978e700519805
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Apr 1 00:05:12 2010 +0200
r300g: compile fixes
commit 76711ff40d2092f9ef03d452de7458c4e76d9246
Author: Roland Scheidegger <sroland@vmware.com>
Date: Thu Apr 1 00:04:47 2010 +0200
nvfx: more compile fixes
commit c5d2e90c9cc119447a447dc04a4bce4ab91fc671
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Mar 31 23:18:50 2010 +0200
gallium: more mostly merge fallout fixes...
commit fbc3722696790857f4adc936190406e74dffd969
Merge: 86d9225 d97f696
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Mar 31 22:09:35 2010 +0200
Merge commit 'origin/master' into gallium-resources
Conflicts:
src/gallium/drivers/cell/ppu/cell_screen.c
src/gallium/drivers/i915/i915_buffer.c
src/gallium/drivers/i915/i915_context.h
src/gallium/drivers/i915/i915_resource_texture.c
src/gallium/drivers/i915/i915_screen.c
src/gallium/drivers/i915/i915_state_emit.c
src/gallium/drivers/i965/brw_resource_texture.c
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/nvfx/nv30_fragtex.c
src/gallium/drivers/nvfx/nv40_fragtex.c
src/gallium/drivers/nvfx/nvfx_miptree.c
src/gallium/drivers/nvfx/nvfx_screen.c
src/gallium/drivers/nvfx/nvfx_transfer.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/svga/svga_screen_texture.c
src/gallium/state_trackers/dri/common/dri_drawable.c
src/gallium/state_trackers/dri/common/dri_screen.c
src/gallium/state_trackers/dri/common/dri_st_api.h
src/gallium/state_trackers/dri/drm/dri1.c
src/gallium/state_trackers/dri/drm/dri1.h
src/gallium/state_trackers/dri/drm/dri2.c
src/gallium/state_trackers/python/st_device.c
src/gallium/state_trackers/python/st_sample.c
src/mesa/state_tracker/st_cb_clear.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_readpixels.c
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_extensions.c
commit 86d9225d19d194eebbbe95b059695697c3307d15
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Mar 31 19:06:06 2010 +0200
gallium: more fixes for bind changes
commit a215ef0606347e34669a580ec8df93ede7e46399
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Mar 31 18:48:36 2010 +0200
gallium/docs: some updates for bind changes
commit c6c7e6746cbc7af59f7972719ed76f43e8ac16fc
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Mar 30 20:24:26 2010 +0200
gallium: more bind change compile fixes
commit a83fa1504b78180524a5eb454ae186741a27cdf8
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Mar 30 17:37:13 2010 +0200
compile fixes
commit 30dc8afcd243d6a160571bac5f06d773e54a4196
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Mar 30 16:56:28 2010 +0200
fix some merge issues
commit 30aa617fee11fe50c0a9c2f33fcd120a474f5e34
Merge: 1dde609 3a830bc
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Mar 30 16:09:45 2010 +0200
Merge commit 'origin/gallium-buffer-usage-cleanup' into gallium-resources
Conflicts:
src/gallium/drivers/nouveau/nouveau_screen.c
src/gallium/drivers/nvfx/nvfx_transfer.c
src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c
commit 1dde609ad6c9d2dfa0a5f7167f3c5bcf023b7c4d
Author: Roland Scheidegger <sroland@vmware.com>
Date: Wed Mar 24 02:35:00 2010 +0100
docs: some updates for pipe_resource
commit f236f9660d31b936f54b64ae07e569f8637067bd
Author: Luca Barbieri <luca@luca-barbieri.com>
Date: Wed Mar 24 01:31:28 2010 +0100
nvfx: fix for gallium-resources
It seems to work with basic applications but almost surely needs more work.
In particular, it probably shouldn't use PIPE_BUFFER_USAGE_* flags
and should use PIPE_TRANSFER_* in several places.
Also, we probably don't want the vtable indirect calls and that ought
to be replaced with something better instead.
commit 5a136ad7b63768cb9a753eff8686c44592e62325
Author: Luca Barbieri <luca@luca-barbieri.com>
Date: Wed Mar 24 01:31:19 2010 +0100
nv50: fix build in gallium-resources
Not actually tested.
Also needs next patch tee to actually build, this is just the nv50 part
split from the rest.
commit 3a830bc4a3f0f60c925b9434845a6bcad9a913c5
Author: Keith Whitwell <keithw@vmware.com>
Date: Tue Mar 23 14:00:52 2010 -0700
st/egl: fix up for binding flags
commit c6a80dc32ef17bc972d4137ce7444ebed4d28ebb
Author: Keith Whitwell <keithw@vmware.com>
Date: Tue Mar 23 13:52:15 2010 -0700
r300: restore 4k alignment for oqbo buffers
commit e75a8d5ea9e0ffcf67bc858e08937e10b4fc74ba
Author: Keith Whitwell <keithw@vmware.com>
Date: Tue Mar 23 13:00:07 2010 -0700
gallium: bind flags
commit 1f5b509543a7f399835fd9edf27c18e1643fab7d
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Mar 23 19:32:21 2010 +0100
i965g: scons compile fixes
commit 2c385f8f905ec794d9119c05c6293e0b1b9b565a
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Mar 23 19:20:33 2010 +0100
nouveau: drm compile fix
commit b285086ebd5132b47c340897c4622cc9fbd286cb
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Mar 23 18:36:19 2010 +0100
r300g: pipe_resource compile fixes
bring back mistakenly deleted radeon_buffer.h
plus some more
commit 7810606f423ef2f51f0a14b919640c2fd2c931aa
Author: Michal Krol <michal@vmware.com>
Date: Tue Mar 23 16:21:03 2010 +0100
softpipe: Map GS constants, too.
commit 366f1176fb89d2b1978da6cfe60000b76bbc7338
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Mar 23 15:51:52 2010 +0100
failover: update for pipe_resources
commit 615f44d70d293704ed821bc0b21fcfe6e363895d
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Mar 23 15:51:02 2010 +0100
identity: remove double is_resource_reference assignment
commit 7008586020395905ddfff333d02b3893de369796
Author: Roland Scheidegger <sroland@vmware.com>
Date: Tue Mar 23 15:50:32 2010 +0100
trace: compile fix
commit 058c5697bda4c9cf7b49d26ee27a34586544efaa
Merge: dd7ba13 b33fd3c
Author: Keith Whitwell <keithw@vmware.com>
Date: Tue Mar 23 06:40:39 2010 -0700
Merge commit 'origin/gallium-resources' into gallium-buffer-usage-cleanup
Conflicts:
src/gallium/state_trackers/vega/api_filters.c
src/mesa/state_tracker/st_cb_drawpixels.c
commit b33fd3ce3daf2921a895367d0ed3fd9c718a8575
Author: Michal Krol <michal@vmware.com>
Date: Mon Mar 22 21:03:26 2010 +0100
gallium: Usage parameter of get_transfer/transfer_inline_write is a bitfield.
commit 9c1162d9d656062a490a529997def3f674cc61fc
Author: Michal Krol <michal@vmware.com>
Date: Mon Mar 22 20:50:49 2010 +0100
scons: Update file lists after gallium-resources changes.
commit af9793ab9e5386b150d6b25c0d1978fdc67172e4
Author: Michal Krol <michal@vmware.com>
Date: Mon Mar 22 20:04:39 2010 +0100
gallium: Do not use `template` for formal parameter names.
commit dc2e12d714c444af9ff1acdd5a7e91408b116c99
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 22:41:34 2010 +0000
ws/nouveau: remove pipe_texture reference
commit b94c72329f1be85887d40d49b0586979da469d77
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 22:40:41 2010 +0000
ws/xlib: remove pipe_buffer reference in comment
commit 0a2af3eeae7de1d1cb433f0a2c35136b115f9920
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 22:39:34 2010 +0000
st/vega: clean up reference to pipe_texture
commit 437ce98daae46be5d532fbb04c7cbf4a503c1623
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 22:39:02 2010 +0000
st/python: begin conversion to pipe_resources, much more to do
commit 1b02e1ee3e5e87774f0c9e5f0e1898b7f8de1b16
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 22:29:34 2010 +0000
st/xorg: update for pipe_resources
commit eb39977fe7a1d9f0c3f4f2d4303a93c2c613cc3b
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 22:23:51 2010 +0000
st/dri: update for pipe_resources
commit e447aeff597a4d8c0f5de25854c14c99f2cc138c
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 22:23:36 2010 +0000
st/egl: update for pipe_resources
commit e4cc48da8fdbd7d521257a6d7cd10e6fc5aa1a65
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 22:08:44 2010 +0000
r300: drop use of R300 DONT SYNC flag
commit 129a83ab4d32e44ded5faea3f86ae5e1e62cddb6
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 22:08:17 2010 +0000
pipebuffer: use transfer flag
commit 575b35ee6b683d77095ef21c573c1de207107e79
Merge: f29ac73 9fc6c8b
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 22:03:25 2010 +0000
Merge commit 'origin/master' into gallium-resources
Conflicts:
src/gallium/drivers/llvmpipe/lp_texture.c
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_texture.c
src/gallium/winsys/drm/radeon/core/radeon_buffer.h
commit f29ac73f3f626d5779a627b7fa6fecdb60a35aab
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 18:37:25 2010 +0000
cell: attempt to convert to pipe_resources
Can't even compile test this driver.
commit 484b1947f4af81bab60b41f21c3c23ea6f67488c
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 17:25:50 2010 +0000
nvfx: restore usage of pipe_winsys
The interface that cannot be killed...
commit ac76ac6eb30f4f9aa9f5733d60358b357925953a
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 17:25:10 2010 +0000
nv50: fix warning
commit 9683f4423449fa5acf6c019c571223650473bd82
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 17:14:31 2010 +0000
util: restore u_simple_screen, nouveau still relies on it
commit 961cbcb62232689c959965384c6aa9b8eca697c1
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 16:51:54 2010 +0000
nouveau: convert nvfx and nv50 to pipe_resources
Compile tested only.
This was a deeper change than I was hoping for, due to the
layering of the pipe_texture implementation in each driver on
top of a shared pipe_buffer implementation in the shared code.
Have modified the shared code to act as a set of convenience
routines operating on nouveau_bo objects.
Each driver now uses the u_resource_vtbl technique to split the
implementation of pipe_resources between the existing miptree code
for textures and a new, minimal buffer implementation in each
driver.
Eventually these should be combined, not least because APIs are now
allowing things like binding buffer resources as textures and render
targets.
commit 18ba74016db13b23282f5033ee37b628a12ee566
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 10:02:54 2010 +0000
r300: fix compilation after merge
Also build r300 by default.
commit eb9c0175c8e4baca3fcb0b8364f83ceba9d74e0d
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 09:59:49 2010 +0000
st/vega: fix up after merge
commit ea8dd1d4ae7b58c9315c3491046ef3852ddd3377
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 09:59:44 2010 +0000
aux: remove unused piperesource helpers
commit be7af29d3ad1a10409b0ea689d882cf30a4e1d62
Merge: d22c2c6 12deb9e
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 21 09:54:53 2010 +0000
Merge commit 'origin/master' into gallium-resources
Conflicts:
src/gallium/auxiliary/cso_cache/cso_context.c
src/gallium/auxiliary/cso_cache/cso_context.h
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_render.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_state_derived.c
src/gallium/state_trackers/vega/api_filters.c
src/gallium/state_trackers/vega/image.c
src/gallium/state_trackers/vega/image.h
src/gallium/state_trackers/vega/mask.c
src/gallium/state_trackers/vega/mask.h
src/gallium/state_trackers/vega/paint.c
src/gallium/state_trackers/vega/paint.h
src/gallium/state_trackers/vega/renderer.c
src/gallium/state_trackers/vega/renderer.h
src/gallium/state_trackers/vega/shader.c
src/gallium/state_trackers/vega/vg_context.h
src/gallium/state_trackers/vega/vg_tracker.c
src/mesa/state_tracker/st_manager.c
commit d22c2c6cb23a063e3334a165d0c5c3d73f05d234
Author: Keith Whitwell <keithw@vmware.com>
Date: Sat Mar 20 11:48:54 2010 +0000
drm/r300: update for r300g pipe_resources conversion
Remove old files that related to pipe_buffers but weren't being
built. Hopefully this is correct.
commit f07b2c836958bee5796899123eca4ed05ac6242b
Author: Keith Whitwell <keithw@vmware.com>
Date: Sat Mar 20 11:47:03 2010 +0000
r300: convert to pipe_resources
Do a very shallow conversion - basically keeping the existing
buffer and texture code intact and using a vtbl struct
inside our resource struct to select between the two implementations.
The buffer and texture treatments could be further merged without
much effort, but try to keep the existing code working at this point.
commit feca9c3ca62daaf0d8745370106d4e3b22340c49
Author: Keith Whitwell <keithw@vmware.com>
Date: Thu Mar 18 06:00:34 2010 +0000
gallium: update new merges to pipe_resource
commit 1cad983eac77a0c5333e6a3ce92b90ac87407714
Author: Keith Whitwell <keithw@vmware.com>
Date: Thu Mar 18 06:00:19 2010 +0000
drm/sw: update new merges to pipe_resource
commit 191d39490ed792c569f98d42cf05891b264f71f8
Author: Keith Whitwell <keithw@vmware.com>
Date: Thu Mar 18 06:00:01 2010 +0000
vg: update new merges to pipe_resource
commit b727c59bc44812ad503d9390505c92b738a5b8b0
Author: Keith Whitwell <keithw@vmware.com>
Date: Thu Mar 18 05:59:38 2010 +0000
llvmpipe: update new merges to pipe_resource
commit 5f4b64b37fdcd70162c382b2ebbd494bef751dbd
Author: Keith Whitwell <keithw@vmware.com>
Date: Thu Mar 18 05:59:23 2010 +0000
brw: pipe_resource fixes
commit d4aca209f531f1b65bf706ce1e5fc0375b587eb6
Author: Keith Whitwell <keithw@vmware.com>
Date: Thu Mar 18 05:59:06 2010 +0000
util: update new merges to pipe_resource
commit cf6bef0afee10763c78509a3d17e9a6e49bcd3c8
Merge: 1997231 6de8e56
Author: Keith Whitwell <keithw@vmware.com>
Date: Thu Mar 18 05:38:50 2010 +0000
Merge commit 'origin/master' into gallium-resources
commit 1997231916144485c3c4a36f53eda39fce460272
Merge: ad88ac7 e1ee3ea
Author: Keith Whitwell <keithw@vmware.com>
Date: Wed Mar 17 08:46:38 2010 +0000
Merge commit 'origin/master' into gallium-resources
Conflicts:
src/gallium/auxiliary/Makefile
src/gallium/auxiliary/util/u_blit.c
src/gallium/auxiliary/util/u_blit.h
src/gallium/auxiliary/util/u_gen_mipmap.c
src/gallium/auxiliary/util/u_gen_mipmap.h
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_gen_mipmap.c
commit ad88ac79034a91670940276e722bdd398d5c9023
Merge: 77bc770 8cdfd12
Author: Keith Whitwell <keithw@vmware.com>
Date: Tue Mar 16 09:13:07 2010 +0000
Merge branch 'gallium-sampler-view' into gallium-resources
Conflicts:
src/gallium/auxiliary/cso_cache/cso_context.c
src/gallium/auxiliary/util/u_blit.c
src/gallium/drivers/llvmpipe/lp_texture.c
src/gallium/drivers/softpipe/sp_texture.c
src/mesa/state_tracker/st_cb_fbo.c
src/mesa/state_tracker/st_framebuffer.c
src/mesa/state_tracker/st_texture.c
commit 77bc770c991ea025c82eaa4e0e2390efd825d96d
Author: Keith Whitwell <keithw@vmware.com>
Date: Mon Mar 15 22:21:48 2010 +0000
util: missing file
commit f83c91db8ae63a3c3a34ff21492427a5663fb760
Merge: c1d4774 42910eb
Author: Keith Whitwell <keithw@vmware.com>
Date: Mon Mar 15 09:48:58 2010 +0000
Merge commit 'origin/gallium-sampler-view' into gallium-resources
Conflicts:
src/gallium/drivers/nv40/nv40_transfer.c
src/gallium/drivers/nvfx/nvfx_transfer.c
src/gallium/drivers/trace/tr_drm.c
commit dd7ba1378fc50710667724d30d6d4cf1125ad61e
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 23:54:36 2010 +0000
gallium: start a cleanup of buffer_usage
Remove fairly meaningless CPU/GPU READ/WRITE flags and
replace with proper usages.
commit c1d4774187189f4af8ff421b210824f3d53ceefb
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 23:05:45 2010 +0000
llvmpipe: don't FREE userbuffer data
commit 9bfa07afe179f8060e7beefb754a29c4d9c6e349
Merge: 65757a1 08cddfe
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 22:54:51 2010 +0000
Merge commit 'origin/master' into gallium-resources
Conflicts:
src/gallium/drivers/llvmpipe/lp_rast.c
src/gallium/drivers/llvmpipe/lp_scene.c
src/gallium/drivers/llvmpipe/lp_texture.c
src/gallium/drivers/llvmpipe/lp_texture.h
src/gallium/drivers/softpipe/sp_texture.c
src/gallium/drivers/svga/svga_screen_texture.c
commit 65757a143f8e3fcd7afbc1ff92db44a823edf46c
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 22:41:17 2010 +0000
svga: build fixes
commit 2f5435220501d4b3050cab2bb1dce6174cd13ff6
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 22:39:25 2010 +0000
gallivm: build fix
commit 42642ec0984107d82b740711f2debbf38457a06e
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 22:38:33 2010 +0000
llvmpipe: convert to pipe_resources
commit 7bbcb21e20cb545ef8dd5fc61d67ed931c69e813
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 22:19:30 2010 +0000
gallivm: convert to pipe_resources
commit 88ae0d04610ca52649b42e32141a52af6d5a739b
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 21:01:22 2010 +0000
configs: build svga
commit 0e112bc69828e65085ebfaef895ecd78fe53f1c4
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 21:01:17 2010 +0000
gallium: restore PIPE_BUFFER_USAGE_CUSTOM
commit 102aca688b95c976b7178b84092fba7d041ff9d2
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 21:00:41 2010 +0000
util: more transfer helpers
commit a79f6a4a0836fc64c07f9aeec21d914474fe3649
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 20:59:36 2010 +0000
svga: convert to use pipe_resrource
As with others so far, a fairly shallow conversion.
commit 087fb54492fa5e3baf040c5efbf7dacd98a8849b
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 18:38:08 2010 +0000
brw: fix function name
commit cfc9dd707d16e06fd23b6926da3a6e2269f31dc8
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 18:19:06 2010 +0000
gallium: enable brw compile
commit 8a5b86d76bdd3c7de63322423f59940a4dc2ee25
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 18:18:50 2010 +0000
brw: compiles with pipe_resource
commit 563ca458b548c41ca4dca559354c16ca1a80d009
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 18:18:42 2010 +0000
i915: hook up userbuffer create
commit b5095b48247b6020e36cc942ac145c3fccbe9a19
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 17:20:51 2010 +0000
i915: use helpers for is_resource_referenced
commit d5392bdc6d70002acf9c5bac0fde14ba405c4d84
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 17:20:38 2010 +0000
util: helpers for is_resource_referenced
commit 2f3492a5aefbb2e745f6700d8e910ebb5cbb98cf
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 17:08:50 2010 +0000
i915: remove buffer.c again
commit 1373a35b65fcc25ec6cdfea2703bbb3417de2c6d
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 17:08:34 2010 +0000
i915: add new files to scons
commit 0251612d70e57fe38e10e75915b394631d224f2c
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 16:38:29 2010 +0000
i915: compiling with pipe_resources
commit 9a0235864252929a8eedd44dbd2fe30fe54c531d
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 13:51:16 2010 +0000
gallium: remove inline_read transfer
commit a6ba315e25793e0c228d3a4ae2f8201634dc9ff0
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 13:50:32 2010 +0000
trace: get running
Some dumping will be incorrect or disabled, but it runs without
crashing
commit 2133f1d90aa919662a8420a0cf3b4557e6ec1afd
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 13:49:42 2010 +0000
gallium: remove the inline_read transfer
There aren't enough users of this to justify it.
commit bccaf1fa30881f6b4fb189a9b74fc7af79c3b481
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 12:30:37 2010 +0000
identity: hook up inline transfer operations
commit e4c152a344f2f53c842b810724a2ae7cb4554f58
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 12:21:54 2010 +0000
gallium: build trace and identity
commit 0b5a311db78852fa9fd021e17b5968a1e0436b49
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 12:21:36 2010 +0000
gallium: add more of the transfer state to pipe_transfer
Not really sure if recording all the arguments to the
create_{transfer,texture,surface,etc} functions in the result of those
calls is a great idea, but it seems we're fairly dependent on it
throughout the code.
commit a23985c26eafe76b0a7dacc892e50cb589f211fe
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 12:19:46 2010 +0000
identity: compiles with pipe_resources
commit d0d630944304c208f6dade6ef8836763ee2bc7b4
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 12:13:02 2010 +0000
trace: compiles with pipe_resources
commit a4451ea459cc8bfc915fe6aed2891b90854b6c9d
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 11:39:50 2010 +0000
softpipe: give userbuffers a format other than NONE
Most mesa demos working
commit 32bb1bd4ba29884a4ecfa11c8441d33dfceabcef
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 11:39:21 2010 +0000
util: correct argument order in pipe_buffer_map
commit 7e2696c06445282feb781047277b260308760a33
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 11:32:55 2010 +0000
softpipe: transfer flush
commit a0543b13c042e3c1142522d9d136f16fd4cabf78
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 11:32:13 2010 +0000
util: noop implementation of transfer_flush_region
commit ce418533be752dbeb164e7ff82a99483048e482b
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 11:26:07 2010 +0000
gallium: softpipe runs gears with pipe_resources
commit bfda4f2eb34498e4b7f3c608d30fccff6bb9651b
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 11:25:48 2010 +0000
util: get clip_tile working again
commit f5ef219c3bed62b6a0da842e675fae16268e0fbe
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 09:43:20 2010 +0000
softpipe: use u_transfer helpers
commit 072957aab25affecf0702e925310e46c694a5ee4
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 09:42:46 2010 +0000
util: helpers for inline transfers
commit 9c45561fb0d7a52400093bcb2ce5f727fafd7777
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 09:42:25 2010 +0000
util: fix typo calculating transfer box
commit f3e98fd47f36804d019a684d49ff230df3ab0cf5
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 09:25:46 2010 +0000
st/vega: convert to pipe_resource
commit d1b7b00afc944f6499c83d676c7642115d62a62c
Author: Keith Whitwell <keithw@vmware.com>
Date: Sun Mar 14 08:37:56 2010 +0000
gallium: begin converting drivers to pipe_resource
Work in progress...
commit 51c25117f5d6da1926a2be5ecc66677952a8abf0
Author: Keith Whitwell <keithw@vmware.com>
Date: Sat Mar 13 20:16:27 2010 +0000
gallium: work in progress on layering resources on top of old textures
Helper code in an aux module to avoid rewriting all the drivers.
commit fb6764d3ce95c55aa78af2f1c8cbb17b79ce1ba2
Author: Keith Whitwell <keithw@vmware.com>
Date: Sat Mar 13 19:19:09 2010 +0000
heaps of wip
commit ee6b3bc730fcdaf8da3646d62f04578ec06d36a1
Author: Keith Whitwell <keithw@vmware.com>
Date: Sat Mar 13 16:38:02 2010 +0000
wip2
commit 1830880212445189fe267d615075239ed17c7cc0
Merge: 90b4045 47bfbd4
Author: Keith Whitwell <keithw@vmware.com>
Date: Sat Mar 13 15:14:03 2010 +0000
Merge branch 'gallium-sampler-view' into gallium-resources
Conflicts:
src/gallium/include/pipe/p_context.h
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_cb_bitmap.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_context.h
src/mesa/state_tracker/st_texture.h
commit 90b4045fbc0a093fcd04efba7e045ec259c490b8
Author: Keith Whitwell <keithw@vmware.com>
Date: Sat Mar 13 14:52:43 2010 +0000
wip
Diffstat (limited to 'src/gallium/drivers/i965')
26 files changed, 738 insertions, 684 deletions
diff --git a/src/gallium/drivers/i965/Makefile b/src/gallium/drivers/i965/Makefile index 95fd3cd69b..b0b0970338 100644 --- a/src/gallium/drivers/i965/Makefile +++ b/src/gallium/drivers/i965/Makefile @@ -36,6 +36,7 @@ C_SOURCES = \ brw_pipe_vertex.c \ brw_pipe_clear.c \ brw_pipe_rast.c \ + brw_resource.c \ brw_sf.c \ brw_sf_emit.c \ brw_sf_state.c \ @@ -46,7 +47,6 @@ C_SOURCES = \ brw_structs_dump.c \ brw_swtnl.c \ brw_urb.c \ - brw_util.c \ brw_vs.c \ brw_vs_emit.c \ brw_vs_state.c \ @@ -63,9 +63,9 @@ C_SOURCES = \ brw_wm_state.c \ brw_wm_surface_state.c \ brw_screen.c \ - brw_screen_buffers.c \ - brw_screen_tex_layout.c \ - brw_screen_texture.c \ + brw_resource_buffer.c \ + brw_resource_texture.c \ + brw_resource_texture_layout.c \ brw_screen_surface.c \ brw_batchbuffer.c \ brw_winsys_debug.c \ diff --git a/src/gallium/drivers/i965/SConscript b/src/gallium/drivers/i965/SConscript index d900ea2596..85c4d7ed22 100644 --- a/src/gallium/drivers/i965/SConscript +++ b/src/gallium/drivers/i965/SConscript @@ -38,11 +38,12 @@ i965 = env.ConvenienceLibrary( 'brw_pipe_sampler.c', 'brw_pipe_shader.c', 'brw_pipe_vertex.c', - 'brw_screen_buffers.c', + 'brw_resource.c', + 'brw_resource_buffer.c', + 'brw_resource_texture.c', + 'brw_resource_texture_layout.c', 'brw_screen.c', 'brw_screen_surface.c', - 'brw_screen_tex_layout.c', - 'brw_screen_texture.c', 'brw_structs_dump.c', 'brw_sf.c', 'brw_sf_emit.c', @@ -53,7 +54,6 @@ i965 = env.ConvenienceLibrary( 'brw_state_upload.c', 'brw_swtnl.c', 'brw_urb.c', - 'brw_util.c', 'brw_vs.c', 'brw_vs_emit.c', 'brw_vs_state.c', diff --git a/src/gallium/drivers/i965/brw_context.c b/src/gallium/drivers/i965/brw_context.c index 4bcdcdd17e..227bc790de 100644 --- a/src/gallium/drivers/i965/brw_context.c +++ b/src/gallium/drivers/i965/brw_context.c @@ -39,6 +39,7 @@ #include "brw_state.h" #include "brw_batchbuffer.h" #include "brw_winsys.h" +#include "brw_resource.h" #include "brw_screen.h" @@ -118,7 +119,7 @@ struct pipe_context *brw_create_context(struct pipe_screen *screen, brw->sws = brw_screen(screen)->sws; brw->chipset = brw_screen(screen)->chipset; - brw_tex_init( brw ); + brw_init_resource_functions( brw ); brw_pipe_blend_init( brw ); brw_pipe_depth_stencil_init( brw ); brw_pipe_framebuffer_init( brw ); diff --git a/src/gallium/drivers/i965/brw_context.h b/src/gallium/drivers/i965/brw_context.h index dab881fea2..94c9c443f0 100644 --- a/src/gallium/drivers/i965/brw_context.h +++ b/src/gallium/drivers/i965/brw_context.h @@ -561,8 +561,8 @@ struct brw_context struct pipe_stencil_ref stencil_ref; struct pipe_framebuffer_state fb; struct pipe_clip_state ucp; - struct pipe_buffer *vertex_constants; - struct pipe_buffer *fragment_constants; + struct pipe_resource *vertex_constants; + struct pipe_resource *fragment_constants; struct brw_blend_constant_color bcc; struct brw_cc1 cc1_stencil_ref; @@ -574,7 +574,7 @@ struct brw_context * * Updates are signaled by PIPE_NEW_INDEX_BUFFER. */ - struct pipe_buffer *index_buffer; + struct pipe_resource *index_buffer; unsigned index_size; /* Updates are signalled by PIPE_NEW_INDEX_RANGE: diff --git a/src/gallium/drivers/i965/brw_curbe.c b/src/gallium/drivers/i965/brw_curbe.c index 4b215a001c..323af16b14 100644 --- a/src/gallium/drivers/i965/brw_curbe.c +++ b/src/gallium/drivers/i965/brw_curbe.c @@ -160,7 +160,6 @@ static GLfloat fixed_plane[6][4] = { */ static enum pipe_error prepare_curbe_buffer(struct brw_context *brw) { - struct pipe_screen *screen = brw->base.screen; const GLuint sz = brw->curbe.total_size; const GLuint bufsz = sz * 16 * sizeof(GLfloat); enum pipe_error ret; @@ -196,15 +195,11 @@ static enum pipe_error prepare_curbe_buffer(struct brw_context *brw) nr_const = fs->info.file_max[TGSI_FILE_CONSTANT] + 1; /* nr_const = brw->wm.prog_data->nr_params; */ if (nr_const) { - const GLfloat *value = screen->buffer_map( screen, - brw->curr.fragment_constants, - PIPE_BUFFER_USAGE_CPU_READ); - - memcpy(&buf[offset], value, - nr_const * 4 * sizeof(float)); - - screen->buffer_unmap( screen, - brw->curr.fragment_constants ); + pipe_buffer_read( &brw->base, + brw->curr.fragment_constants, + 0, + nr_const * 4 * sizeof(float), + &buf[offset]); } } @@ -258,15 +253,14 @@ static enum pipe_error prepare_curbe_buffer(struct brw_context *brw) * buffer objects. If we want to keep on putting them into the * curbe, makes sense to treat constbuf's specially with malloc. */ - const GLfloat *value = screen->buffer_map( screen, - brw->curr.vertex_constants, - PIPE_BUFFER_USAGE_CPU_READ); /* XXX: what if user's constant buffer is too small? */ - memcpy(&buf[offset], value, nr_const * 4 * sizeof(float)); - - screen->buffer_unmap( screen, brw->curr.vertex_constants ); + pipe_buffer_read(&brw->base, + brw->curr.vertex_constants, + 0, + nr_const * 4 * sizeof(float), + &buf[offset]); } } diff --git a/src/gallium/drivers/i965/brw_draw.c b/src/gallium/drivers/i965/brw_draw.c index 9bad61ef72..eb73ec2f27 100644 --- a/src/gallium/drivers/i965/brw_draw.c +++ b/src/gallium/drivers/i965/brw_draw.c @@ -142,7 +142,7 @@ static int brw_emit_prim(struct brw_context *brw, */ static int try_draw_range_elements(struct brw_context *brw, - struct pipe_buffer *index_buffer, + struct pipe_resource *index_buffer, unsigned hw_prim, unsigned start, unsigned count) { @@ -178,7 +178,7 @@ try_draw_range_elements(struct brw_context *brw, static void brw_draw_range_elements(struct pipe_context *pipe, - struct pipe_buffer *index_buffer, + struct pipe_resource *index_buffer, unsigned index_size, unsigned min_index, unsigned max_index, @@ -201,7 +201,7 @@ brw_draw_range_elements(struct pipe_context *pipe, */ if (brw->curr.index_buffer != index_buffer || brw->curr.index_size != index_size) { - pipe_buffer_reference( &brw->curr.index_buffer, index_buffer ); + pipe_resource_reference( &brw->curr.index_buffer, index_buffer ); brw->curr.index_size = index_size; brw->state.dirty.mesa |= PIPE_NEW_INDEX_BUFFER; } @@ -232,7 +232,7 @@ brw_draw_range_elements(struct pipe_context *pipe, static void brw_draw_elements(struct pipe_context *pipe, - struct pipe_buffer *index_buffer, + struct pipe_resource *index_buffer, unsigned index_size, unsigned mode, unsigned start, unsigned count) @@ -263,17 +263,17 @@ boolean brw_draw_init( struct brw_context *brw ) /* Create helpers for uploading data in user buffers: */ - brw->vb.upload_vertex = u_upload_create( brw->base.screen, + brw->vb.upload_vertex = u_upload_create( &brw->base, 128 * 1024, 64, - PIPE_BUFFER_USAGE_VERTEX ); + PIPE_BIND_VERTEX_BUFFER ); if (brw->vb.upload_vertex == NULL) return FALSE; - brw->vb.upload_index = u_upload_create( brw->base.screen, + brw->vb.upload_index = u_upload_create( &brw->base, 32 * 1024, 64, - PIPE_BUFFER_USAGE_INDEX ); + PIPE_BIND_INDEX_BUFFER ); if (brw->vb.upload_index == NULL) return FALSE; diff --git a/src/gallium/drivers/i965/brw_draw_upload.c b/src/gallium/drivers/i965/brw_draw_upload.c index 0820ba20a0..337eee8cd9 100644 --- a/src/gallium/drivers/i965/brw_draw_upload.c +++ b/src/gallium/drivers/i965/brw_draw_upload.c @@ -38,6 +38,7 @@ #include "brw_screen.h" #include "brw_batchbuffer.h" #include "brw_debug.h" +#include "brw_resource.h" @@ -67,7 +68,7 @@ static int brw_prepare_vertices(struct brw_context *brw) for (i = 0; i < brw->curr.num_vertex_buffers; i++) { struct pipe_vertex_buffer *vb = &brw->curr.vertex_buffer[i]; struct brw_winsys_buffer *bo; - struct pipe_buffer *upload_buf = NULL; + struct pipe_resource *upload_buf = NULL; unsigned offset; if (BRW_DEBUG & DEBUG_VERTS) @@ -75,7 +76,7 @@ static int brw_prepare_vertices(struct brw_context *brw) __FUNCTION__, i, brw_buffer_is_user_buffer(vb->buffer), vb->buffer_offset, - vb->buffer->size, + vb->buffer->width0, vb->stride); if (brw_buffer_is_user_buffer(vb->buffer)) { @@ -85,8 +86,8 @@ static int brw_prepare_vertices(struct brw_context *brw) * add support for >1 constant buffer) instead. */ unsigned size = (vb->stride == 0 ? - vb->buffer->size - vb->buffer_offset : - MAX2(vb->buffer->size - vb->buffer_offset, + vb->buffer->width0 - vb->buffer_offset : + MAX2(vb->buffer->width0 - vb->buffer_offset, vb->stride * (max_index + 1 - min_index))); ret = u_upload_buffer( brw->vb.upload_vertex, @@ -123,7 +124,7 @@ static int brw_prepare_vertices(struct brw_context *brw) /* Don't need to retain this reference. We have a reference on * the underlying winsys buffer: */ - pipe_buffer_reference( &upload_buf, NULL ); + pipe_resource_reference( &upload_buf, NULL ); } brw->vb.nr_vb = i; @@ -226,8 +227,8 @@ const struct brw_tracked_state brw_vertices = { static int brw_prepare_indices(struct brw_context *brw) { - struct pipe_buffer *index_buffer = brw->curr.index_buffer; - struct pipe_buffer *upload_buf = NULL; + struct pipe_resource *index_buffer = brw->curr.index_buffer; + struct pipe_resource *upload_buf = NULL; struct brw_winsys_buffer *bo = NULL; GLuint offset; GLuint index_size; @@ -241,9 +242,9 @@ static int brw_prepare_indices(struct brw_context *brw) debug_printf("%s: index_size:%d index_buffer->size:%d\n", __FUNCTION__, brw->curr.index_size, - brw->curr.index_buffer->size); + brw->curr.index_buffer->width0); - ib_size = index_buffer->size; + ib_size = index_buffer->width0; index_size = brw->curr.index_size; /* Turn userbuffer into a proper hardware buffer? @@ -297,7 +298,7 @@ static int brw_prepare_indices(struct brw_context *brw) brw->state.dirty.brw |= BRW_NEW_INDEX_BUFFER; } - pipe_buffer_reference( &upload_buf, NULL ); + pipe_resource_reference( &upload_buf, NULL ); brw_add_validated_bo(brw, brw->ib.bo); return 0; } diff --git a/src/gallium/drivers/i965/brw_pipe_flush.c b/src/gallium/drivers/i965/brw_pipe_flush.c index fdc4814b22..fa2b64fd26 100644 --- a/src/gallium/drivers/i965/brw_pipe_flush.c +++ b/src/gallium/drivers/i965/brw_pipe_flush.c @@ -1,10 +1,11 @@ -#include "util/u_upload_mgr.h" - #include "brw_context.h" #include "brw_screen.h" #include "brw_batchbuffer.h" +#include "util/u_upload_mgr.h" + + /* All batchbuffer flushes must go through this function. @@ -46,35 +47,9 @@ brw_flush( struct pipe_context *pipe, *fence = NULL; } -static unsigned brw_is_buffer_referenced(struct pipe_context *pipe, - struct pipe_buffer *buffer) -{ - struct brw_context *brw = brw_context(pipe); - struct brw_screen *bscreen = brw_screen(brw->base.screen); - - return brw_is_buffer_referenced_by_bo( bscreen, - buffer, - brw->batch->buf ); -} - -static unsigned brw_is_texture_referenced(struct pipe_context *pipe, - struct pipe_texture *texture, - unsigned face, - unsigned level) -{ - struct brw_context *brw = brw_context(pipe); - struct brw_screen *bscreen = brw_screen(brw->base.screen); - - return brw_is_texture_referenced_by_bo( bscreen, - texture, face, level, - brw->batch->buf ); -} - void brw_pipe_flush_init( struct brw_context *brw ) { brw->base.flush = brw_flush; - brw->base.is_buffer_referenced = brw_is_buffer_referenced; - brw->base.is_texture_referenced = brw_is_texture_referenced; } diff --git a/src/gallium/drivers/i965/brw_pipe_sampler.c b/src/gallium/drivers/i965/brw_pipe_sampler.c index d2aa2bc9f3..3fe753ec42 100644 --- a/src/gallium/drivers/i965/brw_pipe_sampler.c +++ b/src/gallium/drivers/i965/brw_pipe_sampler.c @@ -214,7 +214,7 @@ static void brw_bind_vertex_sampler_state(struct pipe_context *pipe, static struct pipe_sampler_view * brw_create_sampler_view(struct pipe_context *pipe, - struct pipe_texture *texture, + struct pipe_resource *texture, const struct pipe_sampler_view *templ) { struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view); @@ -223,7 +223,7 @@ brw_create_sampler_view(struct pipe_context *pipe, *view = *templ; view->reference.count = 1; view->texture = NULL; - pipe_texture_reference(&view->texture, texture); + pipe_resource_reference(&view->texture, texture); view->context = pipe; } @@ -235,7 +235,7 @@ static void brw_sampler_view_destroy(struct pipe_context *pipe, struct pipe_sampler_view *view) { - pipe_texture_reference(&view->texture, NULL); + pipe_resource_reference(&view->texture, NULL); FREE(view); } diff --git a/src/gallium/drivers/i965/brw_pipe_shader.c b/src/gallium/drivers/i965/brw_pipe_shader.c index fe445b9982..d9bee96c11 100644 --- a/src/gallium/drivers/i965/brw_pipe_shader.c +++ b/src/gallium/drivers/i965/brw_pipe_shader.c @@ -262,20 +262,20 @@ static void brw_delete_vs_state( struct pipe_context *pipe, void *prog ) static void brw_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, - struct pipe_buffer *buf) + struct pipe_resource *buf) { struct brw_context *brw = brw_context(pipe); assert(index == 0); if (shader == PIPE_SHADER_FRAGMENT) { - pipe_buffer_reference( &brw->curr.fragment_constants, + pipe_resource_reference( &brw->curr.fragment_constants, buf ); brw->state.dirty.mesa |= PIPE_NEW_FRAGMENT_CONSTANTS; } else { - pipe_buffer_reference( &brw->curr.vertex_constants, + pipe_resource_reference( &brw->curr.vertex_constants, buf ); brw->state.dirty.mesa |= PIPE_NEW_VERTEX_CONSTANTS; @@ -298,6 +298,6 @@ void brw_pipe_shader_init( struct brw_context *brw ) void brw_pipe_shader_cleanup( struct brw_context *brw ) { - pipe_buffer_reference( &brw->curr.fragment_constants, NULL ); - pipe_buffer_reference( &brw->curr.vertex_constants, NULL ); + pipe_resource_reference( &brw->curr.fragment_constants, NULL ); + pipe_resource_reference( &brw->curr.vertex_constants, NULL ); } diff --git a/src/gallium/drivers/i965/brw_pipe_vertex.c b/src/gallium/drivers/i965/brw_pipe_vertex.c index d6a840857e..4a120a51da 100644 --- a/src/gallium/drivers/i965/brw_pipe_vertex.c +++ b/src/gallium/drivers/i965/brw_pipe_vertex.c @@ -259,11 +259,11 @@ static void brw_set_vertex_buffers(struct pipe_context *pipe, /* Adjust refcounts */ for (i = 0; i < count; i++) - pipe_buffer_reference(&brw->curr.vertex_buffer[i].buffer, + pipe_resource_reference(&brw->curr.vertex_buffer[i].buffer, buffers[i].buffer); for ( ; i < brw->curr.num_vertex_buffers; i++) - pipe_buffer_reference(&brw->curr.vertex_buffer[i].buffer, + pipe_resource_reference(&brw->curr.vertex_buffer[i].buffer, NULL); /* Copy remaining data */ diff --git a/src/gallium/drivers/i965/brw_resource.c b/src/gallium/drivers/i965/brw_resource.c new file mode 100644 index 0000000000..d601f42dd1 --- /dev/null +++ b/src/gallium/drivers/i965/brw_resource.c @@ -0,0 +1,50 @@ +#include "util/u_debug.h" + +#include "brw_resource.h" +#include "brw_context.h" +#include "brw_screen.h" + + +static struct pipe_resource * +brw_resource_create(struct pipe_screen *screen, + const struct pipe_resource *template) +{ + if (template->target == PIPE_BUFFER) + return brw_buffer_create(screen, template); + else + return brw_resource_create(screen, template); + +} + +static struct pipe_resource * +brw_resource_from_handle(struct pipe_screen * screen, + const struct pipe_resource *template, + struct winsys_handle *whandle) +{ + if (template->target == PIPE_BUFFER) + return NULL; + else + return brw_texture_from_handle(screen, template, whandle); +} + + +void +brw_init_resource_functions(struct brw_context *brw ) +{ + brw->base.get_transfer = u_get_transfer_vtbl; + brw->base.transfer_map = u_transfer_map_vtbl; + brw->base.transfer_flush_region = u_transfer_flush_region_vtbl; + brw->base.transfer_unmap = u_transfer_unmap_vtbl; + brw->base.transfer_destroy = u_transfer_destroy_vtbl; + brw->base.transfer_inline_write = u_transfer_inline_write_vtbl; +} + +void +brw_init_screen_resource_functions(struct brw_screen *is) +{ + is->base.resource_create = brw_resource_create; + is->base.resource_from_handle = brw_resource_from_handle; + is->base.resource_get_handle = u_resource_get_handle_vtbl; + is->base.resource_destroy = u_resource_destroy_vtbl; + is->base.user_buffer_create = brw_user_buffer_create; +} diff --git a/src/gallium/drivers/i965/brw_resource.h b/src/gallium/drivers/i965/brw_resource.h new file mode 100644 index 0000000000..3390c270d4 --- /dev/null +++ b/src/gallium/drivers/i965/brw_resource.h @@ -0,0 +1,151 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef BRW_RESOURCE_H +#define BRW_RESOURCE_H + +struct brw_screen; + +#include "util/u_transfer.h" +#include "util/u_debug.h" + +#include "brw_screen.h" /* for brw_surface */ + +struct brw_context; +struct brw_screen; + + +struct brw_buffer { + struct u_resource b; + + /* One of either bo or user_buffer will be non-null, depending on + * whether this is a hardware or user buffer. + */ + struct brw_winsys_buffer *bo; + void *user_buffer; + + /* Mapped pointer?? + */ + void *ptr; +}; + +#define BRW_MAX_TEXTURE_2D_LEVELS 11 /* max 1024x1024 */ +#define BRW_MAX_TEXTURE_3D_LEVELS 8 /* max 128x128x128 */ + + + +struct brw_texture { + struct u_resource b; + struct brw_winsys_buffer *bo; + struct brw_surface_state ss; + + unsigned *image_offset[BRW_MAX_TEXTURE_2D_LEVELS]; + unsigned nr_images[BRW_MAX_TEXTURE_2D_LEVELS]; + unsigned level_offset[BRW_MAX_TEXTURE_2D_LEVELS]; + + boolean compressed; + unsigned brw_target; + unsigned pitch; + unsigned tiling; + unsigned cpp; + unsigned total_height; + + struct brw_surface views[2]; +}; + + +void brw_init_screen_resource_functions(struct brw_screen *is); +void brw_init_resource_functions(struct brw_context *brw ); + +extern struct u_resource_vtbl brw_buffer_vtbl; +extern struct u_resource_vtbl brw_texture_vtbl; + +static INLINE struct brw_texture *brw_texture( struct pipe_resource *resource ) +{ + struct brw_texture *tex = (struct brw_texture *)resource; + assert(tex->b.vtbl == &brw_texture_vtbl); + return tex; +} + +static INLINE struct brw_buffer *brw_buffer( struct pipe_resource *resource ) +{ + struct brw_buffer *tex = (struct brw_buffer *)resource; + assert(tex->b.vtbl == &brw_buffer_vtbl); + return tex; +} + +struct pipe_resource * +brw_texture_create(struct pipe_screen *screen, + const struct pipe_resource *template); + +struct pipe_resource * +brw_texture_from_handle(struct pipe_screen * screen, + const struct pipe_resource *template, + struct winsys_handle *whandle); + + +struct pipe_resource * +brw_user_buffer_create(struct pipe_screen *screen, + void *ptr, + unsigned bytes, + unsigned usage); + +struct pipe_resource * +brw_buffer_create(struct pipe_screen *screen, + const struct pipe_resource *template); + + +/* +boolean +brw_is_format_supported( struct pipe_screen *screen, + enum pipe_format format, + enum pipe_texture_target target, + unsigned tex_usage, + unsigned geom_flags ); +*/ + +/* Pipe buffer helpers + */ +static INLINE boolean +brw_buffer_is_user_buffer( const struct pipe_resource *buf ) +{ + return ((const struct brw_buffer *)buf)->user_buffer != NULL; +} + + +/*********************************************************************** + * Internal functions + */ +GLboolean brw_texture_layout(struct brw_screen *brw_screen, + struct brw_texture *tex ); + +void brw_update_texture( struct brw_screen *brw_screen, + struct brw_texture *tex ); + + + +#endif /* BRW_RESOURCE_H */ diff --git a/src/gallium/drivers/i965/brw_resource_buffer.c b/src/gallium/drivers/i965/brw_resource_buffer.c new file mode 100644 index 0000000000..488fe13c71 --- /dev/null +++ b/src/gallium/drivers/i965/brw_resource_buffer.c @@ -0,0 +1,201 @@ + +#include "util/u_memory.h" +#include "util/u_math.h" + +#include "pipe/p_state.h" +#include "pipe/p_defines.h" +#include "util/u_inlines.h" + +#include "brw_resource.h" +#include "brw_context.h" +#include "brw_batchbuffer.h" +#include "brw_winsys.h" + +static boolean +brw_buffer_get_handle(struct pipe_screen *screen, + struct pipe_resource *resource, + struct winsys_handle *handle) +{ + return FALSE; +} + + +static void +brw_buffer_destroy(struct pipe_screen *screen, + struct pipe_resource *resource) +{ + struct brw_buffer *buf = brw_buffer( resource ); + + bo_reference(&buf->bo, NULL); + FREE(buf); +} + + +static void * +brw_buffer_transfer_map( struct pipe_context *pipe, + struct pipe_transfer *transfer) +{ + struct brw_screen *bscreen = brw_screen(pipe->screen); + struct brw_winsys_screen *sws = bscreen->sws; + struct brw_buffer *buf = brw_buffer(transfer->resource); + unsigned offset = transfer->box.x; + unsigned length = transfer->box.width; + unsigned usage = transfer->usage; + uint8_t *map; + + if (buf->user_buffer) + map = buf->user_buffer; + else + map = sws->bo_map( buf->bo, + BRW_DATA_OTHER, + offset, + length, + (usage & PIPE_TRANSFER_WRITE) ? TRUE : FALSE, + (usage & PIPE_TRANSFER_DISCARD) ? TRUE : FALSE, + (usage & PIPE_TRANSFER_FLUSH_EXPLICIT) ? TRUE : FALSE); + + return map + offset; +} + + +static void +brw_buffer_transfer_flush_region( struct pipe_context *pipe, + struct pipe_transfer *transfer, + const struct pipe_box *box) +{ + struct brw_screen *bscreen = brw_screen(pipe->screen); + struct brw_winsys_screen *sws = bscreen->sws; + struct brw_buffer *buf = brw_buffer(transfer->resource); + unsigned offset = box->x; + unsigned length = box->width; + + if (buf->user_buffer) + return; + + sws->bo_flush_range( buf->bo, + offset, + length ); +} + + +static void +brw_buffer_transfer_unmap( struct pipe_context *pipe, + struct pipe_transfer *transfer) +{ + struct brw_screen *bscreen = brw_screen(pipe->screen); + struct brw_winsys_screen *sws = bscreen->sws; + struct brw_buffer *buf = brw_buffer( transfer->resource ); + + if (buf->bo) + sws->bo_unmap(buf->bo); +} + + +static unsigned brw_buffer_is_referenced( struct pipe_context *pipe, + struct pipe_resource *resource, + unsigned face, + unsigned level) +{ + struct brw_context *brw = brw_context(pipe); + struct brw_winsys_buffer *batch_bo = brw->batch->buf; + struct brw_buffer *buf = brw_buffer(resource); + + if (buf->bo == NULL) + return PIPE_UNREFERENCED; + + if (!brw_screen(pipe->screen)->sws->bo_references( batch_bo, buf->bo )) + return PIPE_UNREFERENCED; + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + + +struct u_resource_vtbl brw_buffer_vtbl = +{ + brw_buffer_get_handle, /* get_handle */ + brw_buffer_destroy, /* resource_destroy */ + brw_buffer_is_referenced, /* is_resource_referenced */ + u_default_get_transfer, /* get_transfer */ + u_default_transfer_destroy, /* transfer_destroy */ + brw_buffer_transfer_map, /* transfer_map */ + brw_buffer_transfer_flush_region, /* transfer_flush_region */ + brw_buffer_transfer_unmap, /* transfer_unmap */ + u_default_transfer_inline_write /* transfer_inline_write */ +}; + + +struct pipe_resource * +brw_buffer_create(struct pipe_screen *screen, + const struct pipe_resource *template) +{ + struct brw_screen *bscreen = brw_screen(screen); + struct brw_winsys_screen *sws = bscreen->sws; + struct brw_buffer *buf; + unsigned buffer_type; + enum pipe_error ret; + + buf = CALLOC_STRUCT(brw_buffer); + if (!buf) + return NULL; + + buf->b.b = *template; + buf->b.vtbl = &brw_buffer_vtbl; + pipe_reference_init(&buf->b.b.reference, 1); + buf->b.b.screen = screen; + + switch (template->bind & (PIPE_BIND_VERTEX_BUFFER | + PIPE_BIND_INDEX_BUFFER | + PIPE_BIND_CONSTANT_BUFFER)) + { + case PIPE_BIND_VERTEX_BUFFER: + case PIPE_BIND_INDEX_BUFFER: + case (PIPE_BIND_VERTEX_BUFFER|PIPE_BIND_INDEX_BUFFER): + buffer_type = BRW_BUFFER_TYPE_VERTEX; + break; + + case PIPE_BIND_CONSTANT_BUFFER: + buffer_type = BRW_BUFFER_TYPE_SHADER_CONSTANTS; + break; + + default: + buffer_type = BRW_BUFFER_TYPE_GENERIC; + break; + } + + ret = sws->bo_alloc( sws, buffer_type, + template->width0, + 64, /* alignment */ + &buf->bo ); + if (ret != PIPE_OK) + return NULL; + + return &buf->b.b; +} + + +struct pipe_resource * +brw_user_buffer_create(struct pipe_screen *screen, + void *ptr, + unsigned bytes, + unsigned bind) +{ + struct brw_buffer *buf; + + buf = CALLOC_STRUCT(brw_buffer); + if (!buf) + return NULL; + + pipe_reference_init(&buf->b.b.reference, 1); + buf->b.vtbl = &brw_buffer_vtbl; + buf->b.b.screen = screen; + buf->b.b.format = PIPE_FORMAT_R8_UNORM; /* ?? */ + buf->b.b._usage = PIPE_USAGE_IMMUTABLE; + buf->b.b.bind = bind; + buf->b.b.width0 = bytes; + buf->b.b.height0 = 1; + buf->b.b.depth0 = 1; + + buf->user_buffer = ptr; + + return &buf->b.b; +} diff --git a/src/gallium/drivers/i965/brw_screen_texture.c b/src/gallium/drivers/i965/brw_resource_texture.c index 17bf3152dc..a6f27b8a41 100644 --- a/src/gallium/drivers/i965/brw_screen_texture.c +++ b/src/gallium/drivers/i965/brw_resource_texture.c @@ -37,9 +37,26 @@ #include "brw_defines.h" #include "brw_structs.h" #include "brw_winsys.h" +#include "brw_batchbuffer.h" #include "brw_context.h" +#include "brw_resource.h" +/** + * Subclass of pipe_transfer + */ +struct brw_transfer +{ + struct pipe_transfer base; + + unsigned offset; +}; + +static INLINE struct brw_transfer * +brw_transfer(struct pipe_transfer *transfer) +{ + return (struct brw_transfer *)transfer; +} static GLuint translate_tex_target( unsigned target ) @@ -182,12 +199,176 @@ static GLuint translate_tex_format( enum pipe_format pf ) } +static boolean +brw_texture_get_handle(struct pipe_screen *screen, + struct pipe_resource *texture, + struct winsys_handle *whandle) +{ + struct brw_screen *bscreen = brw_screen(screen); + struct brw_texture *tex = brw_texture(texture); + unsigned stride; + + stride = tex->pitch * tex->cpp; + + return bscreen->sws->bo_get_handle(tex->bo, whandle, stride); +} + + + +static void brw_texture_destroy(struct pipe_screen *screen, + struct pipe_resource *pt) +{ + struct brw_texture *tex = brw_texture(pt); + bo_reference(&tex->bo, NULL); + FREE(pt); +} + + + + +static unsigned brw_texture_is_referenced( struct pipe_context *pipe, + struct pipe_resource *texture, + unsigned face, + unsigned level ) +{ + struct brw_context *brw = brw_context(pipe); + struct brw_screen *bscreen = brw_screen(pipe->screen); + struct brw_winsys_buffer *batch_bo = brw->batch->buf; + struct brw_texture *tex = brw_texture(texture); + struct brw_surface *surf; + int i; + + /* XXX: this is subject to false positives if the underlying + * texture BO is referenced, we can't tell whether the sub-region + * we care about participates in that. + */ + if (bscreen->sws->bo_references( batch_bo, tex->bo )) + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; + + /* Find any view on this texture for this face/level and see if it + * is referenced: + */ + for (i = 0; i < 2; i++) { + foreach (surf, &tex->views[i]) { + if (surf->bo == tex->bo) + continue; + + if (surf->id.bits.face != face || + surf->id.bits.level != level) + continue; + + if (bscreen->sws->bo_references( batch_bo, surf->bo)) + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; + } + } + + return PIPE_UNREFERENCED; +} + + +/* + * Transfer functions + */ + + +static struct pipe_transfer * +brw_texture_get_transfer(struct pipe_context *context, + struct pipe_resource *resource, + struct pipe_subresource sr, + unsigned usage, + const struct pipe_box *box) +{ + struct brw_texture *tex = brw_texture(resource); + struct pipe_transfer *transfer = CALLOC_STRUCT(pipe_transfer); + if (transfer == NULL) + return NULL; + + transfer->resource = resource; + transfer->sr = sr; + transfer->usage = usage; + transfer->box = *box; + transfer->stride = tex->pitch * tex->cpp; + + return transfer; +} + + +static void * +brw_texture_transfer_map(struct pipe_context *pipe, + struct pipe_transfer *transfer) +{ + struct pipe_resource *resource = transfer->resource; + struct brw_texture *tex = brw_texture(transfer->resource); + struct brw_winsys_screen *sws = brw_screen(pipe->screen)->sws; + struct pipe_subresource sr = transfer->sr; + struct pipe_box *box = &transfer->box; + enum pipe_format format = resource->format; + unsigned usage = transfer->usage; + unsigned offset; + char *map; + + if (resource->target == PIPE_TEXTURE_CUBE) { + offset = tex->image_offset[sr.level][sr.face]; + } + else if (resource->target == PIPE_TEXTURE_3D) { + offset = tex->image_offset[sr.level][box->z]; + } + else { + offset = tex->image_offset[sr.level][0]; + assert(sr.face == 0); + assert(box->z == 0); + } + + map = sws->bo_map(tex->bo, + BRW_DATA_OTHER, + 0, + tex->bo->size, + (usage & PIPE_TRANSFER_WRITE) ? TRUE : FALSE, + (usage & 0) ? TRUE : FALSE, + (usage & 0) ? TRUE : FALSE); + + if (!map) + return NULL; + + return map + offset + + box->y / util_format_get_blockheight(format) * transfer->stride + + box->x / util_format_get_blockwidth(format) * util_format_get_blocksize(format); +} + +static void +brw_texture_transfer_unmap(struct pipe_context *pipe, + struct pipe_transfer *transfer) +{ + struct brw_texture *tex = brw_texture(transfer->resource); + struct brw_winsys_screen *sws = brw_screen(pipe->screen)->sws; + + sws->bo_unmap(tex->bo); +} + + + + + +struct u_resource_vtbl brw_texture_vtbl = +{ + brw_texture_get_handle, /* get_handle */ + brw_texture_destroy, /* resource_destroy */ + brw_texture_is_referenced, /* is_resource_referenced */ + brw_texture_get_transfer, /* get_transfer */ + u_default_transfer_destroy, /* transfer_destroy */ + brw_texture_transfer_map, /* transfer_map */ + u_default_transfer_flush_region, /* transfer_flush_region */ + brw_texture_transfer_unmap, /* transfer_unmap */ + u_default_transfer_inline_write /* transfer_inline_write */ +}; -static struct pipe_texture *brw_texture_create( struct pipe_screen *screen, - const struct pipe_texture *templ ) + +struct pipe_resource * +brw_texture_create( struct pipe_screen *screen, + const struct pipe_resource *template ) { struct brw_screen *bscreen = brw_screen(screen); struct brw_texture *tex; @@ -199,14 +380,15 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen, if (tex == NULL) return NULL; - memcpy(&tex->base, templ, sizeof *templ); - pipe_reference_init(&tex->base.reference, 1); - tex->base.screen = screen; + tex->b.b = *template; + tex->b.vtbl = &brw_texture_vtbl; + pipe_reference_init(&tex->b.b.reference, 1); + tex->b.b.screen = screen; /* XXX: compressed textures need special treatment here */ - tex->cpp = util_format_get_blocksize(tex->base.format); - tex->compressed = util_format_is_s3tc(tex->base.format); + tex->cpp = util_format_get_blocksize(tex->b.b.format); + tex->compressed = util_format_is_s3tc(tex->b.b.format); make_empty_list(&tex->views[0]); make_empty_list(&tex->views[1]); @@ -217,7 +399,7 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen, !bscreen->no_tiling) { if (bscreen->chipset.is_965 && - util_format_is_depth_or_stencil(templ->format)) + util_format_is_depth_or_stencil(template->format)) tex->tiling = BRW_TILING_Y; else tex->tiling = BRW_TILING_X; @@ -227,14 +409,12 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen, } - - if (!brw_texture_layout( bscreen, tex )) goto fail; - if (templ->tex_usage & (PIPE_TEXTURE_USAGE_SCANOUT | - PIPE_TEXTURE_USAGE_SHARED)) { + if (template->bind & (PIPE_BIND_SCANOUT | + PIPE_BIND_SHARED)) { buffer_type = BRW_BUFFER_TYPE_SCANOUT; } else { @@ -250,9 +430,9 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen, goto fail; tex->ss.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW; - tex->ss.ss0.surface_type = translate_tex_target(tex->base.target); + tex->ss.ss0.surface_type = translate_tex_target(tex->b.b.target); - format = translate_tex_format(tex->base.format); + format = translate_tex_format(tex->b.b.format); assert(format != BRW_SURFACEFORMAT_INVALID); tex->ss.ss0.surface_format = format; @@ -264,9 +444,9 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen, /* XXX: what happens when tex->bo->offset changes??? */ tex->ss.ss1.base_addr = 0; /* reloc */ - tex->ss.ss2.mip_count = tex->base.last_level; - tex->ss.ss2.width = tex->base.width0 - 1; - tex->ss.ss2.height = tex->base.height0 - 1; + tex->ss.ss2.mip_count = tex->b.b.last_level; + tex->ss.ss2.width = tex->b.b.width0 - 1; + tex->ss.ss2.height = tex->b.b.height0 - 1; switch (tex->tiling) { case BRW_TILING_NONE: @@ -284,11 +464,11 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen, } tex->ss.ss3.pitch = (tex->pitch * tex->cpp) - 1; - tex->ss.ss3.depth = tex->base.depth0 - 1; + tex->ss.ss3.depth = tex->b.b.depth0 - 1; tex->ss.ss4.min_lod = 0; - if (tex->base.target == PIPE_TEXTURE_CUBE) { + if (tex->b.b.target == PIPE_TEXTURE_CUBE) { tex->ss.ss0.cube_pos_x = 1; tex->ss.ss0.cube_pos_y = 1; tex->ss.ss0.cube_pos_z = 1; @@ -297,7 +477,7 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen, tex->ss.ss0.cube_neg_z = 1; } - return &tex->base; + return &tex->b.b; fail: bo_reference(&tex->bo, NULL); @@ -305,9 +485,10 @@ fail: return NULL; } -static struct pipe_texture * + +struct pipe_resource * brw_texture_from_handle(struct pipe_screen *screen, - const struct pipe_texture *templ, + const struct pipe_resource *template, struct winsys_handle *whandle) { struct brw_screen *bscreen = brw_screen(screen); @@ -317,12 +498,12 @@ brw_texture_from_handle(struct pipe_screen *screen, unsigned pitch; GLuint format; - if (templ->target != PIPE_TEXTURE_2D || - templ->last_level != 0 || - templ->depth0 != 1) + if (template->target != PIPE_TEXTURE_2D || + template->last_level != 0 || + template->depth0 != 1) return NULL; - if (util_format_is_s3tc(templ->format)) + if (util_format_is_s3tc(template->format)) return NULL; tex = CALLOC_STRUCT(brw_texture); @@ -332,13 +513,14 @@ brw_texture_from_handle(struct pipe_screen *screen, if (bscreen->sws->bo_from_handle(bscreen->sws, whandle, &pitch, &tiling, &buffer) != PIPE_OK) goto fail; - memcpy(&tex->base, templ, sizeof *templ); - pipe_reference_init(&tex->base.reference, 1); - tex->base.screen = screen; + tex->b.b = *template; + tex->b.vtbl = &brw_texture_vtbl; + pipe_reference_init(&tex->b.b.reference, 1); + tex->b.b.screen = screen; /* XXX: cpp vs. blocksize */ - tex->cpp = util_format_get_blocksize(tex->base.format); + tex->cpp = util_format_get_blocksize(tex->b.b.format); tex->tiling = tiling; make_empty_list(&tex->views[0]); @@ -362,11 +544,12 @@ brw_texture_from_handle(struct pipe_screen *screen, #endif tex->ss.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW; - tex->ss.ss0.surface_type = translate_tex_target(tex->base.target); + tex->ss.ss0.surface_type = translate_tex_target(tex->b.b.target); - format = translate_tex_format(tex->base.format); + format = translate_tex_format(tex->b.b.format); assert(format != BRW_SURFACEFORMAT_INVALID); tex->ss.ss0.surface_format = format; + assert(tex->ss.ss0.surface_format != BRW_SURFACEFORMAT_INVALID); /* This is ok for all textures with channel width 8bit or less: */ @@ -376,9 +559,9 @@ brw_texture_from_handle(struct pipe_screen *screen, /* XXX: what happens when tex->bo->offset changes??? */ tex->ss.ss1.base_addr = 0; /* reloc */ - tex->ss.ss2.mip_count = tex->base.last_level; - tex->ss.ss2.width = tex->base.width0 - 1; - tex->ss.ss2.height = tex->base.height0 - 1; + tex->ss.ss2.mip_count = tex->b.b.last_level; + tex->ss.ss2.width = tex->b.b.width0 - 1; + tex->ss.ss2.height = tex->b.b.height0 - 1; switch (tex->tiling) { case BRW_TILING_NONE: @@ -396,187 +579,25 @@ brw_texture_from_handle(struct pipe_screen *screen, } tex->ss.ss3.pitch = (tex->pitch * tex->cpp) - 1; - tex->ss.ss3.depth = tex->base.depth0 - 1; + tex->ss.ss3.depth = tex->b.b.depth0 - 1; tex->ss.ss4.min_lod = 0; - return &tex->base; + return &tex->b.b; fail: FREE(tex); return NULL; } -static boolean -brw_texture_get_handle(struct pipe_screen *screen, - struct pipe_texture *texture, - struct winsys_handle *whandle) -{ - struct brw_screen *bscreen = brw_screen(screen); - struct brw_texture *tex = brw_texture(texture); - unsigned stride; - - stride = tex->pitch * tex->cpp; - return bscreen->sws->bo_get_handle(tex->bo, whandle, stride); -} - - - -static void brw_texture_destroy(struct pipe_texture *pt) -{ - struct brw_texture *tex = brw_texture(pt); - bo_reference(&tex->bo, NULL); - FREE(pt); -} - - -static boolean brw_is_format_supported( struct pipe_screen *screen, - enum pipe_format format, - enum pipe_texture_target target, - unsigned tex_usage, - unsigned geom_flags ) +#if 0 +boolean brw_is_format_supported( struct pipe_screen *screen, + enum pipe_format format, + enum pipe_texture_target target, + unsigned tex_usage, + unsigned geom_flags ) { return translate_tex_format(format) != BRW_SURFACEFORMAT_INVALID; } - - -boolean brw_is_texture_referenced_by_bo( struct brw_screen *brw_screen, - struct pipe_texture *texture, - unsigned face, - unsigned level, - struct brw_winsys_buffer *bo ) -{ - struct brw_texture *tex = brw_texture(texture); - struct brw_surface *surf; - int i; - - /* XXX: this is subject to false positives if the underlying - * texture BO is referenced, we can't tell whether the sub-region - * we care about participates in that. - */ - if (brw_screen->sws->bo_references( bo, tex->bo )) - return TRUE; - - /* Find any view on this texture for this face/level and see if it - * is referenced: - */ - for (i = 0; i < 2; i++) { - foreach (surf, &tex->views[i]) { - if (surf->bo == tex->bo) - continue; - - if (surf->id.bits.face != face || - surf->id.bits.level != level) - continue; - - if (brw_screen->sws->bo_references( bo, surf->bo)) - return TRUE; - } - } - - return FALSE; -} - - -/* - * Transfer functions - */ - -static struct pipe_transfer* -brw_get_tex_transfer(struct pipe_context *pipe, - struct pipe_texture *texture, - unsigned face, unsigned level, unsigned zslice, - enum pipe_transfer_usage usage, unsigned x, unsigned y, - unsigned w, unsigned h) -{ - struct brw_texture *tex = brw_texture(texture); - struct brw_transfer *trans; - unsigned offset; /* in bytes */ - - if (texture->target == PIPE_TEXTURE_CUBE) { - offset = tex->image_offset[level][face]; - } else if (texture->target == PIPE_TEXTURE_3D) { - offset = tex->image_offset[level][zslice]; - } else { - offset = tex->image_offset[level][0]; - assert(face == 0); - assert(zslice == 0); - } - - trans = CALLOC_STRUCT(brw_transfer); - if (trans) { - pipe_texture_reference(&trans->base.texture, texture); - trans->base.x = x; - trans->base.y = y; - trans->base.width = w; - trans->base.height = h; - trans->base.stride = tex->pitch * tex->cpp; - trans->offset = offset; - trans->base.usage = usage; - } - return &trans->base; -} - -static void * -brw_transfer_map(struct pipe_context *pipe, - struct pipe_transfer *transfer) -{ - struct brw_texture *tex = brw_texture(transfer->texture); - struct brw_winsys_screen *sws = brw_screen(pipe->screen)->sws; - char *map; - unsigned usage = transfer->usage; - - map = sws->bo_map(tex->bo, - BRW_DATA_OTHER, - 0, - tex->bo->size, - (usage & PIPE_TRANSFER_WRITE) ? TRUE : FALSE, - (usage & 0) ? TRUE : FALSE, - (usage & 0) ? TRUE : FALSE); - - if (!map) - return NULL; - - /* XXX: blocksize and compressed textures - */ - return map + brw_transfer(transfer)->offset + - transfer->y /* / transfer->block.height */ * transfer->stride + - transfer->x /* / transfer->block.width */ * brw_texture(transfer->texture)->cpp; -} - -static void -brw_transfer_unmap(struct pipe_context *pipe, - struct pipe_transfer *transfer) -{ - struct brw_texture *tex = brw_texture(transfer->texture); - struct brw_winsys_screen *sws = brw_screen(pipe->screen)->sws; - - sws->bo_unmap(tex->bo); -} - -static void -brw_tex_transfer_destroy(struct pipe_context *pipe, - struct pipe_transfer *trans) -{ - pipe_texture_reference(&trans->texture, NULL); - FREE(trans); -} - - -void brw_tex_init( struct brw_context *brw ) -{ - brw->base.get_tex_transfer = brw_get_tex_transfer; - brw->base.transfer_map = brw_transfer_map; - brw->base.transfer_unmap = brw_transfer_unmap; - brw->base.tex_transfer_destroy = brw_tex_transfer_destroy; -} - -void brw_screen_tex_init( struct brw_screen *brw_screen ) -{ - brw_screen->base.is_format_supported = brw_is_format_supported; - brw_screen->base.texture_create = brw_texture_create; - brw_screen->base.texture_from_handle = brw_texture_from_handle; - brw_screen->base.texture_get_handle = brw_texture_get_handle; - brw_screen->base.texture_destroy = brw_texture_destroy; -} +#endif diff --git a/src/gallium/drivers/i965/brw_screen_tex_layout.c b/src/gallium/drivers/i965/brw_resource_texture_layout.c index 894f4bea40..2187bdd82c 100644 --- a/src/gallium/drivers/i965/brw_screen_tex_layout.c +++ b/src/gallium/drivers/i965/brw_resource_texture_layout.c @@ -30,7 +30,7 @@ #include "util/u_math.h" #include "util/u_memory.h" -#include "brw_screen.h" +#include "brw_resource.h" #include "brw_debug.h" #include "brw_winsys.h" @@ -143,14 +143,14 @@ static void brw_layout_2d( struct brw_texture *tex ) GLuint level; GLuint x = 0; GLuint y = 0; - GLuint width = tex->base.width0; - GLuint height = tex->base.height0; + GLuint width = tex->b.b.width0; + GLuint height = tex->b.b.height0; - tex->pitch = tex->base.width0; - brw_tex_alignment_unit(tex->base.format, &align_w, &align_h); + tex->pitch = tex->b.b.width0; + brw_tex_alignment_unit(tex->b.b.format, &align_w, &align_h); if (tex->compressed) { - tex->pitch = align(tex->base.width0, align_w); + tex->pitch = align(tex->b.b.width0, align_w); } /* May need to adjust pitch to accomodate the placement of @@ -158,15 +158,15 @@ static void brw_layout_2d( struct brw_texture *tex ) * constraints of mipmap placement push the right edge of the * 2nd mipmap out past the width of its parent. */ - if (tex->base.last_level > 0) { + if (tex->b.b.last_level > 0) { GLuint mip1_width; if (tex->compressed) { - mip1_width = (align(u_minify(tex->base.width0, 1), align_w) + - align(u_minify(tex->base.width0, 2), align_w)); + mip1_width = (align(u_minify(tex->b.b.width0, 1), align_w) + + align(u_minify(tex->b.b.width0, 2), align_w)); } else { - mip1_width = (align(u_minify(tex->base.width0, 1), align_w) + - u_minify(tex->base.width0, 2)); + mip1_width = (align(u_minify(tex->b.b.width0, 1), align_w) + + u_minify(tex->b.b.width0, 2)); } if (mip1_width > tex->pitch) { @@ -180,7 +180,7 @@ static void brw_layout_2d( struct brw_texture *tex ) tex->pitch = brw_tex_pitch_align (tex, tex->pitch); tex->total_height = 0; - for ( level = 0 ; level <= tex->base.last_level ; level++ ) { + for ( level = 0 ; level <= tex->b.b.last_level ; level++ ) { GLuint img_height; brw_tex_set_level_info(tex, level, 1, x, y, width, height, 1); @@ -218,28 +218,28 @@ brw_layout_cubemap_idgng( struct brw_texture *tex ) GLuint level; GLuint x = 0; GLuint y = 0; - GLuint width = tex->base.width0; - GLuint height = tex->base.height0; + GLuint width = tex->b.b.width0; + GLuint height = tex->b.b.height0; GLuint qpitch = 0; GLuint y_pitch = 0; - tex->pitch = tex->base.width0; - brw_tex_alignment_unit(tex->base.format, &align_w, &align_h); + tex->pitch = tex->b.b.width0; + brw_tex_alignment_unit(tex->b.b.format, &align_w, &align_h); y_pitch = align(height, align_h); if (tex->compressed) { - tex->pitch = align(tex->base.width0, align_w); + tex->pitch = align(tex->b.b.width0, align_w); } - if (tex->base.last_level != 0) { + if (tex->b.b.last_level != 0) { GLuint mip1_width; if (tex->compressed) { - mip1_width = (align(u_minify(tex->base.width0, 1), align_w) + - align(u_minify(tex->base.width0, 2), align_w)); + mip1_width = (align(u_minify(tex->b.b.width0, 1), align_w) + + align(u_minify(tex->b.b.width0, 2), align_w)); } else { - mip1_width = (align(u_minify(tex->base.width0, 1), align_w) + - u_minify(tex->base.width0, 2)); + mip1_width = (align(u_minify(tex->b.b.width0, 1), align_w) + + u_minify(tex->b.b.width0, 2)); } if (mip1_width > tex->pitch) { @@ -267,7 +267,7 @@ brw_layout_cubemap_idgng( struct brw_texture *tex ) 11 * align_h) * 6; } - for (level = 0; level <= tex->base.last_level; level++) { + for (level = 0; level <= tex->b.b.last_level; level++) { GLuint img_height; GLuint nr_images = 6; GLuint q = 0; @@ -300,9 +300,9 @@ brw_layout_cubemap_idgng( struct brw_texture *tex ) static boolean brw_layout_3d_cube( struct brw_texture *tex ) { - GLuint width = tex->base.width0; - GLuint height = tex->base.height0; - GLuint depth = tex->base.depth0; + GLuint width = tex->b.b.width0; + GLuint height = tex->b.b.height0; + GLuint depth = tex->b.b.depth0; GLuint pack_x_pitch, pack_x_nr; GLuint pack_y_pitch; GLuint level; @@ -310,21 +310,21 @@ brw_layout_3d_cube( struct brw_texture *tex ) GLuint align_w = 4; tex->total_height = 0; - brw_tex_alignment_unit(tex->base.format, &align_w, &align_h); + brw_tex_alignment_unit(tex->b.b.format, &align_w, &align_h); if (tex->compressed) { tex->pitch = align(width, align_w); pack_y_pitch = (height + 3) / 4; } else { - tex->pitch = brw_tex_pitch_align(tex, tex->base.width0); - pack_y_pitch = align(tex->base.height0, align_h); + tex->pitch = brw_tex_pitch_align(tex, tex->b.b.width0); + pack_y_pitch = align(tex->b.b.height0, align_h); } pack_x_pitch = width; pack_x_nr = 1; - for (level = 0 ; level <= tex->base.last_level ; level++) { - GLuint nr_images = tex->base.target == PIPE_TEXTURE_3D ? depth : 6; + for (level = 0 ; level <= tex->b.b.last_level ; level++) { + GLuint nr_images = tex->b.b.target == PIPE_TEXTURE_3D ? depth : 6; GLint x = 0; GLint y = 0; GLint q, j; @@ -375,7 +375,7 @@ brw_layout_3d_cube( struct brw_texture *tex ) * memory. As a result, the docs say in Surface Padding Requirements: * Sampling Engine Surfaces that two extra rows of padding are required. */ - if (tex->base.target == PIPE_TEXTURE_CUBE) + if (tex->b.b.target == PIPE_TEXTURE_CUBE) tex->total_height += 2; return TRUE; @@ -386,7 +386,7 @@ brw_layout_3d_cube( struct brw_texture *tex ) GLboolean brw_texture_layout(struct brw_screen *brw_screen, struct brw_texture *tex ) { - switch (tex->base.target) { + switch (tex->b.b.target) { case PIPE_TEXTURE_CUBE: if (brw_screen->chipset.is_igdng) brw_layout_cubemap_idgng( tex ); diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c index ba30e63f20..0a7151bde4 100644 --- a/src/gallium/drivers/i965/brw_screen.c +++ b/src/gallium/drivers/i965/brw_screen.c @@ -35,6 +35,7 @@ #include "brw_screen.h" #include "brw_winsys.h" #include "brw_debug.h" +#include "brw_resource.h" #ifdef DEBUG static const struct debug_named_value debug_names[] = { @@ -275,9 +276,9 @@ brw_is_format_supported(struct pipe_screen *screen, const enum pipe_format *list; uint i; - if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) + if (tex_usage & PIPE_BIND_DEPTH_STENCIL) list = depth_supported; - else if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) + else if (tex_usage & PIPE_BIND_RENDER_TARGET) list = render_supported; else list = tex_supported; @@ -406,9 +407,8 @@ brw_create_screen(struct brw_winsys_screen *sws, uint pci_id) bscreen->base.fence_signalled = brw_fence_signalled; bscreen->base.fence_finish = brw_fence_finish; - brw_screen_tex_init(bscreen); + brw_init_screen_resource_functions(bscreen); brw_screen_tex_surface_init(bscreen); - brw_screen_buffer_init(bscreen); bscreen->no_tiling = debug_get_option("BRW_NO_TILING", FALSE) != NULL; diff --git a/src/gallium/drivers/i965/brw_screen.h b/src/gallium/drivers/i965/brw_screen.h index e3a7c64d48..522a3bf899 100644 --- a/src/gallium/drivers/i965/brw_screen.h +++ b/src/gallium/drivers/i965/brw_screen.h @@ -48,30 +48,6 @@ struct brw_screen boolean no_tiling; }; -/** - * Subclass of pipe_transfer - */ -struct brw_transfer -{ - struct pipe_transfer base; - - unsigned offset; -}; - -struct brw_buffer -{ - struct pipe_buffer base; - - /* One of either bo or user_buffer will be non-null, depending on - * whether this is a hardware or user buffer. - */ - struct brw_winsys_buffer *bo; - void *user_buffer; - - /* Mapped pointer?? - */ - void *ptr; -}; union brw_surface_id { @@ -100,31 +76,6 @@ struct brw_surface }; -#define BRW_MAX_TEXTURE_2D_LEVELS 11 /* max 1024x1024 */ -#define BRW_MAX_TEXTURE_3D_LEVELS 8 /* max 128x128x128 */ - - -struct brw_texture -{ - struct pipe_texture base; - struct brw_winsys_buffer *bo; - struct brw_surface_state ss; - - unsigned *image_offset[BRW_MAX_TEXTURE_2D_LEVELS]; - unsigned nr_images[BRW_MAX_TEXTURE_2D_LEVELS]; - unsigned level_offset[BRW_MAX_TEXTURE_2D_LEVELS]; - - boolean compressed; - unsigned brw_target; - unsigned pitch; - unsigned tiling; - unsigned cpp; - unsigned total_height; - - struct brw_surface views[2]; -}; - - /* * Cast wrappers @@ -135,11 +86,6 @@ brw_screen(struct pipe_screen *pscreen) return (struct brw_screen *) pscreen; } -static INLINE struct brw_transfer * -brw_transfer(struct pipe_transfer *transfer) -{ - return (struct brw_transfer *)transfer; -} static INLINE struct brw_surface * brw_surface(struct pipe_surface *surface) @@ -147,60 +93,10 @@ brw_surface(struct pipe_surface *surface) return (struct brw_surface *)surface; } -static INLINE struct brw_buffer * -brw_buffer(struct pipe_buffer *buffer) -{ - return (struct brw_buffer *)buffer; -} - -static INLINE struct brw_texture * -brw_texture(struct pipe_texture *texture) -{ - return (struct brw_texture *)texture; -} - - -/* Pipe buffer helpers - */ -static INLINE boolean -brw_buffer_is_user_buffer( const struct pipe_buffer *buf ) -{ - return ((const struct brw_buffer *)buf)->user_buffer != NULL; -} - unsigned brw_surface_pitch( const struct pipe_surface *surface ); -/*********************************************************************** - * Internal functions - */ -GLboolean brw_texture_layout(struct brw_screen *brw_screen, - struct brw_texture *tex ); - -void brw_update_texture( struct brw_screen *brw_screen, - struct brw_texture *tex ); - - -/* brw_screen_texture.h - */ -struct brw_context; -void brw_tex_init( struct brw_context *brw ); -void brw_screen_tex_init( struct brw_screen *brw_screen ); void brw_screen_tex_surface_init( struct brw_screen *brw_screen ); -void brw_screen_buffer_init(struct brw_screen *brw_screen); - - -boolean brw_is_texture_referenced_by_bo( struct brw_screen *brw_screen, - struct pipe_texture *texture, - unsigned face, - unsigned level, - struct brw_winsys_buffer *bo ); - -boolean brw_is_buffer_referenced_by_bo( struct brw_screen *brw_screen, - struct pipe_buffer *buffer, - struct brw_winsys_buffer *bo ); - - #endif /* BRW_SCREEN_H */ diff --git a/src/gallium/drivers/i965/brw_screen_buffers.c b/src/gallium/drivers/i965/brw_screen_buffers.c deleted file mode 100644 index 0b38885f40..0000000000 --- a/src/gallium/drivers/i965/brw_screen_buffers.c +++ /dev/null @@ -1,202 +0,0 @@ - -#include "util/u_memory.h" -#include "util/u_math.h" - -#include "pipe/p_state.h" -#include "pipe/p_defines.h" -#include "util/u_inlines.h" - -#include "brw_screen.h" -#include "brw_winsys.h" - - - -static void * -brw_buffer_map_range( struct pipe_screen *screen, - struct pipe_buffer *buffer, - unsigned offset, - unsigned length, - unsigned usage ) -{ - struct brw_screen *bscreen = brw_screen(screen); - struct brw_winsys_screen *sws = bscreen->sws; - struct brw_buffer *buf = brw_buffer( buffer ); - - if (buf->user_buffer) - return buf->user_buffer; - - return sws->bo_map( buf->bo, - BRW_DATA_OTHER, - offset, - length, - (usage & PIPE_BUFFER_USAGE_CPU_WRITE) ? TRUE : FALSE, - (usage & PIPE_BUFFER_USAGE_DISCARD) ? TRUE : FALSE, - (usage & PIPE_BUFFER_USAGE_FLUSH_EXPLICIT) ? TRUE : FALSE); -} - -static void * -brw_buffer_map( struct pipe_screen *screen, - struct pipe_buffer *buffer, - unsigned usage ) -{ - struct brw_screen *bscreen = brw_screen(screen); - struct brw_winsys_screen *sws = bscreen->sws; - struct brw_buffer *buf = brw_buffer( buffer ); - - if (buf->user_buffer) - return buf->user_buffer; - - return sws->bo_map( buf->bo, - BRW_DATA_OTHER, - 0, - buf->base.size, - (usage & PIPE_BUFFER_USAGE_CPU_WRITE) ? TRUE : FALSE, - FALSE, - FALSE); -} - - -static void -brw_buffer_flush_mapped_range( struct pipe_screen *screen, - struct pipe_buffer *buffer, - unsigned offset, - unsigned length ) -{ - struct brw_screen *bscreen = brw_screen(screen); - struct brw_winsys_screen *sws = bscreen->sws; - struct brw_buffer *buf = brw_buffer( buffer ); - - if (buf->user_buffer) - return; - - sws->bo_flush_range( buf->bo, - offset, - length ); -} - - -static void -brw_buffer_unmap( struct pipe_screen *screen, - struct pipe_buffer *buffer ) -{ - struct brw_screen *bscreen = brw_screen(screen); - struct brw_winsys_screen *sws = bscreen->sws; - struct brw_buffer *buf = brw_buffer( buffer ); - - if (buf->bo) - sws->bo_unmap(buf->bo); -} - -static void -brw_buffer_destroy( struct pipe_buffer *buffer ) -{ - struct brw_buffer *buf = brw_buffer( buffer ); - - assert(!p_atomic_read(&buffer->reference.count)); - - bo_reference(&buf->bo, NULL); - FREE(buf); -} - - -static struct pipe_buffer * -brw_buffer_create(struct pipe_screen *screen, - unsigned alignment, - unsigned usage, - unsigned size) -{ - struct brw_screen *bscreen = brw_screen(screen); - struct brw_winsys_screen *sws = bscreen->sws; - struct brw_buffer *buf; - unsigned buffer_type; - enum pipe_error ret; - - buf = CALLOC_STRUCT(brw_buffer); - if (!buf) - return NULL; - - pipe_reference_init(&buf->base.reference, 1); - buf->base.screen = screen; - buf->base.alignment = alignment; - buf->base.usage = usage; - buf->base.size = size; - - switch (usage & (PIPE_BUFFER_USAGE_VERTEX | - PIPE_BUFFER_USAGE_INDEX | - PIPE_BUFFER_USAGE_PIXEL | - PIPE_BUFFER_USAGE_CONSTANT)) - { - case PIPE_BUFFER_USAGE_VERTEX: - case PIPE_BUFFER_USAGE_INDEX: - case (PIPE_BUFFER_USAGE_VERTEX|PIPE_BUFFER_USAGE_INDEX): - buffer_type = BRW_BUFFER_TYPE_VERTEX; - break; - - case PIPE_BUFFER_USAGE_PIXEL: - buffer_type = BRW_BUFFER_TYPE_PIXEL; - break; - - case PIPE_BUFFER_USAGE_CONSTANT: - buffer_type = BRW_BUFFER_TYPE_SHADER_CONSTANTS; - break; - - default: - buffer_type = BRW_BUFFER_TYPE_GENERIC; - break; - } - - ret = sws->bo_alloc( sws, buffer_type, - size, alignment, - &buf->bo ); - if (ret != PIPE_OK) - return NULL; - - return &buf->base; -} - - -static struct pipe_buffer * -brw_user_buffer_create(struct pipe_screen *screen, - void *ptr, - unsigned bytes) -{ - struct brw_buffer *buf; - - buf = CALLOC_STRUCT(brw_buffer); - if (!buf) - return NULL; - - buf->user_buffer = ptr; - - pipe_reference_init(&buf->base.reference, 1); - buf->base.screen = screen; - buf->base.alignment = 1; - buf->base.usage = 0; - buf->base.size = bytes; - - return &buf->base; -} - - -boolean brw_is_buffer_referenced_by_bo( struct brw_screen *brw_screen, - struct pipe_buffer *buffer, - struct brw_winsys_buffer *bo ) -{ - struct brw_buffer *buf = brw_buffer(buffer); - if (buf->bo == NULL) - return FALSE; - - return brw_screen->sws->bo_references( bo, buf->bo ); -} - - -void brw_screen_buffer_init(struct brw_screen *brw_screen) -{ - brw_screen->base.buffer_create = brw_buffer_create; - brw_screen->base.user_buffer_create = brw_user_buffer_create; - brw_screen->base.buffer_map = brw_buffer_map; - brw_screen->base.buffer_map_range = brw_buffer_map_range; - brw_screen->base.buffer_flush_mapped_range = brw_buffer_flush_mapped_range; - brw_screen->base.buffer_unmap = brw_buffer_unmap; - brw_screen->base.buffer_destroy = brw_buffer_destroy; -} diff --git a/src/gallium/drivers/i965/brw_screen_surface.c b/src/gallium/drivers/i965/brw_screen_surface.c index 904df813dd..f288fdbcd3 100644 --- a/src/gallium/drivers/i965/brw_screen_surface.c +++ b/src/gallium/drivers/i965/brw_screen_surface.c @@ -36,6 +36,7 @@ #include "pipe/p_screen.h" #include "brw_screen.h" #include "brw_defines.h" +#include "brw_resource.h" #include "brw_winsys.h" enum { @@ -138,9 +139,9 @@ static struct brw_surface *create_in_place_view( struct brw_screen *brw_screen, */ assert(id.bits.zslice == 0); - surface->base.format = tex->base.format; - surface->base.width = u_minify(tex->base.width0, id.bits.level); - surface->base.height = u_minify(tex->base.height0, id.bits.level); + surface->base.format = tex->b.b.format; + surface->base.width = u_minify(tex->b.b.width0, id.bits.level); + surface->base.height = u_minify(tex->b.b.height0, id.bits.level); surface->base.offset = tex->image_offset[id.bits.level][id.bits.face]; surface->base.usage = usage; surface->base.zslice = id.bits.zslice; @@ -152,7 +153,7 @@ static struct brw_surface *create_in_place_view( struct brw_screen *brw_screen, surface->tiling = tex->tiling; bo_reference( &surface->bo, tex->bo ); - pipe_texture_reference( &surface->base.texture, &tex->base ); + pipe_resource_reference( &surface->base.texture, &tex->b.b ); surface->ss.ss0.surface_format = tex->ss.ss0.surface_format; surface->ss.ss0.surface_type = BRW_SURFACE_2D; @@ -198,7 +199,7 @@ static struct brw_surface *create_in_place_view( struct brw_screen *brw_screen, /* Get a surface which is view into a texture */ static struct pipe_surface *brw_get_tex_surface(struct pipe_screen *screen, - struct pipe_texture *pt, + struct pipe_resource *pt, unsigned face, unsigned level, unsigned zslice, unsigned usage ) @@ -246,7 +247,7 @@ static void brw_tex_surface_destroy( struct pipe_surface *surf ) */ remove_from_list(surface); bo_reference(&surface->bo, NULL); - pipe_texture_reference( &surface->base.texture, NULL ); + pipe_resource_reference( &surface->base.texture, NULL ); FREE(surface); diff --git a/src/gallium/drivers/i965/brw_util.c b/src/gallium/drivers/i965/brw_util.c deleted file mode 100644 index 1fd2e29713..0000000000 --- a/src/gallium/drivers/i965/brw_util.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - **********************************************************************/ - /* - * Authors: - * Keith Whitwell <keith@tungstengraphics.com> - */ - - - - - - diff --git a/src/gallium/drivers/i965/brw_vs_surface_state.c b/src/gallium/drivers/i965/brw_vs_surface_state.c index 004e3cb4e6..424bb0d0df 100644 --- a/src/gallium/drivers/i965/brw_vs_surface_state.c +++ b/src/gallium/drivers/i965/brw_vs_surface_state.c @@ -82,7 +82,7 @@ brw_update_vs_constant_surface( struct brw_context *brw, GLuint surf) { struct brw_surface_key key; - struct pipe_buffer *cb = brw->curr.vs_constants; + struct pipe_resource *cb = brw->curr.vs_constants; enum pipe_error ret; assert(surf == 0); diff --git a/src/gallium/drivers/i965/brw_wm.c b/src/gallium/drivers/i965/brw_wm.c index 7ed2378ec0..5d66e61fbc 100644 --- a/src/gallium/drivers/i965/brw_wm.c +++ b/src/gallium/drivers/i965/brw_wm.c @@ -35,6 +35,7 @@ #include "brw_wm.h" #include "brw_state.h" #include "brw_debug.h" +#include "brw_resource.h" #include "brw_pipe_rast.h" @@ -254,10 +255,10 @@ static void brw_wm_populate_key( struct brw_context *brw, for (i = 0; i < brw->curr.num_fragment_sampler_views; i++) { const struct brw_texture *tex = brw_texture(brw->curr.fragment_sampler_views[i]->texture); - if (tex->base.format == PIPE_FORMAT_UYVY) + if (tex->b.b.format == PIPE_FORMAT_UYVY) key->yuvtex_mask |= 1 << i; - if (tex->base.format == PIPE_FORMAT_YUYV) + if (tex->b.b.format == PIPE_FORMAT_YUYV) key->yuvtex_swap_mask |= 1 << i; /* XXX: shadow texture diff --git a/src/gallium/drivers/i965/brw_wm_constant_buffer.c b/src/gallium/drivers/i965/brw_wm_constant_buffer.c index 6434c6acf7..df5cd0398c 100644 --- a/src/gallium/drivers/i965/brw_wm_constant_buffer.c +++ b/src/gallium/drivers/i965/brw_wm_constant_buffer.c @@ -62,7 +62,7 @@ brw_update_wm_constant_surface( struct brw_context *brw, { struct brw_surface_key key; struct brw_fragment_shader *fp = brw->curr.fragment_shader; - struct pipe_buffer *cbuf = brw->curr.fragment_constants; + struct pipe_resource *cbuf = brw->curr.fragment_constants; int pitch = cbuf->size / (4 * sizeof(float)); enum pipe_error ret; diff --git a/src/gallium/drivers/i965/brw_wm_sampler_state.c b/src/gallium/drivers/i965/brw_wm_sampler_state.c index 3f18062c58..8406a1a9e2 100644 --- a/src/gallium/drivers/i965/brw_wm_sampler_state.c +++ b/src/gallium/drivers/i965/brw_wm_sampler_state.c @@ -35,7 +35,7 @@ #include "brw_context.h" #include "brw_state.h" #include "brw_defines.h" -#include "brw_screen.h" +#include "brw_resource.h" /* Samplers aren't strictly wm state from the hardware's perspective, @@ -94,7 +94,7 @@ brw_wm_sampler_populate_key(struct brw_context *brw, /* Cube-maps on 965 and later must use the same wrap mode for all 3 * coordinate dimensions. Futher, only CUBE and CLAMP are valid. */ - if (tex->base.target == PIPE_TEXTURE_CUBE) { + if (tex->b.b.target == PIPE_TEXTURE_CUBE) { if (FALSE && (sampler->ss0.min_filter != BRW_MAPFILTER_NEAREST || sampler->ss0.mag_filter != BRW_MAPFILTER_NEAREST)) { @@ -106,7 +106,7 @@ brw_wm_sampler_populate_key(struct brw_context *brw, entry->ss1.s_wrap_mode = BRW_TEXCOORDMODE_CLAMP; entry->ss1.t_wrap_mode = BRW_TEXCOORDMODE_CLAMP; } - } else if (tex->base.target == PIPE_TEXTURE_1D) { + } else if (tex->b.b.target == PIPE_TEXTURE_1D) { /* There's a bug in 1D texture sampling - it actually pays * attention to the wrap_t value, though it should not. * Override the wrap_t value here to GL_REPEAT to keep @@ -137,7 +137,7 @@ brw_wm_sampler_update_default_colors(struct brw_context *brw) sampler->border_color[0] }; - if (util_format_is_depth_or_stencil(tex->base.format)) { + if (util_format_is_depth_or_stencil(tex->b.b.format)) { bc = bordercolor; } else { diff --git a/src/gallium/drivers/i965/brw_wm_surface_state.c b/src/gallium/drivers/i965/brw_wm_surface_state.c index 2368ae3f80..0d80a0114a 100644 --- a/src/gallium/drivers/i965/brw_wm_surface_state.c +++ b/src/gallium/drivers/i965/brw_wm_surface_state.c @@ -34,7 +34,7 @@ #include "brw_batchbuffer.h" #include "brw_context.h" #include "brw_state.h" -#include "brw_screen.h" +#include "brw_resource.h" |