Commit Graph

14891 Commits

Author SHA1 Message Date
Eric Anholt
8097c88702 glamor: Drop tracking of the last picture attached to pixmaps.
Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-07-10 09:42:58 -07:00
Eric Anholt
0dbdb83b0d glamor: Use the actual picture's format when uploading memory pixmaps.
The pixmap->picture is just the *last* picture attached to the pixmap,
so you'd potentially be looking at the wrong one when trying to
temporarily upload to avoid a composite fallback.

There's some trickiness in glamor_render.c when we're dealing with the
upload of a GLAMOR_MEMORY pixmap as both the source and mask using
different formats, where we smash the source's format to a new value
so that the mask can use the same uploaded bits.  Dropping most of
that should be safe, since it will be uploaded as the source first, so
the smashed format will still be used.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-07-10 09:42:58 -07:00
Eric Anholt
1fd11c46aa glamor: Move glamor_render.c pict handling to glamor_picture.c
These functions aren't used by anything else, and are specific to the
temporary-upload-as-a-weird-format path of glamor_render.c, called
through glamor_upload_picture_to_texture().

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-07-10 09:42:58 -07:00
Eric Anholt
53aed06fb4 glamor: Drop dead glamor_upload_bits_to_pixmap_texture() proto.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-07-10 09:42:58 -07:00
Eric Anholt
b51e079e18 glamor: Use the new upload/download interface for XV uploads.
We don't need any of its weird handling of picture formats, since our
XV pixmaps don't have any pictures attached.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-07-10 09:42:58 -07:00
Eric Anholt
1bd966d16d glamor: Ignore picture formats when choosing color for core rendering.
Attaching a picture to a pixmap doesn't change its GL format, so it
doesn't change how core rendering should be assigning colors to it.

(Imagine XCreatePixmap(), optional XCreatePicture(pixmap) with various
formats, XFillRectangle, XGetImage().  If the XGetImage results
changed, this would be wrong).

Fixes all failures in "rendercheck -t fill" and, as a result, the
remaining failures in "rendercheck -t blend -o src -f
a8r8g8b8,x2r10g10b10"

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-07-10 09:42:58 -07:00
Eric Anholt
5a81de8284 glamor: Don't try to do rendering with unsupported formats.
I'm amazed we've made it as far as we have without these checks: if
you made an unusual format picture that wasn't the normal a8r8g8b8 or
x8r8g8b8 or a8, we'd go ahead and try to render with it, ignoring that
the sampler would fetch totally wrong bits.

Fixes 260 tests in rendercheck -t blend -o src -f a8r8g8b8,x2r10g10b10

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-07-10 09:42:58 -07:00
Hans de Goede
0d7cbd6f5a glamor_egl: Properly free resources on init-error and exit
glamor_egl_init() was not undoing any of the init steps on init error,
add an glamor_egl_cleanup() function and use this both on error and on exit
to cleanup the various resources.

Even on a clean exit eglTerminate() was not being called, causing the fd
dup()-ed by eglInitialize() to stay open, call eglTerminate() from the new
glamor_egl_cleanup() to fix this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-07-10 09:42:57 -07:00
Eric Anholt
80b6652c9f glamor: Drop a bunch of glamor_priv == NULL checks.
Now that it's always non-null when the pixmap is non-null, we don't
need so much of this.  glamor_get_pixmap_private() itself still
accepts a NULL pixmap and returns NULL, because of glamor_render.c

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2015-07-10 09:42:57 -07:00
Eric Anholt
a2a2f6e34b glamor: Ask the server to always allocate our private.
This avoids a lot of screwing around to attach our privates later.  It
means that non-glamor pixmaps now gain 120 bytes of glamor privates on
64-bit (which has quite a bit of fixable bloat), and glamor pixmaps
take one less pointer of storage (not counting malloc overhead).

Note that privates start out zero-filled, which matches the callocs we
were doing when making our own privates, and in the case of an fb
pixmap that has a priv where it didn't before, the type ends up being
GLAMOR_MEMORY as we would want.

