summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTorsten Jager <t.jager@gmx.de>2014-04-26 15:06:15 +0200
committerTorsten Jager <t.jager@gmx.de>2014-04-26 15:06:15 +0200
commitf1653e41abc6782287b4f79f0edd70b4651a55d7 (patch)
treedfdfda993c17bfcf736ba5c507ef1c89c2b239c3 /src
parentb5c806222e22d7824490e9fb76fd537110013de8 (diff)
downloadxine-lib-f1653e41abc6782287b4f79f0edd70b4651a55d7.tar.gz
xine-lib-f1653e41abc6782287b4f79f0edd70b4651a55d7.tar.bz2
vo_x(cb)v: add color matrix support for "radeonhd" drivers.
This should fix wrong colors in large still images there, for example. BTW. I stumbled upon that manpage while looking for something else :-/
Diffstat (limited to 'src')
-rw-r--r--src/video_out/video_out_xcbxv.c39
-rw-r--r--src/video_out/video_out_xv.c24
2 files changed, 57 insertions, 6 deletions
diff --git a/src/video_out/video_out_xcbxv.c b/src/video_out/video_out_xcbxv.c
index 64c45cfee..498f297d9 100644
--- a/src/video_out/video_out_xcbxv.c
+++ b/src/video_out/video_out_xcbxv.c
@@ -149,7 +149,7 @@ struct xv_driver_s {
/* color matrix switching */
int cm_active, cm_state;
- xcb_atom_t cm_atom;
+ xcb_atom_t cm_atom, cm_atom2;
int fullrange_mode;
};
@@ -646,13 +646,21 @@ static void xv_new_color (xv_driver_t *this, int cm) {
xcb_xv_set_port_attribute (this->connection, this->xv_port, atom, satu);
pthread_mutex_unlock(&this->main_mutex);
- /* so far only binary nvidia drivers support this. why not nuveau? */
if (this->cm_atom != XCB_NONE) {
+ /* 0 = 601 (SD), 1 = 709 (HD) */
+ /* so far only binary nvidia drivers support this. why not nuveau? */
cm2 = (0xc00c >> cm) & 1;
pthread_mutex_lock(&this->main_mutex);
xcb_xv_set_port_attribute (this->connection, this->xv_port, this->cm_atom, cm2);
pthread_mutex_unlock(&this->main_mutex);
cm2 = cm2 ? 2 : 10;
+ } else if (this->cm_atom2 != XCB_NONE) {
+ /* radeonhd: 0 = size based auto, 1 = 601 (SD), 2 = 709 (HD) */
+ cm2 = ((0xc00c >> cm) & 1) + 1;
+ pthread_mutex_lock(&this->main_mutex);
+ xcb_xv_set_port_attribute (this->connection, this->xv_port, this->cm_atom2, cm2);
+ pthread_mutex_unlock(&this->main_mutex);
+ cm2 = cm2 == 2 ? 2 : 10;
} else {
cm2 = 10;
}
@@ -1401,6 +1409,7 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis
this->ovl_changed = 0;
this->xine = class->xine;
this->cm_atom = XCB_NONE;
+ this->cm_atom2 = XCB_NONE;
this->vo_driver.get_capabilities = xv_get_capabilities;
this->vo_driver.alloc_frame = xv_alloc_frame;
@@ -1483,7 +1492,7 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis
xv_check_capability (this, VO_PROP_GAMMA, attribute_it.data,
adaptor_it.data->base_id,
NULL, NULL, NULL);
- } else if(!strcmp(name, "XV_ITURBT_709")) {
+ } else if(!strcmp(name, "XV_ITURBT_709")) { /* nvidia */
xcb_xv_get_port_attribute_cookie_t get_attribute_cookie;
xcb_xv_get_port_attribute_reply_t *get_attribute_reply;
xcb_intern_atom_cookie_t atom_cookie;
@@ -1507,6 +1516,30 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis
}
}
pthread_mutex_unlock(&this->main_mutex);
+ } else if(!strcmp(name, "XV_COLORSPACE")) { /* radeonhd */
+ xcb_xv_get_port_attribute_cookie_t get_attribute_cookie;
+ xcb_xv_get_port_attribute_reply_t *get_attribute_reply;
+ xcb_intern_atom_cookie_t atom_cookie;
+ xcb_intern_atom_reply_t *atom_reply;
+ pthread_mutex_lock(&this->main_mutex);
+ atom_cookie = xcb_intern_atom (this->connection, 0, 13, name);
+ atom_reply = xcb_intern_atom_reply (this->connection, atom_cookie, NULL);
+ if (atom_reply) {
+ this->cm_atom2 = atom_reply->atom;
+ free (atom_reply);
+ }
+ if (this->cm_atom2 != XCB_NONE) {
+ get_attribute_cookie = xcb_xv_get_port_attribute (this->connection,
+ this->xv_port, this->cm_atom2);
+ get_attribute_reply = xcb_xv_get_port_attribute_reply (this->connection,
+ get_attribute_cookie, NULL);
+ if (get_attribute_reply) {
+ this->cm_active = get_attribute_reply->value == 2 ? 2 : (get_attribute_reply->value == 1 ? 10 : 0);
+ free(get_attribute_reply);
+ this->capabilities |= VO_CAP_COLOR_MATRIX;
+ }
+ }
+ pthread_mutex_unlock(&this->main_mutex);
} else if(!strcmp(name, "XV_COLORKEY")) {
this->capabilities |= VO_CAP_COLORKEY;
xv_check_capability (this, VO_PROP_COLORKEY, attribute_it.data,
diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c
index 2e4b6e94a..741706b12 100644
--- a/src/video_out/video_out_xv.c
+++ b/src/video_out/video_out_xv.c
@@ -160,7 +160,7 @@ struct xv_driver_s {
/* color matrix switching */
int cm_active, cm_state;
- Atom cm_atom;
+ Atom cm_atom, cm_atom2;
int fullrange_mode;
};
@@ -740,13 +740,21 @@ static void xv_new_color (xv_driver_t *this, int cm) {
XvSetPortAttribute (this->display, this->xv_port, atom, satu);
UNLOCK_DISPLAY(this);
- /* so far only binary nvidia drivers support this. why not nuveau? */
if (this->cm_atom != None) {
+ /* 0 = 601 (SD), 1 = 709 (HD) */
+ /* so far only binary nvidia drivers support this. why not nuveau? */
cm2 = (0xc00c >> cm) & 1;
LOCK_DISPLAY(this);
XvSetPortAttribute (this->display, this->xv_port, this->cm_atom, cm2);
UNLOCK_DISPLAY(this);
cm2 = cm2 ? 2 : 10;
+ } else if (this->cm_atom2 != None) {
+ /* radeonhd: 0 = size based auto, 1 = 601 (SD), 2 = 709 (HD) */
+ cm2 = ((0xc00c >> cm) & 1) + 1;
+ LOCK_DISPLAY(this);
+ XvSetPortAttribute (this->display, this->xv_port, this->cm_atom2, cm2);
+ UNLOCK_DISPLAY(this);
+ cm2 = cm2 == 2 ? 2 : 10;
} else {
cm2 = 10;
}
@@ -1455,6 +1463,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void *
this->xine = class->xine;
this->cm_atom = None;
+ this->cm_atom2 = None;
LOCK_DISPLAY(this);
XAllocNamedColor (this->display,
@@ -1542,7 +1551,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void *
xv_check_capability (this, VO_PROP_GAMMA, attr[k],
adaptor_info[adaptor_num].base_id,
NULL, NULL, NULL);
- } else if(!strcmp(name, "XV_ITURBT_709")) {
+ } else if(!strcmp(name, "XV_ITURBT_709")) { /* nvidia */
LOCK_DISPLAY(this);
this->cm_atom = XInternAtom (this->display, name, False);
if (this->cm_atom != None) {
@@ -1551,6 +1560,15 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void *
this->capabilities |= VO_CAP_COLOR_MATRIX;
}
UNLOCK_DISPLAY(this);
+ } else if(!strcmp(name, "XV_COLORSPACE")) { /* radeonhd */
+ LOCK_DISPLAY(this);
+ this->cm_atom2 = XInternAtom (this->display, name, False);
+ if (this->cm_atom2 != None) {
+ XvGetPortAttribute (this->display, this->xv_port, this->cm_atom2, &this->cm_active);
+ this->cm_active = this->cm_active == 2 ? 2 : (this->cm_active == 1 ? 10 : 0);
+ this->capabilities |= VO_CAP_COLOR_MATRIX;
+ }
+ UNLOCK_DISPLAY(this);
} else if(!strcmp(name, "XV_COLORKEY")) {
this->capabilities |= VO_CAP_COLORKEY;
xv_check_capability (this, VO_PROP_COLORKEY, attr[k],