diff options
author | Keith Whitwell <[email protected]> | 2010-04-10 16:05:54 +0100 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2010-04-10 16:05:54 +0100 |
commit | 287c94ea4987033f9c99a2f91c5750c9083504ca (patch) | |
tree | a3c1d20522d0ba4a259a5c83e2126affd7aba83c /src/gallium/state_trackers/xorg | |
parent | e7f1e5ca648d6c96d056d3ae8eab65e98f47f311 (diff) |
Squashed commit of the following:
commit 0189cb2fde9f5d7326fd4bfbc2e52db4cce73b3e
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
Date: Sat Apr 10 13:49:34 2010 +0800
i915g: Initialize screen surface function.
commit eb56e64986790aa2fa35534ce652b78656b0c3c5
Merge: f8b0a7f e7f1e5c
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date: Fri Apr 9 18:07:56 2010 +0200
gallium: fix another compile warning after merge. Hmpf.
commit 52953cd7b0e51deafecb812bdc40f9e45f9ac62a
Author: Roland Scheidegger <[email protected]>
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 <[email protected]>
Date: Fri Apr 9 17:51:23 2010 +0200
gallium: more comments fixup
commit 8f3f9d5e1e9c0de98a3dfb19e81250d2c32ee4e9
Author: Roland Scheidegger <[email protected]>
Date: Fri Apr 9 17:48:18 2010 +0200
gallium: another fix after merge
commit 41f00a32ee5be91512c048bacb89ede0e04bc08d
Author: Roland Scheidegger <[email protected]>
Date: Fri Apr 9 17:44:30 2010 +0200
gallium: more pipe_texture/resource fixes after merge
commit faf53328d1154c51d8a59513f2bfcae62272b0bf
Author: Roland Scheidegger <[email protected]>
Date: Fri Apr 9 17:44:24 2010 +0200
gallium: fix comments for changed USAGE flags
commit fdcb17bea4b0798d316b56deea69832f41142adf
Author: Roland Scheidegger <[email protected]>
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 <[email protected]>
Date: Fri Apr 9 13:44:35 2010 +0100
llvmpipe: fix merge glitches
commit 28f8b8683175149a381be5eff263d4c20568bce7
Author: Keith Whitwell <[email protected]>
Date: Fri Apr 9 13:41:39 2010 +0100
r300g: update after merge for pipe_resources
commit 248c93cbc066ba6e3fadd94c5fcf3bdbb373d8fd
Author: Keith Whitwell <[email protected]>
Date: Fri Apr 9 13:41:20 2010 +0100
st/mesa: fix old pipe_texture usages
commit a563b1c5c2cb57b3ef28a3654d9b477460d13ced
Author: Keith Whitwell <[email protected]>
Date: Fri Apr 9 13:40:56 2010 +0100
r300g: remove unused variable
commit 734500131d828c9dfd68c5fa26b3e6b07e086d2d
Author: Keith Whitwell <[email protected]>
Date: Fri Apr 9 13:40:36 2010 +0100
nv50: fix compiler warning
commit efd402e13037e5c3e29759fa5b1c754c6d65d0e2
Merge: fec8a1d 5452615
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
Date: Sat Apr 3 07:58:34 2010 +0200
util: fix assertion failures in pipe_buffer_flush_mapped_range
commit 1ff3984c2edce9927744f3cce3e7b07778990170
Author: Roland Scheidegger <[email protected]>
Date: Thu Apr 8 17:44:54 2010 +0200
docs: fix transfer_map description
commit 20bf14be8ac6438cb1afa38212e306fc06a5ed40
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date: Wed Apr 7 17:26:08 2010 +0100
nv50: fix compiler warning
commit d040daff0642dd791ac38e9b353dc251b03fc873
Author: Keith Whitwell <[email protected]>
Date: Wed Apr 7 17:25:58 2010 +0100
nvfx: fix compiler warning
commit 49ec01dffb8e99ab3ff8f856287db7b4df3efed6
Author: Chia-I Wu <[email protected]>
Date: Mon Apr 5 11:58:53 2010 +0800
mesa/es: Fixes for gallium-resources.
commit 47c87ada452be45766928a01b6d69da63e3a5f5e
Author: Marek Olšák <[email protected]>
Date: Sat Apr 3 05:19:20 2010 +0200
r300g: fix transfers for textures created from winsys handles
commit 5f2701fddaef9c18d85c049311c2819c49cc1ae0
Author: Luca Barbieri <[email protected]>
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 <[email protected]>
Date: Sat Apr 3 03:27:19 2010 +0200
i965: add brw_resource.c to Makefile
commit b94f3e7389cbd1b6465de3c04e8059ce73f1ea1f
Author: Luca Barbieri <[email protected]>
Date: Sat Apr 3 01:48:33 2010 +0200
nouveau: fix for gallium-resources
commit a01ff99a19986e6beb7903431e60a074945b09bc
Author: Roland Scheidegger <[email protected]>
Date: Thu Apr 1 19:26:35 2010 +0200
gallium: fix missing includes
commit 26aeded562ce947a6deeb867fe22bf8daf7b1a1a
Author: Roland Scheidegger <[email protected]>
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/[email protected]/msg09619.html
for a discussion of this. Video related work is done in origin/pipe-video
branch.
commit c64285aea45997a276fb141d7badc8a04f617c7c
Author: Roland Scheidegger <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date: Thu Apr 1 00:05:12 2010 +0200
r300g: compile fixes
commit 76711ff40d2092f9ef03d452de7458c4e76d9246
Author: Roland Scheidegger <[email protected]>
Date: Thu Apr 1 00:04:47 2010 +0200
nvfx: more compile fixes
commit c5d2e90c9cc119447a447dc04a4bce4ab91fc671
Author: Roland Scheidegger <[email protected]>
Date: Wed Mar 31 23:18:50 2010 +0200
gallium: more mostly merge fallout fixes...
commit fbc3722696790857f4adc936190406e74dffd969
Merge: 86d9225 d97f696
Author: Roland Scheidegger <[email protected]>
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 <[email protected]>
Date: Wed Mar 31 19:06:06 2010 +0200
gallium: more fixes for bind changes
commit a215ef0606347e34669a580ec8df93ede7e46399
Author: Roland Scheidegger <[email protected]>
Date: Wed Mar 31 18:48:36 2010 +0200
gallium/docs: some updates for bind changes
commit c6c7e6746cbc7af59f7972719ed76f43e8ac16fc
Author: Roland Scheidegger <[email protected]>
Date: Tue Mar 30 20:24:26 2010 +0200
gallium: more bind change compile fixes
commit a83fa1504b78180524a5eb454ae186741a27cdf8
Author: Roland Scheidegger <[email protected]>
Date: Tue Mar 30 17:37:13 2010 +0200
compile fixes
commit 30dc8afcd243d6a160571bac5f06d773e54a4196
Author: Roland Scheidegger <[email protected]>
Date: Tue Mar 30 16:56:28 2010 +0200
fix some merge issues
commit 30aa617fee11fe50c0a9c2f33fcd120a474f5e34
Merge: 1dde609 3a830bc
Author: Roland Scheidegger <[email protected]>
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 <[email protected]>
Date: Wed Mar 24 02:35:00 2010 +0100
docs: some updates for pipe_resource
commit f236f9660d31b936f54b64ae07e569f8637067bd
Author: Luca Barbieri <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date: Tue Mar 23 14:00:52 2010 -0700
st/egl: fix up for binding flags
commit c6a80dc32ef17bc972d4137ce7444ebed4d28ebb
Author: Keith Whitwell <[email protected]>
Date: Tue Mar 23 13:52:15 2010 -0700
r300: restore 4k alignment for oqbo buffers
commit e75a8d5ea9e0ffcf67bc858e08937e10b4fc74ba
Author: Keith Whitwell <[email protected]>
Date: Tue Mar 23 13:00:07 2010 -0700
gallium: bind flags
commit 1f5b509543a7f399835fd9edf27c18e1643fab7d
Author: Roland Scheidegger <[email protected]>
Date: Tue Mar 23 19:32:21 2010 +0100
i965g: scons compile fixes
commit 2c385f8f905ec794d9119c05c6293e0b1b9b565a
Author: Roland Scheidegger <[email protected]>
Date: Tue Mar 23 19:20:33 2010 +0100
nouveau: drm compile fix
commit b285086ebd5132b47c340897c4622cc9fbd286cb
Author: Roland Scheidegger <[email protected]>
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 <[email protected]>
Date: Tue Mar 23 16:21:03 2010 +0100
softpipe: Map GS constants, too.
commit 366f1176fb89d2b1978da6cfe60000b76bbc7338
Author: Roland Scheidegger <[email protected]>
Date: Tue Mar 23 15:51:52 2010 +0100
failover: update for pipe_resources
commit 615f44d70d293704ed821bc0b21fcfe6e363895d
Author: Roland Scheidegger <[email protected]>
Date: Tue Mar 23 15:51:02 2010 +0100
identity: remove double is_resource_reference assignment
commit 7008586020395905ddfff333d02b3893de369796
Author: Roland Scheidegger <[email protected]>
Date: Tue Mar 23 15:50:32 2010 +0100
trace: compile fix
commit 058c5697bda4c9cf7b49d26ee27a34586544efaa
Merge: dd7ba13 b33fd3c
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date: Mon Mar 22 20:50:49 2010 +0100
scons: Update file lists after gallium-resources changes.
commit af9793ab9e5386b150d6b25c0d1978fdc67172e4
Author: Michal Krol <[email protected]>
Date: Mon Mar 22 20:04:39 2010 +0100
gallium: Do not use `template` for formal parameter names.
commit dc2e12d714c444af9ff1acdd5a7e91408b116c99
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 21 22:41:34 2010 +0000
ws/nouveau: remove pipe_texture reference
commit b94c72329f1be85887d40d49b0586979da469d77
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 21 22:40:41 2010 +0000
ws/xlib: remove pipe_buffer reference in comment
commit 0a2af3eeae7de1d1cb433f0a2c35136b115f9920
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 21 22:39:34 2010 +0000
st/vega: clean up reference to pipe_texture
commit 437ce98daae46be5d532fbb04c7cbf4a503c1623
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
Date: Sun Mar 21 22:29:34 2010 +0000
st/xorg: update for pipe_resources
commit eb39977fe7a1d9f0c3f4f2d4303a93c2c613cc3b
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 21 22:23:51 2010 +0000
st/dri: update for pipe_resources
commit e447aeff597a4d8c0f5de25854c14c99f2cc138c
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 21 22:23:36 2010 +0000
st/egl: update for pipe_resources
commit e4cc48da8fdbd7d521257a6d7cd10e6fc5aa1a65
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 21 22:08:44 2010 +0000
r300: drop use of R300 DONT SYNC flag
commit 129a83ab4d32e44ded5faea3f86ae5e1e62cddb6
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 21 22:08:17 2010 +0000
pipebuffer: use transfer flag
commit 575b35ee6b683d77095ef21c573c1de207107e79
Merge: f29ac73 9fc6c8b
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date: Sun Mar 21 17:25:10 2010 +0000
nv50: fix warning
commit 9683f4423449fa5acf6c019c571223650473bd82
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 21 17:14:31 2010 +0000
util: restore u_simple_screen, nouveau still relies on it
commit 961cbcb62232689c959965384c6aa9b8eca697c1
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
Date: Sun Mar 21 10:02:54 2010 +0000
r300: fix compilation after merge
Also build r300 by default.
commit eb9c0175c8e4baca3fcb0b8364f83ceba9d74e0d
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 21 09:59:49 2010 +0000
st/vega: fix up after merge
commit ea8dd1d4ae7b58c9315c3491046ef3852ddd3377
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 21 09:59:44 2010 +0000
aux: remove unused piperesource helpers
commit be7af29d3ad1a10409b0ea689d882cf30a4e1d62
Merge: d22c2c6 12deb9e
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date: Thu Mar 18 06:00:34 2010 +0000
gallium: update new merges to pipe_resource
commit 1cad983eac77a0c5333e6a3ce92b90ac87407714
Author: Keith Whitwell <[email protected]>
Date: Thu Mar 18 06:00:19 2010 +0000
drm/sw: update new merges to pipe_resource
commit 191d39490ed792c569f98d42cf05891b264f71f8
Author: Keith Whitwell <[email protected]>
Date: Thu Mar 18 06:00:01 2010 +0000
vg: update new merges to pipe_resource
commit b727c59bc44812ad503d9390505c92b738a5b8b0
Author: Keith Whitwell <[email protected]>
Date: Thu Mar 18 05:59:38 2010 +0000
llvmpipe: update new merges to pipe_resource
commit 5f4b64b37fdcd70162c382b2ebbd494bef751dbd
Author: Keith Whitwell <[email protected]>
Date: Thu Mar 18 05:59:23 2010 +0000
brw: pipe_resource fixes
commit d4aca209f531f1b65bf706ce1e5fc0375b587eb6
Author: Keith Whitwell <[email protected]>
Date: Thu Mar 18 05:59:06 2010 +0000
util: update new merges to pipe_resource
commit cf6bef0afee10763c78509a3d17e9a6e49bcd3c8
Merge: 1997231 6de8e56
Author: Keith Whitwell <[email protected]>
Date: Thu Mar 18 05:38:50 2010 +0000
Merge commit 'origin/master' into gallium-resources
commit 1997231916144485c3c4a36f53eda39fce460272
Merge: ad88ac7 e1ee3ea
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date: Mon Mar 15 22:21:48 2010 +0000
util: missing file
commit f83c91db8ae63a3c3a34ff21492427a5663fb760
Merge: c1d4774 42910eb
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date: Sun Mar 14 23:05:45 2010 +0000
llvmpipe: don't FREE userbuffer data
commit 9bfa07afe179f8060e7beefb754a29c4d9c6e349
Merge: 65757a1 08cddfe
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
Date: Sun Mar 14 22:41:17 2010 +0000
svga: build fixes
commit 2f5435220501d4b3050cab2bb1dce6174cd13ff6
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 22:39:25 2010 +0000
gallivm: build fix
commit 42642ec0984107d82b740711f2debbf38457a06e
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 22:38:33 2010 +0000
llvmpipe: convert to pipe_resources
commit 7bbcb21e20cb545ef8dd5fc61d67ed931c69e813
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 22:19:30 2010 +0000
gallivm: convert to pipe_resources
commit 88ae0d04610ca52649b42e32141a52af6d5a739b
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 21:01:22 2010 +0000
configs: build svga
commit 0e112bc69828e65085ebfaef895ecd78fe53f1c4
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 21:01:17 2010 +0000
gallium: restore PIPE_BUFFER_USAGE_CUSTOM
commit 102aca688b95c976b7178b84092fba7d041ff9d2
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 21:00:41 2010 +0000
util: more transfer helpers
commit a79f6a4a0836fc64c07f9aeec21d914474fe3649
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
Date: Sun Mar 14 18:38:08 2010 +0000
brw: fix function name
commit cfc9dd707d16e06fd23b6926da3a6e2269f31dc8
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 18:19:06 2010 +0000
gallium: enable brw compile
commit 8a5b86d76bdd3c7de63322423f59940a4dc2ee25
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 18:18:50 2010 +0000
brw: compiles with pipe_resource
commit 563ca458b548c41ca4dca559354c16ca1a80d009
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 18:18:42 2010 +0000
i915: hook up userbuffer create
commit b5095b48247b6020e36cc942ac145c3fccbe9a19
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 17:20:51 2010 +0000
i915: use helpers for is_resource_referenced
commit d5392bdc6d70002acf9c5bac0fde14ba405c4d84
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 17:20:38 2010 +0000
util: helpers for is_resource_referenced
commit 2f3492a5aefbb2e745f6700d8e910ebb5cbb98cf
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 17:08:50 2010 +0000
i915: remove buffer.c again
commit 1373a35b65fcc25ec6cdfea2703bbb3417de2c6d
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 17:08:34 2010 +0000
i915: add new files to scons
commit 0251612d70e57fe38e10e75915b394631d224f2c
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 16:38:29 2010 +0000
i915: compiling with pipe_resources
commit 9a0235864252929a8eedd44dbd2fe30fe54c531d
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 13:51:16 2010 +0000
gallium: remove inline_read transfer
commit a6ba315e25793e0c228d3a4ae2f8201634dc9ff0
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date: Sun Mar 14 12:30:37 2010 +0000
identity: hook up inline transfer operations
commit e4c152a344f2f53c842b810724a2ae7cb4554f58
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 12:21:54 2010 +0000
gallium: build trace and identity
commit 0b5a311db78852fa9fd021e17b5968a1e0436b49
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
Date: Sun Mar 14 12:19:46 2010 +0000
identity: compiles with pipe_resources
commit d0d630944304c208f6dade6ef8836763ee2bc7b4
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 12:13:02 2010 +0000
trace: compiles with pipe_resources
commit a4451ea459cc8bfc915fe6aed2891b90854b6c9d
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
Date: Sun Mar 14 11:39:21 2010 +0000
util: correct argument order in pipe_buffer_map
commit 7e2696c06445282feb781047277b260308760a33
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 11:32:55 2010 +0000
softpipe: transfer flush
commit a0543b13c042e3c1142522d9d136f16fd4cabf78
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 11:32:13 2010 +0000
util: noop implementation of transfer_flush_region
commit ce418533be752dbeb164e7ff82a99483048e482b
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 11:26:07 2010 +0000
gallium: softpipe runs gears with pipe_resources
commit bfda4f2eb34498e4b7f3c608d30fccff6bb9651b
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 11:25:48 2010 +0000
util: get clip_tile working again
commit f5ef219c3bed62b6a0da842e675fae16268e0fbe
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 09:43:20 2010 +0000
softpipe: use u_transfer helpers
commit 072957aab25affecf0702e925310e46c694a5ee4
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 09:42:46 2010 +0000
util: helpers for inline transfers
commit 9c45561fb0d7a52400093bcb2ce5f727fafd7777
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 09:42:25 2010 +0000
util: fix typo calculating transfer box
commit f3e98fd47f36804d019a684d49ff230df3ab0cf5
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 09:25:46 2010 +0000
st/vega: convert to pipe_resource
commit d1b7b00afc944f6499c83d676c7642115d62a62c
Author: Keith Whitwell <[email protected]>
Date: Sun Mar 14 08:37:56 2010 +0000
gallium: begin converting drivers to pipe_resource
Work in progress...
commit 51c25117f5d6da1926a2be5ecc66677952a8abf0
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
Date: Sat Mar 13 19:19:09 2010 +0000
heaps of wip
commit ee6b3bc730fcdaf8da3646d62f04578ec06d36a1
Author: Keith Whitwell <[email protected]>
Date: Sat Mar 13 16:38:02 2010 +0000
wip2
commit 1830880212445189fe267d615075239ed17c7cc0
Merge: 90b4045 47bfbd4
Author: Keith Whitwell <[email protected]>
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 <[email protected]>
Date: Sat Mar 13 14:52:43 2010 +0000
wip
Diffstat (limited to 'src/gallium/state_trackers/xorg')
26 files changed, 145 insertions, 2423 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index eef428232b0..669bd9edcf0 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -62,7 +62,7 @@ struct crtc_private drmModeCrtcPtr drm_crtc; /* hwcursor */ - struct pipe_texture *cursor_tex; + struct pipe_resource *cursor_tex; struct kms_bo *cursor_bo; unsigned cursor_handle; @@ -197,12 +197,12 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image) struct pipe_transfer *transfer; if (!crtcp->cursor_tex) { - struct pipe_texture templat; + struct pipe_resource templat; struct winsys_handle whandle; memset(&templat, 0, sizeof(templat)); - templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET; - templat.tex_usage |= PIPE_TEXTURE_USAGE_SCANOUT; + templat.bind |= PIPE_BIND_RENDER_TARGET; + templat.bind |= PIPE_BIND_SCANOUT; templat.target = PIPE_TEXTURE_2D; templat.last_level = 0; templat.depth0 = 1; @@ -213,14 +213,14 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image) memset(&whandle, 0, sizeof(whandle)); whandle.type = DRM_API_HANDLE_TYPE_KMS; - crtcp->cursor_tex = ms->screen->texture_create(ms->screen, + crtcp->cursor_tex = ms->screen->resource_create(ms->screen, &templat); - ms->screen->texture_get_handle(ms->screen, crtcp->cursor_tex, &whandle); + ms->screen->resource_get_handle(ms->screen, crtcp->cursor_tex, &whandle); crtcp->cursor_handle = whandle.handle; } - transfer = ms->ctx->get_tex_transfer(ms->ctx, crtcp->cursor_tex, + transfer = pipe_get_transfer(ms->ctx, crtcp->cursor_tex, 0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0, 64, 64); @@ -229,7 +229,7 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image) transfer->stride, 0, 0, 64, 64, (void*)image, 64 * 4, 0, 0); ms->ctx->transfer_unmap(ms->ctx, transfer); - ms->ctx->tex_transfer_destroy(ms->ctx, transfer); + ms->ctx->transfer_destroy(ms->ctx, transfer); } #if HAVE_LIBKMS @@ -329,7 +329,7 @@ xorg_crtc_cursor_destroy(xf86CrtcPtr crtc) struct crtc_private *crtcp = crtc->driver_private; if (crtcp->cursor_tex) - pipe_texture_reference(&crtcp->cursor_tex, NULL); + pipe_resource_reference(&crtcp->cursor_tex, NULL); #ifdef HAVE_LIBKMS if (crtcp->cursor_bo) kms_bo_destroy(&crtcp->cursor_bo); diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index 91c251bb4ff..b90f9c908d2 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -53,14 +53,14 @@ static Bool set_format_in_do_create_buffer; typedef struct { PixmapPtr pPixmap; - struct pipe_texture *tex; + struct pipe_resource *tex; struct pipe_fence_handle *fence; } *BufferPrivatePtr; static Bool dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format) { - struct pipe_texture *tex = NULL; + struct pipe_resource *tex = NULL; ScreenPtr pScreen = pDraw->pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); @@ -101,9 +101,9 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form /* Fall through */ case DRI2BufferDepth: if (exa_priv->depth_stencil_tex) - pipe_texture_reference(&tex, exa_priv->depth_stencil_tex); + pipe_resource_reference(&tex, exa_priv->depth_stencil_tex); else { - struct pipe_texture template; + struct pipe_resource template; unsigned depthBits = (format != 0) ? format : pDraw->depth; memset(&template, 0, sizeof(template)); template.target = PIPE_TEXTURE_2D; @@ -128,10 +128,10 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form template.height0 = pDraw->height; template.depth0 = 1; template.last_level = 0; - template.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL | - PIPE_TEXTURE_USAGE_SHARED; - tex = ms->screen->texture_create(ms->screen, &template); - pipe_texture_reference(&exa_priv->depth_stencil_tex, tex); + template.bind = PIPE_BIND_DEPTH_STENCIL | + PIPE_BIND_SHARED; + tex = ms->screen->resource_create(ms->screen, &template); + pipe_resource_reference(&exa_priv->depth_stencil_tex, tex); } break; } @@ -157,7 +157,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form memset(&whandle, 0, sizeof(whandle)); whandle.type = DRM_API_HANDLE_TYPE_SHARED; - ms->screen->texture_get_handle(ms->screen, tex, &whandle); + ms->screen->resource_get_handle(ms->screen, tex, &whandle); buffer->name = whandle.handle; buffer->pitch = whandle.stride; @@ -185,9 +185,9 @@ dri2_do_destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer) BufferPrivatePtr private = buffer->driverPrivate; struct exa_pixmap_priv *exa_priv = exaGetPixmapDriverPrivate(private->pPixmap); - pipe_texture_reference(&private->tex, NULL); + pipe_resource_reference(&private->tex, NULL); ms->screen->fence_reference(ms->screen, &private->fence, NULL); - pipe_texture_reference(&exa_priv->depth_stencil_tex, NULL); + pipe_resource_reference(&exa_priv->depth_stencil_tex, NULL); (*pScreen->DestroyPixmap)(private->pPixmap); } @@ -437,11 +437,11 @@ xorg_dri2_init(ScreenPtr pScreen) ms->d_depth_bits_last = ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24X8_UNORM, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL, 0); ms->ds_depth_bits_last = ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL, 0); return DRI2ScreenInit(pScreen, &dri2info); } diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index a59e8dcad51..3687ee0db4e 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -985,7 +985,7 @@ drv_destroy_front_buffer_ga3d(ScrnInfoPtr pScrn) ms->fb_id = -1; } - pipe_texture_reference(&ms->root_texture, NULL); + pipe_resource_reference(&ms->root_texture, NULL); return TRUE; } @@ -993,7 +993,7 @@ static Bool drv_create_front_buffer_ga3d(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); - struct pipe_texture *tex; + struct pipe_resource *tex; struct winsys_handle whandle; unsigned fb_id; int ret; @@ -1009,7 +1009,7 @@ drv_create_front_buffer_ga3d(ScrnInfoPtr pScrn) memset(&whandle, 0, sizeof(whandle)); whandle.type = DRM_API_HANDLE_TYPE_KMS; - if (!ms->screen->texture_get_handle(ms->screen, tex, &whandle)) + if (!ms->screen->resource_get_handle(ms->screen, tex, &whandle)) goto err_destroy; ret = drmModeAddFB(ms->fd, @@ -1033,14 +1033,14 @@ drv_create_front_buffer_ga3d(ScrnInfoPtr pScrn) pScrn->frameY0 = 0; drv_adjust_frame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - pipe_texture_reference(&ms->root_texture, tex); - pipe_texture_reference(&tex, NULL); + pipe_resource_reference(&ms->root_texture, tex); + pipe_resource_reference(&tex, NULL); ms->fb_id = fb_id; return TRUE; err_destroy: - pipe_texture_reference(&tex, NULL); + pipe_resource_reference(&tex, NULL); return FALSE; } @@ -1050,7 +1050,7 @@ drv_bind_front_buffer_ga3d(ScrnInfoPtr pScrn) modesettingPtr ms = modesettingPTR(pScrn); ScreenPtr pScreen = pScrn->pScreen; PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen); - struct pipe_texture *check; + struct pipe_resource *check; xorg_exa_set_displayed_usage(rootPixmap); xorg_exa_set_shared_usage(rootPixmap); @@ -1062,7 +1062,7 @@ drv_bind_front_buffer_ga3d(ScrnInfoPtr pScrn) if (ms->root_texture != check) FatalError("Created new root texture\n"); - pipe_texture_reference(&check, NULL); + pipe_resource_reference(&check, NULL); return TRUE; } diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 76e6411bb8c..d5a1be81747 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -188,7 +188,7 @@ ExaDownloadFromScreen(PixmapPtr pPix, int x, int y, int w, int h, char *dst, if (!priv || !priv->tex) return FALSE; - transfer = exa->pipe->get_tex_transfer(exa->pipe, priv->tex, 0, 0, 0, + transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0, 0, PIPE_TRANSFER_READ, x, y, w, h); if (!transfer) return FALSE; @@ -203,7 +203,7 @@ ExaDownloadFromScreen(PixmapPtr pPix, int x, int y, int w, int h, char *dst, transfer->stride, 0, 0); exa->pipe->transfer_unmap(exa->pipe, transfer); - exa->pipe->tex_transfer_destroy(exa->pipe, transfer); + exa->pipe->transfer_destroy(exa->pipe, transfer); return TRUE; } @@ -222,7 +222,7 @@ ExaUploadToScreen(PixmapPtr pPix, int x, int y, int w, int h, char *src, if (!priv || !priv->tex) return FALSE; - transfer = exa->pipe->get_tex_transfer(exa->pipe, priv->tex, 0, 0, 0, + transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0, 0, PIPE_TRANSFER_WRITE, x, y, w, h); if (!transfer) return FALSE; @@ -237,7 +237,7 @@ ExaUploadToScreen(PixmapPtr pPix, int x, int y, int w, int h, char *src, (unsigned char*)src, src_pitch, 0, 0); exa->pipe->transfer_unmap(exa->pipe, transfer); - exa->pipe->tex_transfer_destroy(exa->pipe, transfer); + exa->pipe->transfer_destroy(exa->pipe, transfer); return TRUE; } @@ -265,7 +265,7 @@ ExaPrepareAccess(PixmapPtr pPix, int index) assert(pPix->drawable.height <= priv->tex->height0); priv->map_transfer = - exa->pipe->get_tex_transfer(exa->pipe, priv->tex, 0, 0, 0, + pipe_get_transfer(exa->pipe, priv->tex, 0, 0, 0, #ifdef EXA_MIXED_PIXMAPS PIPE_TRANSFER_MAP_DIRECTLY | #endif @@ -309,7 +309,7 @@ ExaFinishAccess(PixmapPtr pPix, int index) if (--priv->map_count == 0) { assert(priv->map_transfer); exa->pipe->transfer_unmap(exa->pipe, priv->map_transfer); - exa->pipe->tex_transfer_destroy(exa->pipe, priv->map_transfer); + exa->pipe->transfer_destroy(exa->pipe, priv->map_transfer); priv->map_transfer = NULL; pPix->devPrivate.ptr = NULL; } @@ -347,7 +347,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, - PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { + PIPE_BIND_RENDER_TARGET, 0)) { XORG_FALLBACK("format %s", util_format_name(priv->tex->format)); } @@ -428,12 +428,12 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, - PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) + PIPE_BIND_RENDER_TARGET, 0)) XORG_FALLBACK("pDst format %s", util_format_name(priv->tex->format)); if (!exa->scrn->is_format_supported(exa->scrn, src_priv->tex->format, src_priv->tex->target, - PIPE_TEXTURE_USAGE_SAMPLER, 0)) + PIPE_BIND_SAMPLER_VIEW, 0)) XORG_FALLBACK("pSrc format %s", util_format_name(src_priv->tex->format)); exa->copy.src = src_priv; @@ -453,13 +453,13 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, exa->scrn->get_tex_surface( exa->scrn, exa->copy.src->tex, 0, 0, 0, - PIPE_BUFFER_USAGE_GPU_READ); + PIPE_BIND_BLIT_SOURCE); exa->copy.dst_surface = exa->scrn->get_tex_surface( exa->scrn, exa->copy.dst->tex, 0, 0, 0, - PIPE_BUFFER_USAGE_GPU_WRITE ); + PIPE_BIND_BLIT_DESTINATION ); } else { exa->copy.use_surface_copy = FALSE; @@ -468,14 +468,14 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, exa->copy.src_texture = renderer_clone_texture( exa->renderer, exa->copy.src->tex ); else - pipe_texture_reference(&exa->copy.src_texture, + pipe_resource_reference(&exa->copy.src_texture, exa->copy.src->tex); exa->copy.dst_surface = exa->scrn->get_tex_surface(exa->scrn, exa->copy.dst->tex, 0, 0, 0, - PIPE_BUFFER_USAGE_GPU_WRITE); + PIPE_BIND_BLIT_DESTINATION); renderer_copy_prepare(exa->renderer, @@ -541,7 +541,7 @@ ExaDoneCopy(PixmapPtr pPixmap) exa->copy.dst = NULL; pipe_surface_reference(&exa->copy.src_surface, NULL); pipe_surface_reference(&exa->copy.dst_surface, NULL); - pipe_texture_reference(&exa->copy.src_texture, NULL); + pipe_resource_reference(&exa->copy.src_texture, NULL); } @@ -639,7 +639,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, - PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) + PIPE_BIND_RENDER_TARGET, 0)) XORG_FALLBACK("pDst format: %s", util_format_name(priv->tex->format)); if (priv->picture_format != pDstPicture->format) @@ -654,7 +654,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, - PIPE_TEXTURE_USAGE_SAMPLER, 0)) + PIPE_BIND_SAMPLER_VIEW, 0)) XORG_FALLBACK("pSrc format: %s", util_format_name(priv->tex->format)); if (!picture_check_formats(priv, pSrcPicture)) @@ -671,7 +671,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, - PIPE_TEXTURE_USAGE_SAMPLER, 0)) + PIPE_BIND_SAMPLER_VIEW, 0)) XORG_FALLBACK("pMask format: %s", util_format_name(priv->tex->format)); if (!picture_check_formats(priv, pMaskPicture)) @@ -744,7 +744,7 @@ ExaDestroyPixmap(ScreenPtr pScreen, void *dPriv) if (!priv) return; - pipe_texture_reference(&priv->tex, NULL); + pipe_resource_reference(&priv->tex, NULL); xfree(priv); } @@ -776,7 +776,7 @@ xorg_exa_set_displayed_usage(PixmapPtr pPixmap) return 0; } - priv->flags |= PIPE_TEXTURE_USAGE_SCANOUT; + priv->flags |= PIPE_BIND_SCANOUT; return 0; } @@ -792,7 +792,7 @@ xorg_exa_set_shared_usage(PixmapPtr pPixmap) return 0; } - priv->flags |= PIPE_TEXTURE_USAGE_SHARED; + priv->flags |= PIPE_BIND_SHARED; return 0; } @@ -867,8 +867,8 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, !size_match(width, priv->tex->width0) || !size_match(height, priv->tex->height0) || priv->tex_flags != priv->flags)) { - struct pipe_texture *texture = NULL; - struct pipe_texture template; + struct pipe_resource *texture = NULL; + struct pipe_resource template; memset(&template, 0, sizeof(template)); template.target = PIPE_TEXTURE_2D; @@ -884,16 +884,16 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, template.depth0 = 1; template.last_level = 0; - template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET | priv->flags; + template.bind = PIPE_BIND_RENDER_TARGET | priv->flags; priv->tex_flags = priv->flags; - texture = exa->scrn->texture_create(exa->scrn, &template); + texture = exa->scrn->resource_create(exa->scrn, &template); if (priv->tex) { struct pipe_surface *dst_surf; struct pipe_surface *src_surf; dst_surf = exa->scrn->get_tex_surface( - exa->scrn, texture, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE); + exa->scrn, texture, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION); src_surf = xorg_gpu_surface(exa->pipe->screen, priv); if (exa->pipe->surface_copy) { exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf, @@ -908,29 +908,29 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, exa->scrn->tex_surface_destroy(src_surf); } - pipe_texture_reference(&priv->tex, texture); + pipe_resource_reference(&priv->tex, texture); /* the texture we create has one reference */ - pipe_texture_reference(&texture, NULL); + pipe_resource_reference(&texture, NULL); } return TRUE; } -struct pipe_texture * +struct pipe_resource * xorg_exa_get_texture(PixmapPtr pPixmap) { struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); - struct pipe_texture *tex = NULL; - pipe_texture_reference(&tex, priv->tex); + struct pipe_resource *tex = NULL; + pipe_resource_reference(&tex, priv->tex); return tex; } Bool -xorg_exa_set_texture(PixmapPtr pPixmap, struct pipe_texture *tex) +xorg_exa_set_texture(PixmapPtr pPixmap, struct pipe_resource *tex) { struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); - int mask = PIPE_TEXTURE_USAGE_SHARED | PIPE_TEXTURE_USAGE_SCANOUT; + int mask = PIPE_BIND_SHARED | PIPE_BIND_SCANOUT; if (!priv) return FALSE; @@ -939,20 +939,20 @@ xorg_exa_set_texture(PixmapPtr pPixmap, struct pipe_texture *tex) pPixmap->drawable.height != tex->height0) return FALSE; - pipe_texture_reference(&priv->tex, tex); - priv->tex_flags = tex->tex_usage & mask; + pipe_resource_reference(&priv->tex, tex); + priv->tex_flags = tex->bind & mask; return TRUE; } -struct pipe_texture * +struct pipe_resource * xorg_exa_create_root_texture(ScrnInfoPtr pScrn, int width, int height, int depth, int bitsPerPixel) { modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; - struct pipe_texture template; + struct pipe_resource template; int dummy; memset(&template, 0, sizeof(template)); @@ -962,11 +962,11 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn, template.height0 = height; template.depth0 = 1; template.last_level = 0; - template.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET; - template.tex_usage |= PIPE_TEXTURE_USAGE_SCANOUT; - template.tex_usage |= PIPE_TEXTURE_USAGE_SHARED; + template.bind |= PIPE_BIND_RENDER_TARGET; + template.bind |= PIPE_BIND_SCANOUT; + template.bind |= PIPE_BIND_SHARED; - return exa->scrn->texture_create(exa->scrn, &template); + return exa->scrn->resource_create(exa->scrn, &template); } void @@ -1073,9 +1073,12 @@ out_err: struct pipe_surface * xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv) { + + /* seems to get called both for blits and render target usage */ return scrn->get_tex_surface(scrn, priv->tex, 0, 0, 0, - PIPE_BUFFER_USAGE_GPU_READ | - PIPE_BUFFER_USAGE_GPU_WRITE); + PIPE_BIND_BLIT_SOURCE | + PIPE_BIND_BLIT_DESTINATION | + PIPE_BIND_RENDER_TARGET); } diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index 41b19061599..a35e9a5c901 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -43,7 +43,7 @@ struct exa_context struct pipe_surface *src_surface; struct pipe_surface *dst_surface; - struct pipe_texture *src_texture; + struct pipe_resource *src_texture; } copy; }; @@ -56,8 +56,8 @@ struct exa_pixmap_priv int picture_format; - struct pipe_texture *tex; - struct pipe_texture *depth_stencil_tex; + struct pipe_resource *tex; + struct pipe_resource *depth_stencil_tex; struct pipe_transfer *map_transfer; unsigned map_count; diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 81b0dcf656f..13fa561390f 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -42,14 +42,16 @@ static INLINE void map_point(float *mat, float x, float y, } } -static INLINE struct pipe_buffer * +static INLINE struct pipe_resource * renderer_buffer_create(struct xorg_renderer *r) { - struct pipe_buffer *buf = + struct pipe_resource *buf = pipe_user_buffer_create(r->pipe->screen, r->buffer, sizeof(float)* - r->buffer_size); + r->buffer_size, +/* XXX was: PIPE_BUFFER_USAGE_PIXEL/PIPE_BUFFER_USAGE_GPU_WRITE even though this is a vertex buffer??? */ + PIPE_BIND_VERTEX_BUFFER); r->buffer_size = 0; return buf; @@ -59,7 +61,7 @@ static INLINE void renderer_draw(struct xorg_renderer *r) { struct pipe_context *pipe = r->pipe; - struct pipe_buffer *buf = 0; + struct pipe_resource *buf = 0; int num_verts = r->buffer_size/(r->attrs_per_vertex * NUM_COMPONENTS); if (!r->buffer_size) @@ -76,7 +78,7 @@ renderer_draw(struct xorg_renderer *r) num_verts, /* verts */ r->attrs_per_vertex); /* attribs/vert */ - pipe_buffer_reference(&buf, NULL); + pipe_resource_reference(&buf, NULL); } } @@ -161,7 +163,7 @@ static void add_vertex_data1(struct xorg_renderer *r, float srcX, float srcY, float dstX, float dstY, float width, float height, - struct pipe_texture *src, float *src_matrix) + struct pipe_resource *src, float *src_matrix) { float s0, t0, s1, t1, s2, t2, s3, t3; float pt0[2], pt1[2], pt2[2], pt3[2]; @@ -231,8 +233,8 @@ static void add_vertex_data2(struct xorg_renderer *r, float srcX, float srcY, float maskX, float maskY, float dstX, float dstY, float width, float height, - struct pipe_texture *src, - struct pipe_texture *mask, + struct pipe_resource *src, + struct pipe_resource *mask, float *src_matrix, float *mask_matrix) { float src_s0, src_t0, src_s1, src_t1; @@ -284,11 +286,11 @@ add_vertex_data2(struct xorg_renderer *r, src_s0, src_t1, mask_s0, mask_t1); } -static struct pipe_buffer * +static struct pipe_resource * setup_vertex_data_yuv(struct xorg_renderer *r, float srcX, float srcY, float srcW, float srcH, float dstX, float dstY, float dstW, float dstH, - struct pipe_texture **tex) + struct pipe_resource **tex) { float s0, t0, s1, t1; float spt0[2], spt1[2]; @@ -390,14 +392,14 @@ struct xorg_renderer * renderer_create(struct pipe_context *pipe) void renderer_destroy(struct xorg_renderer *r) { - struct pipe_buffer **vsbuf = &r->vs_const_buffer; - struct pipe_buffer **fsbuf = &r->fs_const_buffer; + struct pipe_resource **vsbuf = &r->vs_const_buffer; + struct pipe_resource **fsbuf = &r->fs_const_buffer; if (*vsbuf) - pipe_buffer_reference(vsbuf, NULL); + pipe_resource_reference(vsbuf, NULL); if (*fsbuf) - pipe_buffer_reference(fsbuf, NULL); + pipe_resource_reference(fsbuf, NULL); if (r->shaders) { xorg_shaders_destroy(r->shaders); @@ -420,17 +422,17 @@ void renderer_set_constants(struct xorg_renderer *r, const float *params, int param_bytes) { - struct pipe_buffer **cbuf = + struct pipe_resource **cbuf = (shader_type == PIPE_SHADER_VERTEX) ? &r->vs_const_buffer : &r->fs_const_buffer; - pipe_buffer_reference(cbuf, NULL); - *cbuf = pipe_buffer_create(r->pipe->screen, 16, - PIPE_BUFFER_USAGE_CONSTANT, + pipe_resource_reference(cbuf, NULL); + *cbuf = pipe_buffer_create(r->pipe->screen, + PIPE_BIND_CONSTANT_BUFFER, param_bytes); if (*cbuf) { - pipe_buffer_write(r->pipe->screen, *cbuf, + pipe_buffer_write(r->pipe, *cbuf, 0, param_bytes, params); } r->pipe->set_constant_buffer(r->pipe, shader_type, 0, *cbuf); @@ -439,7 +441,7 @@ void renderer_set_constants(struct xorg_renderer *r, void renderer_copy_prepare(struct xorg_renderer *r, struct pipe_surface *dst_surface, - struct pipe_texture *src_texture) + struct pipe_resource *src_texture) { struct pipe_context *pipe = r->pipe; struct pipe_screen *screen = pipe->screen; @@ -447,7 +449,7 @@ void renderer_copy_prepare(struct xorg_renderer *r, assert(screen->is_format_supported(screen, dst_surface->format, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_RENDER_TARGET, + PIPE_BIND_RENDER_TARGET, 0)); (void) screen; @@ -506,24 +508,24 @@ void renderer_copy_prepare(struct xorg_renderer *r, r->attrs_per_vertex = 2; } -struct pipe_texture * +struct pipe_resource * renderer_clone_texture(struct xorg_renderer *r, - struct pipe_texture *src) + struct pipe_resource *src) { enum pipe_format format; struct pipe_context *pipe = r->pipe; struct pipe_screen *screen = pipe->screen; - struct pipe_texture *pt; - struct pipe_texture templ; + struct pipe_resource *pt; + struct pipe_resource templ; - if (pipe->is_texture_referenced(pipe, src, 0, 0) & + if (pipe->is_resource_referenced(pipe, src, 0, 0) & PIPE_REFERENCED_FOR_WRITE) pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); /* the coming in texture should already have that invariance */ debug_assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_SAMPLER, 0)); + PIPE_BIND_SAMPLER_VIEW, 0)); format = src->format; @@ -534,9 +536,9 @@ renderer_clone_texture(struct xorg_renderer *r, templ.width0 = src->width0; templ.height0 = src->height0; templ.depth0 = 1; - templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; + templ.bind = PIPE_BIND_SAMPLER_VIEW; - pt = screen->texture_create(screen, &templ); + pt = screen->resource_create(screen, &templ); debug_assert(!pt || pipe_is_referenced(&pt->reference)); @@ -546,9 +548,9 @@ renderer_clone_texture(struct xorg_renderer *r, { /* copy source framebuffer surface into texture */ struct pipe_surface *ps_read = screen->get_tex_surface( - screen, src, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ); + screen, src, 0, 0, 0, PIPE_BIND_BLIT_SOURCE); struct pipe_surface *ps_tex = screen->get_tex_surface( - screen, pt, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE ); + screen, pt, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION ); if (pipe->surface_copy) { pipe->surface_copy(pipe, ps_tex, /* dest */ @@ -608,10 +610,10 @@ void renderer_copy_pixmap(struct xorg_renderer *r, void renderer_draw_yuv(struct xorg_renderer *r, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, - struct pipe_texture **textures) + struct pipe_resource **textures) { struct pipe_context *pipe = r->pipe; - struct pipe_buffer *buf = 0; + struct pipe_resource *buf = 0; buf = setup_vertex_data_yuv(r, src_x, src_y, src_w, src_h, @@ -628,7 +630,7 @@ void renderer_draw_yuv(struct xorg_renderer *r, 4, /* verts */ num_attribs); /* attribs/vert */ - pipe_buffer_reference(&buf, NULL); + pipe_resource_reference(&buf, NULL); } } diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index cc5802e79b2..0454a6513d4 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -23,8 +23,8 @@ struct xorg_renderer { int fb_width; int fb_height; - struct pipe_buffer *vs_const_buffer; - struct pipe_buffer *fs_const_buffer; + struct pipe_resource *vs_const_buffer; + struct pipe_resource *fs_const_buffer; float buffer[BUF_SIZE]; int buffer_size; @@ -56,7 +56,7 @@ void renderer_set_constants(struct xorg_renderer *r, void renderer_draw_yuv(struct xorg_renderer *r, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, - struct pipe_texture **textures); + struct pipe_resource **textures); void renderer_begin_solid(struct xorg_renderer *r); void renderer_solid(struct xorg_renderer *r, @@ -77,13 +77,13 @@ void renderer_texture(struct xorg_renderer *r, void renderer_draw_flush(struct xorg_renderer *r); -struct pipe_texture * +struct pipe_resource * renderer_clone_texture(struct xorg_renderer *r, - struct pipe_texture *src); + struct pipe_resource *src); void renderer_copy_prepare(struct xorg_renderer *r, struct pipe_surface *dst_surface, - struct pipe_texture *src_texture); + struct pipe_resource *src_texture); void renderer_copy_pixmap(struct xorg_renderer *r, int dx, int dy, diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index c1884ebd115..cb6773424a8 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -118,7 +118,7 @@ typedef struct _modesettingRec struct pipe_context *ctx; boolean d_depth_bits_last; boolean ds_depth_bits_last; - struct pipe_texture *root_texture; + struct pipe_resource *root_texture; /* exa */ struct exa_context *exa; @@ -142,7 +142,7 @@ Bool xorg_has_gallium(ScrnInfoPtr pScrn); /*********************************************************************** * xorg_exa.c */ -struct pipe_texture * +struct pipe_resource * xorg_exa_get_texture(PixmapPtr pPixmap); int @@ -152,9 +152,9 @@ int xorg_exa_set_shared_usage(PixmapPtr pPixmap); Bool -xorg_exa_set_texture(PixmapPtr pPixmap, struct pipe_texture *tex); +xorg_exa_set_texture(PixmapPtr pPixmap, struct pipe_resource *tex); -struct pipe_texture * +struct pipe_resource * xorg_exa_create_root_texture(ScrnInfoPtr pScrn, int width, int height, int depth, int bpp); diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 5efda6837de..a221594454e 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -91,7 +91,7 @@ struct xorg_xv_port_priv { int current_set; /* juggle two sets of seperate Y, U and V * textures */ - struct pipe_texture *yuv[2][3]; + struct pipe_resource *yuv[2][3]; struct pipe_sampler_view *yuv_views[2][3]; }; @@ -156,13 +156,13 @@ query_best_size(ScrnInfoPtr pScrn, *p_h = drw_h; } -static INLINE struct pipe_texture * +static INLINE struct pipe_resource * create_component_texture(struct pipe_context *pipe, int width, int height) { struct pipe_screen *screen = pipe->screen; - struct pipe_texture *tex = 0; - struct pipe_texture templ; + struct pipe_resource *tex = 0; + struct pipe_resource templ; memset(&templ, 0, sizeof(templ)); templ.target = PIPE_TEXTURE_2D; @@ -171,9 +171,9 @@ create_component_texture(struct pipe_context *pipe, templ.width0 = width; templ.height0 = height; templ.depth0 = 1; - templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; + templ.bind = PIPE_BIND_SAMPLER_VIEW; - tex = screen->texture_create(screen, &templ); + tex = screen->resource_create(screen, &templ); return tex; } @@ -181,7 +181,7 @@ create_component_texture(struct pipe_context *pipe, static int check_yuv_textures(struct xorg_xv_port_priv *priv, int width, int height) { - struct pipe_texture **dst = priv->yuv[priv->current_set]; + struct pipe_resource **dst = priv->yuv[priv->current_set]; struct pipe_sampler_view **dst_view = priv->yuv_views[priv->current_set]; struct pipe_sampler_view view_templ; struct pipe_context *pipe = priv->r->pipe; @@ -189,19 +189,19 @@ check_yuv_textures(struct xorg_xv_port_priv *priv, int width, int height) if (!dst[0] || dst[0]->width0 != width || dst[0]->height0 != height) { - pipe_texture_reference(&dst[0], NULL); + pipe_resource_reference(&dst[0], NULL); pipe_sampler_view_reference(&dst_view[0], NULL); } if (!dst[1] || dst[1]->width0 != width || dst[1]->height0 != height) { - pipe_texture_reference(&dst[1], NULL); + pipe_resource_reference(&dst[1], NULL); pipe_sampler_view_reference(&dst_view[1], NULL); } if (!dst[2] || dst[2]->width0 != width || dst[2]->height0 != height) { - pipe_texture_reference(&dst[2], NULL); + pipe_resource_reference(&dst[2], NULL); pipe_sampler_view_reference(&dst_view[2], NULL); } @@ -303,7 +303,7 @@ copy_packed_data(ScrnInfoPtr pScrn, unsigned short w, unsigned short h) { int i, j; - struct pipe_texture **dst = port->yuv[port->current_set]; + struct pipe_resource **dst = port->yuv[port->current_set]; struct pipe_transfer *ytrans, *utrans, *vtrans; struct pipe_context *pipe = port->r->pipe; char *ymap, *vmap, *umap; @@ -311,15 +311,15 @@ copy_packed_data(ScrnInfoPtr pScrn, int yidx, uidx, vidx; int y_array_size = w * h; - ytrans = pipe->get_tex_transfer(pipe, dst[0], + ytrans = pipe_get_transfer(pipe, dst[0], 0, 0, 0, PIPE_TRANSFER_WRITE, left, top, w, h); - utrans = pipe->get_tex_transfer(pipe, dst[1], + utrans = pipe_get_transfer(pipe, dst[1], 0, 0, 0, PIPE_TRANSFER_WRITE, left, top, w, h); - vtrans = pipe->get_tex_transfer(pipe, dst[2], + vtrans = pipe_get_transfer(pipe, dst[2], 0, 0, 0, PIPE_TRANSFER_WRITE, left, top, w, h); @@ -395,9 +395,9 @@ copy_packed_data(ScrnInfoPtr pScrn, pipe->transfer_unmap(pipe, ytrans); pipe->transfer_unmap(pipe, utrans); pipe->transfer_unmap(pipe, vtrans); - pipe->tex_transfer_destroy(pipe, ytrans); - pipe->tex_transfer_destroy(pipe, utrans); - pipe->tex_transfer_destroy(pipe, vtrans); + pipe->transfer_destroy(pipe, ytrans); + pipe->transfer_destroy(pipe, utrans); + pipe->transfer_destroy(pipe, vtrans); } @@ -416,7 +416,7 @@ draw_yuv(struct xorg_xv_port_priv *port, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h) { - struct pipe_texture **textures = port->yuv[port->current_set]; + struct pipe_resource **textures = port->yuv[port->current_set]; /*debug_printf(" draw_yuv([%d, %d, %d ,%d], [%d, %d, %d, %d])\n", src_x, src_y, src_w, src_h, @@ -461,12 +461,12 @@ bind_shaders(struct xorg_xv_port_priv *port) } static INLINE void -conditional_flush(struct pipe_context *pipe, struct pipe_texture **tex, +conditional_flush(struct pipe_context *pipe, struct pipe_resource **tex, int num) { int i; for (i = 0; i < num; ++i) { - if (tex[i] && pipe->is_texture_referenced(pipe, tex[i], 0, 0) & + if (tex[i] && pipe->is_resource_referenced(pipe, tex[i], 0, 0) & PIPE_REFERENCED_FOR_WRITE) { pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); return; @@ -479,7 +479,7 @@ bind_samplers(struct xorg_xv_port_priv *port) { struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS]; struct pipe_sampler_state sampler; - struct pipe_texture **dst = port->yuv[port->current_set]; + struct pipe_resource **dst = port->yuv[port->current_set]; struct pipe_sampler_view **dst_views = port->yuv_views[port->current_set]; memset(&sampler, 0, sizeof(struct pipe_sampler_state)); diff --git a/src/gallium/state_trackers/xorg/xvmc/Makefile b/src/gallium/state_trackers/xorg/xvmc/Makefile deleted file mode 100644 index 126dc6d58f1..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -TOP = ../../../../.. -include $(TOP)/configs/current - -LIBNAME = xvmctracker - -LIBRARY_INCLUDES = \ - $(shell pkg-config --cflags-only-I xvmc) \ - -I$(TOP)/src/gallium/winsys/g3dvl - -C_SOURCES = block.c \ - surface.c \ - context.c \ - subpicture.c \ - attributes.c - -include ../../../Makefile.template diff --git a/src/gallium/state_trackers/xorg/xvmc/SConscript b/src/gallium/state_trackers/xorg/xvmc/SConscript deleted file mode 100644 index cb25d68bd80..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/SConscript +++ /dev/null @@ -1,27 +0,0 @@ -####################################################################### -# SConscript for xvmc state_tracker - -Import('*') - -if 'xorg/xvmc' in env['statetrackers']: - - env = env.Clone() - - env.Append(CPPPATH = [ - '#/src/gallium/include', - '#/src/gallium/auxiliary', - '#/src/gallium/winsys/g3dvl', - ]) - - env.ParseConfig('pkg-config --cflags --libs xvmc') - - st_xvmc = env.ConvenienceLibrary( - target = 'st_xvmc', - source = [ 'block.c', - 'surface.c', - 'context.c', - 'subpicture.c', - 'attributes.c', - ] - ) - Export('st_xvmc') diff --git a/src/gallium/state_trackers/xorg/xvmc/attributes.c b/src/gallium/state_trackers/xorg/xvmc/attributes.c deleted file mode 100644 index 79a67838e6e..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/attributes.c +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 Younes Manton. - * 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. - * - **************************************************************************/ - -#include <assert.h> -#include <X11/Xlib.h> -#include <X11/extensions/Xvlib.h> -#include <X11/extensions/XvMClib.h> - -XvAttribute* XvMCQueryAttributes(Display *dpy, XvMCContext *context, int *number) -{ - return NULL; -} - -Status XvMCSetAttribute(Display *dpy, XvMCContext *context, Atom attribute, int value) -{ - return BadImplementation; -} - -Status XvMCGetAttribute(Display *dpy, XvMCContext *context, Atom attribute, int *value) -{ - return BadImplementation; -} diff --git a/src/gallium/state_trackers/xorg/xvmc/block.c b/src/gallium/state_trackers/xorg/xvmc/block.c deleted file mode 100644 index 5102375fcf8..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/block.c +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 Younes Manton. - * 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. - * - **************************************************************************/ - -#include <assert.h> -#include <X11/Xlib.h> -#include <X11/extensions/XvMClib.h> -#include <util/u_memory.h> -#include "xvmc_private.h" - -Status XvMCCreateBlocks(Display *dpy, XvMCContext *context, unsigned int num_blocks, XvMCBlockArray *blocks) -{ - assert(dpy); - - if (!context) - return XvMCBadContext; - if (num_blocks == 0) - return BadValue; - - assert(blocks); - - blocks->context_id = context->context_id; - blocks->num_blocks = num_blocks; - blocks->blocks = MALLOC(BLOCK_SIZE_BYTES * num_blocks); - blocks->privData = NULL; - - return Success; -} - -Status XvMCDestroyBlocks(Display *dpy, XvMCBlockArray *blocks) -{ - assert(dpy); - assert(blocks); - FREE(blocks->blocks); - - return Success; -} - -Status XvMCCreateMacroBlocks(Display *dpy, XvMCContext *context, unsigned int num_blocks, XvMCMacroBlockArray *blocks) -{ - assert(dpy); - - if (!context) - return XvMCBadContext; - if (num_blocks == 0) - return BadValue; - - assert(blocks); - - blocks->context_id = context->context_id; - blocks->num_blocks = num_blocks; - blocks->macro_blocks = MALLOC(sizeof(XvMCMacroBlock) * num_blocks); - blocks->privData = NULL; - - return Success; -} - -Status XvMCDestroyMacroBlocks(Display *dpy, XvMCMacroBlockArray *blocks) -{ - assert(dpy); - assert(blocks); - FREE(blocks->macro_blocks); - - return Success; -} diff --git a/src/gallium/state_trackers/xorg/xvmc/context.c b/src/gallium/state_trackers/xorg/xvmc/context.c deleted file mode 100644 index c8a389385a8..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/context.c +++ /dev/null @@ -1,252 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 Younes Manton. - * 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. - * - **************************************************************************/ - -#include <assert.h> -#include <X11/Xlibint.h> -#include <X11/extensions/XvMClib.h> -#include <pipe/p_screen.h> -#include <pipe/p_video_context.h> -#include <pipe/p_video_state.h> -#include <pipe/p_state.h> -#include <vl_winsys.h> -#include <util/u_memory.h> -#include <util/u_debug.h> -#include <vl/vl_csc.h> -#include "xvmc_private.h" - -static Status Validate(Display *dpy, XvPortID port, int surface_type_id, - unsigned int width, unsigned int height, int flags, - bool *found_port, int *screen, int *chroma_format, - int *mc_type, int *surface_flags) -{ - bool found_surface = false; - XvAdaptorInfo *adaptor_info; - unsigned int num_adaptors; - int num_types; - unsigned int max_width, max_height; - Status ret; - - assert(dpy); - assert(found_port); - assert(screen); - assert(chroma_format); - assert(mc_type); - assert(surface_flags); - - *found_port = false; - - for (unsigned int i = 0; i < XScreenCount(dpy); ++i) { - ret = XvQueryAdaptors(dpy, XRootWindow(dpy, i), &num_adaptors, &adaptor_info); - if (ret != Success) - return ret; - - for (unsigned int j = 0; j < num_adaptors && !*found_port; ++j) { - for (unsigned int k = 0; k < adaptor_info[j].num_ports && !*found_port; ++k) { - XvMCSurfaceInfo *surface_info; - - if (adaptor_info[j].base_id + k != port) - continue; - - *found_port = true; - - surface_info = XvMCListSurfaceTypes(dpy, adaptor_info[j].base_id, &num_types); - if (!surface_info) { - XvFreeAdaptorInfo(adaptor_info); - return BadAlloc; - } - - for (unsigned int l = 0; l < num_types && !found_surface; ++l) { - if (surface_info[l].surface_type_id != surface_type_id) - continue; - - found_surface = true; - max_width = surface_info[l].max_width; - max_height = surface_info[l].max_height; - *chroma_format = surface_info[l].chroma_format; - *mc_type = surface_info[l].mc_type; - *surface_flags = surface_info[l].flags; - *screen = i; - } - - XFree(surface_info); - } - } - - XvFreeAdaptorInfo(adaptor_info); - } - - if (!*found_port) - return XvBadPort; - if (!found_surface) - return BadMatch; - if (width > max_width || height > max_height) - return BadValue; - if (flags != XVMC_DIRECT && flags != 0) - return BadValue; - - return Success; -} - -static enum pipe_video_profile ProfileToPipe(int xvmc_profile) -{ - if (xvmc_profile & XVMC_MPEG_1) - assert(0); - if (xvmc_profile & XVMC_MPEG_2) - return PIPE_VIDEO_PROFILE_MPEG2_MAIN; - if (xvmc_profile & XVMC_H263) - assert(0); - if (xvmc_profile & XVMC_MPEG_4) - assert(0); - - assert(0); - - return -1; -} - -static enum pipe_video_chroma_format FormatToPipe(int xvmc_format) -{ - switch (xvmc_format) { - case XVMC_CHROMA_FORMAT_420: - return PIPE_VIDEO_CHROMA_FORMAT_420; - case XVMC_CHROMA_FORMAT_422: - return PIPE_VIDEO_CHROMA_FORMAT_422; - case XVMC_CHROMA_FORMAT_444: - return PIPE_VIDEO_CHROMA_FORMAT_444; - default: - assert(0); - } - - return -1; -} - -Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, - int width, int height, int flags, XvMCContext *context) -{ - bool found_port; - int scrn; - int chroma_format; - int mc_type; - int surface_flags; - Status ret; - struct pipe_screen *screen; - struct pipe_video_context *vpipe; - XvMCContextPrivate *context_priv; - float csc[16]; - - assert(dpy); - - if (!context) - return XvMCBadContext; - - ret = Validate(dpy, port, surface_type_id, width, height, flags, - &found_port, &scrn, &chroma_format, &mc_type, &surface_flags); - - /* Success and XvBadPort have the same value */ - if (ret != Success || !found_port) - return ret; - - /* XXX: Current limits */ - if (chroma_format != XVMC_CHROMA_FORMAT_420) { - debug_printf("[XvMCg3dvl] Cannot decode requested surface type. Unsupported chroma format.\n"); - return BadImplementation; - } - if (mc_type != (XVMC_MOCOMP | XVMC_MPEG_2)) { - debug_printf("[XvMCg3dvl] Cannot decode requested surface type. Non-MPEG2/Mocomp acceleration unsupported.\n"); - return BadImplementation; - } - if (!(surface_flags & XVMC_INTRA_UNSIGNED)) { - debug_printf("[XvMCg3dvl] Cannot decode requested surface type. Signed intra unsupported.\n"); - return BadImplementation; - } - - context_priv = CALLOC(1, sizeof(XvMCContextPrivate)); - if (!context_priv) - return BadAlloc; - - /* TODO: Reuse screen if process creates another context */ - screen = vl_screen_create(dpy, scrn); - - if (!screen) { - FREE(context_priv); - return BadAlloc; - } - - vpipe = vl_video_create(dpy, scrn, screen, ProfileToPipe(mc_type), - FormatToPipe(chroma_format), width, height); - - if (!vpipe) { - screen->destroy(screen); - FREE(context_priv); - return BadAlloc; - } - - /* TODO: Define some Xv attribs to allow users to specify color standard, procamp */ - vl_csc_get_matrix - ( - debug_get_bool_option("G3DVL_NO_CSC", FALSE) ? - VL_CSC_COLOR_STANDARD_IDENTITY : VL_CSC_COLOR_STANDARD_BT_601, - NULL, true, csc - ); - vpipe->set_csc_matrix(vpipe, csc); - - context_priv->vpipe = vpipe; - - context->context_id = XAllocID(dpy); - context->surface_type_id = surface_type_id; - context->width = width; - context->height = height; - context->flags = flags; - context->port = port; - context->privData = context_priv; - - SyncHandle(); - - return Success; -} - -Status XvMCDestroyContext(Display *dpy, XvMCContext *context) -{ - struct pipe_screen *screen; - struct pipe_video_context *vpipe; - XvMCContextPrivate *context_priv; - - assert(dpy); - - if (!context || !context->privData) - return XvMCBadContext; - - context_priv = context->privData; - vpipe = context_priv->vpipe; - pipe_surface_reference(&context_priv->backbuffer, NULL); - screen = vpipe->screen; - vpipe->destroy(vpipe); - screen->destroy(screen); - FREE(context_priv); - context->privData = NULL; - - return Success; -} diff --git a/src/gallium/state_trackers/xorg/xvmc/subpicture.c b/src/gallium/state_trackers/xorg/xvmc/subpicture.c deleted file mode 100644 index 69898d5fcd3..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/subpicture.c +++ /dev/null @@ -1,195 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 Younes Manton. - * 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. - * - **************************************************************************/ - -#include <assert.h> -#include <X11/Xlibint.h> -#include <X11/extensions/XvMClib.h> - -Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture *subpicture, - unsigned short width, unsigned short height, int xvimage_id) -{ - assert(dpy); - - if (!context) - return XvMCBadContext; - - assert(subpicture); - - /*if (width > || height > ) - return BadValue;*/ - - /*if (xvimage_id != ) - return BadMatch;*/ - - subpicture->subpicture_id = XAllocID(dpy); - subpicture->context_id = context->context_id; - subpicture->xvimage_id = xvimage_id; - subpicture->width = width; - subpicture->height = height; - subpicture->num_palette_entries = 0; - subpicture->entry_bytes = 0; - subpicture->component_order[0] = 0; - subpicture->component_order[1] = 0; - subpicture->component_order[2] = 0; - subpicture->component_order[3] = 0; - /* TODO: subpicture->privData = ;*/ - - SyncHandle(); - - return Success; -} - -Status XvMCClearSubpicture(Display *dpy, XvMCSubpicture *subpicture, short x, short y, - unsigned short width, unsigned short height, unsigned int color) -{ - assert(dpy); - - if (!subpicture) - return XvMCBadSubpicture; - - /* TODO: Assert clear rect is within bounds? Or clip? */ - - return Success; -} - -Status XvMCCompositeSubpicture(Display *dpy, XvMCSubpicture *subpicture, XvImage *image, - short srcx, short srcy, unsigned short width, unsigned short height, - short dstx, short dsty) -{ - assert(dpy); - - if (!subpicture) - return XvMCBadSubpicture; - - assert(image); - - if (subpicture->xvimage_id != image->id) - return BadMatch; - - /* TODO: Assert rects are within bounds? Or clip? */ - - return Success; -} - -Status XvMCDestroySubpicture(Display *dpy, XvMCSubpicture *subpicture) -{ - assert(dpy); - - if (!subpicture) - return XvMCBadSubpicture; - - return BadImplementation; -} - -Status XvMCSetSubpicturePalette(Display *dpy, XvMCSubpicture *subpicture, unsigned char *palette) -{ - assert(dpy); - - if (!subpicture) - return XvMCBadSubpicture; - - assert(palette); - - /* We don't support paletted subpictures */ - return BadMatch; -} - -Status XvMCBlendSubpicture(Display *dpy, XvMCSurface *target_surface, XvMCSubpicture *subpicture, - short subx, short suby, unsigned short subw, unsigned short subh, - short surfx, short surfy, unsigned short surfw, unsigned short surfh) -{ - assert(dpy); - - if (!target_surface) - return XvMCBadSurface; - - if (!subpicture) - return XvMCBadSubpicture; - - if (target_surface->context_id != subpicture->context_id) - return BadMatch; - - /* TODO: Assert rects are within bounds? Or clip? */ - return Success; -} - -Status XvMCBlendSubpicture2(Display *dpy, XvMCSurface *source_surface, XvMCSurface *target_surface, - XvMCSubpicture *subpicture, short subx, short suby, unsigned short subw, unsigned short subh, - short surfx, short surfy, unsigned short surfw, unsigned short surfh) -{ - assert(dpy); - - if (!source_surface || !target_surface) - return XvMCBadSurface; - - if (!subpicture) - return XvMCBadSubpicture; - - if (source_surface->context_id != subpicture->context_id) - return BadMatch; - - if (source_surface->context_id != subpicture->context_id) - return BadMatch; - - /* TODO: Assert rects are within bounds? Or clip? */ - return Success; -} - -Status XvMCSyncSubpicture(Display *dpy, XvMCSubpicture *subpicture) -{ - assert(dpy); - - if (!subpicture) - return XvMCBadSubpicture; - - return Success; -} - -Status XvMCFlushSubpicture(Display *dpy, XvMCSubpicture *subpicture) -{ - assert(dpy); - - if (!subpicture) - return XvMCBadSubpicture; - - return Success; -} - -Status XvMCGetSubpictureStatus(Display *dpy, XvMCSubpicture *subpicture, int *status) -{ - assert(dpy); - - if (!subpicture) - return XvMCBadSubpicture; - - assert(status); - - /* TODO */ - *status = 0; - - return Success; -} diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c deleted file mode 100644 index 12d94e0c5ca..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/surface.c +++ /dev/null @@ -1,408 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 Younes Manton. - * 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. - * - **************************************************************************/ - -#include <assert.h> -#include <X11/Xlibint.h> -#include <pipe/p_video_context.h> -#include <pipe/p_video_state.h> -#include <pipe/p_state.h> -#include <util/u_memory.h> -#include "xvmc_private.h" - -static enum pipe_mpeg12_macroblock_type TypeToPipe(int xvmc_mb_type) -{ - if (xvmc_mb_type & XVMC_MB_TYPE_INTRA) - return PIPE_MPEG12_MACROBLOCK_TYPE_INTRA; - if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == XVMC_MB_TYPE_MOTION_FORWARD) - return PIPE_MPEG12_MACROBLOCK_TYPE_FWD; - if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == XVMC_MB_TYPE_MOTION_BACKWARD) - return PIPE_MPEG12_MACROBLOCK_TYPE_BKWD; - if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) - return PIPE_MPEG12_MACROBLOCK_TYPE_BI; - - assert(0); - - return -1; -} - -static enum pipe_mpeg12_picture_type PictureToPipe(int xvmc_pic) -{ - switch (xvmc_pic) { - case XVMC_TOP_FIELD: - return PIPE_MPEG12_PICTURE_TYPE_FIELD_TOP; - case XVMC_BOTTOM_FIELD: - return PIPE_MPEG12_PICTURE_TYPE_FIELD_BOTTOM; - case XVMC_FRAME_PICTURE: - return PIPE_MPEG12_PICTURE_TYPE_FRAME; - default: - assert(0); - } - - return -1; -} - -static enum pipe_mpeg12_motion_type MotionToPipe(int xvmc_motion_type, int xvmc_dct_type) -{ - switch (xvmc_motion_type) { - case XVMC_PREDICTION_FRAME: - return xvmc_dct_type == XVMC_DCT_TYPE_FIELD ? - PIPE_MPEG12_MOTION_TYPE_16x8 : PIPE_MPEG12_MOTION_TYPE_FRAME; - case XVMC_PREDICTION_FIELD: - return PIPE_MPEG12_MOTION_TYPE_FIELD; - case XVMC_PREDICTION_DUAL_PRIME: - return PIPE_MPEG12_MOTION_TYPE_DUALPRIME; - default: - assert(0); - } - - return -1; -} - -static bool -CreateOrResizeBackBuffer(struct pipe_video_context *vpipe, unsigned int width, unsigned int height, - struct pipe_surface **backbuffer) -{ - struct pipe_texture template; - struct pipe_texture *tex; - - assert(vpipe); - - if (*backbuffer) { - if ((*backbuffer)->width != width || (*backbuffer)->height != height) - pipe_surface_reference(backbuffer, NULL); - else - return true; - } - - memset(&template, 0, sizeof(struct pipe_texture)); - template.target = PIPE_TEXTURE_2D; - /* XXX: Needs to match the drawable's format? */ - template.format = PIPE_FORMAT_B8G8R8X8_UNORM; - template.last_level = 0; - template.width0 = width; - template.height0 = height; - template.depth0 = 1; - template.tex_usage = PIPE_TEXTURE_USAGE_SHARED; - - tex = vpipe->screen->texture_create(vpipe->screen, &template); - if (!tex) - return false; - - *backbuffer = vpipe->screen->get_tex_surface(vpipe->screen, tex, 0, 0, 0, - PIPE_BUFFER_USAGE_GPU_READ | - PIPE_BUFFER_USAGE_GPU_WRITE); - pipe_texture_reference(&tex, NULL); - - if (!*backbuffer) - return false; - - /* Clear the backbuffer in case the video doesn't cover the whole window */ - /* FIXME: Need to clear every time a frame moves and leaves dirty rects */ - vpipe->clear_surface(vpipe, 0, 0, width, height, 0, *backbuffer); - - return true; -} - -static void -MacroBlocksToPipe(const XvMCMacroBlockArray *xvmc_macroblocks, - const XvMCBlockArray *xvmc_blocks, - unsigned int first_macroblock, - unsigned int num_macroblocks, - struct pipe_mpeg12_macroblock *pipe_macroblocks) -{ - unsigned int i, j, k, l; - XvMCMacroBlock *xvmc_mb; - - assert(xvmc_macroblocks); - assert(xvmc_blocks); - assert(pipe_macroblocks); - assert(num_macroblocks); - - xvmc_mb = xvmc_macroblocks->macro_blocks + first_macroblock; - - for (i = 0; i < num_macroblocks; ++i) { - pipe_macroblocks->base.codec = PIPE_VIDEO_CODEC_MPEG12; - pipe_macroblocks->mbx = xvmc_mb->x; - pipe_macroblocks->mby = xvmc_mb->y; - pipe_macroblocks->mb_type = TypeToPipe(xvmc_mb->macroblock_type); - if (pipe_macroblocks->mb_type != PIPE_MPEG12_MACROBLOCK_TYPE_INTRA) - pipe_macroblocks->mo_type = MotionToPipe(xvmc_mb->motion_type, xvmc_mb->dct_type); - /* Get rid of Valgrind 'undefined' warnings */ - else - pipe_macroblocks->mo_type = -1; - pipe_macroblocks->dct_type = xvmc_mb->dct_type == XVMC_DCT_TYPE_FIELD ? - PIPE_MPEG12_DCT_TYPE_FIELD : PIPE_MPEG12_DCT_TYPE_FRAME; - - for (j = 0; j < 2; ++j) - for (k = 0; k < 2; ++k) - for (l = 0; l < 2; ++l) - pipe_macroblocks->pmv[j][k][l] = xvmc_mb->PMV[j][k][l]; - - pipe_macroblocks->cbp = xvmc_mb->coded_block_pattern; - pipe_macroblocks->blocks = xvmc_blocks->blocks + xvmc_mb->index * BLOCK_SIZE_SAMPLES; - - ++pipe_macroblocks; - ++xvmc_mb; - } -} - -Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surface) -{ - XvMCContextPrivate *context_priv; - struct pipe_video_context *vpipe; - XvMCSurfacePrivate *surface_priv; - struct pipe_video_surface *vsfc; - - assert(dpy); - - if (!context) - return XvMCBadContext; - if (!surface) - return XvMCBadSurface; - - context_priv = context->privData; - vpipe = context_priv->vpipe; - - surface_priv = CALLOC(1, sizeof(XvMCSurfacePrivate)); - if (!surface_priv) - return BadAlloc; - - vsfc = vpipe->screen->video_surface_create(vpipe->screen, vpipe->chroma_format, - vpipe->width, vpipe->height); - if (!vsfc) { - FREE(surface_priv); - return BadAlloc; - } - - surface_priv->pipe_vsfc = vsfc; - surface_priv->context = context; - - surface->surface_id = XAllocID(dpy); - surface->context_id = context->context_id; - surface->surface_type_id = context->surface_type_id; - surface->width = context->width; - surface->height = context->height; - surface->privData = surface_priv; - - SyncHandle(); - - return Success; -} - -Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int picture_structure, - XvMCSurface *target_surface, XvMCSurface *past_surface, XvMCSurface *future_surface, - unsigned int flags, unsigned int num_macroblocks, unsigned int first_macroblock, - XvMCMacroBlockArray *macroblocks, XvMCBlockArray *blocks -) -{ - struct pipe_video_context *vpipe; - struct pipe_surface *t_vsfc; - struct pipe_surface *p_vsfc; - struct pipe_surface *f_vsfc; - XvMCContextPrivate *context_priv; - XvMCSurfacePrivate *target_surface_priv; - XvMCSurfacePrivate *past_surface_priv; - XvMCSurfacePrivate *future_surface_priv; - struct pipe_mpeg12_macroblock pipe_macroblocks[num_macroblocks]; - - assert(dpy); - - if (!context || !context->privData) - return XvMCBadContext; - if (!target_surface || !target_surface->privData) - return XvMCBadSurface; - - if (picture_structure != XVMC_TOP_FIELD && - picture_structure != XVMC_BOTTOM_FIELD && - picture_structure != XVMC_FRAME_PICTURE) - return BadValue; - /* Bkwd pred equivalent to fwd (past && !future) */ - if (future_surface && !past_surface) - return BadMatch; - - assert(context->context_id == target_surface->context_id); - assert(!past_surface || context->context_id == past_surface->context_id); - assert(!future_surface || context->context_id == future_surface->context_id); - - assert(macroblocks); - assert(blocks); - - assert(macroblocks->context_id == context->context_id); - assert(blocks->context_id == context->context_id); - - assert(flags == 0 || flags == XVMC_SECOND_FIELD); - - target_surface_priv = target_surface->privData; - past_surface_priv = past_surface ? past_surface->privData : NULL; - future_surface_priv = future_surface ? future_surface->privData : NULL; - - assert(target_surface_priv->context == context); - assert(!past_surface || past_surface_priv->context == context); - assert(!future_surface || future_surface_priv->context == context); - - context_priv = context->privData; - vpipe = context_priv->vpipe; - - t_vsfc = target_surface_priv->pipe_vsfc; - p_vsfc = past_surface ? past_surface_priv->pipe_vsfc : NULL; - f_vsfc = future_surface ? future_surface_priv->pipe_vsfc : NULL; - - MacroBlocksToPipe(macroblocks, blocks, first_macroblock, - num_macroblocks, pipe_macroblocks); - - vpipe->set_decode_target(vpipe, t_vsfc); - vpipe->decode_macroblocks(vpipe, p_vsfc, f_vsfc, num_macroblocks, - &pipe_macroblocks->base, target_surface_priv->render_fence); - - return Success; -} - -Status XvMCFlushSurface(Display *dpy, XvMCSurface *surface) -{ - assert(dpy); - - if (!surface) - return XvMCBadSurface; - - return Success; -} - -Status XvMCSyncSurface(Display *dpy, XvMCSurface *surface) -{ - assert(dpy); - - if (!surface) - return XvMCBadSurface; - - return Success; -} - -Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable, - short srcx, short srcy, unsigned short srcw, unsigned short srch, - short destx, short desty, unsigned short destw, unsigned short desth, - int flags) -{ - Window root; - int x, y; - unsigned int width, height; - unsigned int border_width; - unsigned int depth; - struct pipe_video_context *vpipe; - XvMCSurfacePrivate *surface_priv; - XvMCContextPrivate *context_priv; - XvMCContext *context; - struct pipe_video_rect src_rect = {srcx, srcy, srcw, srch}; - struct pipe_video_rect dst_rect = {destx, desty, destw, desth}; - - assert(dpy); - - if (!surface || !surface->privData) - return XvMCBadSurface; - - if (XGetGeometry(dpy, drawable, &root, &x, &y, &width, &height, &border_width, &depth) == BadDrawable) - return BadDrawable; - - assert(flags == XVMC_TOP_FIELD || flags == XVMC_BOTTOM_FIELD || flags == XVMC_FRAME_PICTURE); - assert(srcx + srcw - 1 < surface->width); - assert(srcy + srch - 1 < surface->height); - /* - * Some apps (mplayer) hit these asserts because they call - * this function after the window has been resized by the WM - * but before they've handled the corresponding XEvent and - * know about the new dimensions. The output should be clipped - * until the app updates destw and desth. - */ - /* - assert(destx + destw - 1 < width); - assert(desty + desth - 1 < height); - */ - - surface_priv = surface->privData; - context = surface_priv->context; - context_priv = context->privData; - vpipe = context_priv->vpipe; - - if (!CreateOrResizeBackBuffer(vpipe, width, height, &context_priv->backbuffer)) - return BadAlloc; - - vpipe->render_picture(vpipe, surface_priv->pipe_vsfc, PictureToPipe(flags), &src_rect, - context_priv->backbuffer, &dst_rect, surface_priv->disp_fence); - - vl_video_bind_drawable(vpipe, drawable); - - vpipe->screen->flush_frontbuffer - ( - vpipe->screen, - context_priv->backbuffer, - vpipe->priv - ); - - return Success; -} - -Status XvMCGetSurfaceStatus(Display *dpy, XvMCSurface *surface, int *status) -{ - assert(dpy); - - if (!surface) - return XvMCBadSurface; - - assert(status); - - *status = 0; - - return Success; -} - -Status XvMCDestroySurface(Display *dpy, XvMCSurface *surface) -{ - XvMCSurfacePrivate *surface_priv; - - assert(dpy); - - if (!surface || !surface->privData) - return XvMCBadSurface; - - surface_priv = surface->privData; - pipe_video_surface_reference(&surface_priv->pipe_vsfc, NULL); - FREE(surface_priv); - surface->privData = NULL; - - return Success; -} - -Status XvMCHideSurface(Display *dpy, XvMCSurface *surface) -{ - assert(dpy); - - if (!surface || !surface->privData) - return XvMCBadSurface; - - /* No op, only for overlaid rendering */ - - return Success; -} diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/.gitignore b/src/gallium/state_trackers/xorg/xvmc/tests/.gitignore deleted file mode 100644 index e1d2f9023df..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/tests/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -test_context -test_surface -test_blocks -test_rendering -xvmc_bench diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/Makefile b/src/gallium/state_trackers/xorg/xvmc/tests/Makefile deleted file mode 100644 index c875dd76058..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/tests/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -TOP = ../../../../../.. -include $(TOP)/configs/current - -LIBS = -lXvMCW -lXvMC -lXv -lX11 - -############################################# - -.PHONY: default clean - -default: test_context test_surface test_blocks test_rendering xvmc_bench - -test_context: test_context.o testlib.o - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - -test_surface: test_surface.o testlib.o - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - -test_blocks: test_blocks.o testlib.o - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - -test_rendering: test_rendering.o testlib.o - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - -xvmc_bench: xvmc_bench.o testlib.o - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - -clean: - $(RM) -rf *.o test_context test_surface test_blocks test_rendering xvmc_bench diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/test_blocks.c b/src/gallium/state_trackers/xorg/xvmc/tests/test_blocks.c deleted file mode 100644 index 994e3ca4d14..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/tests/test_blocks.c +++ /dev/null @@ -1,111 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 Younes Manton. - * 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. - * - **************************************************************************/ - -#include <assert.h> -#include <error.h> -#include "testlib.h" - -int main(int argc, char **argv) -{ - const unsigned int width = 16, height = 16; - const unsigned int min_required_blocks = 1, min_required_macroblocks = 1; - const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; - - Display *display; - XvPortID port_num; - int surface_type_id; - unsigned int is_overlay, intra_unsigned; - int colorkey; - XvMCContext context; - XvMCSurface surface; - XvMCBlockArray blocks = {0}; - XvMCMacroBlockArray macroblocks = {0}; - - display = XOpenDisplay(NULL); - - if (!GetPort - ( - display, - width, - height, - XVMC_CHROMA_FORMAT_420, - mc_types, - 2, - &port_num, - &surface_type_id, - &is_overlay, - &intra_unsigned - )) - { - XCloseDisplay(display); - error(1, 0, "Error, unable to find a good port.\n"); - } - - if (is_overlay) - { - Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); - XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); - } - - assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, &context) == Success); - assert(XvMCCreateSurface(display, &context, &surface) == Success); - - /* Test NULL context */ - assert(XvMCCreateBlocks(display, NULL, 1, &blocks) == XvMCBadContext); - /* Test 0 blocks */ - assert(XvMCCreateBlocks(display, &context, 0, &blocks) == BadValue); - /* Test valid params */ - assert(XvMCCreateBlocks(display, &context, min_required_blocks, &blocks) == Success); - /* Test context id assigned and correct */ - assert(blocks.context_id == context.context_id); - /* Test number of blocks assigned and correct */ - assert(blocks.num_blocks == min_required_blocks); - /* Test block pointer valid */ - assert(blocks.blocks != NULL); - /* Test NULL context */ - assert(XvMCCreateMacroBlocks(display, NULL, 1, ¯oblocks) == XvMCBadContext); - /* Test 0 macroblocks */ - assert(XvMCCreateMacroBlocks(display, &context, 0, ¯oblocks) == BadValue); - /* Test valid params */ - assert(XvMCCreateMacroBlocks(display, &context, min_required_macroblocks, ¯oblocks) == Success); - /* Test context id assigned and correct */ - assert(macroblocks.context_id == context.context_id); - /* Test macroblock pointer valid */ - assert(macroblocks.macro_blocks != NULL); - /* Test valid params */ - assert(XvMCDestroyMacroBlocks(display, ¯oblocks) == Success); - /* Test valid params */ - assert(XvMCDestroyBlocks(display, &blocks) == Success); - - assert(XvMCDestroySurface(display, &surface) == Success); - assert(XvMCDestroyContext(display, &context) == Success); - - XvUngrabPort(display, port_num, CurrentTime); - XCloseDisplay(display); - - return 0; -} diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/test_context.c b/src/gallium/state_trackers/xorg/xvmc/tests/test_context.c deleted file mode 100644 index 3da957c9330..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/tests/test_context.c +++ /dev/null @@ -1,119 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 Younes Manton. - * 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. - * - **************************************************************************/ - -#include <assert.h> -#include <error.h> -#include "testlib.h" - -int main(int argc, char **argv) -{ - const unsigned int width = 16, height = 16; - const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; - - Display *display; - XvPortID port_num; - int surface_type_id; - unsigned int is_overlay, intra_unsigned; - int colorkey; - XvMCContext context = {0}; - - display = XOpenDisplay(NULL); - - if (!GetPort - ( - display, - width, - height, - XVMC_CHROMA_FORMAT_420, - mc_types, - 2, - &port_num, - &surface_type_id, - &is_overlay, - &intra_unsigned - )) - { - XCloseDisplay(display); - error(1, 0, "Error, unable to find a good port.\n"); - } - - if (is_overlay) - { - Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); - XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); - } - - /* Test NULL context */ - /* XXX: XvMCBadContext not a valid return for XvMCCreateContext in the XvMC API, but openChrome driver returns it */ - assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, NULL) == XvMCBadContext); - /* Test invalid port */ - /* XXX: Success and XvBadPort have the same value, if this call actually gets passed the validation step as of now we'll crash later */ - assert(XvMCCreateContext(display, -1, surface_type_id, width, height, XVMC_DIRECT, &context) == XvBadPort); - /* Test invalid surface */ - assert(XvMCCreateContext(display, port_num, -1, width, height, XVMC_DIRECT, &context) == BadMatch); - /* Test invalid flags */ - assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, -1, &context) == BadValue); - /* Test huge width */ - assert(XvMCCreateContext(display, port_num, surface_type_id, 16384, height, XVMC_DIRECT, &context) == BadValue); - /* Test huge height */ - assert(XvMCCreateContext(display, port_num, surface_type_id, width, 16384, XVMC_DIRECT, &context) == BadValue); - /* Test huge width & height */ - assert(XvMCCreateContext(display, port_num, surface_type_id, 16384, 16384, XVMC_DIRECT, &context) == BadValue); - /* Test valid params */ - assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, &context) == Success); - /* Test context id assigned */ - assert(context.context_id != 0); - /* Test surface type id assigned and correct */ - assert(context.surface_type_id == surface_type_id); - /* Test width & height assigned and correct */ - assert(context.width == width && context.height == height); - /* Test port assigned and correct */ - assert(context.port == port_num); - /* Test flags assigned and correct */ - assert(context.flags == XVMC_DIRECT); - /* Test NULL context */ - assert(XvMCDestroyContext(display, NULL) == XvMCBadContext); - /* Test valid params */ - assert(XvMCDestroyContext(display, &context) == Success); - /* Test awkward but valid width */ - assert(XvMCCreateContext(display, port_num, surface_type_id, width + 1, height, XVMC_DIRECT, &context) == Success); - assert(context.width >= width + 1); - assert(XvMCDestroyContext(display, &context) == Success); - /* Test awkward but valid height */ - assert(XvMCCreateContext(display, port_num, surface_type_id, width, height + 1, XVMC_DIRECT, &context) == Success); - assert(context.height >= height + 1); - assert(XvMCDestroyContext(display, &context) == Success); - /* Test awkward but valid width & height */ - assert(XvMCCreateContext(display, port_num, surface_type_id, width + 1, height + 1, XVMC_DIRECT, &context) == Success); - assert(context.width >= width + 1 && context.height >= height + 1); - assert(XvMCDestroyContext(display, &context) == Success); - - XvUngrabPort(display, port_num, CurrentTime); - XCloseDisplay(display); - - return 0; -} diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/test_rendering.c b/src/gallium/state_trackers/xorg/xvmc/tests/test_rendering.c deleted file mode 100644 index 6058783a798..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/tests/test_rendering.c +++ /dev/null @@ -1,317 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 Younes Manton. - * 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. - * - **************************************************************************/ - -#include <assert.h> -#include <stdio.h> -#include <string.h> -#include <error.h> -#include "testlib.h" - -#define BLOCK_WIDTH 8 -#define BLOCK_HEIGHT 8 -#define BLOCK_SIZE (BLOCK_WIDTH * BLOCK_HEIGHT) -#define MACROBLOCK_WIDTH 16 -#define MACROBLOCK_HEIGHT 16 -#define MACROBLOCK_WIDTH_IN_BLOCKS (MACROBLOCK_WIDTH / BLOCK_WIDTH) -#define MACROBLOCK_HEIGHT_IN_BLOCKS (MACROBLOCK_HEIGHT / BLOCK_HEIGHT) -#define BLOCKS_PER_MACROBLOCK 6 - -#define INPUT_WIDTH 16 -#define INPUT_HEIGHT 16 -#define INPUT_WIDTH_IN_MACROBLOCKS (INPUT_WIDTH / MACROBLOCK_WIDTH) -#define INPUT_HEIGHT_IN_MACROBLOCKS (INPUT_HEIGHT / MACROBLOCK_HEIGHT) -#define NUM_MACROBLOCKS (INPUT_WIDTH_IN_MACROBLOCKS * INPUT_HEIGHT_IN_MACROBLOCKS) - -#define DEFAULT_OUTPUT_WIDTH INPUT_WIDTH -#define DEFAULT_OUTPUT_HEIGHT INPUT_HEIGHT -#define DEFAULT_ACCEPTABLE_ERR 0.01 - -void ParseArgs(int argc, char **argv, unsigned int *output_width, unsigned int *output_height, double *acceptable_error, int *prompt); -void Gradient(short *block, unsigned int start, unsigned int stop, int horizontal); - -void ParseArgs(int argc, char **argv, unsigned int *output_width, unsigned int *output_height, double *acceptable_error, int *prompt) -{ - int fail = 0; - int i; - - *output_width = DEFAULT_OUTPUT_WIDTH; - *output_height = DEFAULT_OUTPUT_WIDTH; - *acceptable_error = DEFAULT_ACCEPTABLE_ERR; - *prompt = 1; - - for (i = 1; i < argc && !fail; ++i) - { - if (!strcmp(argv[i], "-w")) - { - if (sscanf(argv[++i], "%u", output_width) != 1) - fail = 1; - } - else if (!strcmp(argv[i], "-h")) - { - if (sscanf(argv[++i], "%u", output_height) != 1) - fail = 1; - } - else if (!strcmp(argv[i], "-e")) - { - if (sscanf(argv[++i], "%lf", acceptable_error) != 1) - fail = 1; - } - else if (strcmp(argv[i], "-n")) - *prompt = 0; - else - fail = 1; - } - - if (fail) - error - ( - 1, 0, - "Bad argument.\n" - "\n" - "Usage: %s [options]\n" - "\t-w <width>\tOutput width\n" - "\t-h <height>\tOutput height\n" - "\t-e <error>\tAcceptable margin of error per pixel, from 0 to 1\n" - "\t-n\tDon't prompt for quit\n", - argv[0] - ); -} - -void Gradient(short *block, unsigned int start, unsigned int stop, int horizontal) -{ - unsigned int x, y; - unsigned int range = stop - start; - - if (horizontal) - { - for (y = 0; y < BLOCK_HEIGHT; ++y) - for (x = 0; x < BLOCK_WIDTH; ++x) - block[y * BLOCK_WIDTH + x] = (short)(start + range * (x / (float)(BLOCK_WIDTH - 1))); - } - else - { - for (y = 0; y < BLOCK_HEIGHT; ++y) - for (x = 0; x < BLOCK_WIDTH; ++x) - block[y * BLOCK_WIDTH + x] = (short)(start + range * (y / (float)(BLOCK_HEIGHT - 1))); - } -} - -int main(int argc, char **argv) -{ - unsigned int output_width; - unsigned int output_height; - double acceptable_error; - int prompt; - Display *display; - Window root, window; - const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; - XvPortID port_num; - int surface_type_id; - unsigned int is_overlay, intra_unsigned; - int colorkey; - XvMCContext context; - XvMCSurface surface; - XvMCBlockArray block_array; - XvMCMacroBlockArray mb_array; - int mbx, mby, bx, by; - XvMCMacroBlock *mb; - short *blocks; - int quit = 0; - - ParseArgs(argc, argv, &output_width, &output_height, &acceptable_error, &prompt); - - display = XOpenDisplay(NULL); - - if (!GetPort - ( - display, - INPUT_WIDTH, - INPUT_HEIGHT, - XVMC_CHROMA_FORMAT_420, - mc_types, - 2, - &port_num, - &surface_type_id, - &is_overlay, - &intra_unsigned - )) - { - XCloseDisplay(display); - error(1, 0, "Error, unable to find a good port.\n"); - } - - if (is_overlay) - { - Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); - XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); - } - - root = XDefaultRootWindow(display); - window = XCreateSimpleWindow(display, root, 0, 0, output_width, output_height, 0, 0, colorkey); - - assert(XvMCCreateContext(display, port_num, surface_type_id, INPUT_WIDTH, INPUT_HEIGHT, XVMC_DIRECT, &context) == Success); - assert(XvMCCreateSurface(display, &context, &surface) == Success); - assert(XvMCCreateBlocks(display, &context, NUM_MACROBLOCKS * BLOCKS_PER_MACROBLOCK, &block_array) == Success); - assert(XvMCCreateMacroBlocks(display, &context, NUM_MACROBLOCKS, &mb_array) == Success); - - mb = mb_array.macro_blocks; - blocks = block_array.blocks; - - for (mby = 0; mby < INPUT_HEIGHT_IN_MACROBLOCKS; ++mby) - for (mbx = 0; mbx < INPUT_WIDTH_IN_MACROBLOCKS; ++mbx) - { - mb->x = mbx; - mb->y = mby; - mb->macroblock_type = XVMC_MB_TYPE_INTRA; - /*mb->motion_type = ;*/ - /*mb->motion_vertical_field_select = ;*/ - mb->dct_type = XVMC_DCT_TYPE_FRAME; - /*mb->PMV[0][0][0] = ; - mb->PMV[0][0][1] = ; - mb->PMV[0][1][0] = ; - mb->PMV[0][1][1] = ; - mb->PMV[1][0][0] = ; - mb->PMV[1][0][1] = ; - mb->PMV[1][1][0] = ; - mb->PMV[1][1][1] = ;*/ - mb->index = (mby * INPUT_WIDTH_IN_MACROBLOCKS + mbx) * BLOCKS_PER_MACROBLOCK; - mb->coded_block_pattern = 0x3F; - - mb++; - - for (by = 0; by < MACROBLOCK_HEIGHT_IN_BLOCKS; ++by) - for (bx = 0; bx < MACROBLOCK_WIDTH_IN_BLOCKS; ++bx) - { - const int start = 16, stop = 235, range = stop - start; - - Gradient - ( - blocks, - (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH) / (float)(INPUT_WIDTH - 1))), - (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH + BLOCK_WIDTH - 1) / (float)(INPUT_WIDTH - 1))), - 1 - ); - - blocks += BLOCK_SIZE; - } - - for (by = 0; by < MACROBLOCK_HEIGHT_IN_BLOCKS / 2; ++by) - for (bx = 0; bx < MACROBLOCK_WIDTH_IN_BLOCKS / 2; ++bx) - { - const int start = 16, stop = 240, range = stop - start; - - Gradient - ( - blocks, - (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH) / (float)(INPUT_WIDTH - 1))), - (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH + BLOCK_WIDTH - 1) / (float)(INPUT_WIDTH - 1))), - 1 - ); - - blocks += BLOCK_SIZE; - - Gradient - ( - blocks, - (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH) / (float)(INPUT_WIDTH - 1))), - (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH + BLOCK_WIDTH - 1) / (float)(INPUT_WIDTH - 1))), - 1 - ); - - blocks += BLOCK_SIZE; - } - } - - XSelectInput(display, window, ExposureMask | KeyPressMask); - XMapWindow(display, window); - XSync(display, 0); - - /* Test NULL context */ - assert(XvMCRenderSurface(display, NULL, XVMC_FRAME_PICTURE, &surface, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == XvMCBadContext); - /* Test NULL surface */ - assert(XvMCRenderSurface(display, &context, XVMC_FRAME_PICTURE, NULL, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == XvMCBadSurface); - /* Test bad picture structure */ - assert(XvMCRenderSurface(display, &context, 0, &surface, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == BadValue); - /* Test valid params */ - assert(XvMCRenderSurface(display, &context, XVMC_FRAME_PICTURE, &surface, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == Success); - - /* Test NULL surface */ - assert(XvMCPutSurface(display, NULL, window, 0, 0, INPUT_WIDTH, INPUT_HEIGHT, 0, 0, output_width, output_height, XVMC_FRAME_PICTURE) == XvMCBadSurface); - /* Test bad window */ - /* XXX: X halts with a bad drawable for some reason, doesn't return BadDrawable as expected */ - /*assert(XvMCPutSurface(display, &surface, 0, 0, 0, width, height, 0, 0, width, height, XVMC_FRAME_PICTURE) == BadDrawable);*/ - - if (prompt) - { - puts("Press any button to quit..."); - - while (!quit) - { - if (XPending(display) > 0) - { - XEvent event; - - XNextEvent(display, &event); - - switch (event.type) - { - case Expose: - { - /* Test valid params */ - assert - ( - XvMCPutSurface - ( - display, &surface, window, - 0, 0, INPUT_WIDTH, INPUT_HEIGHT, - 0, 0, output_width, output_height, - XVMC_FRAME_PICTURE - ) == Success - ); - break; - } - case KeyPress: - { - quit = 1; - break; - } - } - } - } - } - - assert(XvMCDestroyBlocks(display, &block_array) == Success); - assert(XvMCDestroyMacroBlocks(display, &mb_array) == Success); - assert(XvMCDestroySurface(display, &surface) == Success); - assert(XvMCDestroyContext(display, &context) == Success); - - XvUngrabPort(display, port_num, CurrentTime); - XDestroyWindow(display, window); - XCloseDisplay(display); - - return 0; -} diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/test_surface.c b/src/gallium/state_trackers/xorg/xvmc/tests/test_surface.c deleted file mode 100644 index b65eb265c0a..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/tests/test_surface.c +++ /dev/null @@ -1,98 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 Younes Manton. - * 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. - * - **************************************************************************/ - -#include <assert.h> -#include <error.h> -#include "testlib.h" - -int main(int argc, char **argv) -{ - const unsigned int width = 16, height = 16; - const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; - - Display *display; - XvPortID port_num; - int surface_type_id; - unsigned int is_overlay, intra_unsigned; - int colorkey; - XvMCContext context; - XvMCSurface surface = {0}; - - display = XOpenDisplay(NULL); - - if (!GetPort - ( - display, - width, - height, - XVMC_CHROMA_FORMAT_420, - mc_types, - 2, - &port_num, - &surface_type_id, - &is_overlay, - &intra_unsigned - )) - { - XCloseDisplay(display); - error(1, 0, "Error, unable to find a good port.\n"); - } - - if (is_overlay) - { - Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); - XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); - } - - assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, &context) == Success); - - /* Test NULL context */ - assert(XvMCCreateSurface(display, NULL, &surface) == XvMCBadContext); - /* Test NULL surface */ - assert(XvMCCreateSurface(display, &context, NULL) == XvMCBadSurface); - /* Test valid params */ - assert(XvMCCreateSurface(display, &context, &surface) == Success); - /* Test surface id assigned */ - assert(surface.surface_id != 0); - /* Test context id assigned and correct */ - assert(surface.context_id == context.context_id); - /* Test surface type id assigned and correct */ - assert(surface.surface_type_id == surface_type_id); - /* Test width & height assigned and correct */ - assert(surface.width == width && surface.height == height); - /* Test valid params */ - assert(XvMCDestroySurface(display, &surface) == Success); - /* Test NULL surface */ - assert(XvMCDestroySurface(display, NULL) == XvMCBadSurface); - - assert(XvMCDestroyContext(display, &context) == Success); - - XvUngrabPort(display, port_num, CurrentTime); - XCloseDisplay(display); - - return 0; -} diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/testlib.c b/src/gallium/state_trackers/xorg/xvmc/tests/testlib.c deleted file mode 100644 index 142c09bb590..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/tests/testlib.c +++ /dev/null @@ -1,146 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 Younes Manton. - * 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. - * - **************************************************************************/ - -#include "testlib.h" -#include <stdio.h> - -/* -void test(int pred, const char *pred_string, const char *doc_string, const char *file, unsigned int line) -{ - fputs(doc_string, stderr); - if (!pred) - fprintf(stderr, " FAIL!\n\t\"%s\" at %s:%u\n", pred_string, file, line); - else - fputs(" PASS!\n", stderr); -} -*/ - -int GetPort -( - Display *display, - unsigned int width, - unsigned int height, - unsigned int chroma_format, - const unsigned int *mc_types, - unsigned int num_mc_types, - XvPortID *port_id, - int *surface_type_id, - unsigned int *is_overlay, - unsigned int *intra_unsigned -) -{ - unsigned int found_port = 0; - XvAdaptorInfo *adaptor_info; - unsigned int num_adaptors; - int num_types; - int ev_base, err_base; - unsigned int i, j, k, l; - - if (!XvMCQueryExtension(display, &ev_base, &err_base)) - return 0; - if (XvQueryAdaptors(display, XDefaultRootWindow(display), &num_adaptors, &adaptor_info) != Success) - return 0; - - for (i = 0; i < num_adaptors && !found_port; ++i) - { - if (adaptor_info[i].type & XvImageMask) - { - XvMCSurfaceInfo *surface_info = XvMCListSurfaceTypes(display, adaptor_info[i].base_id, &num_types); - - if (surface_info) - { - for (j = 0; j < num_types && !found_port; ++j) - { - if - ( - surface_info[j].chroma_format == chroma_format && - surface_info[j].max_width >= width && - surface_info[j].max_height >= height - ) - { - for (k = 0; k < num_mc_types && !found_port; ++k) - { - if (surface_info[j].mc_type == mc_types[k]) - { - for (l = 0; l < adaptor_info[i].num_ports && !found_port; ++l) - { - if (XvGrabPort(display, adaptor_info[i].base_id + l, CurrentTime) == Success) - { - *port_id = adaptor_info[i].base_id + l; - *surface_type_id = surface_info[j].surface_type_id; - *is_overlay = surface_info[j].flags & XVMC_OVERLAID_SURFACE; - *intra_unsigned = surface_info[j].flags & XVMC_INTRA_UNSIGNED; - found_port = 1; - } - } - } - } - } - } - - XFree(surface_info); - } - } - } - - XvFreeAdaptorInfo(adaptor_info); - - return found_port; -} - -unsigned int align(unsigned int value, unsigned int alignment) -{ - return (value + alignment - 1) & ~(alignment - 1); -} - -/* From the glibc manual */ -int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y) -{ - /* Perform the carry for the later subtraction by updating y. */ - if (x->tv_usec < y->tv_usec) - { - int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1; - y->tv_usec -= 1000000 * nsec; - y->tv_sec += nsec; - } - if (x->tv_usec - y->tv_usec > 1000000) - { - int nsec = (x->tv_usec - y->tv_usec) / 1000000; - y->tv_usec += 1000000 * nsec; - y->tv_sec -= nsec; - } - - /* - * Compute the time remaining to wait. - * tv_usec is certainly positive. - */ - result->tv_sec = x->tv_sec - y->tv_sec; - result->tv_usec = x->tv_usec - y->tv_usec; - - /* Return 1 if result is negative. */ - return x->tv_sec < y->tv_sec; -} diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/testlib.h b/src/gallium/state_trackers/xorg/xvmc/tests/testlib.h deleted file mode 100644 index 0438e52928b..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/tests/testlib.h +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 Younes Manton. - * 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 testlib_h -#define testlib_h - -/* -#define TEST(pred, doc) test(pred, #pred, doc, __FILE__, __LINE__) - -void test(int pred, const char *pred_string, const char *doc_string, const char *file, unsigned int line); -*/ - -#include <sys/time.h> -#include <X11/Xlib.h> -#include <X11/extensions/XvMClib.h> - -/* - * display: IN A valid X display - * width, height: IN Surface size that the port must display - * chroma_format: IN Chroma format that the port must display - * mc_types, num_mc_types: IN List of MC types that the port must support, first port that matches the first mc_type will be returned - * port_id: OUT Your port's ID - * surface_type_id: OUT Your port's surface ID - * is_overlay: OUT If 1, port uses overlay surfaces, you need to set a colorkey - * intra_unsigned: OUT If 1, port uses unsigned values for intra-coded blocks - */ -int GetPort -( - Display *display, - unsigned int width, - unsigned int height, - unsigned int chroma_format, - const unsigned int *mc_types, - unsigned int num_mc_types, - XvPortID *port_id, - int *surface_type_id, - unsigned int *is_overlay, - unsigned int *intra_unsigned -); - -unsigned int align(unsigned int value, unsigned int alignment); - -int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y); - -#endif diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/xvmc_bench.c b/src/gallium/state_trackers/xorg/xvmc/tests/xvmc_bench.c deleted file mode 100644 index bf94d856234..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/tests/xvmc_bench.c +++ /dev/null @@ -1,300 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 Younes Manton. - * 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. - * - **************************************************************************/ - -#include <assert.h> -#include <stdio.h> -#include <string.h> -#include <error.h> -#include <sys/time.h> -#include "testlib.h" - -#define MACROBLOCK_WIDTH 16 -#define MACROBLOCK_HEIGHT 16 -#define BLOCKS_PER_MACROBLOCK 6 - -#define DEFAULT_INPUT_WIDTH 720 -#define DEFAULT_INPUT_HEIGHT 480 -#define DEFAULT_REPS 100 - -#define PIPELINE_STEP_MC 1 -#define PIPELINE_STEP_CSC 2 -#define PIPELINE_STEP_SWAP 4 - -#define MB_TYPE_I 1 -#define MB_TYPE_P 2 -#define MB_TYPE_B 4 - -struct Config -{ - unsigned int input_width; - unsigned int input_height; - unsigned int output_width; - unsigned int output_height; - unsigned int pipeline; - unsigned int mb_types; - unsigned int reps; -}; - -void ParseArgs(int argc, char **argv, struct Config *config); - -void ParseArgs(int argc, char **argv, struct Config *config) -{ - int fail = 0; - int i; - - config->input_width = DEFAULT_INPUT_WIDTH; - config->input_height = DEFAULT_INPUT_HEIGHT; - config->output_width = 0; - config->output_height = 0; - config->pipeline = 0; - config->mb_types = 0; - config->reps = DEFAULT_REPS; - - for (i = 1; i < argc && !fail; ++i) - { - if (!strcmp(argv[i], "-iw")) - { - if (sscanf(argv[++i], "%u", &config->input_width) != 1) - fail = 1; - } - else if (!strcmp(argv[i], "-ih")) - { - if (sscanf(argv[++i], "%u", &config->input_height) != 1) - fail = 1; - } - else if (!strcmp(argv[i], "-ow")) - { - if (sscanf(argv[++i], "%u", &config->output_width) != 1) - fail = 1; - } - else if (!strcmp(argv[i], "-oh")) - { - if (sscanf(argv[++i], "%u", &config->output_height) != 1) - fail = 1; - } - else if (!strcmp(argv[i], "-p")) - { - char *token = strtok(argv[++i], ","); - - while (token && !fail) - { - if (!strcmp(token, "mc")) - config->pipeline |= PIPELINE_STEP_MC; - else if (!strcmp(token, "csc")) - config->pipeline |= PIPELINE_STEP_CSC; - else if (!strcmp(token, "swp")) - config->pipeline |= PIPELINE_STEP_SWAP; - else - fail = 1; - - if (!fail) - token = strtok(NULL, ","); - } - } - else if (!strcmp(argv[i], "-mb")) - { - char *token = strtok(argv[++i], ","); - - while (token && !fail) - { - if (strcmp(token, "i")) - config->mb_types |= MB_TYPE_I; - else if (strcmp(token, "p")) - config->mb_types |= MB_TYPE_P; - else if (strcmp(token, "b")) - config->mb_types |= MB_TYPE_B; - else - fail = 1; - - if (!fail) - token = strtok(NULL, ","); - } - } - else if (!strcmp(argv[i], "-r")) - { - if (sscanf(argv[++i], "%u", &config->reps) != 1) - fail = 1; - } - else - fail = 1; - } - - if (fail) - error - ( - 1, 0, - "Bad argument.\n" - "\n" - "Usage: %s [options]\n" - "\t-iw <width>\tInput width\n" - "\t-ih <height>\tInput height\n" - "\t-ow <width>\tOutput width\n" - "\t-oh <height>\tOutput height\n" - "\t-p <pipeline>\tPipeline to test\n" - "\t-mb <mb type>\tMacroBlock types to use\n" - "\t-r <reps>\tRepetitions\n\n" - "\tPipeline steps: mc,csc,swap\n" - "\tMB types: i,p,b\n", - argv[0] - ); - - if (config->output_width == 0) - config->output_width = config->input_width; - if (config->output_height == 0) - config->output_height = config->input_height; - if (!config->pipeline) - config->pipeline = PIPELINE_STEP_MC | PIPELINE_STEP_CSC | PIPELINE_STEP_SWAP; - if (!config->mb_types) - config->mb_types = MB_TYPE_I | MB_TYPE_P | MB_TYPE_B; -} - -int main(int argc, char **argv) -{ - struct Config config; - Display *display; - Window root, window; - const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; - XvPortID port_num; - int surface_type_id; - unsigned int is_overlay, intra_unsigned; - int colorkey; - XvMCContext context; - XvMCSurface surface; - XvMCBlockArray block_array; - XvMCMacroBlockArray mb_array; - unsigned int mbw, mbh; - unsigned int mbx, mby; - unsigned int reps; - struct timeval start, stop, diff; - double diff_secs; - - ParseArgs(argc, argv, &config); - - mbw = align(config.input_width, MACROBLOCK_WIDTH) / MACROBLOCK_WIDTH; - mbh = align(config.input_height, MACROBLOCK_HEIGHT) / MACROBLOCK_HEIGHT; - - display = XOpenDisplay(NULL); - - if (!GetPort - ( - display, - config.input_width, - config.input_height, - XVMC_CHROMA_FORMAT_420, - mc_types, - 2, - &port_num, - &surface_type_id, - &is_overlay, - &intra_unsigned - )) - { - XCloseDisplay(display); - error(1, 0, "Error, unable to find a good port.\n"); - } - - if (is_overlay) - { - Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); - XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); - } - - root = XDefaultRootWindow(display); - window = XCreateSimpleWindow(display, root, 0, 0, config.output_width, config.output_height, 0, 0, colorkey); - - assert(XvMCCreateContext(display, port_num, surface_type_id, config.input_width, config.input_height, XVMC_DIRECT, &context) == Success); - assert(XvMCCreateSurface(display, &context, &surface) == Success); - assert(XvMCCreateBlocks(display, &context, mbw * mbh * BLOCKS_PER_MACROBLOCK, &block_array) == Success); - assert(XvMCCreateMacroBlocks(display, &context, mbw * mbh, &mb_array) == Success); - - for (mby = 0; mby < mbh; ++mby) - for (mbx = 0; mbx < mbw; ++mbx) - { - mb_array.macro_blocks[mby * mbw + mbx].x = mbx; - mb_array.macro_blocks[mby * mbw + mbx].y = mby; - mb_array.macro_blocks[mby * mbw + mbx].macroblock_type = XVMC_MB_TYPE_INTRA; - /*mb->motion_type = ;*/ - /*mb->motion_vertical_field_select = ;*/ - mb_array.macro_blocks[mby * mbw + mbx].dct_type = XVMC_DCT_TYPE_FRAME; - /*mb->PMV[0][0][0] = ; - mb->PMV[0][0][1] = ; - mb->PMV[0][1][0] = ; - mb->PMV[0][1][1] = ; - mb->PMV[1][0][0] = ; - mb->PMV[1][0][1] = ; - mb->PMV[1][1][0] = ; - mb->PMV[1][1][1] = ;*/ - mb_array.macro_blocks[mby * mbw + mbx].index = (mby * mbw + mbx) * BLOCKS_PER_MACROBLOCK; - mb_array.macro_blocks[mby * mbw + mbx].coded_block_pattern = 0x3F; - } - - XSelectInput(display, window, ExposureMask | KeyPressMask); - XMapWindow(display, window); - XSync(display, 0); - - gettimeofday(&start, NULL); - - for (reps = 0; reps < config.reps; ++reps) - { - if (config.pipeline & PIPELINE_STEP_MC) - { - assert(XvMCRenderSurface(display, &context, XVMC_FRAME_PICTURE, &surface, NULL, NULL, 0, mbw * mbh, 0, &mb_array, &block_array) == Success); - assert(XvMCFlushSurface(display, &surface) == Success); - } - if (config.pipeline & PIPELINE_STEP_CSC) - assert(XvMCPutSurface(display, &surface, window, 0, 0, config.input_width, config.input_height, 0, 0, config.output_width, config.output_height, XVMC_FRAME_PICTURE) == Success); - } - - gettimeofday(&stop, NULL); - - timeval_subtract(&diff, &stop, &start); - diff_secs = (double)diff.tv_sec + (double)diff.tv_usec / 1000000.0; - - printf("XvMC Benchmark\n"); - printf("Input: %u,%u\nOutput: %u,%u\n", config.input_width, config.input_height, config.output_width, config.output_height); - printf("Pipeline: "); - if (config.pipeline & PIPELINE_STEP_MC) - printf("|mc|"); - if (config.pipeline & PIPELINE_STEP_CSC) - printf("|csc|"); - if (config.pipeline & PIPELINE_STEP_SWAP) - printf("|swap|"); - printf("\n"); - printf("Reps: %u\n", config.reps); - printf("Total time: %.2lf (%.2lf reps / sec)\n", diff_secs, config.reps / diff_secs); - - assert(XvMCDestroyBlocks(display, &block_array) == Success); - assert(XvMCDestroyMacroBlocks(display, &mb_array) == Success); - assert(XvMCDestroySurface(display, &surface) == Success); - assert(XvMCDestroyContext(display, &context) == Success); - - XvUngrabPort(display, port_num, CurrentTime); - XDestroyWindow(display, window); - XCloseDisplay(display); - - return 0; -} diff --git a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h deleted file mode 100644 index 42337631ca1..00000000000 --- a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 Younes Manton. - * 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 xvmc_private_h -#define xvmc_private_h - -#include <X11/Xlib.h> -#include <X11/extensions/XvMClib.h> - -#define BLOCK_SIZE_SAMPLES 64 -#define BLOCK_SIZE_BYTES (BLOCK_SIZE_SAMPLES * 2) - -struct pipe_video_context; -struct pipe_surface; -struct pipe_fence_handle; - -typedef struct -{ - struct pipe_video_context *vpipe; - struct pipe_surface *backbuffer; -} XvMCContextPrivate; - -typedef struct -{ - struct pipe_video_surface *pipe_vsfc; - struct pipe_fence_handle *render_fence; - struct pipe_fence_handle *disp_fence; - - /* Some XvMC functions take a surface but not a context, - so we keep track of which context each surface belongs to. */ - XvMCContext *context; -} XvMCSurfacePrivate; - -#endif /* xvmc_private_h */ |