v2: Clarify that the GLAMOR_MEMORY enum must be 0 (as it was
    previosuly), so that the new pixmap private behavior is as
    expected.  Suggested by keithp.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> (v1)
Reviewed-by: Keith Packard <keithp@keithp.com>
2015-07-10 09:42:57 -07:00
Eric Anholt
d278c30e68 glamor: Drop dead glamor_is_large_picture().
It died as of keithp's new glyphs code.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2015-07-10 09:42:57 -07:00
Eric Anholt
cd608a516d glamor: Reuse the glamor_is_memory helper.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2015-07-10 09:42:57 -07:00
Dave Airlie
90db5edf11 prime: add rotation support for offloaded outputs (v2)
One of the lacking features with output offloading was
that screen rotation didn't work at all.

This patch makes 0/90/180/270 rotation work with USB output
and GPU outputs.

When it allocates the shared pixmap it allocates it rotated,
and any updates to the shared pixmap are done using a composite
path that does the rotation. The slave GPU then doesn't need
to know about the rotation and just displays the pixmap.

v2:
rewrite the sync dirty helper to use the dst pixmap, and
avoid any strange hobbits and rotations.

This breaks ABI in two places.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-07-08 11:13:09 -07:00
Keith Packard
991712f1e8 Merge remote-tracking branch 'ofourdan/for-keith' 2015-07-08 10:43:31 -07:00
Jon TURNEY
0cd228073a hw/xwin: printf format fixes for Pixel type
Pixel is CARD32, so inside the server has type unsigned int (x86_64) or unsigned
long (x86)

Cast to unsigned int and use a %u format

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:53 +01:00
Jon TURNEY
e3cfeb949a hw/xwin: printf format fixes for WPARAM and LPARAM types
Some Win32 API types are different fundamental types in the 32-bit and 64-bit

This problem is then further compounded by the fact that whilst both 32-bit
Cygwin and 32-bit MinGW use the ILP32 data model, 64-bit MinGW uses the LLP64
data model, but 64-bit Cygwin uses the LP64 data model.

This makes it impossible to write printf format specifiers which are correct for
all those targets, so we use some macros to provide the correct specifier for
the target.

LPARAM and WPARAM are integer types which can contain a pointer

LPARAM is long in ILP32 and long long in LLP64
WPARAM is unsigned int in ILP32 and unsigned long long in LLP64

Generally, these are just used to passs integer parameters, so for simplicity,
cast to int and use an int-compatible format

In the specific case of WM_CHANGECBCHAIN, they are used to pass HWND, so cast to
that type and print using an appropriate format.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:50 +01:00
Jon TURNEY
4f8661fac9 hw/xwin: printf format fixes for LONG type
Some Win32 API types are different fundamental types in the 32-bit and 64-bit
versions.

This problem is then further compounded by the fact that whilst both 32-bit
Cygwin and 32-bit MinGW use the ILP32 data model, 64-bit MinGW uses the LLP64
data model, but 64-bit Cygwin uses the LP64 data model.

This makes it impossible to write printf format specifiers which are correct for
all those targets

In the Win32 API, DWORD is an signed, 32-bit type.  It is defined in terms of a
long, except in the LP64 data model, where it is an int.

It should always be safe to cast it to int and use %d.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:47 +01:00
Jon TURNEY
aa83c61f51 hw/xwin: printf format fixes for DWORD type
Some Win32 API types are different fundamental types in the 32-bit and 64-bit
versions.

This problem is then further compounded by the fact that whilst both 32-bit
Cygwin and 32-bit MinGW use the ILP32 data model, 64-bit MinGW uses the LLP64
data model, but 64-bit Cygwin uses the LP64 data model.

This makes it impossible to write printf format specifiers which are correct for
all those targets

In the Win32 API, DWORD is an unsigned, 32-bit type.  It is defined in terms of
an unsigned long, except in the LP64 data model, where it is an unsigned int.

