xf86-video-intel: 2 commits - src/sna/kgem.c src/sna/sna_display.c
Chris Wilson
ickle at kemper.freedesktop.org
Tue Apr 14 13:03:04 PDT 2015
src/sna/kgem.c | 34 +++++++++++++---------
src/sna/sna_display.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 96 insertions(+), 14 deletions(-)
New commits:
commit 26fd6bec113194c471c5d9e1b414c0a1824c5a23
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Apr 14 20:47:26 2015 +0100
sna: Add common widescreen resolutions
Currently we add fake modes to cater for applications that want to
change the screen size but limit themselves to only those that are
available, and do not wish to either use RandR scaling or their own. For
widescreen panels, these 4:3 aspect ratio modes require panel fitting
and so are less than satisfory. Since we add fake modes, let's add a few
common widescreen modes as well (choosing the right aspect ration for
the panel).
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37858
References: https://bugs.freedesktop.org/show_bug.cgi?id=29890
References: https://bugs.freedesktop.org/show_bug.cgi?id=89996
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 9e6c8cc..944bb53 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3259,10 +3259,40 @@ static bool duplicate_mode(DisplayModePtr modes, DisplayModePtr m)
return false;
}
+static struct pixel_count {
+ int16_t width, height;
+} common_16_9[] = {
+ { 640, 360 },
+ { 720, 405 },
+ { 864, 486 },
+ { 960, 540 },
+ { 1024, 576 },
+ { 1280, 720 },
+ { 1366, 768 },
+ { 1600, 900 },
+ { 1920, 1080 },
+ { 2048, 1152 },
+ { 2560, 1440 },
+ { 2880, 1620 },
+ { 3200, 1800 },
+ { 3840, 2160 },
+ { 4096, 2304 },
+ { 5120, 2880 },
+ { 7680, 4320 },
+ { 15360, 8640 },
+}, common_16_10[] = {
+ { 1280, 800 },
+ { 1400, 900 },
+ { 1680, 1050 },
+ { 1920, 1200 },
+ { 2560, 1600 },
+};
+
static DisplayModePtr
default_modes(DisplayModePtr preferred)
{
DisplayModePtr modes;
+ int n;
#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
modes = xf86GetDefaultModes();
@@ -3270,6 +3300,8 @@ default_modes(DisplayModePtr preferred)
modes = xf86GetDefaultModes(0, 0);
#endif
+ /* XXX O(n^2) mode list generation :( */
+
#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,4,99,901,0)
if (preferred) {
DisplayModePtr m;
@@ -3283,6 +3315,50 @@ default_modes(DisplayModePtr preferred)
modes = xf86ModesAdd(modes, m);
else
free(m);
+
+ if (preferred->VDisplay * 16 > preferred->HDisplay*9 - preferred->HDisplay/32 &&
+ preferred->VDisplay * 16 < preferred->HDisplay*9 + preferred->HDisplay/32) {
+ DBG(("Adding 16:9 modes -- %d < %d > %d\n",
+ preferred->HDisplay*9 - preferred->HDisplay/32,
+ preferred->VDisplay * 16,
+ preferred->HDisplay*9 + preferred->HDisplay/32));
+ for (n = 0; n < ARRAY_SIZE(common_16_9); n++) {
+ if (preferred->HDisplay >= common_16_9[n].width ||
+ preferred->VDisplay >= common_16_9[n].height)
+ break;
+
+ m = xf86GTFMode(common_16_9[n].width,
+ common_16_9[n].height,
+ xf86ModeVRefresh(preferred),
+ FALSE, FALSE);
+ if (!duplicate_mode(modes, m))
+ modes = xf86ModesAdd(modes, m);
+ else
+ free(m);
+ }
+ }
+
+ if (preferred->VDisplay * 16 > preferred->HDisplay*10 - preferred->HDisplay/32 &&
+ preferred->VDisplay * 16 < preferred->HDisplay*10 + preferred->HDisplay/32) {
+ DBG(("Adding 16:10 modes -- %d < %d > %d\n",
+ preferred->HDisplay*10 - preferred->HDisplay/32,
+ preferred->VDisplay * 16,
+ preferred->HDisplay*10 + preferred->HDisplay/32));
+ for (n = 0; n < ARRAY_SIZE(common_16_10); n++) {
+ if (preferred->HDisplay >= common_16_10[n].width ||
+ preferred->VDisplay >= common_16_10[n].height)
+ break;
+
+ m = xf86GTFMode(common_16_10[n].width,
+ common_16_10[n].height,
+ xf86ModeVRefresh(preferred),
+ FALSE, FALSE);
+ if (!duplicate_mode(modes, m))
+ modes = xf86ModesAdd(modes, m);
+ else
+ free(m);
+ }
+ }
}
#endif
commit 4c277bc43d958b256d15f72aec884bb921f4ad0a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Apr 14 15:33:57 2015 +0100
sna: Make ioctl invocation more compiler friendly
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index b6cae24..59ebe83 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -230,25 +230,31 @@ static inline int bytes(struct kgem_bo *bo)
#define bucket(B) (B)->size.pages.bucket
#define num_pages(B) (B)->size.pages.count
-static int do_ioctl(int fd, unsigned long req, void *arg)
+static int __do_ioctl(int fd, unsigned long req, void *arg)
{
- int err;
-
-restart:
- if (ioctl(fd, req, arg) == 0)
- return 0;
+ do {
+ int err;
- err = errno;
+ switch ((err = errno)) {
+ case EAGAIN:
+ sched_yield();
+ case EINTR:
+ break;
+ default:
+ return -err;
+ }
- if (err == EINTR)
- goto restart;
+ if (likely(ioctl(fd, req, arg) == 0))
+ return 0;
+ } while (1);
+}
- if (err == EAGAIN) {
- sched_yield();
- goto restart;
- }
+inline static int do_ioctl(int fd, unsigned long req, void *arg)
+{
+ if (likely(ioctl(fd, req, arg) == 0))
+ return 0;
- return -err;
+ return __do_ioctl(fd, req, arg);
}
#ifdef DEBUG_MEMORY
More information about the xorg-commit
mailing list