It should always be safe to cast it to unsigned int and use %u or %x.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:44 +01:00
Jon TURNEY
487f2595c9 hw/xwin: printf format fixes in xevents.c
Window and Atom types derive from XID, which is always unsigned long in client
code, so use %ld format specifier

XTextProperty.nitems is of type unsigned long, so use %lu format specifier

ulReturnBytesLeft is of type unsigned long, so use %lu format specifier

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:41 +01:00
Jon TURNEY
98798fcf0d hw/xwin: printf format fix in winProcessXEventsTimeout()
remainingTime is computed as a long int, so use %ld format specifier

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:38 +01:00
Jon TURNEY
5b6f511c2f hw/xwin: printf format fix in winCreateDefColormap()
Use %lu for unsigned long

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:35 +01:00
Jon TURNEY
eb67967156 hw/xwin: printf format fixes in winAllocatePrivates()
serverGeneration is of type unsigned long, so use %lu format specifier

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:32 +01:00
Jon TURNEY
0d6c499b99 hw/xwin: printf format fixes in winConfigKeyboard()
struct winInfoRec.keyboard members are of type long, not type int

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:29 +01:00
Jon TURNEY
ba468e003e hw/xwin: printf format fixes for XID type
XID inside the server has type unsigned int (x86_64) or unsigned long (x86)

Follow the example of the rest of the server and cast to unsigned int and use
a %u or %x format.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:26 +01:00
Jon TURNEY
dcb797b31f hw/xwin: printf format fixes for HWND type
HWND derives from HANDLE, a pointer type, so we should use the %p format

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:23 +01:00
Jon TURNEY
f1d1426667 hw/xwin: Ensure format warnings in winclipboard/
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:20 +01:00
Jon TURNEY
38f340b13e hw/xwin: Remove GetTickCount() from various pieces of debugging output
The use of %d format for the DWORD return value of GetTickCount() isn't
portable, but it doesn't seem to be worth fixing it when this information isn't
very useful (and is redundant to the timestamping of log messages we now have)

Instead just remove these uses of GetTickCount()

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:18 +01:00
Michel Dänzer
732e3b9c08 Instead of one glTexSubImage2D call for each glyph.
This significantly reduces the amount of time it takes for xterm to start
up on a fresh X server with the radeonsi driver.

v2: Use GLYPHWIDTHBYTESPADDED instead of hardcoding 4 bytes glyph
    alignment (Keith Packard)

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-07-06 18:45:51 -07:00
Julien Cristau
ac94cdb9df mi: fix typo in warning about overflowing queue
Debian bug#726041

Reported-by: Vincent Hobeïka <vincent.hobeika@gmail.com>
Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2015-07-06 16:08:08 -07:00
Dave Airlie
e3624aa5fd xserver: fix build with glamor disabled.
This fixes modesetting when glamor is disabled.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2015-07-06 12:01:33 -07:00
Eric Anholt
3703c88ac1 glamor: Use GL_ARB_debug_output to log GL errors.
This should help people debugging when glamor does something stupid on
their driver.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-07-06 12:01:33 -07:00
Eric Anholt
f4dfd282d3 glamor: Add an assert to catch the previous bug.
Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Michel Dänzer <michel.daenzer@amd.com>
2015-07-06 12:01:33 -07:00
Keith Packard
c268d2fc33 glamor: Fix bad rendering of glyphs after an a1 glyph upload. (v3)
Fixes regressions since Eric's "don't make an FBO for the glyph atlas"
change.  The a1 upload was a fallback, as expected.  However, fallback
reads use glReadPixels() because there's no glGetTexSubImage2D() to
match glTexSubImage2D().  We were just binding the 0 FBO value, so the
glReadPixels() would throw a GL error instead of getting any data.
After the fallback was done we'd write back the undefined data to the
atlas, blowing away the entire rest of the atlas because we didn't
specify any bounds on our prepare.

To fix the fallbacks to actually work, we'd need a prepare path that
allocates some memory memory do a full glGetTexImage() into, then
memcpy out of that.  Instead, just dodge the general fallback by
implementing the specific upload we need to do here, which should also
be *much* faster at uploading a1 glyphs since it's not
readpixels/texsubimaging back and forth.

v3: Use CopyPlane to a temp pixmap for the upload
v4: Rewrite anholt's commit message to be from keithp's perspective
    (changes by anholt)

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-07-06 12:01:07 -07:00
Eric Anholt
5c440817f7 glamor: Use ARRAY_SIZE in a couple more places for consistency.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-07-02 10:06:36 -07:00
Eric Anholt
7b6edb5243 glamor: Mark a bunch of single-file data static.
This gives the compiler a chance to optimize when the data is never
changed -- for example, with pict_format_combine_tab, the compiler
ends up inlining the 24 bytes of data into just 10 more bytes of code.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-07-02 10:06:36 -07:00
Eric Anholt
3fe6731b17 glamor: Make a bunch of single-file glamor functions static.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-07-02 10:05:59 -07:00
Eric Anholt
a8e84e8c3b glamor: Drop dead glamor_es2_pixmap_read_prepare().
It's been unused since I killed glamor_download_pixmap_to_cpu().

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-07-02 10:05:59 -07:00
Eric Anholt
cad56dc62d glamor: Restore the hook to glamor_composite_rectangles().
It was apparently accidentally dropped in keithp's removal of _nf
functions in 90d326fcc6.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-07-02 10:05:59 -07:00
Eric Anholt
7adb38a0d1 glamor: Fix up some weird formatting in _glamor_create_fbo_array().
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-07-02 10:05:59 -07:00
Eric Anholt
835067a409 glamor: Drop a redundant check.
Above, we've already checked for ->fbo && ->fbo->fb and returned.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-07-02 10:05:59 -07:00
Eric Anholt
47b868492c glamor: Simplify some temp pixmap extents calculations.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-07-02 10:05:59 -07:00
Eric Anholt
bfb6a290af glamor: Drop a dead flag to glamor_create_fbo_array().
v2: Don't forget to set priv->block_w/block_h like the wrapper used
    to.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
2015-07-02 10:05:59 -07:00
Eric Anholt
fe3fedf280 glamor: Drop dead GLAMOR_FBO_DOWNLOADED flag.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-07-02 10:05:59 -07:00
Eric Anholt
4472740941 glamor: Move doxygen for private structs into the structs.
This should hopefully keep the comments more up to date with the
structure comments.  While I'm here, I've reworded a few of them to be
more accurate, and dropped a bunch of stale comments.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-07-02 10:05:59 -07:00
Eric Anholt
33d6384b29 glamor: Drop the dead "PBO" field in an FBO cache struct.
PBOs are only used at the whole pixmap level.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-07-02 10:05:59 -07:00
Eric Anholt
1734aa2856 glamor: Remove dead gl_tex flag in the fbo struct.
This used to be used in the old copy_area path.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-07-02 10:05:59 -07:00
Eric Anholt
82d23fc729 glamor: Propagate the fact that pbo_valid is never set.
The code to set it was deleted in keithp's big rewrite.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-07-02 10:05:59 -07:00
Eric Anholt
0e3f1252da glamor: Avoid using GL_QUADS on VC4.
Improves text rendering from about 284k glyphs per second to 320k
glyphs per second.  There's no GL extension for probing this, because
of the philosophy of "Don't expose whether things are really in
hardware or not."

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-06-29 21:43:36 -07:00
Eric Anholt
f47e3f5395 glamor: Use proper Bools for some boolean values.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-06-29 21:43:36 -07:00
Eric Anholt
4001a7465e glamor: Provide a fallback path for using an index buffer to do quads.
Improves x11perf -aa10text performance by 1377.59% +/- 23.8198% (n=93)
on Intel with GLES2.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-06-29 21:43:35 -07:00